From: Florian Krohm Date: Wed, 5 Aug 2015 14:38:57 +0000 (+0000) Subject: Fix printf format inconsistencies as pointed out by gcc -Wformat-signedness. X-Git-Tag: svn/VALGRIND_3_11_0~162 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b790e0847477a87093b98ac265a444952b57ee96;p=thirdparty%2Fvalgrind.git Fix printf format inconsistencies as pointed out by gcc -Wformat-signedness. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15495 --- diff --git a/drd/drd_barrier.c b/drd/drd_barrier.c index 24bec960fb..12cb7e9e15 100644 --- a/drd/drd_barrier.c +++ b/drd/drd_barrier.c @@ -259,11 +259,11 @@ void DRD_(barrier_init)(const Addr barrier, if (s_trace_barrier) { if (reinitialization) - DRD_(trace_msg)("[%d] barrier_reinit %s 0x%lx count %ld -> %ld", + DRD_(trace_msg)("[%u] barrier_reinit %s 0x%lx count %ld -> %ld", DRD_(thread_get_running_tid)(), barrier_get_typename(p), barrier, p->count, count); else - DRD_(trace_msg)("[%d] barrier_init %s 0x%lx", + DRD_(trace_msg)("[%u] barrier_init %s 0x%lx", DRD_(thread_get_running_tid)(), barrier_get_typename(p), barrier); @@ -293,7 +293,7 @@ void DRD_(barrier_destroy)(const Addr barrier, const BarrierT barrier_type) p = DRD_(barrier_get)(barrier); if (s_trace_barrier) - DRD_(trace_msg)("[%d] barrier_destroy %s 0x%lx", + DRD_(trace_msg)("[%u] barrier_destroy %s 0x%lx", DRD_(thread_get_running_tid)(), barrier_get_typename(p), barrier); @@ -352,7 +352,7 @@ void DRD_(barrier_pre_wait)(const DrdThreadId tid, const Addr barrier, tl_assert(p); if (s_trace_barrier) - DRD_(trace_msg)("[%d] barrier_pre_wait %s 0x%lx iteration %ld", + DRD_(trace_msg)("[%u] barrier_pre_wait %s 0x%lx iteration %ld", DRD_(thread_get_running_tid)(), barrier_get_typename(p), barrier, p->pre_iteration); @@ -413,7 +413,7 @@ void DRD_(barrier_post_wait)(const DrdThreadId tid, const Addr barrier, p = DRD_(barrier_get)(barrier); if (s_trace_barrier) - DRD_(trace_msg)("[%d] barrier_post_wait %s 0x%lx iteration %ld%s", + DRD_(trace_msg)("[%u] barrier_post_wait %s 0x%lx iteration %ld%s", tid, p ? barrier_get_typename(p) : "(?)", barrier, p ? p->post_iteration : -1, serializing ? " (serializing)" : ""); diff --git a/drd/drd_clientobj.c b/drd/drd_clientobj.c index 44234f9c28..66c1f1086d 100644 --- a/drd/drd_clientobj.c +++ b/drd/drd_clientobj.c @@ -132,7 +132,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) - DRD_(trace_msg)("Adding client object 0x%lx of type %d", a1, t); + DRD_(trace_msg)("Adding client object 0x%lx of type %d", a1, (Int)t); p = VG_(OSetGen_AllocNode)(s_clientobj_set, sizeof(*p)); VG_(memset)(p, 0, sizeof(*p)); @@ -179,7 +179,7 @@ static Bool clientobj_remove_obj(DrdClientobj* const p) if (s_trace_clientobj) { DRD_(trace_msg)("Removing client object 0x%lx of type %d", p->any.a1, - p->any.type); + (Int)p->any.type); #if 0 VG_(get_and_pp_StackTrace)(VG_(get_running_tid)(), VG_(clo_backtrace_size)); diff --git a/drd/drd_cond.c b/drd/drd_cond.c index bcdef30661..ccab0814d2 100644 --- a/drd/drd_cond.c +++ b/drd/drd_cond.c @@ -147,7 +147,7 @@ void DRD_(cond_pre_init)(const Addr cond) struct cond_info* p; if (DRD_(s_trace_cond)) - DRD_(trace_msg)("[%d] cond_init cond 0x%lx", + DRD_(trace_msg)("[%u] cond_init cond 0x%lx", DRD_(thread_get_running_tid)(), cond); p = DRD_(cond_get)(cond); @@ -170,7 +170,7 @@ void DRD_(cond_post_destroy)(const Addr cond, const Bool destroy_succeeded) struct cond_info* p; if (DRD_(s_trace_cond)) - DRD_(trace_msg)("[%d] cond_destroy cond 0x%lx", + DRD_(trace_msg)("[%u] cond_destroy cond 0x%lx", DRD_(thread_get_running_tid)(), cond); p = DRD_(cond_get)(cond); @@ -210,7 +210,7 @@ void DRD_(cond_pre_wait)(const Addr cond, const Addr mutex) struct mutex_info* q; if (DRD_(s_trace_cond)) - DRD_(trace_msg)("[%d] cond_pre_wait cond 0x%lx", + DRD_(trace_msg)("[%u] cond_pre_wait cond 0x%lx", DRD_(thread_get_running_tid)(), cond); p = cond_get_or_allocate(cond); @@ -271,7 +271,7 @@ void DRD_(cond_post_wait)(const Addr cond) struct cond_info* p; if (DRD_(s_trace_cond)) - DRD_(trace_msg)("[%d] cond_post_wait cond 0x%lx", + DRD_(trace_msg)("[%u] cond_post_wait cond 0x%lx", DRD_(thread_get_running_tid)(), cond); p = DRD_(cond_get)(cond); @@ -352,7 +352,7 @@ void DRD_(cond_pre_signal)(Addr const cond) p = DRD_(cond_get)(cond); if (DRD_(s_trace_cond)) - DRD_(trace_msg)("[%d] cond_signal cond 0x%lx", + DRD_(trace_msg)("[%u] cond_signal cond 0x%lx", DRD_(thread_get_running_tid)(), cond); tl_assert(DRD_(pthread_cond_initializer)); @@ -375,7 +375,7 @@ void DRD_(cond_pre_broadcast)(Addr const cond) struct cond_info* p; if (DRD_(s_trace_cond)) - DRD_(trace_msg)("[%d] cond_broadcast cond 0x%lx", + DRD_(trace_msg)("[%u] cond_broadcast cond 0x%lx", DRD_(thread_get_running_tid)(), cond); p = DRD_(cond_get)(cond); diff --git a/drd/drd_error.c b/drd/drd_error.c index eb9268957a..fd963df886 100644 --- a/drd/drd_error.c +++ b/drd/drd_error.c @@ -199,7 +199,7 @@ void drd_report_data_race(const Error* const err, describe_malloced_addr(dri->addr, &ai); } - print_err_detail("%sConflicting %s by thread %d at 0x%08lx size %ld%s\n", + print_err_detail("%sConflicting %s by thread %u at 0x%08lx size %lu%s\n", what_prefix, dri->access_type == eStore ? "store" : "load", dri->tid, dri->addr, dri->size, what_suffix); @@ -316,7 +316,7 @@ static void drd_tool_error_pp(const Error* const e) MutexErrInfo* p = (MutexErrInfo*)(VG_(get_error_extra)(e)); tl_assert(p); if (p->recursion_count >= 0) { - print_err_detail("%s%s: mutex 0x%lx, recursion count %d, owner %d." + print_err_detail("%s%s: mutex 0x%lx, recursion count %d, owner %u." "%s\n", what_prefix, VG_(get_error_string)(e), p->mutex, p->recursion_count, p->owner, what_suffix); } else { @@ -337,7 +337,7 @@ static void drd_tool_error_pp(const Error* const e) } case CondDestrErr: { CondDestrErrInfo* cdi = (CondDestrErrInfo*)(VG_(get_error_extra)(e)); - print_err_detail("%s%s: cond 0x%lx, mutex 0x%lx locked by thread %d%s\n", + print_err_detail("%s%s: cond 0x%lx, mutex 0x%lx locked by thread %u%s\n", what_prefix, VG_(get_error_string)(e), cdi->cond, cdi->mutex, cdi->owner, what_suffix); VG_(pp_ExeContext)(VG_(get_error_where)(e)); @@ -384,7 +384,7 @@ static void drd_tool_error_pp(const Error* const e) if (bei->other_context) { if (xml) print_err_detail(" \n"); - print_err_detail("%sConflicting wait call by thread %d:%s\n", + print_err_detail("%sConflicting wait call by thread %u:%s\n", what_prefix, bei->other_tid, what_suffix); VG_(pp_ExeContext)(bei->other_context); if (xml) @@ -413,8 +413,8 @@ static void drd_tool_error_pp(const Error* const e) VG_(pp_ExeContext)(p->acquired_at); if (xml) print_err_detail(" \n"); - print_err_detail("%sLock on %s 0x%lx was held during %d ms" - " (threshold: %d ms).%s\n", what_prefix, + print_err_detail("%sLock on %s 0x%lx was held during %u ms" + " (threshold: %u ms).%s\n", what_prefix, VG_(get_error_string)(e), p->synchronization_object, p->hold_time_ms, p->threshold_ms, what_suffix); VG_(pp_ExeContext)(VG_(get_error_where)(e)); diff --git a/drd/drd_hb.c b/drd/drd_hb.c index aeb9dedd7a..d4ea6d36ee 100644 --- a/drd/drd_hb.c +++ b/drd/drd_hb.c @@ -164,7 +164,7 @@ void DRD_(hb_happens_before)(const DrdThreadId tid, Addr const hb) p = DRD_(hb_get_or_allocate)(hb); if (DRD_(s_trace_hb)) - DRD_(trace_msg)("[%d] happens_before 0x%lx", + DRD_(trace_msg)("[%u] happens_before 0x%lx", DRD_(thread_get_running_tid)(), hb); if (!p) @@ -198,7 +198,7 @@ void DRD_(hb_happens_after)(const DrdThreadId tid, const Addr hb) p = DRD_(hb_get_or_allocate)(hb); if (DRD_(s_trace_hb)) - DRD_(trace_msg)("[%d] happens_after 0x%lx", + DRD_(trace_msg)("[%u] happens_after 0x%lx", DRD_(thread_get_running_tid)(), hb); if (!p) @@ -230,7 +230,7 @@ void DRD_(hb_happens_done)(const DrdThreadId tid, const Addr hb) struct hb_info* p; if (DRD_(s_trace_hb)) - DRD_(trace_msg)("[%d] happens_done 0x%lx", + DRD_(trace_msg)("[%u] happens_done 0x%lx", DRD_(thread_get_running_tid)(), hb); p = DRD_(hb_get)(hb); diff --git a/drd/drd_load_store.c b/drd/drd_load_store.c index 88e4d44e1f..99be669b1e 100644 --- a/drd/drd_load_store.c +++ b/drd/drd_load_store.c @@ -103,7 +103,7 @@ void DRD_(trace_mem_access)(const Addr addr, const SizeT size, vc = DRD_(vc_aprint)(DRD_(thread_get_vc)(DRD_(thread_get_running_tid)())); if (access_type == eStore && size <= sizeof(HWord)) { - DRD_(trace_msg_w_bt)("store 0x%lx size %ld val %ld/0x%lx (thread %d /" + DRD_(trace_msg_w_bt)("store 0x%lx size %lu val %lu/0x%lx (thread %u /" " vc %s)", addr, size, stored_value_lo, stored_value_lo, DRD_(thread_get_running_tid)(), vc); @@ -112,11 +112,11 @@ void DRD_(trace_mem_access)(const Addr addr, const SizeT size, tl_assert(sizeof(HWord) == 4); sv = ((ULong)stored_value_hi << 32) | stored_value_lo; - DRD_(trace_msg_w_bt)("store 0x%lx size %ld val %lld/0x%llx (thread %d" + DRD_(trace_msg_w_bt)("store 0x%lx size %lu val %llu/0x%llx (thread %u" " / vc %s)", addr, size, sv, sv, DRD_(thread_get_running_tid)(), vc); } else { - DRD_(trace_msg_w_bt)("%s 0x%lx size %ld (thread %d / vc %s)", + DRD_(trace_msg_w_bt)("%s 0x%lx size %lu (thread %u / vc %s)", access_type == eLoad ? "load " : access_type == eStore ? "store" : access_type == eStart ? "start" diff --git a/drd/drd_main.c b/drd/drd_main.c index 504aa6a8c7..d96256f27e 100644 --- a/drd/drd_main.c +++ b/drd/drd_main.c @@ -163,7 +163,7 @@ static Bool DRD_(process_cmd_line_option)(const HChar* arg) DRD_(start_tracing_address_range)(addr, addr + 1, False); } if (ptrace_address) { - char *plus = VG_(strchr)(ptrace_address, '+'); + HChar *plus = VG_(strchr)(ptrace_address, '+'); Addr addr, length; if (plus) *plus = '\0'; @@ -339,7 +339,7 @@ void drd_start_using_mem(const Addr a1, const SizeT len, tl_assert(a1 <= a2); if (!is_stack_mem && s_trace_alloc) - DRD_(trace_msg)("Started using memory range 0x%lx + %ld%s", + DRD_(trace_msg)("Started using memory range 0x%lx + %lu%s", a1, len, DRD_(running_thread_inside_pthread_create)() ? " (inside pthread_create())" : ""); @@ -383,7 +383,7 @@ void drd_stop_using_mem(const Addr a1, const SizeT len, DRD_(trace_mem_access)(a1, len, eEnd, 0, 0); if (!is_stack_mem && s_trace_alloc) - DRD_(trace_msg)("Stopped using memory range 0x%lx + %ld", + DRD_(trace_msg)("Stopped using memory range 0x%lx + %lu", a1, len); if (!is_stack_mem || DRD_(get_check_stack_accesses)()) @@ -430,7 +430,7 @@ static void DRD_(suppress_relocation_conflicts)(const Addr a, const SizeT len) const DebugInfo* di; if (trace_sectsuppr) - VG_(dmsg)("Evaluating range @ 0x%lx size %ld\n", a, len); + VG_(dmsg)("Evaluating range @ 0x%lx size %lu\n", a, len); for (di = VG_(next_DebugInfo)(0); di; di = VG_(next_DebugInfo)(di)) { Addr avma; @@ -451,7 +451,7 @@ static void DRD_(suppress_relocation_conflicts)(const Addr a, const SizeT len) if (size > 0 && VG_(strcmp)(VG_(DebugInfo_get_soname)(di), "libpthread.so.0") == 0) { if (trace_sectsuppr) - VG_(dmsg)("Suppressing .bss @ 0x%lx size %ld\n", avma, size); + VG_(dmsg)("Suppressing .bss @ 0x%lx size %lu\n", avma, size); tl_assert(VG_(DebugInfo_sect_kind)(NULL, avma) == Vg_SectBSS); DRD_(start_suppression)(avma, avma + size, ".bss"); } @@ -461,7 +461,7 @@ static void DRD_(suppress_relocation_conflicts)(const Addr a, const SizeT len) tl_assert((avma && size) || (avma == 0 && size == 0)); if (size > 0) { if (trace_sectsuppr) - VG_(dmsg)("Suppressing .plt @ 0x%lx size %ld\n", avma, size); + VG_(dmsg)("Suppressing .plt @ 0x%lx size %lu\n", avma, size); tl_assert(VG_(DebugInfo_sect_kind)(NULL, avma) == Vg_SectPLT); DRD_(start_suppression)(avma, avma + size, ".plt"); } @@ -471,7 +471,7 @@ static void DRD_(suppress_relocation_conflicts)(const Addr a, const SizeT len) tl_assert((avma && size) || (avma == 0 && size == 0)); if (size > 0) { if (trace_sectsuppr) - VG_(dmsg)("Suppressing .got.plt @ 0x%lx size %ld\n", avma, size); + VG_(dmsg)("Suppressing .got.plt @ 0x%lx size %lu\n", avma, size); tl_assert(VG_(DebugInfo_sect_kind)(NULL, avma) == Vg_SectGOTPLT); DRD_(start_suppression)(avma, avma + size, ".gotplt"); } @@ -481,7 +481,7 @@ static void DRD_(suppress_relocation_conflicts)(const Addr a, const SizeT len) tl_assert((avma && size) || (avma == 0 && size == 0)); if (size > 0) { if (trace_sectsuppr) - VG_(dmsg)("Suppressing .got @ 0x%lx size %ld\n", avma, size); + VG_(dmsg)("Suppressing .got @ 0x%lx size %lu\n", avma, size); tl_assert(VG_(DebugInfo_sect_kind)(NULL, avma) == Vg_SectGOT); DRD_(start_suppression)(avma, avma + size, ".got"); } @@ -643,7 +643,7 @@ void drd_pre_thread_create(const ThreadId creator, const ThreadId created) } if (DRD_(thread_get_trace_fork_join)()) { - DRD_(trace_msg)("drd_pre_thread_create creator = %d, created = %d", + DRD_(trace_msg)("drd_pre_thread_create creator = %u, created = %u", drd_creator, created); } } @@ -668,7 +668,7 @@ void drd_post_thread_create(const ThreadId vg_created) if (DRD_(thread_get_trace_fork_join)()) { - DRD_(trace_msg)("drd_post_thread_create created = %d", drd_created); + DRD_(trace_msg)("drd_post_thread_create created = %u", drd_created); } if (! DRD_(get_check_stack_accesses)()) { @@ -695,7 +695,7 @@ static void drd_thread_finished(ThreadId vg_tid) tl_assert(drd_tid != DRD_INVALID_THREADID); if (DRD_(thread_get_trace_fork_join)()) { - DRD_(trace_msg)("drd_thread_finished tid = %d%s", drd_tid, + DRD_(trace_msg)("drd_thread_finished tid = %u%s", drd_tid, DRD_(thread_get_joinable)(drd_tid) ? "" : " (which is a detached thread)"); } @@ -705,8 +705,8 @@ static void drd_thread_finished(ThreadId vg_tid) = (DRD_(thread_get_stack_max)(drd_tid) - DRD_(thread_get_stack_min_min)(drd_tid)); VG_(message)(Vg_UserMsg, - "thread %d%s finished and used %ld bytes out of %ld" - " on its stack. Margin: %ld bytes.\n", + "thread %u%s finished and used %lu bytes out of %lu" + " on its stack. Margin: %lu bytes.\n", drd_tid, DRD_(thread_get_joinable)(drd_tid) ? "" : " (which is a detached thread)", @@ -774,47 +774,47 @@ static void DRD_(fini)(Int exitcode) ULong pu_join = DRD_(thread_get_update_conflict_set_join_count)(); VG_(message)(Vg_UserMsg, - " thread: %lld context switches.\n", + " thread: %llu context switches.\n", DRD_(thread_get_context_switch_count)()); VG_(message)(Vg_UserMsg, - "confl set: %lld full updates and %lld partial updates;\n", + "confl set: %llu full updates and %llu partial updates;\n", DRD_(thread_get_compute_conflict_set_count)(), pu); VG_(message)(Vg_UserMsg, - " %lld partial updates during segment creation,\n", + " %llu partial updates during segment creation,\n", pu_seg_cr); VG_(message)(Vg_UserMsg, - " %lld because of mutex/sema/cond.var. operations,\n", + " %llu because of mutex/sema/cond.var. operations,\n", pu_mtx_cv); VG_(message)(Vg_UserMsg, - " %lld because of barrier/rwlock operations and\n", + " %llu because of barrier/rwlock operations and\n", pu - pu_seg_cr - pu_mtx_cv - pu_join); VG_(message)(Vg_UserMsg, - " %lld partial updates because of thread join" + " %llu partial updates because of thread join" " operations.\n", pu_join); VG_(message)(Vg_UserMsg, - " segments: created %lld segments, max %lld alive,\n", + " segments: created %llu segments, max %llu alive,\n", DRD_(sg_get_segments_created_count)(), DRD_(sg_get_max_segments_alive_count)()); VG_(message)(Vg_UserMsg, - " %lld discard points and %lld merges.\n", + " %llu discard points and %llu merges.\n", DRD_(thread_get_discard_ordered_segments_count)(), DRD_(sg_get_segment_merge_count)()); VG_(message)(Vg_UserMsg, - "segmnt cr: %lld mutex, %lld rwlock, %lld semaphore and" - " %lld barrier.\n", + "segmnt cr: %llu mutex, %llu rwlock, %llu semaphore and" + " %llu barrier.\n", DRD_(get_mutex_segment_creation_count)(), DRD_(get_rwlock_segment_creation_count)(), DRD_(get_semaphore_segment_creation_count)(), DRD_(get_barrier_segment_creation_count)()); VG_(message)(Vg_UserMsg, - " bitmaps: %lld level one" - " and %lld level two bitmaps were allocated.\n", + " bitmaps: %llu level one" + " and %llu level two bitmaps were allocated.\n", DRD_(bm_get_bitmap_creation_count)(), DRD_(bm_get_bitmap2_creation_count)()); VG_(message)(Vg_UserMsg, - " mutex: %lld non-recursive lock/unlock events.\n", + " mutex: %llu non-recursive lock/unlock events.\n", DRD_(get_mutex_lock_count)()); DRD_(print_malloc_stats)(); } diff --git a/drd/drd_mutex.c b/drd/drd_mutex.c index 650000683c..c7f536498e 100644 --- a/drd/drd_mutex.c +++ b/drd/drd_mutex.c @@ -88,7 +88,7 @@ void DRD_(mutex_ignore_ordering)(const Addr mutex) struct mutex_info* p = DRD_(mutex_get)(mutex); if (s_trace_mutex) - DRD_(trace_msg)("[%d] mutex_ignore_ordering %s 0x%lx", + DRD_(trace_msg)("[%u] mutex_ignore_ordering %s 0x%lx", DRD_(thread_get_running_tid)(), p ? DRD_(mutex_type_name)(p->mutex_type) : "(?)", mutex); @@ -106,7 +106,7 @@ static void mutex_cleanup(struct mutex_info* p) tl_assert(p); if (s_trace_mutex) - DRD_(trace_msg)("[%d] mutex_destroy %s 0x%lx rc %d owner %d", + DRD_(trace_msg)("[%u] mutex_destroy %s 0x%lx rc %d owner %u", DRD_(thread_get_running_tid)(), DRD_(mutex_get_typename)(p), p->a1, p ? p->recursion_count : -1, @@ -197,7 +197,7 @@ DRD_(mutex_init)(const Addr mutex, const MutexT mutex_type) struct mutex_info* p; if (s_trace_mutex) - DRD_(trace_msg)("[%d] mutex_init %s 0x%lx", + DRD_(trace_msg)("[%u] mutex_init %s 0x%lx", DRD_(thread_get_running_tid)(), DRD_(mutex_type_name)(mutex_type), mutex); @@ -258,7 +258,7 @@ void DRD_(mutex_pre_lock)(const Addr mutex, MutexT mutex_type, mutex_type = p->mutex_type; if (s_trace_mutex) - DRD_(trace_msg)("[%d] %s %s 0x%lx rc %d owner %d", + DRD_(trace_msg)("[%u] %s %s 0x%lx rc %d owner %u", DRD_(thread_get_running_tid)(), trylock ? "pre_mutex_lock " : "mutex_trylock ", p ? DRD_(mutex_get_typename)(p) : "(?)", @@ -308,7 +308,7 @@ void DRD_(mutex_post_lock)(const Addr mutex, const Bool took_lock, p = DRD_(mutex_get)(mutex); if (s_trace_mutex) - DRD_(trace_msg)("[%d] %s %s 0x%lx rc %d owner %d%s", + DRD_(trace_msg)("[%u] %s %s 0x%lx rc %d owner %u%s", drd_tid, post_cond_wait ? "cond_post_wait " : "post_mutex_lock", p ? DRD_(mutex_get_typename)(p) : "(?)", @@ -374,7 +374,7 @@ void DRD_(mutex_unlock)(const Addr mutex, MutexT mutex_type) mutex_type = p->mutex_type; if (s_trace_mutex) { - DRD_(trace_msg)("[%d] mutex_unlock %s 0x%lx rc %d", + DRD_(trace_msg)("[%u] mutex_unlock %s 0x%lx rc %d", drd_tid, p ? DRD_(mutex_get_typename)(p) : "(?)", mutex, p ? p->recursion_count : 0); } diff --git a/drd/drd_rwlock.c b/drd/drd_rwlock.c index db589a0bed..04bae0595f 100644 --- a/drd/drd_rwlock.c +++ b/drd/drd_rwlock.c @@ -244,7 +244,7 @@ static void rwlock_cleanup(struct rwlock_info* p) tl_assert(p); if (DRD_(s_trace_rwlock)) - DRD_(trace_msg)("[%d] rwlock_destroy 0x%lx", + DRD_(trace_msg)("[%u] rwlock_destroy 0x%lx", DRD_(thread_get_running_tid)(), p->a1); if (DRD_(rwlock_is_locked)(p)) @@ -313,7 +313,7 @@ struct rwlock_info* DRD_(rwlock_pre_init)(const Addr rwlock, struct rwlock_info* p; if (DRD_(s_trace_rwlock)) - DRD_(trace_msg)("[%d] rwlock_init 0x%lx", + DRD_(trace_msg)("[%u] rwlock_init 0x%lx", DRD_(thread_get_running_tid)(), rwlock); p = DRD_(rwlock_get)(rwlock); @@ -374,7 +374,7 @@ void DRD_(rwlock_pre_rdlock)(const Addr rwlock, const RwLockT rwlock_type) struct rwlock_info* p; if (DRD_(s_trace_rwlock)) - DRD_(trace_msg)("[%d] pre_rwlock_rdlock 0x%lx", + DRD_(trace_msg)("[%u] pre_rwlock_rdlock 0x%lx", DRD_(thread_get_running_tid)(), rwlock); p = DRD_(rwlock_get_or_allocate)(rwlock, rwlock_type); @@ -403,7 +403,7 @@ void DRD_(rwlock_post_rdlock)(const Addr rwlock, const RwLockT rwlock_type, struct rwlock_thread_info* q; if (DRD_(s_trace_rwlock)) - DRD_(trace_msg)("[%d] post_rwlock_rdlock 0x%lx", drd_tid, rwlock); + DRD_(trace_msg)("[%u] post_rwlock_rdlock 0x%lx", drd_tid, rwlock); p = DRD_(rwlock_get)(rwlock); @@ -437,7 +437,7 @@ void DRD_(rwlock_pre_wrlock)(const Addr rwlock, const RwLockT rwlock_type) p = DRD_(rwlock_get)(rwlock); if (DRD_(s_trace_rwlock)) - DRD_(trace_msg)("[%d] pre_rwlock_wrlock 0x%lx", + DRD_(trace_msg)("[%u] pre_rwlock_wrlock 0x%lx", DRD_(thread_get_running_tid)(), rwlock); if (p == 0) @@ -471,7 +471,7 @@ void DRD_(rwlock_post_wrlock)(const Addr rwlock, const RwLockT rwlock_type, p = DRD_(rwlock_get)(rwlock); if (DRD_(s_trace_rwlock)) - DRD_(trace_msg)("[%d] post_rwlock_wrlock 0x%lx", drd_tid, rwlock); + DRD_(trace_msg)("[%u] post_rwlock_wrlock 0x%lx", drd_tid, rwlock); if (! p || ! took_lock) return; @@ -506,7 +506,7 @@ void DRD_(rwlock_pre_unlock)(const Addr rwlock, const RwLockT rwlock_type) struct rwlock_thread_info* q; if (DRD_(s_trace_rwlock)) - DRD_(trace_msg)("[%d] rwlock_unlock 0x%lx", drd_tid, rwlock); + DRD_(trace_msg)("[%u] rwlock_unlock 0x%lx", drd_tid, rwlock); p = DRD_(rwlock_get)(rwlock); if (p == 0) diff --git a/drd/drd_segment.c b/drd/drd_segment.c index a625f47432..8b4aa4c73d 100644 --- a/drd/drd_segment.c +++ b/drd/drd_segment.c @@ -97,7 +97,7 @@ static void sg_init(Segment* const sg, HChar* vc; vc = DRD_(vc_aprint)(&sg->vc); - VG_(message)(Vg_DebugMsg, "New segment for thread %d with vc %s\n", + VG_(message)(Vg_DebugMsg, "New segment for thread %u with vc %s\n", created, vc); VG_(free)(vc); } diff --git a/drd/drd_semaphore.c b/drd/drd_semaphore.c index 90d460951f..ef729ccbc9 100644 --- a/drd/drd_semaphore.c +++ b/drd/drd_semaphore.c @@ -174,7 +174,7 @@ struct semaphore_info* DRD_(semaphore_init)(const Addr semaphore, Segment* sg; if (s_trace_semaphore) - DRD_(trace_msg)("[%d] sem_init 0x%lx value %u", + DRD_(trace_msg)("[%u] sem_init 0x%lx value %u", DRD_(thread_get_running_tid)(), semaphore, value); p = semaphore_get(semaphore); @@ -222,7 +222,7 @@ void DRD_(semaphore_destroy)(const Addr semaphore) p = semaphore_get(semaphore); if (s_trace_semaphore) - DRD_(trace_msg)("[%d] sem_destroy 0x%lx value %u", + DRD_(trace_msg)("[%u] sem_destroy 0x%lx value %u", DRD_(thread_get_running_tid)(), semaphore, p ? p->value : 0); @@ -252,10 +252,10 @@ struct semaphore_info* DRD_(semaphore_open)(const Addr semaphore, Segment* sg; if (s_trace_semaphore) - DRD_(trace_msg)("[%d] sem_open 0x%lx name %s" + DRD_(trace_msg)("[%u] sem_open 0x%lx name %s" " oflag %#lx mode %#lo value %u", DRD_(thread_get_running_tid)(), - semaphore, name, oflag, mode, value); + semaphore, name, (UWord)oflag, (UWord)mode, value); /* Return if the sem_open() call failed. */ if (! semaphore) @@ -295,7 +295,7 @@ void DRD_(semaphore_close)(const Addr semaphore) p = semaphore_get(semaphore); if (s_trace_semaphore) - DRD_(trace_msg)("[%d] sem_close 0x%lx value %u", + DRD_(trace_msg)("[%u] sem_close 0x%lx value %u", DRD_(thread_get_running_tid)(), semaphore, p ? p->value : 0); @@ -350,7 +350,7 @@ void DRD_(semaphore_post_wait)(const DrdThreadId tid, const Addr semaphore, tl_assert(waited == 0 || waited == 1); p = semaphore_get(semaphore); if (s_trace_semaphore) - DRD_(trace_msg)("[%d] sem_wait 0x%lx value %u -> %u%s", + DRD_(trace_msg)("[%u] sem_wait 0x%lx value %u -> %u%s", DRD_(thread_get_running_tid)(), semaphore, p ? p->value : 0, p ? p->value - waited : 0, waited ? "" : " (did not wait)"); @@ -409,7 +409,7 @@ void DRD_(semaphore_pre_post)(const DrdThreadId tid, const Addr semaphore) p->value++; if (s_trace_semaphore) - DRD_(trace_msg)("[%d] sem_post 0x%lx value %u -> %u", + DRD_(trace_msg)("[%u] sem_post 0x%lx value %u -> %u", DRD_(thread_get_running_tid)(), semaphore, p->value - 1, p->value); diff --git a/drd/drd_suppression.c b/drd/drd_suppression.c index 6d884349e0..ef6d186289 100644 --- a/drd/drd_suppression.c +++ b/drd/drd_suppression.c @@ -63,7 +63,7 @@ void DRD_(start_suppression)(const Addr a1, const Addr a2, const HChar* const reason) { if (s_trace_suppression) - VG_(message)(Vg_DebugMsg, "start suppression of 0x%lx sz %ld (%s)\n", + VG_(message)(Vg_DebugMsg, "start suppression of 0x%lx sz %lu (%s)\n", a1, a2 - a1, reason); tl_assert(a1 <= a2); @@ -73,7 +73,7 @@ void DRD_(start_suppression)(const Addr a1, const Addr a2, void DRD_(finish_suppression)(const Addr a1, const Addr a2) { if (s_trace_suppression) { - VG_(message)(Vg_DebugMsg, "finish suppression of 0x%lx sz %ld\n", + VG_(message)(Vg_DebugMsg, "finish suppression of 0x%lx sz %lu\n", a1, a2 - a1); VG_(get_and_pp_StackTrace)(VG_(get_running_tid)(), 12); } @@ -122,7 +122,7 @@ void DRD_(start_tracing_address_range)(const Addr a1, const Addr a2, tl_assert(a1 <= a2); if (s_trace_suppression) - VG_(message)(Vg_DebugMsg, "start_tracing(0x%lx, %ld) %s\n", + VG_(message)(Vg_DebugMsg, "start_tracing(0x%lx, %lu) %s\n", a1, a2 - a1, persistent ? "persistent" : "non-persistent"); DRD_(bm_access_range_load)(s_traced, a1, a2); @@ -140,7 +140,7 @@ void DRD_(stop_tracing_address_range)(const Addr a1, const Addr a2) tl_assert(a1 <= a2); if (s_trace_suppression) - VG_(message)(Vg_DebugMsg, "stop_tracing(0x%lx, %ld)\n", + VG_(message)(Vg_DebugMsg, "stop_tracing(0x%lx, %lu)\n", a1, a2 - a1); if (DRD_(g_any_address_traced)) { @@ -165,7 +165,7 @@ void DRD_(suppression_stop_using_mem)(const Addr a1, const Addr a2) for (b = a1; b < a2; b++) { if (DRD_(bm_has_1)(s_suppressed, b, eStore)) { VG_(message)(Vg_DebugMsg, - "stop_using_mem(0x%lx, %ld) finish suppression of" + "stop_using_mem(0x%lx, %lu) finish suppression of" " 0x%lx\n", a1, a2 - a1, b); } } diff --git a/drd/drd_thread.c b/drd/drd_thread.c index f0f39f8546..f1e8b27907 100644 --- a/drd/drd_thread.c +++ b/drd/drd_thread.c @@ -408,7 +408,7 @@ void DRD_(thread_post_join)(DrdThreadId drd_joiner, DrdThreadId drd_joinee) msg = VG_(malloc)("drd.main.dptj.1", msg_size); VG_(snprintf)(msg, msg_size, - "drd_post_thread_join joiner = %d, joinee = %d", + "drd_post_thread_join joiner = %u, joinee = %u", drd_joiner, drd_joinee); if (joiner) { @@ -595,7 +595,7 @@ 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)()) - DRD_(trace_msg)("[%d] drd_thread_pre_cancel %d", + DRD_(trace_msg)("[%u] drd_thread_pre_cancel %u", DRD_(g_drd_running_tid), tid); } @@ -730,12 +730,12 @@ void DRD_(thread_set_name)(const DrdThreadId tid, const HChar* const name) if (name == NULL || name[0] == 0) VG_(snprintf)(DRD_(g_threadinfo)[tid].name, sizeof(DRD_(g_threadinfo)[tid].name), - "Thread %d", + "Thread %u", tid); else VG_(snprintf)(DRD_(g_threadinfo)[tid].name, sizeof(DRD_(g_threadinfo)[tid].name), - "Thread %d (%s)", + "Thread %u (%s)", tid, name); DRD_(g_threadinfo)[tid].name[sizeof(DRD_(g_threadinfo)[tid].name) - 1] = 0; } @@ -774,7 +774,7 @@ void DRD_(thread_set_running_tid)(const ThreadId vg_tid, && DRD_(g_drd_running_tid) != DRD_INVALID_THREADID) { VG_(message)(Vg_DebugMsg, - "Context switch from thread %d to thread %d;" + "Context switch from thread %u to thread %u;" " segments: %llu\n", DRD_(g_drd_running_tid), drd_tid, DRD_(sg_get_segments_alive_count)()); @@ -1221,7 +1221,7 @@ static void thread_combine_vc_sync(DrdThreadId tid, const Segment* sg) HChar *str1, *str2; str1 = DRD_(vc_aprint)(&old_vc); str2 = DRD_(vc_aprint)(DRD_(thread_get_vc)(tid)); - VG_(message)(Vg_DebugMsg, "thread %d: vc %s -> %s\n", tid, str1, str2); + VG_(message)(Vg_DebugMsg, "thread %u: vc %s -> %s\n", tid, str1, str2); VG_(free)(str1); VG_(free)(str2); } @@ -1304,7 +1304,7 @@ void DRD_(thread_set_record_stores)(const DrdThreadId tid, const Bool enabled) */ void DRD_(thread_print_all)(void) { - unsigned i; + UInt i; Segment* p; for (i = 0; i < DRD_N_THREADS; i++) @@ -1312,7 +1312,7 @@ void DRD_(thread_print_all)(void) p = DRD_(g_threadinfo)[i].sg_first; if (p) { VG_(printf)("**************\n" - "* thread %3d (%d/%d/%d/%d/0x%lx/%d) *\n" + "* thread %3u (%d/%u/%u/%u/0x%lx/%d) *\n" "**************\n", i, DRD_(g_threadinfo)[i].valid, @@ -1381,14 +1381,14 @@ thread_report_conflicting_segments_segment(const DrdThreadId tid, VG_(printf_xml)(" \n"); else VG_(message)(Vg_UserMsg, - "Other segment start (thread %d)\n", i); + "Other segment start (thread %u)\n", i); show_call_stack(i, q->stacktrace); if (VG_(clo_xml)) VG_(printf_xml)(" \n" " \n"); else VG_(message)(Vg_UserMsg, - "Other segment end (thread %d)\n", i); + "Other segment end (thread %u)\n", i); q_next = q->thr_next; show_call_stack(i, q_next ? q_next->stacktrace : 0); if (VG_(clo_xml)) @@ -1477,7 +1477,7 @@ static void thread_compute_conflict_set(struct bitmap** conflict_set, str = DRD_(vc_aprint)(DRD_(thread_get_vc)(tid)); VG_(message)(Vg_DebugMsg, - "computing conflict set for thread %d with vc %s\n", + "computing conflict set for thread %u with vc %s\n", tid, str); VG_(free)(str); } @@ -1490,7 +1490,7 @@ static void thread_compute_conflict_set(struct bitmap** conflict_set, HChar* vc; vc = DRD_(vc_aprint)(&p->vc); - VG_(message)(Vg_DebugMsg, "conflict set: thread [%d] at vc %s\n", + VG_(message)(Vg_DebugMsg, "conflict set: thread [%u] at vc %s\n", tid, vc); VG_(free)(vc); } @@ -1507,7 +1507,7 @@ static void thread_compute_conflict_set(struct bitmap** conflict_set, str = DRD_(vc_aprint)(&q->vc); VG_(message)(Vg_DebugMsg, - "conflict set: [%d] merging segment %s\n", + "conflict set: [%u] merging segment %s\n", j, str); VG_(free)(str); } @@ -1518,7 +1518,7 @@ static void thread_compute_conflict_set(struct bitmap** conflict_set, str = DRD_(vc_aprint)(&q->vc); VG_(message)(Vg_DebugMsg, - "conflict set: [%d] ignoring segment %s\n", + "conflict set: [%u] ignoring segment %s\n", j, str); VG_(free)(str); } @@ -1534,9 +1534,9 @@ static void thread_compute_conflict_set(struct bitmap** conflict_set, += DRD_(bm_get_bitmap2_creation_count)(); if (s_trace_conflict_set_bm) { - VG_(message)(Vg_DebugMsg, "[%d] new conflict set:\n", tid); + VG_(message)(Vg_DebugMsg, "[%u] new conflict set:\n", tid); DRD_(bm_print)(*conflict_set); - VG_(message)(Vg_DebugMsg, "[%d] end of new conflict set.\n", tid); + VG_(message)(Vg_DebugMsg, "[%u] end of new conflict set.\n", tid); } } @@ -1563,7 +1563,7 @@ void DRD_(thread_update_conflict_set)(const DrdThreadId tid, str = DRD_(vc_aprint)(DRD_(thread_get_vc)(tid)); VG_(message)(Vg_DebugMsg, - "updating conflict set for thread %d with vc %s\n", + "updating conflict set for thread %u with vc %s\n", tid, str); VG_(free)(str); } @@ -1593,7 +1593,7 @@ void DRD_(thread_update_conflict_set)(const DrdThreadId tid, str = DRD_(vc_aprint)(&q->vc); VG_(message)(Vg_DebugMsg, - "conflict set: [%d] %s segment %s\n", j, + "conflict set: [%u] %s segment %s\n", j, included_in_old_conflict_set != included_in_new_conflict_set ? "merging" : "ignoring", str); @@ -1615,7 +1615,7 @@ void DRD_(thread_update_conflict_set)(const DrdThreadId tid, str = DRD_(vc_aprint)(&q->vc); VG_(message)(Vg_DebugMsg, - "conflict set: [%d] %s segment %s\n", j, + "conflict set: [%u] %s segment %s\n", j, included_in_old_conflict_set != included_in_new_conflict_set ? "merging" : "ignoring", str); @@ -1647,9 +1647,9 @@ void DRD_(thread_update_conflict_set)(const DrdThreadId tid, if (s_trace_conflict_set_bm) { - VG_(message)(Vg_DebugMsg, "[%d] updated conflict set:\n", tid); + VG_(message)(Vg_DebugMsg, "[%u] updated conflict set:\n", tid); DRD_(bm_print)(DRD_(g_conflict_set)); - VG_(message)(Vg_DebugMsg, "[%d] end of updated conflict set.\n", tid); + VG_(message)(Vg_DebugMsg, "[%u] end of updated conflict set.\n", tid); } tl_assert(thread_conflict_set_up_to_date(DRD_(g_drd_running_tid))); diff --git a/drd/drd_vc.c b/drd/drd_vc.c index 0da3b4eddb..edde023068 100644 --- a/drd/drd_vc.c +++ b/drd/drd_vc.c @@ -277,7 +277,7 @@ HChar* DRD_(vc_aprint)(const VectorClock* const vc) return str; } size += VG_(snprintf)(str + size, reserved - size, - "%s %d: %d", i > 0 ? "," : "", + "%s %u: %u", i > 0 ? "," : "", vc->vc[i].threadid, vc->vc[i].count); } size += VG_(snprintf)(str + size, reserved - size, " ]");