diff options
author | njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2009-05-07 23:08:10 +0000 |
---|---|---|
committer | njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2009-05-07 23:08:10 +0000 |
commit | 3a4b58f812bb0dd4cdb20b2869629845a683191d (patch) | |
tree | 728272565eaa842b2596b3d8ff99497ab4550660 /helgrind | |
parent | f1d906fd99d33c645405c69ab478290c61cd477d (diff) | |
download | valgrind-3a4b58f812bb0dd4cdb20b2869629845a683191d.tar.gz |
Fix up some stack trace inconsistencies:
- When printing suppressions, never print more entries than there are in the
stack. This avoids bogus suppressions in some cases! (I haven't seen
them on Linux, but I have seen them on Darwin.)
- When getting a stack trace, stop if we get an IP of zero or one; that
means we've hit the end of the stack. And don't include that entry in the
stack trace, because it's a guaranteed "???" if it's ever printed which is
useless.
- In VG_(apply_StackTrace), we can now rely entirely on the n_ip parameter
rather than looking for 0 or -1, because that check is done when the stack
trace is first obtained. In other words, stack traces all use an n_ip
parameter to record their size, whereas previously they used an odd
mixture of n_ip and null-termination.
- Rename 'n_ips' variables as 'max_n_ips' where appropriate; those left as
'n_ips' truly describe how many IPs there are in the stack trace.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9793 a5019735-40e9-0310-863c-91ae7b9d1cf9
Diffstat (limited to 'helgrind')
-rw-r--r-- | helgrind/libhb_core.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/helgrind/libhb_core.c b/helgrind/libhb_core.c index b2142ec32..1a600ac50 100644 --- a/helgrind/libhb_core.c +++ b/helgrind/libhb_core.c @@ -3184,15 +3184,18 @@ Bool libhb_event_map_lookup ( /*OUT*/ExeContext** resEC, tl_assert(i >= 0 && i <= N_OLDREF_ACCS); if (i < N_OLDREF_ACCS) { + Int n, maxNFrames; /* return with success */ tl_assert(cand_thr); tl_assert(cand_rcec); tl_assert(cand_rcec->magic == RCEC_MAGIC); tl_assert(cand_szB >= 1); - *resEC = VG_(make_ExeContext_from_StackTrace)( - &cand_rcec->frames[0], - min_UInt(N_FRAMES, VG_(clo_backtrace_size)) - ); + /* Count how many non-zero frames we have. */ + maxNFrames = min_UInt(N_FRAMES, VG_(clo_backtrace_size)); + for (n = 0; n < maxNFrames; n++) { + if (0 == cand_rcec->frames[n]) break; + } + *resEC = VG_(make_ExeContext_from_StackTrace)(cand_rcec->frames, n); *resThr = cand_thr; *resSzB = cand_szB; *resIsW = cand_isW; |