diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2011-12-29 18:46:53 +0400 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2011-12-29 18:46:53 +0400 |
commit | 31b3afc08c93ec3bed211ccee923e9e8e06764f6 (patch) | |
tree | 4622c36d7e209ff00ee8c1f9850274378e011352 /darwin_stop_world.c | |
parent | 83ad781e1bfdc44bb5143dccfa0a0d5b0445788c (diff) | |
download | bdwgc-31b3afc08c93ec3bed211ccee923e9e8e06764f6.tar.gz |
Replace printf PRIxMAX specifier with '%p' for thread id debug output
* pthread_support.c (GC_new_thread, GC_delete_thread,
GC_delete_gc_thread, GC_unregister_my_thread_inner,
GC_unregister_my_thread, GC_thread_exit_proc,
GC_start_rtn_prepare_thread, pthread_create): Output thread id value
(when DEBUG_THREADS) using %p format specifier instead of PRIxMAX, %x
and %lx (casting passed id value to pointer type instead of uintmax_t).
* pthread_start.c (GC_inner_start_routine): Likewise.
GC_stop_world, GC_thread_resume, GC_start_world): Likewise.
* pthread_stop_world.c (GC_suspend_handler_inner, GC_restart_handler,
GC_push_all_stacks, GC_suspend_all, GC_stop_world, GC_start_world):
Likewise.
* darwin_stop_world.c (GC_stack_range_for, GC_suspend_thread_list,
* pthread_start.c: Do not include inttypes.h.
* pthread_support.c: Likewise.
* pthread_support.c (GC_count_threads): Define only if DEBUG_THREADS.
* pthread_support.c (GC_unregister_my_thread): Rename gc_self local
variable to "me".
* pthread_support.c (pthread_create): Report thread started (when
DEBUG_THREADS) only if result is 0.
Diffstat (limited to 'darwin_stop_world.c')
-rw-r--r-- | darwin_stop_world.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/darwin_stop_world.c b/darwin_stop_world.c index f05dc685..dfccdc19 100644 --- a/darwin_stop_world.c +++ b/darwin_stop_world.c @@ -255,8 +255,8 @@ STATIC ptr_t GC_stack_range_for(ptr_t *phi, thread_act_t thread, GC_thread p, *phi = (p->flags & MAIN_THREAD) != 0 ? GC_stackbottom : p->stack_end; # endif # ifdef DEBUG_THREADS - GC_log_printf("Darwin: Stack for thread 0x%lx = [%p,%p)\n", - (unsigned long)thread, lo, *phi); + GC_log_printf("Darwin: Stack for thread %p = [%p,%p)\n", + (void *)thread, lo, *phi); # endif return lo; } @@ -382,8 +382,7 @@ STATIC GC_bool GC_suspend_thread_list(thread_act_array_t act_list, int count, # endif # ifdef DEBUG_THREADS - GC_log_printf("Attempting to suspend thread 0x%lx\n", - (unsigned long)thread); + GC_log_printf("Attempting to suspend thread %p\n", (void *)thread); # endif /* find the current thread in the old list */ found = FALSE; @@ -427,8 +426,7 @@ STATIC GC_bool GC_suspend_thread_list(thread_act_array_t act_list, int count, continue; } # ifdef DEBUG_THREADS - GC_log_printf("Thread state for 0x%lx = %d\n", (unsigned long)thread, - info.run_state); + GC_log_printf("Thread state for %p = %d\n", (void *)thread, info.run_state); # endif if (info.suspend_count != 0) { /* thread is already suspended. */ @@ -438,7 +436,7 @@ STATIC GC_bool GC_suspend_thread_list(thread_act_array_t act_list, int count, } # ifdef DEBUG_THREADS - GC_log_printf("Suspending 0x%lx\n", (unsigned long)thread); + GC_log_printf("Suspending %p\n", (void *)thread); # endif kern_result = thread_suspend(thread); if (kern_result != KERN_SUCCESS) { @@ -465,8 +463,7 @@ GC_INNER void GC_stop_world(void) kern_return_t kern_result; # ifdef DEBUG_THREADS - GC_log_printf("Stopping the world from thread 0x%lx\n", - (unsigned long)my_thread); + GC_log_printf("Stopping the world from thread %p\n", (void *)my_thread); # endif # ifdef PARALLEL_MARK if (GC_parallel) { @@ -555,7 +552,7 @@ GC_INNER void GC_stop_world(void) # endif # ifdef DEBUG_THREADS - GC_log_printf("World stopped from 0x%lx\n", (unsigned long)my_thread); + GC_log_printf("World stopped from %p\n", (void *)my_thread); # endif mach_port_deallocate(my_task, my_thread); } @@ -572,8 +569,8 @@ GC_INLINE void GC_thread_resume(thread_act_t thread) ABORT("thread_info failed"); # endif # ifdef DEBUG_THREADS - GC_log_printf("Resuming thread 0x%lx with state %d\n", - (unsigned long)thread, info.run_state); + GC_log_printf("Resuming thread %p with state %d\n", (void *)thread, + info.run_state); # endif /* Resume the thread */ kern_result = thread_resume(thread); @@ -630,8 +627,8 @@ GC_INNER void GC_start_world(void) /* The thread is found in GC_mach_threads. */ if (GC_mach_threads[j].already_suspended) { # ifdef DEBUG_THREADS - GC_log_printf("Not resuming already suspended thread 0x%lx\n", - (unsigned long)thread); + GC_log_printf("Not resuming already suspended thread %p\n", + (void *)thread); # endif } else { GC_thread_resume(thread); |