Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Incorrect output in error case
@ 2011-11-28 17:34 Andrew Burgess
  2011-11-30 15:56 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Burgess @ 2011-11-28 17:34 UTC (permalink / raw)
  To: gdb-patches

Hi,


If I try this,

   $ cat woof.c
#include <stdio.h>

int
main ()
{
   printf ("Woof!\n");

   return 0;
}
   $ gcc -g -o woof.x woof.c
   $ mv woof.c woof.c.bak
   $ cat cmds.gdb
list main
quit
   $ gdb -q -x cmds.gdb woof.x
Reading symbols from /home/andrew/tmp/woof.x...done.
1	woof.c: No such file or directory.
	in woof.c


I believe the "in woof.c" output from gdb is a mistake caused by missing 
braces in an else clause.

Patch/Changelog below for review.  I think this is an "obvious" fix, so 
I'll commit this in a week unless someones says not to.

Thanks,

Andrew

gdb/ChangeLog

2011-11-28  Andrew Burgess  <aburgess@broadcom.com>

	* source.c (print_source_lines_base): Fix missing braces on else
	clause leading to additional output.

diff --git a/gdb/source.c b/gdb/source.c
index 77df541..e456ac0 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -1322,10 +1322,12 @@ print_source_lines_base (struct symtab *s, int 
line, int
           print_sys_errmsg (name, errno);
         }
        else
-       ui_out_field_int (uiout, "line", line);
-      ui_out_text (uiout, "\tin ");
-      ui_out_field_string (uiout, "file", s->filename);
-      ui_out_text (uiout, "\n");
+       {
+         ui_out_field_int (uiout, "line", line);
+         ui_out_text (uiout, "\tin ");
+         ui_out_field_string (uiout, "file", s->filename);
+         ui_out_text (uiout, "\n");
+       }

        return;
      }




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-12-01 10:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-28 17:34 [PATCH] Incorrect output in error case Andrew Burgess
2011-11-30 15:56 ` Tom Tromey
2011-12-01 10:39   ` Andrew Burgess

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox