Patch adding (or showing the proper/not confusing) helgrind thread nr for block
and stack address description.
* A race condition on an allocated block shows the stacktrace, but
does not show the thread # that allocated the block.
This patch adds the output of the thread # that allocated the block.
* The patch also fixes the confusion that might appear between
the core threadid and the helgrind thread nr in Stack address description:
A printed stack addrinfo was containing a thread id, while all other helgrind
messages are using (supposed to use) an 'helgrind thread #' which
is used in the thread announcement.
Basically, the idea is to let a tool set a "tool specific thread nr'
in an addrinfo.
The pretty printing of the addrinfo is then by preference showing this
thread nr (if it was set, i.e. different of 0).
Currently, only helgrind uses this addrinfo tnr.
Note: in xml mode, the output is matching the protocol description.
I.e., GUI should not be impacted by this change, if they properly implement
the xml protocol.
* Also, make the output produced by m_addrinfo consistent:
The message 'block was alloc'd at' is changed to be like all other
output : one character indent, and starting with an uppercase
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14175 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/helgrind/hg_main.c b/helgrind/hg_main.c
index f5d02b2..65b045b 100644
--- a/helgrind/hg_main.c
+++ b/helgrind/hg_main.c
@@ -4213,6 +4213,7 @@
}
Bool HG_(mm_find_containing_block)( /*OUT*/ExeContext** where,
+ /*OUT*/UInt* tnr,
/*OUT*/Addr* payload,
/*OUT*/SizeT* szB,
Addr data_addr )
@@ -4249,6 +4250,7 @@
tl_assert(mm);
tl_assert(addr_is_in_MM_Chunk(mm, data_addr));
if (where) *where = mm->where;
+ if (tnr) *tnr = mm->thr->errmsg_index;
if (payload) *payload = mm->payload;
if (szB) *szB = mm->szB;
return True;
@@ -4868,7 +4870,8 @@
SizeT pszB = 0;
if (0) VG_(printf)("VG_USERREQ__HG_CLEAN_MEMORY_HEAPBLOCK(%#lx)\n",
args[1]);
- if (HG_(mm_find_containing_block)(NULL, &payload, &pszB, args[1])) {
+ if (HG_(mm_find_containing_block)(NULL, NULL,
+ &payload, &pszB, args[1])) {
if (pszB > 0) {
evh__die_mem(payload, pszB);
evh__new_mem(payload, pszB);