#include "pub_core_threadstate.h" // For VG_N_THREADS
#include "pub_core_debugger.h"
#include "pub_core_debuginfo.h"
+#include "pub_core_debuglog.h"
#include "pub_core_errormgr.h"
#include "pub_core_execontext.h"
#include "pub_core_gdbserver.h"
#include "pub_core_translate.h" // for VG_(translate)()
#include "pub_core_xarray.h" // VG_(xaprintf) et al
+#define DEBUG_ERRORMGR 0 // set to 1 for heavyweight tracing
+
/*------------------------------------------------------------*/
/*--- Globals ---*/
/*------------------------------------------------------------*/
}
IPtoFunOrObjCompleter;
-// free the memory in ip2fo.
-static void clearIPtoFunOrObjCompleter
- (IPtoFunOrObjCompleter* ip2fo)
+static void pp_ip2fo (IPtoFunOrObjCompleter* ip2fo)
+{
+ Int i, j;
+ Int o;
+
+ VG_(printf)("n_ips %lu n_ips_expanded %lu resulting in n_expanded %lu\n",
+ ip2fo->n_ips, ip2fo->n_ips_expanded, ip2fo->n_expanded);
+ for (i = 0; i < ip2fo->n_ips_expanded; i++) {
+ o = 0;
+ for (j = 0; j < i; j++)
+ o += ip2fo->n_offsets_per_ip[j];
+ VG_(printf)("ips %d 0x08%lx offset [%d,%d] ",
+ i, ip2fo->ips[i],
+ o, o+ip2fo->n_offsets_per_ip[i]-1);
+ for (j = 0; j < ip2fo->n_offsets_per_ip[i]; j++) {
+ VG_(printf)("%sfun:%s obj:%s\n",
+ j == 0 ? "" : " ",
+ ip2fo->fun_offsets[o+j] == -1 ?
+ "<not expanded>" : &ip2fo->names[ip2fo->fun_offsets[o+j]],
+ ip2fo->obj_offsets[o+j] == -1 ?
+ "<not expanded>" : &ip2fo->names[ip2fo->obj_offsets[o+j]]);
+ }
+ }
+}
+
+/* free the memory in ip2fo.
+ At debuglog 4, su (or NULL) will be used to show the matching (or non matching)
+ with ip2fo. */
+static void clearIPtoFunOrObjCompleter ( Supp *su, IPtoFunOrObjCompleter* ip2fo)
{
+ if (DEBUG_ERRORMGR || VG_(debugLog_getLevel)() >= 4) {
+ if (su)
+ VG_(dmsg)("errormgr matching end suppression %s %s:%d matched:\n",
+ su->sname,
+ VG_(clo_suppressions)[su->clo_suppressions_i],
+ su->sname_lineno);
+ else
+ VG_(dmsg)("errormgr matching end no suppression matched:\n");
+ VG_(pp_StackTrace) (ip2fo->ips, ip2fo->n_ips);
+ pp_ip2fo(ip2fo);
+ }
if (ip2fo->n_offsets_per_ip) VG_(free)(ip2fo->n_offsets_per_ip);
if (ip2fo->fun_offsets) VG_(free)(ip2fo->fun_offsets);
if (ip2fo->obj_offsets) VG_(free)(ip2fo->obj_offsets);
if ((*offsets)[ixInput] == -1) {
HChar* caller_name = grow_names(ip2fo);
(*offsets)[ixInput] = ip2fo->names_free;
+ if (DEBUG_ERRORMGR) VG_(printf)("marking %s ixInput %d offset %d\n",
+ needFun ? "fun" : "obj",
+ ixInput, ip2fo->names_free);
if (needFun) {
// With inline info, fn names must have been completed already.
vg_assert (!VG_(clo_read_inline_info));
/* First get the pos in ips corresponding to ixInput */
for (pos_ips = 0; pos_ips < ip2fo->n_expanded; pos_ips++) {
last_expand_pos_ips += ip2fo->n_offsets_per_ip[pos_ips];
- if (ixInput <= last_expand_pos_ips)
+ if (ixInput < last_expand_pos_ips)
break;
}
/* pos_ips is the position in ips corresponding to ixInput.
VG_(strcpy)(caller_name, "???");
// Have all inlined calls pointing at this object name
- for (i = last_expand_pos_ips - ip2fo->n_offsets_per_ip[pos_ips] - 1;
- i <= last_expand_pos_ips;
- i++)
+ for (i = last_expand_pos_ips - ip2fo->n_offsets_per_ip[pos_ips] + 1;
+ i < last_expand_pos_ips;
+ i++) {
ip2fo->obj_offsets[i] = ip2fo->names_free;
+ if (DEBUG_ERRORMGR)
+ VG_(printf) (" set obj_offset %lu to %d\n", i, ip2fo->names_free);
+ }
}
ip2fo->names_free += VG_(strlen)(caller_name) + 1;
+ if (DEBUG_ERRORMGR) pp_ip2fo(ip2fo);
}
return ip2fo->names + (*offsets)[ixInput];
const SuppLoc* supploc = supplocV; /* PATTERN */
IPtoFunOrObjCompleter* ip2fo = inputCompleter;
HChar* funobj_name; // Fun or Obj name.
+ Bool ret;
expandInput(ip2fo, ixInput);
vg_assert(ixInput < ip2fo->n_expanded);
supploc->name. Hence (and leading to a re-entrant call of
VG_(generic_match) if there is a wildcard character): */
if (supploc->name_is_simple_str)
- return VG_(strcmp) (supploc->name, funobj_name) == 0;
+ ret = VG_(strcmp) (supploc->name, funobj_name) == 0;
else
- return VG_(string_match)(supploc->name, funobj_name);
+ ret = VG_(string_match)(supploc->name, funobj_name);
+ if (DEBUG_ERRORMGR)
+ VG_(printf) ("supp_pattEQinp %s patt %s ixUnput %lu value:%s match:%s\n",
+ supploc->ty == FunName ? "fun" : "obj",
+ supploc->name, ixInput, funobj_name,
+ ret ? "yes" : "no");
+ return ret;
}
/////////////////////////////////////////////////////
UWord n_supps = su->n_callers;
UWord szbPatt = sizeof(SuppLoc);
Bool matchAll = False; /* we just want to match a prefix */
+ if (DEBUG_ERRORMGR)
+ VG_(dmsg)(" errormgr Checking match with %s %s:%d\n",
+ su->sname,
+ VG_(clo_suppressions)[su->clo_suppressions_i],
+ su->sname_lineno);
return
VG_(generic_match)(
matchAll,
ip2fo.names_free = 0;
/* See if the error context matches any suppression. */
+ if (DEBUG_ERRORMGR || VG_(debugLog_getLevel)() >= 4)
+ VG_(dmsg)("errormgr matching begin\n");
su_prev = NULL;
for (su = suppressions; su != NULL; su = su->next) {
em_supplist_cmps++;
su->next = suppressions;
suppressions = su;
}
- clearIPtoFunOrObjCompleter(&ip2fo);
+ clearIPtoFunOrObjCompleter(su, &ip2fo);
return su;
}
su_prev = su;
}
- clearIPtoFunOrObjCompleter(&ip2fo);
+ clearIPtoFunOrObjCompleter(NULL, &ip2fo);
return NULL; /* no matches */
}