|
From: <sv...@va...> - 2008-12-13 01:20:27
|
Author: sewardj
Date: 2008-12-13 01:20:21 +0000 (Sat, 13 Dec 2008)
New Revision: 8820
Log:
Avoid causing an assertion failure in VG_(make_ExeContext_from_StackTrace)
in the case where VG_(clo_backtrace_size) < N_FRAMES (that is, with
--num-callers=N where N < N_FRAMES).
Modified:
trunk/helgrind/libhb_core.c
Modified: trunk/helgrind/libhb_core.c
===================================================================
--- trunk/helgrind/libhb_core.c 2008-12-13 01:18:38 UTC (rev 8819)
+++ trunk/helgrind/libhb_core.c 2008-12-13 01:20:21 UTC (rev 8820)
@@ -2955,6 +2955,10 @@
return (void*)( ((UWord)p) & ((UWord)w) );
}
+inline static UInt min_UInt ( UInt a, UInt b ) {
+ return a < b ? a : b;
+}
+
/* Compare the intervals [a1,a1+n1) and [a2,a2+n2). Return -1 if the
first interval is lower, 1 if the first interval is higher, and 0
if there is any overlap. Redundant paranoia with casting is there
@@ -3177,7 +3181,8 @@
tl_assert(cand_rcec->magic == RCEC_MAGIC);
tl_assert(cand_szB >= 1);
*resEC = VG_(make_ExeContext_from_StackTrace)(
- &cand_rcec->frames[1], N_FRAMES
+ &cand_rcec->frames[1],
+ min_UInt(N_FRAMES, VG_(clo_backtrace_size))
);
*resThr = cand_thr;
*resSzB = cand_szB;
|