Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Fix powerpc 64bit backtrace code
@ 2006-06-02  2:40 Anton Blanchard
  2006-06-08 18:41 ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Anton Blanchard @ 2006-06-02  2:40 UTC (permalink / raw)
  To: gdb-patches


Hi,

When backtracing a 64bit task on ppc64/Linux I notice we sometimes get
garbage for the PC:

#3  0xc00000006d337cd0 in ?? ()
#4  0x8822248200000001 in ?? ()
#5  0x4822248200000000 in ?? ()

Looking closer, it appears that gdb has missed the LR field and instead
got the CR field. On 32bit the LR is at SP + wordsize, however on 64bit
it is SP + 2*wordsize.

Knowing this I looked through the backtrace code and it looks like the
fallback is incorrect. If we fail to determine the stack layout
accurately we should make a guess based on the ABI. It turns out 
tdep->lr_frame_offset was created for this purpose, but isnt used
anywhere.

Look OK?

Anton
---

2006-06-02  Anton Blanchard  <anton@samba.org>

	* rs6000-tdep.c (rs6000_frame_cache): Use tdep->lr_frame_offset
	instead of wordsize when looking for the LR in a stack frame.


--- src/gdb/rs6000-tdep.c~	2006-06-02 09:34:44.000000000 +1000
+++ src/gdb/rs6000-tdep.c	2006-06-02 09:33:42.000000000 +1000
@@ -2988,7 +2988,7 @@
       if (make_frame)
 	{
 	  fdata.frameless = 0;
-	  fdata.lr_offset = wordsize;
+	  fdata.lr_offset = tdep->lr_frame_offset;
 	}
     }
 


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

* Re: [PATCH] Fix powerpc 64bit backtrace code
  2006-06-02  2:40 [PATCH] Fix powerpc 64bit backtrace code Anton Blanchard
@ 2006-06-08 18:41 ` Daniel Jacobowitz
  2007-03-27 19:05   ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2006-06-08 18:41 UTC (permalink / raw)
  To: Anton Blanchard; +Cc: gdb-patches

On Fri, Jun 02, 2006 at 12:38:24PM +1000, Anton Blanchard wrote:
> Knowing this I looked through the backtrace code and it looks like the
> fallback is incorrect. If we fail to determine the stack layout
> accurately we should make a guess based on the ABI. It turns out 
> tdep->lr_frame_offset was created for this purpose, but isnt used
> anywhere.

Yep.  It was used, but that code is long gone; I think I added the
fallback you're fixing, but I didn't know about lr_frame_offset.
The patch looks right.

Do you have write access to src?  If so, you can check this in and add
your name to write-after-approval in MAINTAINERS.  Or I can check it in
for you; just let me know which.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: [PATCH] Fix powerpc 64bit backtrace code
  2006-06-08 18:41 ` Daniel Jacobowitz
@ 2007-03-27 19:05   ` Daniel Jacobowitz
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Jacobowitz @ 2007-03-27 19:05 UTC (permalink / raw)
  To: Anton Blanchard, gdb-patches

On Thu, Jun 08, 2006 at 02:41:34PM -0400, Daniel Jacobowitz wrote:
> On Fri, Jun 02, 2006 at 12:38:24PM +1000, Anton Blanchard wrote:
> > Knowing this I looked through the backtrace code and it looks like the
> > fallback is incorrect. If we fail to determine the stack layout
> > accurately we should make a guess based on the ABI. It turns out 
> > tdep->lr_frame_offset was created for this purpose, but isnt used
> > anywhere.
> 
> Yep.  It was used, but that code is long gone; I think I added the
> fallback you're fixing, but I didn't know about lr_frame_offset.
> The patch looks right.
> 
> Do you have write access to src?  If so, you can check this in and add
> your name to write-after-approval in MAINTAINERS.  Or I can check it in
> for you; just let me know which.

Andreas Schwab pointed out that I'd never heard back.  So I went ahead
and checked this in.

-- 
Daniel Jacobowitz
CodeSourcery


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

end of thread, other threads:[~2007-03-27 19:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-02  2:40 [PATCH] Fix powerpc 64bit backtrace code Anton Blanchard
2006-06-08 18:41 ` Daniel Jacobowitz
2007-03-27 19:05   ` Daniel Jacobowitz

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