This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Fix ada `Multiple matches' prompt (for the testsuite)


Hi,

before:
$ gdb -nx -ex 'file gdb.ada/sym_print_name/foo' -ex 'p i'
Multiple matches for i
[0] cancel
[1] pck.first.i at .../sources/gdb/testsuite/gdb.ada/sym_print_name/pck.adb:18
[2] pck.second.i at .../sources/gdb/testsuite/gdb.ada/sym_print_name/pck.adb:22
> (gdb) _

after:
Multiple matches for i
[0] cancel
[1] pck.first.i at .../sources/gdb/testsuite/gdb.ada/sym_print_name/pck.adb:18
[2] pck.second.i at .../sources/gdb/testsuite/gdb.ada/sym_print_name/pck.adb:22
> _

Due to it at least the testcase `gdb.ada/sym_print_name.exp' has instable
results:

 [1] pck.first.i at /home/jkratoch/redhat/sources/gdb/testsuite/gdb.ada/sym_print_name/pck.adb:18^M
 [2] pck.second.i at /home/jkratoch/redhat/sources/gdb/testsuite/gdb.ada/sym_print_name/pck.adb:22^M
 > PASS: gdb.ada/sym_print_name.exp: multiple matches for symbol i
-1^M
-(gdb) FAIL: gdb.ada/sym_print_name.exp: select first choice from multiple-choice menu
+(gdb) 1^M
+$1 = 48^M
+(gdb) PASS: gdb.ada/sym_print_name.exp: select first choice from multiple-choice menu



Regards,
Jan
2008-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* ada-lang.c (get_selections): Variable PROMPT made non-const and
	initialized with a trailing space now.  Use PROMPT_ARG of
	COMMAND_LINE_INPUT instead of printing it ourselves.

--- ./gdb/ada-lang.c	6 Apr 2008 08:56:36 -0000	1.137
+++ ./gdb/ada-lang.c	21 Apr 2008 13:33:42 -0000
@@ -3424,18 +3424,15 @@ get_selections (int *choices, int n_choi
                 int is_all_choice, char *annotation_suffix)
 {
   char *args;
-  const char *prompt;
+  char *prompt;
   int n_chosen;
   int first_choice = is_all_choice ? 2 : 1;
 
   prompt = getenv ("PS2");
   if (prompt == NULL)
-    prompt = ">";
+    prompt = "> ";
 
-  printf_unfiltered (("%s "), prompt);
-  gdb_flush (gdb_stdout);
-
-  args = command_line_input ((char *) NULL, 0, annotation_suffix);
+  args = command_line_input (prompt, 0, annotation_suffix);
 
   if (args == NULL)
     error_no_arg (_("one or more choice numbers"));

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]