diff options
author | Mike Frysinger <vapier@gentoo.org> | 2005-07-01 00:26:56 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2005-07-01 00:26:56 +0000 |
commit | e0308acf280a75ef58fd6b8b20bf6e6e2fdc00df (patch) | |
tree | 1617d79c9ecefaeeabd47da991c64dc24ed43527 /libpthread | |
parent | 2f1c4fcdbb83534d7facb7d28150b8d87a16c8ab (diff) |
update the debug macros so they build with newer gcc versions
Diffstat (limited to 'libpthread')
-rw-r--r-- | libpthread/linuxthreads/debug.h | 8 | ||||
-rw-r--r-- | libpthread/linuxthreads/join.c | 10 | ||||
-rw-r--r-- | libpthread/linuxthreads/manager.c | 40 | ||||
-rw-r--r-- | libpthread/linuxthreads/pthread.c | 8 |
4 files changed, 36 insertions, 30 deletions
diff --git a/libpthread/linuxthreads/debug.h b/libpthread/linuxthreads/debug.h index 79acb23c0..a2ac5113a 100644 --- a/libpthread/linuxthreads/debug.h +++ b/libpthread/linuxthreads/debug.h @@ -23,13 +23,19 @@ #ifndef _PT_DEBUG_H #define _PT_DEBUG_H +#include <features.h> + +#ifdef __DODEBUG_PT__ +# define DEBUG_PT +#endif + /* include asserts for now */ #define DO_ASSERT /* define the PDEBUG macro here */ #undef PDEBUG #ifdef DEBUG_PT -# define PDEBUG(fmt, args...) __pthread_message(__FUNCTION__": " fmt, ## args) +# define PDEBUG(fmt, args...) __pthread_message("%s: " fmt, __FUNCTION__, ## args) #else # define PDEBUG(fmt, args...) /* debug switched off */ #endif diff --git a/libpthread/linuxthreads/join.c b/libpthread/linuxthreads/join.c index f6c0e602c..5aeec6a20 100644 --- a/libpthread/linuxthreads/join.c +++ b/libpthread/linuxthreads/join.c @@ -31,7 +31,7 @@ void pthread_exit(void * retval) pthread_descr self = thread_self(); pthread_descr joining; struct pthread_request request; -PDEBUG("self=%p, pid=%d\n", self, self->p_pid); + PDEBUG("self=%p, pid=%d\n", self, self->p_pid); /* Reset the cancellation flag to avoid looping if the cleanup handlers contain cancellation points */ @@ -67,7 +67,7 @@ PDEBUG("self=%p, pid=%d\n", self, self->p_pid); THREAD_SETMEM(self, p_terminated, 1); /* See if someone is joining on us */ joining = THREAD_GETMEM(self, p_joining); -PDEBUG("joining = %p, pid=%d\n", joining, joining->p_pid); + PDEBUG("joining = %p, pid=%d\n", joining, joining->p_pid); __pthread_unlock(THREAD_GETMEM(self, p_lock)); /* Restart joining thread if any */ if (joining != NULL) restart(joining); @@ -117,7 +117,7 @@ int pthread_join(pthread_t thread_id, void ** thread_return) pthread_descr th; pthread_extricate_if extr; int already_canceled = 0; -PDEBUG("\n"); + PDEBUG("\n"); /* Set up extrication interface */ extr.pu_object = handle; @@ -154,9 +154,9 @@ PDEBUG("\n"); pthread_exit(PTHREAD_CANCELED); } -PDEBUG("before suspend\n"); + PDEBUG("before suspend\n"); suspend(self); -PDEBUG("after suspend\n"); + PDEBUG("after suspend\n"); /* Deregister extrication interface */ __pthread_set_own_extricate_if(self, 0); diff --git a/libpthread/linuxthreads/manager.c b/libpthread/linuxthreads/manager.c index 11ec6f18c..204344aef 100644 --- a/libpthread/linuxthreads/manager.c +++ b/libpthread/linuxthreads/manager.c @@ -165,9 +165,9 @@ int __pthread_manager(void *arg) FD_SET (reqfd, &fd); n = select (reqfd + 1, &fd, NULL, NULL, &tv); #else -PDEBUG("before poll\n"); + PDEBUG("before poll\n"); n = poll(&ufd, 1, 2000); -PDEBUG("after poll\n"); + PDEBUG("after poll\n"); #endif /* Check for termination of the main thread */ if (getppid() == 1) { @@ -187,13 +187,13 @@ PDEBUG("after poll\n"); #endif { -PDEBUG("before __libc_read\n"); + PDEBUG("before __libc_read\n"); n = __libc_read(reqfd, (char *)&request, sizeof(request)); -PDEBUG("after __libc_read, n=%d\n", n); + PDEBUG("after __libc_read, n=%d\n", n); ASSERT(n == sizeof(request)); switch(request.req_kind) { case REQ_CREATE: -PDEBUG("got REQ_CREATE\n"); + PDEBUG("got REQ_CREATE\n"); request.req_thread->p_retcode = pthread_handle_create((pthread_t *) &request.req_thread->p_retval, request.req_args.create.attr, @@ -201,23 +201,23 @@ PDEBUG("got REQ_CREATE\n"); request.req_args.create.arg, &request.req_args.create.mask, request.req_thread->p_pid, - request.req_thread->p_report_events, - &request.req_thread->p_eventbuf.eventmask); -PDEBUG("restarting %d\n", request.req_thread); + request.req_thread->p_report_events, + &request.req_thread->p_eventbuf.eventmask); + PDEBUG("restarting %d\n", request.req_thread); restart(request.req_thread); break; case REQ_FREE: -PDEBUG("got REQ_FREE\n"); - pthread_handle_free(request.req_args.free.thread_id); + PDEBUG("got REQ_FREE\n"); + pthread_handle_free(request.req_args.free.thread_id); break; case REQ_PROCESS_EXIT: -PDEBUG("got REQ_PROCESS_EXIT from %d, exit code = %d\n", - request.req_thread, request.req_args.exit.code); + PDEBUG("got REQ_PROCESS_EXIT from %d, exit code = %d\n", + request.req_thread, request.req_args.exit.code); pthread_handle_exit(request.req_thread, request.req_args.exit.code); break; case REQ_MAIN_THREAD_EXIT: -PDEBUG("got REQ_MAIN_THREAD_EXIT\n"); + PDEBUG("got REQ_MAIN_THREAD_EXIT\n"); main_thread_exiting = 1; /* Reap children in case all other threads died and the signal handler went off before we set main_thread_exiting to 1, and therefore did @@ -233,15 +233,15 @@ PDEBUG("got REQ_MAIN_THREAD_EXIT\n"); } break; case REQ_POST: -PDEBUG("got REQ_POST\n"); + PDEBUG("got REQ_POST\n"); __new_sem_post(request.req_args.post); break; case REQ_DEBUG: -PDEBUG("got REQ_DEBUG\n"); + PDEBUG("got REQ_DEBUG\n"); /* Make gdb aware of new thread and gdb will restart the new thread when it is ready to handle the new thread. */ if (__pthread_threads_debug && __pthread_sig_debug > 0) { -PDEBUG("about to call raise(__pthread_sig_debug)\n"); + PDEBUG("about to call raise(__pthread_sig_debug)\n"); raise(__pthread_sig_debug); } case REQ_KICK: @@ -280,7 +280,7 @@ pthread_start_thread(void *arg) #ifdef INIT_THREAD_SELF INIT_THREAD_SELF(self, self->p_nr); #endif -PDEBUG("\n"); + PDEBUG("\n"); /* Make sure our pid field is initialized, just in case we get there before our father has initialized it. */ THREAD_SETMEM(self, p_pid, __getpid()); @@ -608,7 +608,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr, } if (pid == 0) { -PDEBUG("cloning new_thread = %p\n", new_thread); + PDEBUG("cloning new_thread = %p\n", new_thread); pid = clone(pthread_start_thread, (void **) new_thread, CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | __pthread_sig_cancel, new_thread); @@ -641,7 +641,7 @@ PDEBUG("cloning new_thread = %p\n", new_thread); __pthread_handles_num--; return errno; } -PDEBUG("new thread pid = %d\n", pid); + PDEBUG("new thread pid = %d\n", pid); #if 0 /* *********************************************************** @@ -783,7 +783,7 @@ static void pthread_reap_children(void) { pid_t pid; int status; -PDEBUG("\n"); + PDEBUG("\n"); while ((pid = __libc_waitpid(-1, &status, WNOHANG | __WCLONE)) > 0) { pthread_exited(pid); diff --git a/libpthread/linuxthreads/pthread.c b/libpthread/linuxthreads/pthread.c index 2615fe724..fed3d8c72 100644 --- a/libpthread/linuxthreads/pthread.c +++ b/libpthread/linuxthreads/pthread.c @@ -513,7 +513,7 @@ int __pthread_initialize_manager(void) __pthread_wait_for_restart_signal(thread_self()); } /* Synchronize debugging of the thread manager */ -PDEBUG("send REQ_DEBUG to manager thread\n"); + PDEBUG("send REQ_DEBUG to manager thread\n"); request.req_kind = REQ_DEBUG; TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, (char *) &request, sizeof(request))); @@ -540,9 +540,9 @@ int pthread_create(pthread_t *thread, const pthread_attr_t *attr, PDEBUG("write REQ_CREATE to manager thread\n"); TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, (char *) &request, sizeof(request))); -PDEBUG("before suspend(self)\n"); + PDEBUG("before suspend(self)\n"); suspend(self); -PDEBUG("after suspend(self)\n"); + PDEBUG("after suspend(self)\n"); if (THREAD_GETMEM(self, p_retcode) == 0) *thread = (pthread_t) THREAD_GETMEM(self, p_retval); return THREAD_GETMEM(self, p_retcode); @@ -577,7 +577,7 @@ pthread_descr __pthread_find_self() #ifdef DEBUG_PT if (h->h_descr == NULL) { - printf("*** "__FUNCTION__" ERROR descriptor is NULL!!!!! ***\n\n"); + printf("*** %s ERROR descriptor is NULL!!!!! ***\n\n", __FUNCTION__); _exit(1); } #endif |