This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix powerpc 64bit backtrace code


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]