A modularisation + refactoring commit. vg_execontext.c has been split into
two halves: stacktrace.c, which deals with getting, traversing and printing
stack traces; and execontext.c, which deals with storing stack traces
permanently in a way that avoids duplicates, and comparing them.
One nice outcome: previously we were often creating ExeContexts, which live
forever, even when they were only needed temporarily. Ie. this was a memory
leak, which has been removed.
As part of this, new headers have been created, carved off core.h and
tool.h. Lots of function names have changed, too.
In Massif, I also changed a lot of "eip" names to "ip" to make them less
x86-specific.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3429 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/vg_errcontext.c b/coregrind/vg_errcontext.c
index ce55550..a28e34e 100644
--- a/coregrind/vg_errcontext.c
+++ b/coregrind/vg_errcontext.c
@@ -29,6 +29,7 @@
*/
#include "core.h"
+#include "pub_core_execontext.h"
/*------------------------------------------------------------*/
/*--- Globals ---*/
@@ -326,7 +327,7 @@
err->count = 1;
err->tid = tid;
if (NULL == where)
- err->where = VG_(get_ExeContext)( tid );
+ err->where = VG_(record_ExeContext)( tid );
else
err->where = where;
@@ -381,7 +382,7 @@
}
// Print stack trace elements
- VG_(apply_ExeContext)(printSuppForIp, ec, stop_at);
+ VG_(apply_StackTrace)(printSuppForIp, VG_(extract_StackTrace)(ec), stop_at);
VG_(printf)("}\n");
}
@@ -675,9 +676,9 @@
pp_Error( p_min, False );
if ((i+1 == VG_(clo_dump_error))) {
+ StackTrace ips = VG_(extract_StackTrace)(p_min->where);
VG_(translate) ( 0 /* dummy ThreadId; irrelevant due to debugging*/,
- p_min->where->ips[0], /*debugging*/True,
- 0xFE/*verbosity*/);
+ ips[0], /*debugging*/True, 0xFE/*verbosity*/);
}
p_min->count = 1 << 30;
@@ -982,9 +983,10 @@
{
Int i;
Char caller_name[M_VG_ERRTXT];
+ StackTrace ips = VG_(extract_StackTrace)(err->where);
for (i = 0; i < su->n_callers; i++) {
- Addr a = err->where->ips[i];
+ Addr a = ips[i];
vg_assert(su->callers[i].name != NULL);
switch (su->callers[i].ty) {
case ObjName: