Bugzilla Bug 279874: use %p instead of %X to print a pointer. The patch is
authorwtchang%redhat.com
Mon, 31 Jan 2005 21:44:35 +0000
changeset 3258 0149d19f636ca5a0c2e888d5cd435969d83d10b9
parent 3256 54244d68a2ef7fd7e46a33aa4be42fca716340c5
child 3264 b394c284096911d71035b98b431249c15e542426
push idunknown
push userunknown
push dateunknown
bugs279874
Bugzilla Bug 279874: use %p instead of %X to print a pointer. The patch is contributed by Tim Ruehsen <tim.ruehsen@gmx.de>. r=wtc.
pr/src/pthreads/ptthread.c
--- a/pr/src/pthreads/ptthread.c
+++ b/pr/src/pthreads/ptthread.c
@@ -568,17 +568,17 @@ PR_IMPLEMENT(PRStatus) PR_JoinThread(PRT
         /*
          * This might be a bad address, but if it isn't, the state should
          * either be an unjoinable thread or it's already had the object
          * deleted. However, the client that called join on a detached
          * thread deserves all the rath I can muster....
          */
         PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
         PR_LogPrint(
-            "PR_JoinThread: 0x%X not joinable | already smashed\n", thred);
+            "PR_JoinThread: %p not joinable | already smashed\n", thred);
     }
     else
     {
         pthread_t id = thred->id;
         rv = pthread_join(id, &result);
         PR_ASSERT(rv == 0 && result == NULL);
         if (0 == rv)
         {
@@ -1126,17 +1126,17 @@ PR_IMPLEMENT(PRStatus) PR_EnumerateThrea
         PRThread* next = thred->next;
 
         if (_PT_IS_GCABLE_THREAD(thred))
         {
 #if !defined(_PR_DCETHREADS)
             PR_ASSERT((thred == me) || (thred->suspend & PT_THREAD_SUSPENDED));
 #endif
             PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, 
-                   ("In PR_EnumerateThreads callback thread %X thid = %X\n", 
+                   ("In PR_EnumerateThreads callback thread %p thid = %X\n", 
                     thred, thred->id));
 
             rv = func(thred, count++, arg);
             if (rv != PR_SUCCESS)
                 return rv;
         }
         thred = next;
     }
@@ -1188,17 +1188,17 @@ static void suspend_signal_handler(PRInt
 {
 	PRThread *me = PR_CurrentThread();
 
 	PR_ASSERT(me != NULL);
 	PR_ASSERT(_PT_IS_GCABLE_THREAD(me));
 	PR_ASSERT((me->suspend & PT_THREAD_SUSPENDED) == 0);
 
 	PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, 
-        ("Begin suspend_signal_handler thred %X thread id = %X\n", 
+        ("Begin suspend_signal_handler thred %p thread id = %X\n", 
 		me, me->id));
 
 	/*
 	 * save stack pointer
 	 */
 	me->sp = &me;
 
 	/* 
@@ -1236,48 +1236,48 @@ static void suspend_signal_handler(PRInt
     /*
      * At this point, thread has been resumed, so set a global condition.
      * The ResumeAll needs to know that this has really been resumed. 
      * So the signal handler sets a flag which PR_ResumeAll will reset. 
      * The PR_ResumeAll must reset this flag ...
      */
 
     PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, 
-        ("End suspend_signal_handler thred = %X tid = %X\n", me, me->id));
+        ("End suspend_signal_handler thred = %p tid = %X\n", me, me->id));
 }  /* suspend_signal_handler */
 
 static void pt_SuspendSet(PRThread *thred)
 {
     PRIntn rv;
 
     PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, 
-	   ("pt_SuspendSet thred %X thread id = %X\n", thred, thred->id));
+	   ("pt_SuspendSet thred %p thread id = %X\n", thred, thred->id));
 
 
     /*
      * Check the thread state and signal the thread to suspend
      */
 
     PR_ASSERT((thred->suspend & PT_THREAD_SUSPENDED) == 0);
 
     PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, 
-	   ("doing pthread_kill in pt_SuspendSet thred %X tid = %X\n",
+	   ("doing pthread_kill in pt_SuspendSet thred %p tid = %X\n",
 	   thred, thred->id));
 #if defined(VMS)
     rv = thread_suspend(thred);
 #else
     rv = pthread_kill (thred->id, SIGUSR2);
 #endif
     PR_ASSERT(0 == rv);
 }
 
 static void pt_SuspendTest(PRThread *thred)
 {
     PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, 
-	   ("Begin pt_SuspendTest thred %X thread id = %X\n", thred, thred->id));
+	   ("Begin pt_SuspendTest thred %p thread id = %X\n", thred, thred->id));
 
 
     /*
      * Wait for the thread to be really suspended. This happens when the
      * suspend signal handler stores the stack pointer and sets the state
      * to suspended. 
      */
 
