Browse Source

Fix numeric base confusion in pid printing (#120)

Michał Kowalczyk 6 years ago
parent
commit
15c2950e0a
3 changed files with 5 additions and 5 deletions
  1. 3 3
      LibOS/shim/include/shim_internal.h
  2. 1 1
      LibOS/shim/src/shim_init.c
  3. 1 1
      LibOS/shim/src/utils/printf.c

+ 3 - 3
LibOS/shim/include/shim_internal.h

@@ -70,9 +70,9 @@ void debug_puts (const char * str);
 void debug_putch (int ch);
 void debug_vprintf (const char * fmt, va_list * ap);
 
-# define VMID_PREFIX     "[P%04u] "
-# define TID_PREFIX      "[%-5u] "
-# define NOID_PREFIX     "[     ] "
+# define VMID_PREFIX     "[P%05u] "
+# define TID_PREFIX      "[%-6u] "
+# define NOID_PREFIX     "[      ] "
 # define debug(fmt, ...)                                                    \
     do {                                                                    \
         if (debug_handle)                                                   \

+ 1 - 1
LibOS/shim/src/shim_init.c

@@ -1135,7 +1135,7 @@ int shim_clean (void)
         DkObjectClose(shim_stdio);
 
     shim_stdio = NULL;
-    debug("process %u successfully terminated\n", cur_process.vmid);
+    debug("process %u successfully terminated\n", cur_process.vmid & 0xFFFF);
     master_lock();
     DkProcessExit(cur_process.exit_code);
     return 0;

+ 1 - 1
LibOS/shim/src/utils/printf.c

@@ -138,7 +138,7 @@ void debug_setprefix (shim_tcb_t * tcb)
         fprintfmt(debug_fputch, NULL, buf, TID_PREFIX, tcb->tid);
     else if (cur_process.vmid)
         fprintfmt(debug_fputch, NULL, buf, VMID_PREFIX,
-                  cur_process.vmid % 10000);
+                  cur_process.vmid & 0xFFFF);
     else
         fprintfmt(debug_fputch, NULL, buf, NOID_PREFIX);