From: Julian Seward Date: Sun, 13 Nov 2005 02:41:35 +0000 (+0000) Subject: ppc32 stack unwind: if the initial FP looks bad, don't use it. X-Git-Tag: svn/VALGRIND_3_1_0~121 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3f0447592e67e3361e6408830a15a2ed83279ba;p=thirdparty%2Fvalgrind.git ppc32 stack unwind: if the initial FP looks bad, don't use it. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5111 --- diff --git a/coregrind/m_stacktrace.c b/coregrind/m_stacktrace.c index c14b57e347..fad1fc37ff 100644 --- a/coregrind/m_stacktrace.c +++ b/coregrind/m_stacktrace.c @@ -189,32 +189,37 @@ UInt VG_(get_StackTrace2) ( Addr* ips, UInt n_ips, ips[0] = ip; i = 1; - fp = (((UWord*)fp)[0]); - while (True) { + if (fp_min <= fp && fp < fp_max-4+1) { - if (i >= n_ips) - break; + /* initial FP is sane; keep going */ + fp = (((UWord*)fp)[0]); - /* Try to derive a new (ip,fp) pair from the current set. */ + while (True) { - if (fp_min <= fp && fp <= fp_max) { - /* fp looks sane, so use it. */ + if (i >= n_ips) + break; - if (i == 1 && lr_is_first_RA) - ip = lr; - else - ip = (((UWord*)fp)[1]); + /* Try to derive a new (ip,fp) pair from the current set. */ - fp = (((UWord*)fp)[0]); - ips[i++] = ip; - if (debug) - VG_(printf)(" ipsF[%d]=%08p\n", i-1, ips[i-1]); - continue; - } + if (fp_min <= fp && fp <= fp_max) { + /* fp looks sane, so use it. */ - /* No luck there. We have to give up. */ - break; + if (i == 1 && lr_is_first_RA) + ip = lr; + else + ip = (((UWord*)fp)[1]); + + fp = (((UWord*)fp)[0]); + ips[i++] = ip; + if (debug) + VG_(printf)(" ipsF[%d]=%08p\n", i-1, ips[i-1]); + continue; + } + + /* No luck there. We have to give up. */ + break; + } } # else