From: Julian Seward Date: Fri, 23 Dec 2005 23:33:51 +0000 (+0000) Subject: Make ppc64-linux stack unwinding work. X-Git-Tag: svn/VALGRIND_3_2_0~453 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=79bbb4ed423ac02c2ab6b146ccd77a6706beb582;p=thirdparty%2Fvalgrind.git Make ppc64-linux stack unwinding work. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5424 --- diff --git a/coregrind/m_stacktrace.c b/coregrind/m_stacktrace.c index b835829ab5..21bc0e9369 100644 --- a/coregrind/m_stacktrace.c +++ b/coregrind/m_stacktrace.c @@ -94,8 +94,9 @@ UInt VG_(get_StackTrace2) ( Addr* ips, UInt n_ips, } /* Otherwise unwind the stack in a platform-specific way. Trying - to merge the x86, amd64 and ppc32 logic into a single piece of - code is just too confusing and difficult to performance-tune. */ + to merge the x86, amd64, ppc32 and ppc64 logic into a single + piece of code is just too confusing and difficult to + performance-tune. */ # if defined(VGP_x86_linux) @@ -251,13 +252,18 @@ UInt VG_(get_StackTrace2) ( Addr* ips, UInt n_ips, ips[0] = ip; i = 1; - if (fp_min <= fp && fp < fp_max-4+1) { + if (fp_min <= fp && fp < fp_max-VG_WORDSIZE+1) { /* initial FP is sane; keep going */ fp = (((UWord*)fp)[0]); while (True) { + /* on ppc64-linux (ppc64-elf, really), the lr save slot is 2 + words back from sp, whereas on ppc32-elf(?) it's only one + word back. */ + const Int lr_offset = VG_WORDSIZE==8 ? 2 : 1; + if (i >= n_ips) break; @@ -269,7 +275,7 @@ UInt VG_(get_StackTrace2) ( Addr* ips, UInt n_ips, if (i == 1 && lr_is_first_RA) ip = lr; else - ip = (((UWord*)fp)[1]); + ip = (((UWord*)fp)[lr_offset]); fp = (((UWord*)fp)[0]); ips[i++] = ip;