|
From: <sv...@va...> - 2008-05-13 11:23:22
|
Author: sewardj
Date: 2008-05-13 12:23:20 +0100 (Tue, 13 May 2008)
New Revision: 8059
Log:
Merge r8058 (Stop massif segfaulting due to stack overflow)
Modified:
branches/VALGRIND_3_3_BRANCH/massif/ms_main.c
Modified: branches/VALGRIND_3_3_BRANCH/massif/ms_main.c
===================================================================
--- branches/VALGRIND_3_3_BRANCH/massif/ms_main.c 2008-05-13 10:57:29 UTC (rev 8058)
+++ branches/VALGRIND_3_3_BRANCH/massif/ms_main.c 2008-05-13 11:23:20 UTC (rev 8059)
@@ -1910,11 +1910,15 @@
{
Int i, n_insig_children_sxpts;
Char* perc;
- Char ip_desc_array[BUF_LEN];
- Char* ip_desc = ip_desc_array;
SXPt* pred = NULL;
SXPt* child = NULL;
+ // Used for printing function names. Is made static to keep it out
+ // of the stack frame -- this function is recursive. Obviously this
+ // now means its contents are trashed across the recursive call.
+ static Char ip_desc_array[BUF_LEN];
+ Char* ip_desc = ip_desc_array;
+
switch (sxpt->tag) {
case SigSXPt:
// Print the SXPt itself.
@@ -1969,7 +1973,9 @@
if (InsigSXPt == child->tag)
n_insig_children_sxpts++;
- // Ok, print the child.
+ // Ok, print the child. NB: contents of ip_desc_array will be
+ // trashed by this recursive call. Doesn't matter currently,
+ // but worth noting.
pp_snapshot_SXPt(fd, child, depth+1, depth_str, depth_str_len,
snapshot_heap_szB, snapshot_total_szB);
}
|