mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-03 18:13:01 +00:00
DRD, refactoring: Introduce DRD_(trace_msg)()
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12120
This commit is contained in:
parent
2eac6e7c8f
commit
9d1823dac9
@ -258,26 +258,16 @@ void DRD_(barrier_init)(const Addr barrier,
|
||||
|
||||
p = DRD_(barrier_get_or_allocate)(barrier, barrier_type, count);
|
||||
|
||||
if (s_trace_barrier)
|
||||
{
|
||||
if (s_trace_barrier) {
|
||||
if (reinitialization)
|
||||
{
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"[%d] barrier_reinit %s 0x%lx count %ld -> %ld\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
barrier_get_typename(p),
|
||||
barrier,
|
||||
p->count,
|
||||
count);
|
||||
}
|
||||
DRD_(trace_msg)("[%d] barrier_reinit %s 0x%lx count %ld -> %ld\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
barrier_get_typename(p), barrier, p->count, count);
|
||||
else
|
||||
{
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"[%d] barrier_init %s 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
barrier_get_typename(p),
|
||||
barrier);
|
||||
}
|
||||
DRD_(trace_msg)("[%d] barrier_init %s 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
barrier_get_typename(p),
|
||||
barrier);
|
||||
}
|
||||
|
||||
if (reinitialization && p->count != count)
|
||||
@ -304,13 +294,9 @@ void DRD_(barrier_destroy)(const Addr barrier, const BarrierT barrier_type)
|
||||
p = DRD_(barrier_get)(barrier);
|
||||
|
||||
if (s_trace_barrier)
|
||||
{
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"[%d] barrier_destroy %s 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
barrier_get_typename(p),
|
||||
barrier);
|
||||
}
|
||||
DRD_(trace_msg)("[%d] barrier_destroy %s 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
barrier_get_typename(p), barrier);
|
||||
|
||||
if (p == 0)
|
||||
{
|
||||
@ -367,14 +353,9 @@ void DRD_(barrier_pre_wait)(const DrdThreadId tid, const Addr barrier,
|
||||
tl_assert(p);
|
||||
|
||||
if (s_trace_barrier)
|
||||
{
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"[%d] barrier_pre_wait %s 0x%lx iteration %ld\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
barrier_get_typename(p),
|
||||
barrier,
|
||||
p->pre_iteration);
|
||||
}
|
||||
DRD_(trace_msg)("[%d] barrier_pre_wait %s 0x%lx iteration %ld\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
barrier_get_typename(p), barrier, p->pre_iteration);
|
||||
|
||||
/* Clean up nodes associated with finished threads. */
|
||||
oset = p->oset[p->pre_iteration & 1];
|
||||
@ -433,15 +414,10 @@ void DRD_(barrier_post_wait)(const DrdThreadId tid, const Addr barrier,
|
||||
p = DRD_(barrier_get)(barrier);
|
||||
|
||||
if (s_trace_barrier)
|
||||
{
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"[%d] barrier_post_wait %s 0x%lx iteration %ld%s\n",
|
||||
tid,
|
||||
p ? barrier_get_typename(p) : "(?)",
|
||||
barrier,
|
||||
p ? p->post_iteration : -1,
|
||||
serializing ? " (serializing)" : "");
|
||||
}
|
||||
DRD_(trace_msg)("[%d] barrier_post_wait %s 0x%lx iteration %ld%s\n",
|
||||
tid, p ? barrier_get_typename(p) : "(?)",
|
||||
barrier, p ? p->post_iteration : -1,
|
||||
serializing ? " (serializing)" : "");
|
||||
|
||||
/*
|
||||
* If p == 0, this means that the barrier has been destroyed after
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
|
||||
|
||||
#include "drd_clientobj.h"
|
||||
#include "drd_error.h"
|
||||
#include "drd_suppression.h"
|
||||
#include "pub_tool_basics.h"
|
||||
#include "pub_tool_libcassert.h"
|
||||
@ -133,9 +134,7 @@ DrdClientobj* DRD_(clientobj_add)(const Addr a1, const ObjType t)
|
||||
tl_assert(VG_(OSetGen_Lookup)(s_clientobj_set, &a1) == 0);
|
||||
|
||||
if (s_trace_clientobj)
|
||||
{
|
||||
VG_(message)(Vg_UserMsg, "Adding client object 0x%lx of type %d\n", a1, t);
|
||||
}
|
||||
DRD_(trace_msg)("Adding client object 0x%lx of type %d\n", a1, t);
|
||||
|
||||
p = VG_(OSetGen_AllocNode)(s_clientobj_set, sizeof(*p));
|
||||
VG_(memset)(p, 0, sizeof(*p));
|
||||
@ -180,10 +179,9 @@ static Bool clientobj_remove_obj(DrdClientobj* const p)
|
||||
{
|
||||
tl_assert(p);
|
||||
|
||||
if (s_trace_clientobj)
|
||||
{
|
||||
VG_(message)(Vg_UserMsg, "Removing client object 0x%lx of type %d\n",
|
||||
p->any.a1, p->any.type);
|
||||
if (s_trace_clientobj) {
|
||||
DRD_(trace_msg)("Removing client object 0x%lx of type %d\n", p->any.a1,
|
||||
p->any.type);
|
||||
#if 0
|
||||
VG_(get_and_pp_StackTrace)(VG_(get_running_tid)(),
|
||||
VG_(clo_backtrace_size));
|
||||
|
||||
@ -148,12 +148,8 @@ void DRD_(cond_pre_init)(const Addr cond)
|
||||
struct cond_info* p;
|
||||
|
||||
if (DRD_(s_trace_cond))
|
||||
{
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"[%d] cond_init cond 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
cond);
|
||||
}
|
||||
DRD_(trace_msg)("[%d] cond_init cond 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(), cond);
|
||||
|
||||
p = DRD_(cond_get)(cond);
|
||||
|
||||
@ -176,12 +172,8 @@ void DRD_(cond_post_destroy)(const Addr cond)
|
||||
struct cond_info* p;
|
||||
|
||||
if (DRD_(s_trace_cond))
|
||||
{
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"[%d] cond_destroy cond 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
cond);
|
||||
}
|
||||
DRD_(trace_msg)("[%d] cond_destroy cond 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(), cond);
|
||||
|
||||
p = DRD_(cond_get)(cond);
|
||||
if (p == 0)
|
||||
@ -219,12 +211,8 @@ void DRD_(cond_pre_wait)(const Addr cond, const Addr mutex)
|
||||
struct mutex_info* q;
|
||||
|
||||
if (DRD_(s_trace_cond))
|
||||
{
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"[%d] cond_pre_wait cond 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
cond);
|
||||
}
|
||||
DRD_(trace_msg)("[%d] cond_pre_wait cond 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(), cond);
|
||||
|
||||
p = cond_get_or_allocate(cond);
|
||||
if (!p)
|
||||
@ -284,12 +272,8 @@ void DRD_(cond_post_wait)(const Addr cond)
|
||||
struct cond_info* p;
|
||||
|
||||
if (DRD_(s_trace_cond))
|
||||
{
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"[%d] cond_post_wait cond 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
cond);
|
||||
}
|
||||
DRD_(trace_msg)("[%d] cond_post_wait cond 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(), cond);
|
||||
|
||||
p = DRD_(cond_get)(cond);
|
||||
if (!p)
|
||||
@ -369,12 +353,8 @@ void DRD_(cond_pre_signal)(Addr const cond)
|
||||
|
||||
p = DRD_(cond_get)(cond);
|
||||
if (DRD_(s_trace_cond))
|
||||
{
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"[%d] cond_signal cond 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
cond);
|
||||
}
|
||||
DRD_(trace_msg)("[%d] cond_signal cond 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(), cond);
|
||||
|
||||
tl_assert(DRD_(pthread_cond_initializer));
|
||||
if (!p && VG_(memcmp)((void*)cond, (void*)DRD_(pthread_cond_initializer),
|
||||
@ -396,12 +376,8 @@ void DRD_(cond_pre_broadcast)(Addr const cond)
|
||||
struct cond_info* p;
|
||||
|
||||
if (DRD_(s_trace_cond))
|
||||
{
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"[%d] cond_broadcast cond 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
cond);
|
||||
}
|
||||
DRD_(trace_msg)("[%d] cond_broadcast cond 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(), cond);
|
||||
|
||||
p = DRD_(cond_get)(cond);
|
||||
tl_assert(DRD_(pthread_cond_initializer));
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
#include "pub_tool_libcprint.h" /* VG_(printf)() */
|
||||
#include "pub_tool_machine.h"
|
||||
#include "pub_tool_mallocfree.h" /* VG_(malloc), VG_(free) */
|
||||
#include "pub_tool_options.h" /* VG_(clo_xml) */
|
||||
#include "pub_tool_threadstate.h" /* VG_(get_pthread_id)() */
|
||||
#include "pub_tool_tooliface.h" /* VG_(needs_tool_errors)() */
|
||||
|
||||
@ -51,6 +52,14 @@ void DRD_(set_show_conflicting_segments)(const Bool scs)
|
||||
s_show_conflicting_segments = scs;
|
||||
}
|
||||
|
||||
void DRD_(trace_msg)(const char* format, ...)
|
||||
{
|
||||
va_list vargs;
|
||||
va_start(vargs, format);
|
||||
VG_(vmessage)(Vg_UserMsg, format, vargs);
|
||||
va_end(vargs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Describe the client address a as good as possible, putting the result in ai.
|
||||
*/
|
||||
|
||||
@ -180,6 +180,7 @@ typedef struct {
|
||||
|
||||
void DRD_(set_show_conflicting_segments)(const Bool scs);
|
||||
void DRD_(register_error_handlers)(void);
|
||||
void DRD_(trace_msg)(const char* format, ...) PRINTF_CHECK(1, 2);
|
||||
|
||||
|
||||
#endif /* __DRD_ERROR_H */
|
||||
|
||||
20
drd/drd_hb.c
20
drd/drd_hb.c
@ -165,12 +165,8 @@ void DRD_(hb_happens_before)(const DrdThreadId tid, Addr const hb)
|
||||
|
||||
p = DRD_(hb_get_or_allocate)(hb);
|
||||
if (DRD_(s_trace_hb))
|
||||
{
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"[%d] happens_before 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
hb);
|
||||
}
|
||||
DRD_(trace_msg)("[%d] happens_before 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(), hb);
|
||||
|
||||
if (!p)
|
||||
return;
|
||||
@ -203,10 +199,8 @@ void DRD_(hb_happens_after)(const DrdThreadId tid, const Addr hb)
|
||||
p = DRD_(hb_get_or_allocate)(hb);
|
||||
|
||||
if (DRD_(s_trace_hb))
|
||||
{
|
||||
VG_(message)(Vg_UserMsg, "[%d] happens_after 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(), hb);
|
||||
}
|
||||
DRD_(trace_msg)("[%d] happens_after 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(), hb);
|
||||
|
||||
if (!p)
|
||||
return;
|
||||
@ -237,10 +231,8 @@ void DRD_(hb_happens_done)(const DrdThreadId tid, const Addr hb)
|
||||
struct hb_info* p;
|
||||
|
||||
if (DRD_(s_trace_hb))
|
||||
{
|
||||
VG_(message)(Vg_UserMsg, "[%d] happens_done 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(), hb);
|
||||
}
|
||||
DRD_(trace_msg)("[%d] happens_done 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(), hb);
|
||||
|
||||
p = DRD_(hb_get)(hb);
|
||||
if (!p)
|
||||
|
||||
@ -93,21 +93,12 @@ void DRD_(trace_mem_access)(const Addr addr, const SizeT size,
|
||||
char* vc;
|
||||
|
||||
vc = DRD_(vc_aprint)(DRD_(thread_get_vc)(DRD_(thread_get_running_tid)()));
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"%s 0x%lx size %ld (thread %d / vc %s)\n",
|
||||
access_type == eLoad
|
||||
? "load "
|
||||
: access_type == eStore
|
||||
? "store"
|
||||
: access_type == eStart
|
||||
? "start"
|
||||
: access_type == eEnd
|
||||
? "end "
|
||||
: "????",
|
||||
addr,
|
||||
size,
|
||||
DRD_(thread_get_running_tid)(),
|
||||
vc);
|
||||
DRD_(trace_msg)("%s 0x%lx size %ld (thread %d / vc %s)\n",
|
||||
access_type == eLoad ? "load "
|
||||
: access_type == eStore ? "store"
|
||||
: access_type == eStart ? "start"
|
||||
: access_type == eEnd ? "end " : "????",
|
||||
addr, size, DRD_(thread_get_running_tid)(), vc);
|
||||
VG_(free)(vc);
|
||||
VG_(get_and_pp_StackTrace)(VG_(get_running_tid)(),
|
||||
VG_(clo_backtrace_size));
|
||||
|
||||
@ -311,9 +311,9 @@ void drd_start_using_mem(const Addr a1, const SizeT len,
|
||||
tl_assert(a1 <= a2);
|
||||
|
||||
if (!is_stack_mem && s_trace_alloc)
|
||||
VG_(message)(Vg_UserMsg, "Started using memory range 0x%lx + %ld%s\n",
|
||||
a1, len, DRD_(running_thread_inside_pthread_create)()
|
||||
? " (inside pthread_create())" : "");
|
||||
DRD_(trace_msg)("Started using memory range 0x%lx + %ld%s\n",
|
||||
a1, len, DRD_(running_thread_inside_pthread_create)()
|
||||
? " (inside pthread_create())" : "");
|
||||
|
||||
if (!is_stack_mem && DRD_(g_free_is_write))
|
||||
DRD_(thread_stop_using_mem)(a1, a2);
|
||||
@ -355,8 +355,8 @@ void drd_stop_using_mem(const Addr a1, const SizeT len,
|
||||
DRD_(trace_mem_access)(a1, len, eEnd);
|
||||
|
||||
if (!is_stack_mem && s_trace_alloc)
|
||||
VG_(message)(Vg_UserMsg, "Stopped using memory range 0x%lx + %ld\n",
|
||||
a1, len);
|
||||
DRD_(trace_msg)("Stopped using memory range 0x%lx + %ld\n",
|
||||
a1, len);
|
||||
|
||||
if (!is_stack_mem || DRD_(get_check_stack_accesses)())
|
||||
{
|
||||
|
||||
@ -89,15 +89,11 @@ static void mutex_cleanup(struct mutex_info* p)
|
||||
tl_assert(p);
|
||||
|
||||
if (s_trace_mutex)
|
||||
{
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"[%d] mutex_destroy %s 0x%lx rc %d owner %d\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
DRD_(mutex_get_typename)(p),
|
||||
p->a1,
|
||||
p ? p->recursion_count : -1,
|
||||
p ? p->owner : DRD_INVALID_THREADID);
|
||||
}
|
||||
DRD_(trace_msg)("[%d] mutex_destroy %s 0x%lx rc %d owner %d\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
DRD_(mutex_get_typename)(p), p->a1,
|
||||
p ? p->recursion_count : -1,
|
||||
p ? p->owner : DRD_INVALID_THREADID);
|
||||
|
||||
if (mutex_is_locked(p))
|
||||
{
|
||||
@ -184,13 +180,10 @@ DRD_(mutex_init)(const Addr mutex, const MutexT mutex_type)
|
||||
struct mutex_info* p;
|
||||
|
||||
if (s_trace_mutex)
|
||||
{
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"[%d] mutex_init %s 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
DRD_(mutex_type_name)(mutex_type),
|
||||
mutex);
|
||||
}
|
||||
DRD_(trace_msg)("[%d] mutex_init %s 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
DRD_(mutex_type_name)(mutex_type),
|
||||
mutex);
|
||||
|
||||
if (mutex_type == mutex_type_invalid_mutex)
|
||||
{
|
||||
@ -248,16 +241,12 @@ void DRD_(mutex_pre_lock)(const Addr mutex, MutexT mutex_type,
|
||||
mutex_type = p->mutex_type;
|
||||
|
||||
if (s_trace_mutex)
|
||||
{
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"[%d] %s %s 0x%lx rc %d owner %d\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
trylock ? "pre_mutex_lock " : "mutex_trylock ",
|
||||
p ? DRD_(mutex_get_typename)(p) : "(?)",
|
||||
mutex,
|
||||
p ? p->recursion_count : -1,
|
||||
p ? p->owner : DRD_INVALID_THREADID);
|
||||
}
|
||||
DRD_(trace_msg)("[%d] %s %s 0x%lx rc %d owner %d\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
trylock ? "pre_mutex_lock " : "mutex_trylock ",
|
||||
p ? DRD_(mutex_get_typename)(p) : "(?)",
|
||||
mutex, p ? p->recursion_count : -1,
|
||||
p ? p->owner : DRD_INVALID_THREADID);
|
||||
|
||||
if (p == 0)
|
||||
{
|
||||
@ -302,17 +291,13 @@ void DRD_(mutex_post_lock)(const Addr mutex, const Bool took_lock,
|
||||
p = DRD_(mutex_get)(mutex);
|
||||
|
||||
if (s_trace_mutex)
|
||||
{
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"[%d] %s %s 0x%lx rc %d owner %d%s\n",
|
||||
drd_tid,
|
||||
post_cond_wait ? "cond_post_wait " : "post_mutex_lock",
|
||||
p ? DRD_(mutex_get_typename)(p) : "(?)",
|
||||
mutex,
|
||||
p ? p->recursion_count : 0,
|
||||
p ? p->owner : VG_INVALID_THREADID,
|
||||
took_lock ? "" : " (locking failed)");
|
||||
}
|
||||
DRD_(trace_msg)("[%d] %s %s 0x%lx rc %d owner %d%s\n",
|
||||
drd_tid,
|
||||
post_cond_wait ? "cond_post_wait " : "post_mutex_lock",
|
||||
p ? DRD_(mutex_get_typename)(p) : "(?)",
|
||||
mutex, p ? p->recursion_count : 0,
|
||||
p ? p->owner : VG_INVALID_THREADID,
|
||||
took_lock ? "" : " (locking failed)");
|
||||
|
||||
if (! p || ! took_lock)
|
||||
return;
|
||||
@ -369,14 +354,10 @@ void DRD_(mutex_unlock)(const Addr mutex, MutexT mutex_type)
|
||||
if (p && mutex_type == mutex_type_unknown)
|
||||
mutex_type = p->mutex_type;
|
||||
|
||||
if (s_trace_mutex)
|
||||
{
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"[%d] mutex_unlock %s 0x%lx rc %d\n",
|
||||
drd_tid,
|
||||
p ? DRD_(mutex_get_typename)(p) : "(?)",
|
||||
mutex,
|
||||
p ? p->recursion_count : 0);
|
||||
if (s_trace_mutex) {
|
||||
DRD_(trace_msg)("[%d] mutex_unlock %s 0x%lx rc %d\n",
|
||||
drd_tid, p ? DRD_(mutex_get_typename)(p) : "(?)",
|
||||
mutex, p ? p->recursion_count : 0);
|
||||
}
|
||||
|
||||
if (p == 0 || mutex_type == mutex_type_invalid_mutex)
|
||||
|
||||
@ -251,12 +251,8 @@ static void rwlock_cleanup(struct rwlock_info* p)
|
||||
tl_assert(p);
|
||||
|
||||
if (DRD_(s_trace_rwlock))
|
||||
{
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"[%d] rwlock_destroy 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
p->a1);
|
||||
}
|
||||
DRD_(trace_msg)("[%d] rwlock_destroy 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(), p->a1);
|
||||
|
||||
if (DRD_(rwlock_is_locked)(p))
|
||||
{
|
||||
@ -324,12 +320,8 @@ struct rwlock_info* DRD_(rwlock_pre_init)(const Addr rwlock,
|
||||
struct rwlock_info* p;
|
||||
|
||||
if (DRD_(s_trace_rwlock))
|
||||
{
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"[%d] rwlock_init 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
rwlock);
|
||||
}
|
||||
DRD_(trace_msg)("[%d] rwlock_init 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(), rwlock);
|
||||
|
||||
p = DRD_(rwlock_get)(rwlock);
|
||||
|
||||
@ -389,12 +381,8 @@ void DRD_(rwlock_pre_rdlock)(const Addr rwlock, const RwLockT rwlock_type)
|
||||
struct rwlock_info* p;
|
||||
|
||||
if (DRD_(s_trace_rwlock))
|
||||
{
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"[%d] pre_rwlock_rdlock 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
rwlock);
|
||||
}
|
||||
DRD_(trace_msg)("[%d] pre_rwlock_rdlock 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(), rwlock);
|
||||
|
||||
p = DRD_(rwlock_get_or_allocate)(rwlock, rwlock_type);
|
||||
tl_assert(p);
|
||||
@ -421,12 +409,7 @@ void DRD_(rwlock_post_rdlock)(const Addr rwlock, const RwLockT rwlock_type,
|
||||
struct rwlock_thread_info* q;
|
||||
|
||||
if (DRD_(s_trace_rwlock))
|
||||
{
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"[%d] post_rwlock_rdlock 0x%lx\n",
|
||||
drd_tid,
|
||||
rwlock);
|
||||
}
|
||||
DRD_(trace_msg)("[%d] post_rwlock_rdlock 0x%lx\n", drd_tid, rwlock);
|
||||
|
||||
p = DRD_(rwlock_get)(rwlock);
|
||||
|
||||
@ -460,12 +443,8 @@ void DRD_(rwlock_pre_wrlock)(const Addr rwlock, const RwLockT rwlock_type)
|
||||
p = DRD_(rwlock_get)(rwlock);
|
||||
|
||||
if (DRD_(s_trace_rwlock))
|
||||
{
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"[%d] pre_rwlock_wrlock 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
rwlock);
|
||||
}
|
||||
DRD_(trace_msg)("[%d] pre_rwlock_wrlock 0x%lx\n",
|
||||
DRD_(thread_get_running_tid)(), rwlock);
|
||||
|
||||
if (p == 0)
|
||||
p = DRD_(rwlock_get_or_allocate)(rwlock, rwlock_type);
|
||||
@ -498,12 +477,7 @@ void DRD_(rwlock_post_wrlock)(const Addr rwlock, const RwLockT rwlock_type,
|
||||
p = DRD_(rwlock_get)(rwlock);
|
||||
|
||||
if (DRD_(s_trace_rwlock))
|
||||
{
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"[%d] post_rwlock_wrlock 0x%lx\n",
|
||||
drd_tid,
|
||||
rwlock);
|
||||
}
|
||||
DRD_(trace_msg)("[%d] post_rwlock_wrlock 0x%lx\n", drd_tid, rwlock);
|
||||
|
||||
if (! p || ! took_lock)
|
||||
return;
|
||||
@ -538,12 +512,7 @@ void DRD_(rwlock_pre_unlock)(const Addr rwlock, const RwLockT rwlock_type)
|
||||
struct rwlock_thread_info* q;
|
||||
|
||||
if (DRD_(s_trace_rwlock))
|
||||
{
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"[%d] rwlock_unlock 0x%lx\n",
|
||||
drd_tid,
|
||||
rwlock);
|
||||
}
|
||||
DRD_(trace_msg)("[%d] rwlock_unlock 0x%lx\n", drd_tid, rwlock);
|
||||
|
||||
p = DRD_(rwlock_get)(rwlock);
|
||||
if (p == 0)
|
||||
|
||||
@ -175,13 +175,9 @@ struct semaphore_info* DRD_(semaphore_init)(const Addr semaphore,
|
||||
Segment* sg;
|
||||
|
||||
if (s_trace_semaphore)
|
||||
{
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"[%d] sem_init 0x%lx value %u\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
semaphore,
|
||||
value);
|
||||
}
|
||||
DRD_(trace_msg)("[%d] sem_init 0x%lx value %u\n",
|
||||
DRD_(thread_get_running_tid)(), semaphore, value);
|
||||
|
||||
p = semaphore_get(semaphore);
|
||||
if (p)
|
||||
{
|
||||
@ -227,13 +223,9 @@ void DRD_(semaphore_destroy)(const Addr semaphore)
|
||||
p = semaphore_get(semaphore);
|
||||
|
||||
if (s_trace_semaphore)
|
||||
{
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"[%d] sem_destroy 0x%lx value %u\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
semaphore,
|
||||
p ? p->value : 0);
|
||||
}
|
||||
DRD_(trace_msg)("[%d] sem_destroy 0x%lx value %u\n",
|
||||
DRD_(thread_get_running_tid)(), semaphore,
|
||||
p ? p->value : 0);
|
||||
|
||||
if (p == 0)
|
||||
{
|
||||
@ -261,13 +253,10 @@ struct semaphore_info* DRD_(semaphore_open)(const Addr semaphore,
|
||||
Segment* sg;
|
||||
|
||||
if (s_trace_semaphore)
|
||||
{
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"[%d] sem_open 0x%lx name %s"
|
||||
" oflag %#lx mode %#lo value %u\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
semaphore, name, oflag, mode, value);
|
||||
}
|
||||
DRD_(trace_msg)("[%d] sem_open 0x%lx name %s"
|
||||
" oflag %#lx mode %#lo value %u\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
semaphore, name, oflag, mode, value);
|
||||
|
||||
/* Return if the sem_open() call failed. */
|
||||
if (! semaphore)
|
||||
@ -307,13 +296,9 @@ void DRD_(semaphore_close)(const Addr semaphore)
|
||||
p = semaphore_get(semaphore);
|
||||
|
||||
if (s_trace_semaphore)
|
||||
{
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"[%d] sem_close 0x%lx value %u\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
semaphore,
|
||||
p ? p->value : 0);
|
||||
}
|
||||
DRD_(trace_msg)("[%d] sem_close 0x%lx value %u\n",
|
||||
DRD_(thread_get_running_tid)(), semaphore,
|
||||
p ? p->value : 0);
|
||||
|
||||
if (p == 0)
|
||||
{
|
||||
@ -366,14 +351,9 @@ void DRD_(semaphore_post_wait)(const DrdThreadId tid, const Addr semaphore,
|
||||
|
||||
p = semaphore_get(semaphore);
|
||||
if (s_trace_semaphore)
|
||||
{
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"[%d] sem_wait 0x%lx value %u -> %u\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
semaphore,
|
||||
p ? p->value : 0,
|
||||
p ? p->value - 1 : 0);
|
||||
}
|
||||
DRD_(trace_msg)("[%d] sem_wait 0x%lx value %u -> %u\n",
|
||||
DRD_(thread_get_running_tid)(), semaphore,
|
||||
p ? p->value : 0, p ? p->value - 1 : 0);
|
||||
|
||||
if (p)
|
||||
{
|
||||
@ -427,13 +407,9 @@ void DRD_(semaphore_pre_post)(const DrdThreadId tid, const Addr semaphore)
|
||||
p->value++;
|
||||
|
||||
if (s_trace_semaphore)
|
||||
{
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"[%d] sem_post 0x%lx value %u -> %u\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
semaphore,
|
||||
p->value - 1, p->value);
|
||||
}
|
||||
DRD_(trace_msg)("[%d] sem_post 0x%lx value %u -> %u\n",
|
||||
DRD_(thread_get_running_tid)(),
|
||||
semaphore, p->value - 1, p->value);
|
||||
|
||||
p->last_sem_post_tid = tid;
|
||||
sg = 0;
|
||||
|
||||
@ -390,7 +390,7 @@ void DRD_(thread_post_join)(DrdThreadId drd_joiner, DrdThreadId drd_joinee)
|
||||
", new vc: %s", vc);
|
||||
VG_(free)(vc);
|
||||
}
|
||||
VG_(message)(Vg_DebugMsg, "%s\n", msg);
|
||||
DRD_(trace_msg)("%s\n", msg);
|
||||
VG_(free)(msg);
|
||||
}
|
||||
|
||||
@ -564,8 +564,8 @@ void DRD_(thread_pre_cancel)(const DrdThreadId tid)
|
||||
tl_assert(DRD_(g_threadinfo)[tid].pt_threadid != INVALID_POSIX_THREADID);
|
||||
|
||||
if (DRD_(thread_get_trace_fork_join)())
|
||||
VG_(message)(Vg_UserMsg, "[%d] drd_thread_pre_cancel %d\n",
|
||||
DRD_(g_drd_running_tid), tid);
|
||||
DRD_(trace_msg)("[%d] drd_thread_pre_cancel %d\n",
|
||||
DRD_(g_drd_running_tid), tid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user