diff --git a/LibOS/shim/include/shim_internal.h b/LibOS/shim/include/shim_internal.h index 06b99e60..c788d61d 100644 --- a/LibOS/shim/include/shim_internal.h +++ b/LibOS/shim/include/shim_internal.h @@ -64,9 +64,6 @@ void debug_puts (const char * str); void debug_putch (int ch); void debug_vprintf (const char * fmt, va_list ap) __attribute__((format (printf, 1, 0))); -#define VMID_PREFIX "[P%05u] " -#define TID_PREFIX "[%-6u] " -#define NOID_PREFIX "[ ] " #define debug(fmt, ...) \ do { \ if (debug_handle) \ diff --git a/LibOS/shim/src/utils/printf.c b/LibOS/shim/src/utils/printf.c index 316df886..1948c8b5 100644 --- a/LibOS/shim/src/utils/printf.c +++ b/LibOS/shim/src/utils/printf.c @@ -103,12 +103,16 @@ void debug_setprefix(shim_tcb_t* tcb) { struct debug_buf* buf = tcb->debug_buf; buf->start = buf->end = 0; + const char* exec = PAL_CB(executable); + for (const char* it = exec; *it; it++) + if (*it == ':' || *it == '/') + exec = it + 1; if (tcb->tid && !is_internal_tid(tcb->tid)) - fprintfmt(debug_fputch, NULL, buf, TID_PREFIX, tcb->tid); + fprintfmt(debug_fputch, NULL, buf, "[%u:%s] ", tcb->tid, exec); else if (cur_process.vmid) - fprintfmt(debug_fputch, NULL, buf, VMID_PREFIX, cur_process.vmid & 0xFFFF); + fprintfmt(debug_fputch, NULL, buf, "[P%u:%s] ", cur_process.vmid & 0xFFFF, exec); else - fprintfmt(debug_fputch, NULL, buf, NOID_PREFIX); + fprintfmt(debug_fputch, NULL, buf, "[%s] ", exec); buf->start = buf->end; }