Incorporate a patch from Craig Chaney which gives better stack
snapshots on ppc32-linux in the presence of functions subject to
leaf-function optimisations.
At the same time, simplify the stack unwinding logic by basically
implementing it separately for each target. Having a single piece of
logic for amd64 and x86 was tenable, but merging ppc32 into it is too
confusing. So now there is an x86/amd64 unwinder and a ppc32
unwinder.
This requires plumbing a link-register value into
VG_(get_StackTrace2), and that in turn requires passing it around
several other stack-trace-related functions. Hence 7 changed files.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4464 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_libcassert.c b/coregrind/m_libcassert.c
index 72a5517..ae8f406 100644
--- a/coregrind/m_libcassert.c
+++ b/coregrind/m_libcassert.c
@@ -94,7 +94,8 @@
}
__attribute__ ((noreturn))
-static void report_and_quit ( const Char* report, Addr ip, Addr sp, Addr fp )
+static void report_and_quit ( const Char* report,
+ Addr ip, Addr sp, Addr fp, Addr lr )
{
Addr stacktop;
Addr ips[BACKTRACE_DEPTH];
@@ -111,7 +112,7 @@
stacktop = tst->os_state.valgrind_stack_base +
tst->os_state.valgrind_stack_szB;
- VG_(get_StackTrace2)(ips, BACKTRACE_DEPTH, ip, sp, fp, sp, stacktop);
+ VG_(get_StackTrace2)(ips, BACKTRACE_DEPTH, ip, sp, fp, lr, sp, stacktop);
VG_(pp_StackTrace) (ips, BACKTRACE_DEPTH);
// Don't print this, as it's not terribly interesting and avoids a
@@ -166,30 +167,30 @@
if (!VG_STREQ(buf, ""))
VG_(printf)("%s: %s\n", component, buf );
- report_and_quit(bugs_to, 0,0,0);
+ report_and_quit(bugs_to, 0,0,0,0);
}
__attribute__ ((noreturn))
static void panic ( Char* name, Char* report, Char* str,
- Addr ip, Addr sp, Addr fp )
+ Addr ip, Addr sp, Addr fp, Addr lr )
{
VG_(printf)("\n%s: the 'impossible' happened:\n %s\n", name, str);
- report_and_quit(report, ip, sp, fp);
+ report_and_quit(report, ip, sp, fp, lr);
}
-void VG_(core_panic_at) ( Char* str, Addr ip, Addr sp, Addr fp )
+void VG_(core_panic_at) ( Char* str, Addr ip, Addr sp, Addr fp, Addr lr )
{
- panic("valgrind", VG_BUGS_TO, str, ip, sp, fp);
+ panic("valgrind", VG_BUGS_TO, str, ip, sp, fp, lr);
}
void VG_(core_panic) ( Char* str )
{
- VG_(core_panic_at)(str, 0,0,0);
+ VG_(core_panic_at)(str, 0,0,0,0);
}
void VG_(tool_panic) ( Char* str )
{
- panic(VG_(details).name, VG_(details).bug_reports_to, str, 0,0,0);
+ panic(VG_(details).name, VG_(details).bug_reports_to, str, 0,0,0,0);
}
/* Print some helpful-ish text about unimplemented things, and give up. */