bug 556948 - suspend NSPR test fails on Android. Patch by Alex Pakhotin <alexp@mozilla.com>, r=ted
authorted.mielczarek%gmail.com
Fri, 24 Sep 2010 18:14:40 +0000
changeset 4276 4387d02de4a5470e61b6a1000a116a7e9c8ab14c
parent 4275 599ac415c10d090e7ec77cd3948e418d20148994
child 4277 70bd678ab93026a41ba276c11bc90a6773be0da7
push idunknown
push userunknown
push dateunknown
reviewersted
bugs556948
bug 556948 - suspend NSPR test fails on Android. Patch by Alex Pakhotin <alexp@mozilla.com>, r=ted
pr/tests/suspend.c
--- a/pr/tests/suspend.c
+++ b/pr/tests/suspend.c
@@ -103,18 +103,19 @@ static PRStatus PR_CALLBACK print_thread
     PRInt32 words;
     PRWord *registers;
 
     printf(
         "\nprint_thread[0x%lx]: %-20s - i = %ld\n",thread, 
         (PR_GLOBAL_THREAD == PR_GetThreadScope(thread)) ?
         "PR_GLOBAL_THREAD" : "PR_LOCAL_THREAD", i);
     registers = PR_GetGCRegisters(thread, 0, (int *)&words);
-    printf("Regsters R0 = 0x%x R1 = 0x%x R2 = 0x%x R3 = 0x%x\n",
-        registers[0],registers[1],registers[2],registers[3]);
+    if (registers)
+        printf("Registers R0 = 0x%x R1 = 0x%x R2 = 0x%x R3 = 0x%x\n",
+            registers[0],registers[1],registers[2],registers[3]);
     printf("Stack Pointer = 0x%lx\n", PR_GetSP(thread));
     return PR_SUCCESS;
 }
 
 static void Level_0_Thread(PRThreadScope scope1, PRThreadScope scope2)
 {
     PRThread *thr;
     PRThread *me = PR_GetCurrentThread();
@@ -144,18 +145,19 @@ static void Level_0_Thread(PRThreadScope
             "PR_GLOBAL_THREAD" : "PR_LOCAL_THREAD",
             thr);
 
         PR_Sleep(0);
     }
     PR_SuspendAll();
     PR_EnumerateThreads(print_thread, NULL);
     registers = PR_GetGCRegisters(me, 1, (int *)&words);
-    printf("My Registers: R0 = 0x%x R1 = 0x%x R2 = 0x%x R3 = 0x%x\n",
-        registers[0],registers[1],registers[2],registers[3]);
+    if (registers)
+        printf("My Registers: R0 = 0x%x R1 = 0x%x R2 = 0x%x R3 = 0x%x\n",
+            registers[0],registers[1],registers[2],registers[3]);
     printf("My Stack Pointer = 0x%lx\n", PR_GetSP(me));
     PR_ResumeAll();
 
     /* Wait for all threads to exit */
     PR_EnterMonitor(mon);
     while (alive) {
         PR_Wait(mon, PR_INTERVAL_NO_TIMEOUT);
     }