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], False);
break;
case VG_USERREQ__DRD_STOP_TRACE_ADDR:
int trace_semaphore = -1;
int trace_suppression = -1;
Char* trace_address = 0;
+ Char* ptrace_address = 0;
if VG_BOOL_CLO(arg, "--check-stack-var", check_stack_accesses) {}
else if VG_INT_CLO (arg, "--join-list-vol", join_list_vol) {}
else if VG_BOOL_CLO(arg, "--trace-suppr", trace_suppression) {}
else if VG_BOOL_CLO(arg, "--var-info", s_var_info) {}
else if VG_INT_CLO (arg, "--exclusive-threshold", exclusive_threshold_ms) {}
+ else if VG_STR_CLO (arg, "--ptrace-addr", ptrace_address) {}
else if VG_INT_CLO (arg, "--shared-threshold", shared_threshold_ms) {}
else if VG_STR_CLO (arg, "--trace-addr", trace_address) {}
else
DRD_(thread_set_segment_merge_interval)(segment_merge_interval);
if (show_confl_seg != -1)
DRD_(set_show_conflicting_segments)(show_confl_seg);
- if (trace_address)
- {
+ 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, False);
+ }
+ if (ptrace_address) {
+ const Addr addr = VG_(strtoll16)(ptrace_address, 0);
+ DRD_(start_tracing_address_range)(addr, addr + 1, True);
}
if (trace_barrier != -1)
DRD_(barrier_set_trace)(trace_barrier);
" --show-stack-usage=yes|no Print stack usage at thread exit time [no].\n"
"\n"
" drd options for monitoring process behavior:\n"
+" --ptrace-addr=<address> Trace all load and store activity for the\n"
+" specified address and keep doing that even after\n"
+" the memory at that address has been freed and\n"
+" reallocated [off].\n"
" --trace-addr=<address> Trace all load and store activity for the\n"
" specified address [off].\n"
" --trace-alloc=yes|no Trace all memory allocations and deallocations\n"" [no].\n"
return DRD_(bm_has_any_access)(s_suppressed, a1, a2);
}
-void DRD_(start_tracing_address_range)(const Addr a1, const Addr a2)
+/**
+ * Start tracing memory accesses in the range [a1,a2). If persistent == True,
+ * keep tracing even after memory deallocation and reallocation.
+ */
+void DRD_(start_tracing_address_range)(const Addr a1, const Addr a2,
+ const Bool persistent)
{
tl_assert(a1 <= a2);
+ if (s_trace_suppression)
+ VG_(message)(Vg_DebugMsg, "start_tracing(0x%lx, %ld) %s\n",
+ a1, a2 - a1, persistent ? "persistent" : "non-persistent");
+
DRD_(bm_access_range_load)(s_traced, a1, a2);
- if (!DRD_(g_any_address_traced))
+ if (persistent)
+ DRD_(bm_access_range_store)(s_traced, a1, a2);
+ if (!DRD_(g_any_address_traced) && a1 < a2)
DRD_(g_any_address_traced) = True;
}
+/**
+ * Stop tracing memory accesses in the range [a1,a2).
+ */
void DRD_(stop_tracing_address_range)(const Addr a1, const Addr a2)
{
tl_assert(a1 <= a2);
- DRD_(bm_clear_load)(s_traced, a1, a2);
- if (DRD_(g_any_address_traced))
- DRD_(g_any_address_traced)
- = DRD_(bm_has_any_load_g)(s_traced);
+ if (s_trace_suppression)
+ VG_(message)(Vg_DebugMsg, "stop_tracing(0x%lx, %ld)\n",
+ a1, a2 - a1);
+
+ if (DRD_(g_any_address_traced)) {
+ DRD_(bm_clear)(s_traced, a1, a2);
+ DRD_(g_any_address_traced) = DRD_(bm_has_any_load_g)(s_traced);
+ }
}
Bool DRD_(is_any_traced)(const Addr a1, const Addr a2)
{
- return DRD_(bm_has_any_load)(s_traced, a1, a2);
+ return DRD_(bm_has_any_access)(s_traced, a1, a2);
}
+/**
+ * Stop using the memory range [a1,a2). Stop tracing memory accesses to
+ * non-persistent address ranges.
+ */
void DRD_(suppression_stop_using_mem)(const Addr a1, const Addr a2)
{
if (s_trace_suppression) {
tl_assert(a1);
tl_assert(a1 <= a2);
DRD_(bm_clear)(s_suppressed, a1, a2);
- DRD_(bm_clear)(s_traced, a1, a2);
+ DRD_(bm_clear_load)(s_traced, a1, a2);
}
Bool DRD_(is_any_suppressed)(const Addr a1, const Addr a2);
void DRD_(mark_hbvar)(const Addr a1);
Bool DRD_(range_contains_suppression_or_hbvar)(const Addr a1, const Addr 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,
+ const Bool persistent);
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);