Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: gdb-patches@sourceware.org, matz@suse.de
Subject: Re: RFC: %ebp-based backtrace patch
Date: Sun, 27 Dec 2009 22:03:00 -0000	[thread overview]
Message-ID: <20091227220311.GA3174@caradoc.them.org> (raw)
In-Reply-To: <200912272137.nBRLbJPq029640@glazunov.sibelius.xs4all.nl>

On Sun, Dec 27, 2009 at 10:37:19PM +0100, Mark Kettenis wrote:
> Sorry, but I don't see how this would solve things.  Do you have a
> diff for me to look at?

Sure.  Here's a version that passes signull.exp for me.

I also noticed that Ubuntu has a version of this applied to
amd64-tdep.c.  I don't know if that has merit or not; I wouldn't
expect it to matter much, given that the ABI mandates .eh_frame.

-- 
Daniel Jacobowitz
CodeSourcery

2009-12-27  Michael Matz  <matz@suse.de>
	    Daniel Jacobowitz  <dan@codesourcery.com>

        * i386-tdep.c (i386_frame_cache): Assume valid anonymous
	functions use a frame pointer.

Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.290
diff -u -p -r1.290 i386-tdep.c
--- i386-tdep.c	12 Oct 2009 15:52:28 -0000	1.290
+++ i386-tdep.c	27 Dec 2009 21:59:51 -0000
@@ -1394,12 +1394,24 @@ i386_frame_cache (struct frame_info *thi
 	  /* This will be added back below.  */
 	  cache->saved_regs[I386_EIP_REGNUM] -= cache->base;
 	}
-      else
+      else if (cache->pc != 0
+	       || target_read_memory (get_frame_pc (this_frame), buf, 1))
 	{
+	  /* We're in a known function, but did not find a frame
+	     setup.  Assume that the function does not use %ebp.
+	     Alternatively, we may have jumped to an invalid
+	     address; in that case there is definitely no new
+	     frame in %ebp.  */
 	  get_frame_register (this_frame, I386_ESP_REGNUM, buf);
 	  cache->base = extract_unsigned_integer (buf, 4, byte_order)
 			+ cache->sp_offset;
 	}
+      else
+	/* We're in an unknown function.  We could not find the start
+	   of the function to analyze the prologue; our best option is
+	   to assume a typical frame layout with the caller's %ebp
+	   saved.  */
+	cache->saved_regs[I386_EBP_REGNUM] = 0;
     }
 
   /* Now that we have the base address for the stack frame we can


  reply	other threads:[~2009-12-27 22:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-06 18:33 Daniel Jacobowitz
2009-07-06 20:11 ` Frank Ch. Eigler
2009-07-06 20:21   ` Daniel Jacobowitz
2009-07-07 12:15   ` Michael Matz
2009-07-07 13:19     ` Frank Ch. Eigler
2009-07-07 13:49       ` Michael Matz
2009-07-06 21:57 ` Mark Kettenis
2009-07-07 12:00   ` Michael Matz
2009-07-07 13:00   ` Daniel Jacobowitz
2009-07-07 13:07     ` Mark Kettenis
2009-07-08  9:01     ` Mark Kettenis
2009-07-08 12:53       ` Daniel Jacobowitz
2009-12-27 16:59         ` Daniel Jacobowitz
2009-12-27 21:37           ` Mark Kettenis
2009-12-27 22:03             ` Daniel Jacobowitz [this message]
2010-02-01 19:46               ` Daniel Jacobowitz

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=20091227220311.GA3174@caradoc.them.org \
    --to=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=mark.kettenis@xs4all.nl \
    --cc=matz@suse.de \
    /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