@@ -1293,23 +1293,23 @@ static void pt_SuspendTest(PRThread *thr
     while ((thred->suspend & PT_THREAD_SUSPENDED) == 0)
     {
 		PRIntn rv = sigtimedwait(&sigwait_set, NULL, &onemillisec);
     	PR_ASSERT(-1 == rv);
 	}
 #endif
 
     PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS,
-        ("End pt_SuspendTest thred %X tid %X\n", thred, thred->id));
+        ("End pt_SuspendTest thred %p tid %X\n", thred, thred->id));
 }  /* pt_SuspendTest */
 
 static void pt_ResumeSet(PRThread *thred)
 {
     PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, 
-	   ("pt_ResumeSet thred %X thread id = %X\n", thred, thred->id));
+	   ("pt_ResumeSet thred %p thread id = %X\n", thred, thred->id));
 
     /*
      * Clear the global state and set the thread state so that it will
      * continue past yield loop in the suspend signal handler
      */
 
     PR_ASSERT(thred->suspend & PT_THREAD_SUSPENDED);
 
@@ -1324,17 +1324,17 @@ static void pt_ResumeSet(PRThread *thred
 #endif
 #endif
 
 }  /* pt_ResumeSet */
 
 static void pt_ResumeTest(PRThread *thred)
 {
     PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, 
-	   ("Begin pt_ResumeTest thred %X thread id = %X\n", thred, thred->id));
+	   ("Begin pt_ResumeTest thred %p thread id = %X\n", thred, thred->id));
 
     /*
      * Wait for the threads resume state to change
      * to indicate it is really resumed 
      */
 #if defined(PT_NO_SIGTIMEDWAIT)
     pthread_mutex_lock(&thred->suspendResumeMutex);
     while ((thred->suspend & PT_THREAD_RESUMED) == 0)
@@ -1348,17 +1348,17 @@ static void pt_ResumeTest(PRThread *thre
 		PRIntn rv = sigtimedwait(&sigwait_set, NULL, &onemillisec);
     	PR_ASSERT(-1 == rv);
 	}
 #endif
 
     thred->suspend &= ~PT_THREAD_RESUMED;
 
     PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, (
-        "End pt_ResumeTest thred %X tid %X\n", thred, thred->id));
+        "End pt_ResumeTest thred %p tid %X\n", thred, thred->id));
 }  /* pt_ResumeTest */
 
 static pthread_once_t pt_gc_support_control = PTHREAD_ONCE_INIT;
 
 PR_IMPLEMENT(void) PR_SuspendAll(void)
 {
 #ifdef DEBUG
     PRIntervalTime stime, etime;
@@ -1444,17 +1444,17 @@ PR_IMPLEMENT(void) PR_ResumeAll(void)
         PR_IntervalToMilliseconds(etime - stime)));
 #endif
 }  /* PR_ResumeAll */
 
 /* Return the stack pointer for the given thread- used by the GC */
 PR_IMPLEMENT(void *)PR_GetSP(PRThread *thred)
 {
     PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, 
-	    ("in PR_GetSP thred %X thid = %X, sp = %X \n", 
+	    ("in PR_GetSP thred %p thid = %X, sp = %p\n", 
 	    thred, thred->id, thred->sp));
     return thred->sp;
 }  /* PR_GetSP */
 
 #else /* !defined(_PR_DCETHREADS) */
 
 static pthread_once_t pt_gc_support_control = pthread_once_init;
 
@@ -1515,17 +1515,17 @@ PR_IMPLEMENT(void*)PR_GetSP(PRThread *th
 	 *     short int           field2;
 	 *     short int           field3;
 	 * where cma_t_address is typedef'd to be either void*
 	 * or char*.
 	 */
 	PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, ("Begin PR_GetSP\n"));
 	thread_tcb = (char*)tid.field1;
 	top_sp = *(char**)(thread_tcb + 128);
-	PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, ("End PR_GetSP %X \n", top_sp));
+	PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, ("End PR_GetSP %p \n", top_sp));
 	return top_sp;
 }  /* PR_GetSP */
 
 #endif /* !defined(_PR_DCETHREADS) */
 
 #endif  /* defined(_PR_PTHREADS) || defined(_PR_DCETHREADS) */
 
 /* ptthread.c */