From: Bart Van Assche Date: Sat, 14 Feb 2009 16:10:53 +0000 (+0000) Subject: Introduced more DRD_ prefixes. X-Git-Tag: svn/VALGRIND_3_5_0~988 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=498c9afeb5c24813c2f01baa626a3fa6de056c38;p=thirdparty%2Fvalgrind.git Introduced more DRD_ prefixes. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9158 --- diff --git a/drd/drd_bitmap.c b/drd/drd_bitmap.c index 9e5d1bab24..928f221812 100644 --- a/drd/drd_bitmap.c +++ b/drd/drd_bitmap.c @@ -858,7 +858,7 @@ int bm_has_races(struct bitmap* const lhs, | ((bm1r->bm0_r[k] & bm0_mask(b)) ? RHS_R : 0) | ((bm1r->bm0_w[k] & bm0_mask(b)) ? RHS_W : 0); Addr const a = MAKE_ADDRESS(bm2l->addr, k * BITS_PER_UWORD | b); - if (HAS_RACE(access_mask) && ! drd_is_suppressed(a, a + 1)) + if (HAS_RACE(access_mask) && ! DRD_(is_suppressed)(a, a + 1)) { return 1; } diff --git a/drd/drd_clientobj.c b/drd/drd_clientobj.c index 768079aa28..074bc1634d 100644 --- a/drd/drd_clientobj.c +++ b/drd/drd_clientobj.c @@ -134,7 +134,7 @@ clientobj_add(const Addr a1, const ObjType t) p->any.first_observed_at = VG_(record_ExeContext)(VG_(get_running_tid)(), 0); VG_(OSetGen_Insert)(s_clientobj, p); tl_assert(VG_(OSetGen_Lookup)(s_clientobj, &a1) == p); - drd_start_suppression(a1, a1 + 1, "clientobj"); + DRD_(start_suppression)(a1, a1 + 1, "clientobj"); return p; } @@ -173,7 +173,7 @@ void clientobj_stop_using_mem(const Addr a1, const Addr a2) tl_assert(s_clientobj); - if (! drd_is_any_suppressed(a1, a2)) + if (! DRD_(is_any_suppressed)(a1, a2)) return; VG_(OSetGen_ResetIter)(s_clientobj); diff --git a/drd/drd_clientreq.c b/drd/drd_clientreq.c index 44c662e4e0..fef90c1a69 100644 --- a/drd/drd_clientreq.c +++ b/drd/drd_clientreq.c @@ -115,11 +115,11 @@ Bool DRD_(handle_client_request)(ThreadId vg_tid, UWord* arg, UWord* ret) break; case VG_USERREQ__DRD_START_SUPPRESSION: - drd_start_suppression(arg[1], arg[1] + arg[2], "client"); + DRD_(start_suppression)(arg[1], arg[1] + arg[2], "client"); break; case VG_USERREQ__DRD_FINISH_SUPPRESSION: - drd_finish_suppression(arg[1], arg[1] + arg[2]); + DRD_(finish_suppression)(arg[1], arg[1] + arg[2]); break; case VG_USERREQ__DRD_SUPPRESS_CURRENT_STACK: @@ -143,8 +143,8 @@ Bool DRD_(handle_client_request)(ThreadId vg_tid, UWord* arg, UWord* ret) } #endif thread_set_stack_startup(drd_tid, VG_(get_SP)(vg_tid)); - drd_start_suppression(topmost_sp, VG_(thread_get_stack_max)(vg_tid), - "stack top"); + DRD_(start_suppression)(topmost_sp, VG_(thread_get_stack_max)(vg_tid), + "stack top"); break; } @@ -153,11 +153,11 @@ Bool DRD_(handle_client_request)(ThreadId vg_tid, UWord* arg, UWord* ret) break; case VG_USERREQ__DRD_START_TRACE_ADDR: - drd_start_tracing_address_range(arg[1], arg[1] + arg[2]); + DRD_(start_tracing_address_range)(arg[1], arg[1] + arg[2]); break; case VG_USERREQ__DRD_STOP_TRACE_ADDR: - drd_stop_tracing_address_range(arg[1], arg[1] + arg[2]); + DRD_(stop_tracing_address_range)(arg[1], arg[1] + arg[2]); break; case VG_USERREQ__DRD_STOP_RECORDING: diff --git a/drd/drd_clientreq.h b/drd/drd_clientreq.h index e43d845c15..29cc75e1b7 100644 --- a/drd/drd_clientreq.h +++ b/drd/drd_clientreq.h @@ -22,6 +22,7 @@ The GNU General Public License is contained in the file COPYING. */ + /* * This header file contains the tool-internal interface for the code that * processes client requests. diff --git a/drd/drd_error.c b/drd/drd_error.c index c3eb745929..c06dea95e6 100644 --- a/drd/drd_error.c +++ b/drd/drd_error.c @@ -413,7 +413,7 @@ static void drd_tool_error_print_extra(Error* e) } } -void drd_register_error_handlers(void) +void DRD_(register_error_handlers)(void) { // Tool error reporting. VG_(needs_tool_errors)(drd_tool_error_eq, diff --git a/drd/drd_error.h b/drd/drd_error.h index b72b82ea5c..4035122940 100644 --- a/drd/drd_error.h +++ b/drd/drd_error.h @@ -148,7 +148,7 @@ typedef struct { void set_show_conflicting_segments(const Bool scs); -void drd_register_error_handlers(void); +void DRD_(register_error_handlers)(void); #endif /* __DRD_ERROR_H */ diff --git a/drd/drd_load_store.c b/drd/drd_load_store.c index 160b356f1f..d53bde64f6 100644 --- a/drd/drd_load_store.c +++ b/drd/drd_load_store.c @@ -67,10 +67,10 @@ void DRD_(set_check_stack_accesses)(const Bool c) s_drd_check_stack_accesses = c; } -void drd_trace_mem_access(const Addr addr, const SizeT size, +void DRD_(trace_mem_access)(const Addr addr, const SizeT size, const BmAccessTypeT access_type) { - if (drd_is_any_traced(addr, addr + size)) + if (DRD_(is_any_traced)(addr, addr + size)) { char vc[80]; vc_snprint(vc, sizeof(vc), thread_get_vc(thread_get_running_tid())); @@ -99,12 +99,12 @@ void drd_trace_mem_access(const Addr addr, const SizeT size, static VG_REGPARM(2) void drd_trace_mem_load(const Addr addr, const SizeT size) { - return drd_trace_mem_access(addr, size, eLoad); + return DRD_(trace_mem_access)(addr, size, eLoad); } static VG_REGPARM(2) void drd_trace_mem_store(const Addr addr,const SizeT size) { - return drd_trace_mem_access(addr, size, eStore); + return DRD_(trace_mem_access)(addr, size, eStore); } static void drd_report_race(const Addr addr, const SizeT size, @@ -134,7 +134,7 @@ VG_REGPARM(2) void drd_trace_load(Addr addr, SizeT size) if (running_thread_is_recording() && (s_drd_check_stack_accesses || ! thread_address_on_stack(addr)) && bm_access_load_triggers_conflict(addr, addr + size) - && ! drd_is_suppressed(addr, addr + size)) + && ! DRD_(is_suppressed)(addr, addr + size)) { drd_report_race(addr, size, eLoad); } @@ -145,7 +145,7 @@ static VG_REGPARM(1) void drd_trace_load_1(Addr addr) if (running_thread_is_recording() && (s_drd_check_stack_accesses || ! thread_address_on_stack(addr)) && bm_access_load_1_triggers_conflict(addr) - && ! drd_is_suppressed(addr, addr + 1)) + && ! DRD_(is_suppressed)(addr, addr + 1)) { drd_report_race(addr, 1, eLoad); } @@ -156,7 +156,7 @@ static VG_REGPARM(1) void drd_trace_load_2(Addr addr) if (running_thread_is_recording() && (s_drd_check_stack_accesses || ! thread_address_on_stack(addr)) && bm_access_load_2_triggers_conflict(addr) - && ! drd_is_suppressed(addr, addr + 2)) + && ! DRD_(is_suppressed)(addr, addr + 2)) { drd_report_race(addr, 2, eLoad); } @@ -167,7 +167,7 @@ static VG_REGPARM(1) void drd_trace_load_4(Addr addr) if (running_thread_is_recording() && (s_drd_check_stack_accesses || ! thread_address_on_stack(addr)) && bm_access_load_4_triggers_conflict(addr) - && ! drd_is_suppressed(addr, addr + 4)) + && ! DRD_(is_suppressed)(addr, addr + 4)) { drd_report_race(addr, 4, eLoad); } @@ -178,7 +178,7 @@ static VG_REGPARM(1) void drd_trace_load_8(Addr addr) if (running_thread_is_recording() && (s_drd_check_stack_accesses || ! thread_address_on_stack(addr)) && bm_access_load_8_triggers_conflict(addr) - && ! drd_is_suppressed(addr, addr + 8)) + && ! DRD_(is_suppressed)(addr, addr + 8)) { drd_report_race(addr, 8, eLoad); } @@ -195,7 +195,7 @@ VG_REGPARM(2) void drd_trace_store(Addr addr, SizeT size) if (running_thread_is_recording() && (s_drd_check_stack_accesses || ! thread_address_on_stack(addr)) && bm_access_store_triggers_conflict(addr, addr + size) - && ! drd_is_suppressed(addr, addr + size)) + && ! DRD_(is_suppressed)(addr, addr + size)) { drd_report_race(addr, size, eStore); } @@ -206,7 +206,7 @@ static VG_REGPARM(1) void drd_trace_store_1(Addr addr) if (running_thread_is_recording() && (s_drd_check_stack_accesses || ! thread_address_on_stack(addr)) && bm_access_store_1_triggers_conflict(addr) - && ! drd_is_suppressed(addr, addr + 1)) + && ! DRD_(is_suppressed)(addr, addr + 1)) { drd_report_race(addr, 1, eStore); } @@ -217,7 +217,7 @@ static VG_REGPARM(1) void drd_trace_store_2(Addr addr) if (running_thread_is_recording() && (s_drd_check_stack_accesses || ! thread_address_on_stack(addr)) && bm_access_store_2_triggers_conflict(addr) - && ! drd_is_suppressed(addr, addr + 2)) + && ! DRD_(is_suppressed)(addr, addr + 2)) { drd_report_race(addr, 2, eStore); } @@ -228,7 +228,7 @@ static VG_REGPARM(1) void drd_trace_store_4(Addr addr) if (running_thread_is_recording() && (s_drd_check_stack_accesses || ! thread_address_on_stack(addr)) && bm_access_store_4_triggers_conflict(addr) - && ! drd_is_suppressed(addr, addr + 4)) + && ! DRD_(is_suppressed)(addr, addr + 4)) { drd_report_race(addr, 4, eStore); } @@ -239,7 +239,7 @@ static VG_REGPARM(1) void drd_trace_store_8(Addr addr) if (running_thread_is_recording() && (s_drd_check_stack_accesses || ! thread_address_on_stack(addr)) && bm_access_store_8_triggers_conflict(addr) - && ! drd_is_suppressed(addr, addr + 8)) + && ! DRD_(is_suppressed)(addr, addr + 8)) { drd_report_race(addr, 8, eStore); } @@ -285,7 +285,7 @@ static void instrument_load(IRSB* const bb, IRExpr** argv; IRDirty* di; - if (UNLIKELY(drd_any_address_is_traced())) + if (UNLIKELY(DRD_(any_address_is_traced)())) { addStmtToIRSB(bb, IRStmt_Dirty( @@ -350,7 +350,7 @@ static void instrument_store(IRSB* const bb, IRExpr** argv; IRDirty* di; - if (UNLIKELY(drd_any_address_is_traced())) + if (UNLIKELY(DRD_(any_address_is_traced)())) { addStmtToIRSB(bb, IRStmt_Dirty( @@ -407,7 +407,7 @@ static void instrument_store(IRSB* const bb, addStmtToIRSB(bb, IRStmt_Dirty(di)); } -IRSB* drd_instrument(VgCallbackClosure* const closure, +IRSB* DRD_(instrument)(VgCallbackClosure* const closure, IRSB* const bb_in, VexGuestLayout* const layout, VexGuestExtents* const vge, diff --git a/drd/drd_load_store.h b/drd/drd_load_store.h index f820555839..9d74147d6a 100644 --- a/drd/drd_load_store.h +++ b/drd/drd_load_store.h @@ -37,14 +37,14 @@ Bool DRD_(get_check_stack_accesses)(void); void DRD_(set_check_stack_accesses)(const Bool c); -IRSB* drd_instrument(VgCallbackClosure* const closure, - IRSB* const bb_in, - VexGuestLayout* const layout, - VexGuestExtents* const vge, - IRType const gWordTy, - IRType const hWordTy); -void drd_trace_mem_access(const Addr addr, const SizeT size, - const BmAccessTypeT access_type); +IRSB* DRD_(instrument)(VgCallbackClosure* const closure, + IRSB* const bb_in, + VexGuestLayout* const layout, + VexGuestExtents* const vge, + IRType const gWordTy, + IRType const hWordTy); +void DRD_(trace_mem_access)(const Addr addr, const SizeT size, + const BmAccessTypeT access_type); VG_REGPARM(2) void drd_trace_load(Addr addr, SizeT size); VG_REGPARM(2) void drd_trace_store(Addr addr, SizeT size); diff --git a/drd/drd_main.c b/drd/drd_main.c index a051711f51..50b1d0371f 100644 --- a/drd/drd_main.c +++ b/drd/drd_main.c @@ -53,23 +53,17 @@ #include "pub_tool_tooliface.h" -// Function declarations. +/* Local variables. */ -static void drd_start_client_code(const ThreadId tid, const ULong bbs_done); +static Bool DRD_(s_print_stats) = False; +static Bool DRD_(s_var_info) = False; +static Bool DRD_(s_show_stack_usage) = False; -// Local variables. - -static Bool s_drd_print_stats = False; -static Bool s_drd_var_info = False; -static Bool s_show_stack_usage = False; - - -// -// Implement the needs_command_line_options for drd. -// - -static Bool drd_process_cmd_line_option(Char* arg) +/** + * Implement the needs_command_line_options for drd. + */ +static Bool DRD_(process_cmd_line_option)(Char* arg) { int check_stack_accesses = -1; int exclusive_threshold_ms = -1; @@ -90,11 +84,11 @@ static Bool drd_process_cmd_line_option(Char* arg) Char* trace_address = 0; VG_BOOL_CLO (arg, "--check-stack-var", check_stack_accesses) - else VG_BOOL_CLO(arg, "--drd-stats", s_drd_print_stats) + else VG_BOOL_CLO(arg, "--drd-stats", DRD_(s_print_stats)) else VG_BOOL_CLO(arg,"--report-signal-unlocked",s_drd_report_signal_unlocked) else VG_BOOL_CLO(arg, "--segment-merging", segment_merging) else VG_BOOL_CLO(arg, "--show-confl-seg", show_confl_seg) - else VG_BOOL_CLO(arg, "--show-stack-usage", s_show_stack_usage) + else VG_BOOL_CLO(arg, "--show-stack-usage", DRD_(s_show_stack_usage)) else VG_BOOL_CLO(arg, "--trace-barrier", trace_barrier) else VG_BOOL_CLO(arg, "--trace-clientobj", trace_clientobj) else VG_BOOL_CLO(arg, "--trace-cond", trace_cond) @@ -106,7 +100,7 @@ static Bool drd_process_cmd_line_option(Char* arg) else VG_BOOL_CLO(arg, "--trace-segment", trace_segment) else VG_BOOL_CLO(arg, "--trace-semaphore", trace_semaphore) else VG_BOOL_CLO(arg, "--trace-suppr", trace_suppression) - else VG_BOOL_CLO(arg, "--var-info", s_drd_var_info) + else VG_BOOL_CLO(arg, "--var-info", DRD_(s_var_info)) else VG_NUM_CLO (arg, "--exclusive-threshold", exclusive_threshold_ms) else VG_NUM_CLO (arg, "--shared-threshold", shared_threshold_ms) else VG_STR_CLO (arg, "--trace-addr", trace_address) @@ -131,7 +125,7 @@ static Bool drd_process_cmd_line_option(Char* arg) if (trace_address) { const Addr addr = VG_(strtoll16)(trace_address, 0); - drd_start_tracing_address_range(addr, addr + 1); + DRD_(start_tracing_address_range)(addr, addr + 1); } if (trace_barrier != -1) barrier_set_trace(trace_barrier); @@ -154,12 +148,12 @@ static Bool drd_process_cmd_line_option(Char* arg) if (trace_semaphore != -1) semaphore_set_trace(trace_semaphore); if (trace_suppression != -1) - suppression_set_trace(trace_suppression); + DRD_(suppression_set_trace)(trace_suppression); return True; } -static void drd_print_usage(void) +static void DRD_(print_usage)(void) { VG_(printf)( " --check-stack-var=yes|no Whether or not to report data races on\n" @@ -198,7 +192,7 @@ static void drd_print_usage(void) VG_(replacement_malloc_print_usage)(); } -static void drd_print_debug_usage(void) +static void DRD_(print_debug_usage)(void) { VG_(printf)( " --drd-stats=yes|no Print statistics about DRD activity [no].\n" @@ -268,9 +262,9 @@ void drd_start_using_mem(const Addr a1, const SizeT len) { tl_assert(a1 < a1 + len); - if (UNLIKELY(drd_any_address_is_traced())) + if (UNLIKELY(DRD_(any_address_is_traced)())) { - drd_trace_mem_access(a1, len, eStart); + DRD_(trace_mem_access)(a1, len, eStart); } } @@ -296,15 +290,15 @@ void drd_stop_using_mem(const Addr a1, const SizeT len, tl_assert(a1 < a2); - if (UNLIKELY(drd_any_address_is_traced())) + if (UNLIKELY(DRD_(any_address_is_traced)())) { - drd_trace_mem_access(a1, len, eEnd); + DRD_(trace_mem_access)(a1, len, eEnd); } if (! is_stack_mem || DRD_(get_check_stack_accesses)()) { thread_stop_using_mem(a1, a2); clientobj_stop_using_mem(a1, a2); - drd_suppression_stop_using_mem(a1, a2); + DRD_(suppression_stop_using_mem)(a1, a2); } } @@ -314,16 +308,17 @@ void drd_stop_using_nonstack_mem(const Addr a1, const SizeT len) drd_stop_using_mem(a1, len, False); } -/** Suppress data race reports on all addresses contained in .plt and - * .got.plt sections inside the address range [ a, a + len [. The data in - * these sections is modified by _dl_relocate_object() every time a function - * in a shared library is called for the first time. Since the first call - * to a function in a shared library can happen from a multithreaded context, - * such calls can cause conflicting accesses. See also Ulrich Drepper's - * paper "How to Write Shared Libraries" for more information about relocation - * (http://people.redhat.com/drepper/dsohowto.pdf). +/** + * Suppress data race reports on all addresses contained in .plt and + * .got.plt sections inside the address range [ a, a + len [. The data in + * these sections is modified by _dl_relocate_object() every time a function + * in a shared library is called for the first time. Since the first call + * to a function in a shared library can happen from a multithreaded context, + * such calls can cause conflicting accesses. See also Ulrich Drepper's + * paper "How to Write Shared Libraries" for more information about relocation + * (http://people.redhat.com/drepper/dsohowto.pdf). */ -static void suppress_relocation_conflicts(const Addr a, const SizeT len) +static void DRD_(suppress_relocation_conflicts)(const Addr a, const SizeT len) { const DebugInfo* di; @@ -345,7 +340,7 @@ static void suppress_relocation_conflicts(const Addr a, const SizeT len) VG_(printf)("Suppressing .plt @ 0x%lx size %ld\n", avma, size); #endif tl_assert(VG_(seginfo_sect_kind)(NULL, 0, avma) == Vg_SectPLT); - drd_start_suppression(avma, avma + size, ".plt"); + DRD_(start_suppression)(avma, avma + size, ".plt"); } avma = VG_(seginfo_get_gotplt_avma)(di); @@ -357,7 +352,7 @@ static void suppress_relocation_conflicts(const Addr a, const SizeT len) VG_(printf)("Suppressing .got.plt @ 0x%lx size %ld\n", avma, size); #endif tl_assert(VG_(seginfo_sect_kind)(NULL, 0, avma) == Vg_SectGOTPLT); - drd_start_suppression(avma, avma + size, ".gotplt"); + DRD_(start_suppression)(avma, avma + size, ".gotplt"); } } } @@ -371,7 +366,7 @@ void drd_start_using_mem_w_perms(const Addr a, const SizeT len, drd_start_using_mem(a, len); - suppress_relocation_conflicts(a, len); + DRD_(suppress_relocation_conflicts)(a, len); } /* Called by the core when the stack of a thread grows, to indicate that */ @@ -447,10 +442,10 @@ void drd_post_thread_create(const ThreadId vg_created) } if (! DRD_(get_check_stack_accesses)()) { - drd_start_suppression(thread_get_stack_max(drd_created) - - thread_get_stack_size(drd_created), - thread_get_stack_max(drd_created), - "stack"); + DRD_(start_suppression)(thread_get_stack_max(drd_created) + - thread_get_stack_size(drd_created), + thread_get_stack_max(drd_created), + "stack"); } } @@ -472,7 +467,7 @@ static void drd_thread_finished(ThreadId vg_tid) ? "" : " (which is a detached thread)"); } - if (s_show_stack_usage) + if (DRD_(s_show_stack_usage)) { const SizeT stack_size = thread_get_stack_size(drd_tid); const SizeT used_stack @@ -502,8 +497,7 @@ static void drd_thread_finished(ThreadId vg_tid) // Implementation of the tool interface. // -static -void drd_post_clo_init(void) +static void DRD_(post_clo_init)(void) { # if defined(VGP_x86_linux) || defined(VGP_amd64_linux) \ || defined(VGP_ppc32_linux) || defined(VGP_ppc64_linux) @@ -512,7 +506,7 @@ void drd_post_clo_init(void) VG_(printf)("\nWARNING: DRD has only been tested on Linux.\n\n"); # endif - if (s_drd_var_info) + if (DRD_(s_var_info)) { VG_(needs_var_info)(); } @@ -524,11 +518,10 @@ static void drd_start_client_code(const ThreadId tid, const ULong bbs_done) thread_set_vg_running_tid(tid); } -static -void drd_fini(Int exitcode) +static void DRD_(fini)(Int exitcode) { // thread_print_all(); - if (VG_(clo_verbosity) > 1 || s_drd_print_stats) + if (VG_(clo_verbosity) > 1 || DRD_(s_print_stats)) { ULong update_conflict_set_count; ULong dsnsc; @@ -585,17 +578,17 @@ void drd_pre_clo_init(void) " by Bart Van Assche."); VG_(details_bug_reports_to) (VG_BUGS_TO); - VG_(basic_tool_funcs) (drd_post_clo_init, - drd_instrument, - drd_fini); + VG_(basic_tool_funcs) (DRD_(post_clo_init), + DRD_(instrument), + DRD_(fini)); // Command line stuff. - VG_(needs_command_line_options)(drd_process_cmd_line_option, - drd_print_usage, - drd_print_debug_usage); + VG_(needs_command_line_options)(DRD_(process_cmd_line_option), + DRD_(print_usage), + DRD_(print_debug_usage)); // Error handling. - drd_register_error_handlers(); + DRD_(register_error_handlers)(); // Core event tracking. VG_(track_pre_mem_read) (drd_pre_mem_read); @@ -621,7 +614,7 @@ void drd_pre_clo_init(void) DRD_(clientreq_init)(); - drd_suppression_init(); + DRD_(suppression_init)(); clientobj_init(); } diff --git a/drd/drd_suppression.c b/drd/drd_suppression.c index a66eca0efc..6e7cc08920 100644 --- a/drd/drd_suppression.c +++ b/drd/drd_suppression.c @@ -31,31 +31,35 @@ #include "pub_tool_libcprint.h" // Vg_DebugMsg -// Local variables. +/* Global variables. */ -static struct bitmap* s_suppressed; -static Bool s_trace_suppression; -Bool g_any_address_traced = False; +Bool DRD_(g_any_address_traced) = False; -// Function definitions. +/* Local variables. */ -void suppression_set_trace(const Bool trace_suppression) +static struct bitmap* DRD_(s_suppressed); +static Bool DRD_(s_trace_suppression); + + +/* Function definitions. */ + +void DRD_(suppression_set_trace)(const Bool trace_suppression) { - s_trace_suppression = trace_suppression; + DRD_(s_trace_suppression) = trace_suppression; } -void drd_suppression_init(void) +void DRD_(suppression_init)(void) { - tl_assert(s_suppressed == 0); - s_suppressed = bm_new(); - tl_assert(s_suppressed); + tl_assert(DRD_(s_suppressed) == 0); + DRD_(s_suppressed) = bm_new(); + tl_assert(DRD_(s_suppressed)); } -void drd_start_suppression(const Addr a1, const Addr a2, - const char* const reason) +void DRD_(start_suppression)(const Addr a1, const Addr a2, + const char* const reason) { - if (s_trace_suppression) + if (DRD_(s_trace_suppression)) { VG_(message)(Vg_DebugMsg, "start suppression of 0x%lx sz %ld (%s)", a1, a2 - a1, reason); @@ -63,12 +67,12 @@ void drd_start_suppression(const Addr a1, const Addr a2, tl_assert(a1 < a2); // tl_assert(! drd_is_any_suppressed(a1, a2)); - bm_access_range_store(s_suppressed, a1, a2); + bm_access_range_store(DRD_(s_suppressed), a1, a2); } -void drd_finish_suppression(const Addr a1, const Addr a2) +void DRD_(finish_suppression)(const Addr a1, const Addr a2) { - if (s_trace_suppression) + if (DRD_(s_trace_suppression)) { VG_(message)(Vg_DebugMsg, "finish suppression of 0x%lx sz %ld", a1, a2 - a1); @@ -76,13 +80,13 @@ void drd_finish_suppression(const Addr a1, const Addr a2) } tl_assert(a1 < a2); - if (! drd_is_suppressed(a1, a2)) + if (! DRD_(is_suppressed)(a1, a2)) { VG_(message)(Vg_DebugMsg, "?? [0x%lx,0x%lx[ not suppressed ??", a1, a2); VG_(get_and_pp_StackTrace)(VG_(get_running_tid)(), 12); tl_assert(False); } - bm_clear_store(s_suppressed, a1, a2); + bm_clear_store(DRD_(s_suppressed), a1, a2); } /** @@ -90,9 +94,9 @@ void drd_finish_suppression(const Addr a1, const Addr a2) * bytes in the range a1 .. a2 - 1 inclusive. Return false in case the range * is only partially suppressed or not suppressed at all. */ -Bool drd_is_suppressed(const Addr a1, const Addr a2) +Bool DRD_(is_suppressed)(const Addr a1, const Addr a2) { - return bm_has(s_suppressed, a1, a2, eStore); + return bm_has(DRD_(s_suppressed), a1, a2, eStore); } /** @@ -100,46 +104,47 @@ Bool drd_is_suppressed(const Addr a1, const Addr a2) * of the bytes in the range a1 .. a2 - 1 inclusive. Return false in case none * of the bytes in the specified range is suppressed. */ -Bool drd_is_any_suppressed(const Addr a1, const Addr a2) +Bool DRD_(is_any_suppressed)(const Addr a1, const Addr a2) { - return bm_has_any_store(s_suppressed, a1, a2); + return bm_has_any_store(DRD_(s_suppressed), a1, a2); } -void drd_start_tracing_address_range(const Addr a1, const Addr a2) +void DRD_(start_tracing_address_range)(const Addr a1, const Addr a2) { tl_assert(a1 < a2); - bm_access_range_load(s_suppressed, a1, a2); - if (! g_any_address_traced) + bm_access_range_load(DRD_(s_suppressed), a1, a2); + if (! DRD_(g_any_address_traced)) { - g_any_address_traced = True; + DRD_(g_any_address_traced) = True; } } -void drd_stop_tracing_address_range(const Addr a1, const Addr a2) +void DRD_(stop_tracing_address_range)(const Addr a1, const Addr a2) { tl_assert(a1 < a2); - bm_clear_load(s_suppressed, a1, a2); - if (g_any_address_traced) + bm_clear_load(DRD_(s_suppressed), a1, a2); + if (DRD_(g_any_address_traced)) { - g_any_address_traced = bm_has_any_load(s_suppressed, 0, ~(Addr)0); + DRD_(g_any_address_traced) + = bm_has_any_load(DRD_(s_suppressed), 0, ~(Addr)0); } } -Bool drd_is_any_traced(const Addr a1, const Addr a2) +Bool DRD_(is_any_traced)(const Addr a1, const Addr a2) { - return bm_has_any_load(s_suppressed, a1, a2); + return bm_has_any_load(DRD_(s_suppressed), a1, a2); } -void drd_suppression_stop_using_mem(const Addr a1, const Addr a2) +void DRD_(suppression_stop_using_mem)(const Addr a1, const Addr a2) { - if (s_trace_suppression) + if (DRD_(s_trace_suppression)) { Addr b; for (b = a1; b < a2; b++) { - if (bm_has_1(s_suppressed, b, eStore)) + if (bm_has_1(DRD_(s_suppressed), b, eStore)) { VG_(message)(Vg_DebugMsg, "stop_using_mem(0x%lx, %ld) finish suppression of 0x%lx", @@ -149,5 +154,5 @@ void drd_suppression_stop_using_mem(const Addr a1, const Addr a2) } tl_assert(a1); tl_assert(a1 < a2); - bm_clear(s_suppressed, a1, a2); + bm_clear(DRD_(s_suppressed), a1, a2); } diff --git a/drd/drd_suppression.h b/drd/drd_suppression.h index cfe4a01a52..94848221cc 100644 --- a/drd/drd_suppression.h +++ b/drd/drd_suppression.h @@ -2,28 +2,29 @@ #define __PUB_CORE_DRD_H +#include "drd_basics.h" #include "pub_tool_basics.h" -extern Bool g_any_address_traced; +extern Bool DRD_(g_any_address_traced); -void suppression_set_trace(const Bool trace_suppression); -void drd_suppression_init(void); -void drd_start_suppression(const Addr a1, const Addr a2, +void DRD_(suppression_set_trace)(const Bool trace_suppression); +void DRD_(suppression_init)(void); +void DRD_(start_suppression)(const Addr a1, const Addr a2, const char* const reason); -void drd_finish_suppression(const Addr a1, const Addr a2); -Bool drd_is_suppressed(const Addr a1, const Addr a2); -Bool drd_is_any_suppressed(const Addr a1, const Addr a2); -void drd_start_tracing_address_range(const Addr a1, const Addr a2); -void drd_stop_tracing_address_range(const Addr a1, const Addr a2); -Bool drd_is_any_traced(const Addr a1, const Addr a2); -void drd_suppression_stop_using_mem(const Addr a1, const Addr a2); +void DRD_(finish_suppression)(const Addr a1, const Addr a2); +Bool DRD_(is_suppressed)(const Addr a1, const Addr a2); +Bool DRD_(is_any_suppressed)(const Addr a1, const Addr a2); +void DRD_(start_tracing_address_range)(const Addr a1, const Addr a2); +void DRD_(stop_tracing_address_range)(const Addr a1, const Addr a2); +Bool DRD_(is_any_traced)(const Addr a1, const Addr a2); +void DRD_(suppression_stop_using_mem)(const Addr a1, const Addr a2); -static __inline__ Bool drd_any_address_is_traced(void) +static __inline__ Bool DRD_(any_address_is_traced)(void) { - return g_any_address_traced; + return DRD_(g_any_address_traced); } diff --git a/drd/drd_thread.c b/drd/drd_thread.c index 8ca0547506..42f2144205 100644 --- a/drd/drd_thread.c +++ b/drd/drd_thread.c @@ -266,9 +266,9 @@ void DRD_(thread_post_join)(DrdThreadId drd_joiner, DrdThreadId drd_joinee) if (! DRD_(get_check_stack_accesses)()) { - drd_finish_suppression(thread_get_stack_max(drd_joinee) - - thread_get_stack_size(drd_joinee), - thread_get_stack_max(drd_joinee)); + DRD_(finish_suppression)(thread_get_stack_max(drd_joinee) + - thread_get_stack_size(drd_joinee), + thread_get_stack_max(drd_joinee)); } thread_delete(drd_joinee); mutex_thread_delete(drd_joinee); diff --git a/drd/tests/drd_bitmap_test.c b/drd/tests/drd_bitmap_test.c index f653f423a0..ea12300b97 100644 --- a/drd/tests/drd_bitmap_test.c +++ b/drd/tests/drd_bitmap_test.c @@ -39,7 +39,7 @@ UInt VG_(printf)(const HChar *format, ...) { UInt ret; va_list vargs; va_start(vargs, format); ret = vprintf(format, vargs); va_end(vargs); return ret; } UInt VG_(message)(VgMsgKind kind, const HChar* format, ...) { UInt ret; va_list vargs; va_start(vargs, format); ret = vprintf(format, vargs); va_end(vargs); printf("\n"); return ret; } -Bool drd_is_suppressed(const Addr a1, const Addr a2) +Bool DRD_(is_suppressed)(const Addr a1, const Addr a2) { assert(0); }