From nobody Fri Jun 2 13:36:44 2006 From: Anton Blanchard Subject: [PATCH] Fix powerpc 64bit backtrace code To: gdb-patches@sourceware.org Date: Fri, 2 Jun 2006 12:38:24 +1000 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 * 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; } }