From b7221a869cef7981cfbb3ccf3643c80d23d8a085 Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Mon, 2 May 2005 00:34:19 +0000 Subject: [PATCH] CFI: if summarisation fails, don't add the result to our collection of CfiSI records. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3587 --- coregrind/vg_dwarf.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/coregrind/vg_dwarf.c b/coregrind/vg_dwarf.c index 68e718152..5c7584111 100644 --- a/coregrind/vg_dwarf.c +++ b/coregrind/vg_dwarf.c @@ -1217,11 +1217,11 @@ static ULong read_ULong ( UChar* data ) static Addr read_Addr ( UChar* data ) { - if (sizeof(Addr) == 4) - return read_UInt(data); - else if (sizeof(Addr) == 8) - return read_ULong(data); - vg_assert(0); + if (sizeof(Addr) == 4) + return read_UInt(data); + else if (sizeof(Addr) == 8) + return read_ULong(data); + vg_assert(0); } static UChar read_UChar ( UChar* data ) @@ -1550,8 +1550,8 @@ Bool run_CF_instructions ( SegInfo* si, UWord fde_arange, UnwindContext* restore_ctx ) { - CfiSI cfisi; - + CfiSI cfisi; + Bool summ_ok; Int j, i = 0; Addr loc_prev; if (0) ppUnwindContext(ctx); @@ -1566,16 +1566,24 @@ Bool run_CF_instructions ( SegInfo* si, i += j; if (0) ppUnwindContext(ctx); if (loc_prev != ctx->loc && si) { - summarise_context ( &cfisi, loc_prev, ctx ); - VG_(addCfiSI)(si, &cfisi); + summ_ok = summarise_context ( &cfisi, loc_prev, ctx ); + if (summ_ok) { + VG_(addCfiSI)(si, &cfisi); + if (VG_(clo_trace_cfi)) + VG_(ppCfiSI)(&cfisi); + } } } if (ctx->loc < fde_arange) { loc_prev = ctx->loc; ctx->loc = fde_arange; if (si) { - summarise_context ( &cfisi, loc_prev, ctx ); - VG_(addCfiSI)(si, &cfisi); + summ_ok = summarise_context ( &cfisi, loc_prev, ctx ); + if (summ_ok) { + VG_(addCfiSI)(si, &cfisi); + if (VG_(clo_trace_cfi)) + VG_(ppCfiSI)(&cfisi); + } } } return True;