From: Bart Van Assche Date: Fri, 7 Mar 2008 18:52:38 +0000 (+0000) Subject: Switched to VG_(get_data_description)() for descriptions of addresses in error reports. X-Git-Tag: svn/VALGRIND_3_4_0~955 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fb679210b0b53c02dfe48b88044e40766bb80128;p=thirdparty%2Fvalgrind.git Switched to VG_(get_data_description)() for descriptions of addresses in error reports. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7585 --- diff --git a/exp-drd/drd_error.c b/exp-drd/drd_error.c index 05bf4a4267..20d3aff248 100644 --- a/exp-drd/drd_error.c +++ b/exp-drd/drd_error.c @@ -220,13 +220,20 @@ static void drd_report_data_race2(Error* const err, const DataRaceErrInfo* const dri) { AddrInfo ai; - Char descr[256]; + Char descr1[256]; + Char descr2[256]; tl_assert(dri); tl_assert(dri->addr); tl_assert(dri->size > 0); - describe_addr_text(dri->addr, dri->size, - &ai, descr, sizeof(descr)); + + descr1[0] = 0; + descr2[0] = 0; + VG_(get_data_description)(descr1, descr2, sizeof(descr1), dri->addr); + if (descr1[0] == 0) + { + describe_addr(dri->addr, dri->size, &ai); + } VG_(message)(Vg_UserMsg, "Conflicting %s by %s at 0x%08lx size %ld", dri->access_type == eStore ? "store" : "load", @@ -234,11 +241,19 @@ void drd_report_data_race2(Error* const err, const DataRaceErrInfo* const dri) dri->addr, dri->size); VG_(pp_ExeContext)(VG_(get_error_where)(err)); - VG_(message)(Vg_UserMsg, "Allocation context: %s", descr); - if (ai.akind == eMallocd && ai.lastchange) + if (descr1[0]) + { + VG_(message)(Vg_UserMsg, "%s", descr1); + VG_(message)(Vg_UserMsg, "%s", descr2); + } + else if (ai.akind == eMallocd && ai.lastchange) { VG_(pp_ExeContext)(ai.lastchange); } + else + { + VG_(message)(Vg_UserMsg, "Allocation context: unknown.\n"); + } thread_report_conflicting_segments(VgThreadIdToDrdThreadId(dri->tid), dri->addr, dri->size, dri->access_type); } diff --git a/exp-drd/drd_error.h b/exp-drd/drd_error.h index 1ef243e078..e459034b19 100644 --- a/exp-drd/drd_error.h +++ b/exp-drd/drd_error.h @@ -27,7 +27,7 @@ #define __DRD_ERROR_H -#include "pub_drd_bitmap.h" // BmAccessTypeT +#include "pub_drd_bitmap.h" // BmAccessTypeT #include "drd_thread.h" // DrdThreadId #include "pub_tool_basics.h" // SizeT #include "pub_tool_debuginfo.h" // SegInfo diff --git a/exp-drd/tests/filter_stderr b/exp-drd/tests/filter_stderr index fd864725ac..aebffc03c6 100755 --- a/exp-drd/tests/filter_stderr +++ b/exp-drd/tests/filter_stderr @@ -11,7 +11,6 @@ $dir/../../tests/filter_stderr_basic | sed \ -e "/^exp-drd, a data race detector\.$/d" \ -e "s/^Allocation context: stack of thread \([0-9]*\), offset -[0-9]*$/Allocation context: stack of thread \1, offset .../" \ --e "s/^Allocation context: .*$/Allocation context: unknown/" \ -e "s/(tc20_verifywrap.c:261)/(tc20_verifywrap.c:262)/" \ -e "/^NOTE: This is an Experimental-Class Valgrind Tool.$/d" \ -e "/^Copyright (C) 2006-200., and GNU GPL'd, by Bart Van Assche.$/d" \ diff --git a/exp-drd/tests/fp_race.stderr.exp b/exp-drd/tests/fp_race.stderr.exp index c9afafd7b1..153ce96090 100644 --- a/exp-drd/tests/fp_race.stderr.exp +++ b/exp-drd/tests/fp_race.stderr.exp @@ -1,7 +1,8 @@ Conflicting load by main at 0x........ size 8 at 0x........: main (fp_race.c:?) -Allocation context: unknown +Location 0x........ is 0 bytes inside local var "s_d3" +declared at fp_race.c:47, in frame #0 of thread 1 Other segment start (thread_func) (thread finished, call stack no longer available) Other segment end (thread_func) @@ -9,7 +10,8 @@ Other segment end (thread_func) Conflicting store by main at 0x........ size 8 at 0x........: main (fp_race.c:?) -Allocation context: unknown +Location 0x........ is 0 bytes inside local var "s_d3" +declared at fp_race.c:47, in frame #0 of thread 1 Other segment start (thread_func) (thread finished, call stack no longer available) Other segment end (thread_func) diff --git a/exp-drd/tests/hg03_inherit.stderr.exp b/exp-drd/tests/hg03_inherit.stderr.exp index 274c6a726e..3102848f89 100644 --- a/exp-drd/tests/hg03_inherit.stderr.exp +++ b/exp-drd/tests/hg03_inherit.stderr.exp @@ -5,7 +5,8 @@ Conflicting store by thread 3 at 0x........ size 4 by 0x........: vg_thread_wrapper (drd_intercepts.c:?) by 0x........: start_thread (in libpthread-?.?.so) by 0x........: clone (in /...libc...) -Allocation context: unknown +Location 0x........ is 0 bytes inside shared[1], +declared at hg03_inherit.c:11, in frame #0 of thread 3 Other segment start (thread 1) at 0x........: pthread_join (drd_intercepts.c:?) by 0x........: main (hg03_inherit.c:49) @@ -19,7 +20,8 @@ Conflicting store by thread 3 at 0x........ size 4 by 0x........: vg_thread_wrapper (drd_intercepts.c:?) by 0x........: start_thread (in libpthread-?.?.so) by 0x........: clone (in /...libc...) -Allocation context: unknown +Location 0x........ is 0 bytes inside shared[1], +declared at hg03_inherit.c:11, in frame #0 of thread 3 Other segment start (thread 1) at 0x........: pthread_join (drd_intercepts.c:?) by 0x........: main (hg03_inherit.c:49) diff --git a/exp-drd/tests/hg04_race.stderr.exp b/exp-drd/tests/hg04_race.stderr.exp index c713aff4b9..8679d06394 100644 --- a/exp-drd/tests/hg04_race.stderr.exp +++ b/exp-drd/tests/hg04_race.stderr.exp @@ -5,7 +5,8 @@ Conflicting load by thread 2 at 0x........ size 4 by 0x........: vg_thread_wrapper (drd_intercepts.c:?) by 0x........: start_thread (in libpthread-?.?.so) by 0x........: clone (in /...libc...) -Allocation context: unknown +Location 0x........ is 0 bytes inside local var "shared" +declared at hg04_race.c:6, in frame #0 of thread 2 Other segment start (thread 2) (thread finished, call stack no longer available) Other segment end (thread 2) @@ -16,7 +17,8 @@ Conflicting store by thread 2 at 0x........ size 4 by 0x........: vg_thread_wrapper (drd_intercepts.c:?) by 0x........: start_thread (in libpthread-?.?.so) by 0x........: clone (in /...libc...) -Allocation context: unknown +Location 0x........ is 0 bytes inside local var "shared" +declared at hg04_race.c:6, in frame #0 of thread 2 Other segment start (thread 2) (thread finished, call stack no longer available) Other segment end (thread 2) diff --git a/exp-drd/tests/hg05_race2.stderr.exp b/exp-drd/tests/hg05_race2.stderr.exp index da70ded1e5..743a78fad1 100644 --- a/exp-drd/tests/hg05_race2.stderr.exp +++ b/exp-drd/tests/hg05_race2.stderr.exp @@ -5,7 +5,8 @@ Conflicting load by thread 2 at 0x........ size 4 by 0x........: vg_thread_wrapper (drd_intercepts.c:?) by 0x........: start_thread (in libpthread-?.?.so) by 0x........: clone (in /...libc...) -Allocation context: unknown +Location 0x........ is 0 bytes inside foo.poot[5].plop[11], +declared at hg05_race2.c:24, in frame #4 of thread 1 Other segment start (thread 2) (thread finished, call stack no longer available) Other segment end (thread 2) @@ -16,7 +17,8 @@ Conflicting store by thread 2 at 0x........ size 4 by 0x........: vg_thread_wrapper (drd_intercepts.c:?) by 0x........: start_thread (in libpthread-?.?.so) by 0x........: clone (in /...libc...) -Allocation context: unknown +Location 0x........ is 0 bytes inside foo.poot[5].plop[11], +declared at hg05_race2.c:24, in frame #4 of thread 1 Other segment start (thread 2) (thread finished, call stack no longer available) Other segment end (thread 2) diff --git a/exp-drd/tests/rwlock_race.stderr.exp b/exp-drd/tests/rwlock_race.stderr.exp index 8bf1411d10..fdcfccc3aa 100644 --- a/exp-drd/tests/rwlock_race.stderr.exp +++ b/exp-drd/tests/rwlock_race.stderr.exp @@ -5,7 +5,8 @@ Conflicting load by thread 2 at 0x........ size 4 by 0x........: vg_thread_wrapper (drd_intercepts.c:?) by 0x........: start_thread (in libpthread-?.?.so) by 0x........: clone (in /...libc...) -Allocation context: unknown +Location 0x........ is 0 bytes inside local var "s_racy" +declared at rwlock_race.c:17, in frame #0 of thread 2 Other segment start (thread 2) (thread finished, call stack no longer available) Other segment end (thread 2) @@ -16,7 +17,8 @@ Conflicting store by thread 2 at 0x........ size 4 by 0x........: vg_thread_wrapper (drd_intercepts.c:?) by 0x........: start_thread (in libpthread-?.?.so) by 0x........: clone (in /...libc...) -Allocation context: unknown +Location 0x........ is 0 bytes inside local var "s_racy" +declared at rwlock_race.c:17, in frame #0 of thread 2 Other segment start (thread 2) (thread finished, call stack no longer available) Other segment end (thread 2) diff --git a/exp-drd/tests/sem_as_mutex.stderr.exp b/exp-drd/tests/sem_as_mutex.stderr.exp index 8c396090a9..8a28a5f0ef 100644 --- a/exp-drd/tests/sem_as_mutex.stderr.exp +++ b/exp-drd/tests/sem_as_mutex.stderr.exp @@ -1,7 +1,8 @@ Conflicting load by main at 0x........ size 8 at 0x........: main (sem_as_mutex.c:?) -Allocation context: unknown +Location 0x........ is 0 bytes inside local var "s_d3" +declared at sem_as_mutex.c:48, in frame #0 of thread 1 Other segment start (thread_func) (thread finished, call stack no longer available) Other segment end (thread_func) @@ -9,7 +10,8 @@ Other segment end (thread_func) Conflicting store by main at 0x........ size 8 at 0x........: main (sem_as_mutex.c:?) -Allocation context: unknown +Location 0x........ is 0 bytes inside local var "s_d3" +declared at sem_as_mutex.c:48, in frame #0 of thread 1 Other segment start (thread_func) (thread finished, call stack no longer available) Other segment end (thread_func) diff --git a/exp-drd/tests/tc01_simple_race.stderr.exp b/exp-drd/tests/tc01_simple_race.stderr.exp index 8a2b91a99b..abe4f211e3 100644 --- a/exp-drd/tests/tc01_simple_race.stderr.exp +++ b/exp-drd/tests/tc01_simple_race.stderr.exp @@ -1,7 +1,8 @@ Conflicting load by thread 1 at 0x........ size 4 at 0x........: main (tc01_simple_race.c:28) -Allocation context: unknown +Location 0x........ is 0 bytes inside global var "x" +declared at tc01_simple_race.c:9 Other segment start (thread 2) (thread finished, call stack no longer available) Other segment end (thread 2) @@ -9,7 +10,8 @@ Other segment end (thread 2) Conflicting store by thread 1 at 0x........ size 4 at 0x........: main (tc01_simple_race.c:28) -Allocation context: unknown +Location 0x........ is 0 bytes inside global var "x" +declared at tc01_simple_race.c:9 Other segment start (thread 2) (thread finished, call stack no longer available) Other segment end (thread 2) diff --git a/exp-drd/tests/tc16_byterace.stderr.exp b/exp-drd/tests/tc16_byterace.stderr.exp index 84db3ce31f..35bfc961af 100644 --- a/exp-drd/tests/tc16_byterace.stderr.exp +++ b/exp-drd/tests/tc16_byterace.stderr.exp @@ -1,7 +1,8 @@ Conflicting load by thread 1 at 0x........ size 1 at 0x........: main (tc16_byterace.c:34) -Allocation context: unknown +Location 0x........ is 0 bytes inside bytes[4], +a global variable declared at tc16_byterace.c:7 Other segment start (thread 2) (thread finished, call stack no longer available) Other segment end (thread 2) @@ -9,7 +10,8 @@ Other segment end (thread 2) Conflicting store by thread 1 at 0x........ size 1 at 0x........: main (tc16_byterace.c:34) -Allocation context: unknown +Location 0x........ is 0 bytes inside bytes[4], +a global variable declared at tc16_byterace.c:7 Other segment start (thread 2) (thread finished, call stack no longer available) Other segment end (thread 2) diff --git a/exp-drd/tests/tc20_verifywrap.stderr.exp b/exp-drd/tests/tc20_verifywrap.stderr.exp index 40b607d8f7..1ea635c29b 100644 --- a/exp-drd/tests/tc20_verifywrap.stderr.exp +++ b/exp-drd/tests/tc20_verifywrap.stderr.exp @@ -7,7 +7,8 @@ Conflicting store by thread 1 at 0x........ size 2 at 0x........: main (tc20_verifywrap.c:78) -Allocation context: unknown +Location 0x........ is 0 bytes inside global var "unprotected" +declared at tc20_verifywrap.c:27 Other segment start (thread 2) (thread finished, call stack no longer available) Other segment end (thread 2) diff --git a/exp-drd/tests/tc20_verifywrap2.stderr.exp b/exp-drd/tests/tc20_verifywrap2.stderr.exp index 4ac981c16f..f7fe3a5dfb 100644 --- a/exp-drd/tests/tc20_verifywrap2.stderr.exp +++ b/exp-drd/tests/tc20_verifywrap2.stderr.exp @@ -7,7 +7,8 @@ Conflicting store by thread 1 at 0x........ size 2 at 0x........: main (tc20_verifywrap.c:78) -Allocation context: unknown +Location 0x........ is 0 bytes inside global var "unprotected" +declared at tc20_verifywrap.c:27 Other segment start (thread 2) (thread finished, call stack no longer available) Other segment end (thread 2)