Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Michael Snyder <msnyder@redhat.com>
Cc: Jason Kraftcheck <kraftche@cae.wisc.edu>,
		gdb-patches@sources.redhat.com
Subject: Re: list/edit command on frame with available symtab
Date: Thu, 30 Mar 2006 16:26:00 -0000	[thread overview]
Message-ID: <20060330161747.GA32409@nevyn.them.org> (raw)
In-Reply-To: <440621BE.4070205@redhat.com>

On Wed, Mar 01, 2006 at 02:35:42PM -0800, Michael Snyder wrote:
> >With this patch, I get what I expect.  Without this patch, stopping due
> >to a sigabrt, edit and list both show whatever was the previous valid
> >sal, which is probably a bug.  After moving up or down a frame, they
> >both report an error (in the edit case, editing a file called "unknown").
> 
> I've never tried it with edit, and I haven't tried it recently
> with list, but my recollection is in line with Daniel's comment --
> afaik, it already works, at least for list.  With what version
> and configuration of gdb do you find it to be broken?

OK, I see what's going on.  Run gdb on coremaker from the GDB
testsuite.  Just load it and type run, then "list"; you'll get main.
Or, list 1, run, list; you'll get line 11.

Here's a slightly nicer patch to do the same thing.  I'm not going to
apply this right now, though, because it makes me a little nervous;
it means that we try to use the unwinder automatically if there is no
debug information, which could lead to e.g. error() complaining about a
corrupt stack, or CFI warnings.

Thoughts?  Is this useful?

2006-03-30  Daniel Jacobowitz  <dan@codesourcery.com>

	* stack.c (set_current_sal_from_frame): Unwind to earlier frames if
	necessary.

Index: stack.c
===================================================================
RCS file: /cvs/src/src/gdb/stack.c,v
retrieving revision 1.137
diff -u -p -r1.137 stack.c
--- stack.c	17 Dec 2005 22:34:03 -0000	1.137
+++ stack.c	30 Mar 2006 16:13:10 -0000
@@ -370,7 +370,8 @@ print_args_stub (void *args)
 }
 
 /* Set the current source and line to the location given by frame
-   FRAME, if possible.  When CENTER is true, adjust so the relevant
+   FRAME, if possible, or the first frame outer of FRAME with line
+   information.  When CENTER is true, adjust so the relevant
    line is in the center of the next 'list'.  */
 
 static void
@@ -378,7 +379,15 @@ set_current_sal_from_frame (struct frame
 {
   struct symtab_and_line sal;
 
-  find_frame_sal (frame, &sal);
+  do
+    {
+      find_frame_sal (frame, &sal);
+      if (sal.symtab)
+	break;
+      frame = get_prev_frame (frame);
+    }
+  while (frame);
+
   if (sal.symtab)
     {
       if (center)


-- 
Daniel Jacobowitz
CodeSourcery


      reply	other threads:[~2006-03-30 16:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-23 18:45 Jason Kraftcheck
2006-02-23 21:02 ` Daniel Jacobowitz
2006-02-23 22:13   ` Jason Kraftcheck
2006-03-01 22:35     ` Michael Snyder
2006-03-30 16:26       ` Daniel Jacobowitz [this message]

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=20060330161747.GA32409@nevyn.them.org \
    --to=drow@false.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=kraftche@cae.wisc.edu \
    --cc=msnyder@redhat.com \
    /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