Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Andrew Burgess" <aburgess@broadcom.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: [PATCH] Incorrect output in error case
Date: Mon, 28 Nov 2011 17:34:00 -0000	[thread overview]
Message-ID: <4ED3C600.9020209@broadcom.com> (raw)

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;
      }




             reply	other threads:[~2011-11-28 17:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-28 17:34 Andrew Burgess [this message]
2011-11-30 15:56 ` Tom Tromey
2011-12-01 10:39   ` Andrew Burgess

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4ED3C600.9020209@broadcom.com \
    --to=aburgess@broadcom.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox