mirror of
https://github.com/clearlinux/graphene.git
synced 2026-09-06 22:01:29 +00:00
[LibOS] Print exec name alongside PID in the logs
This commit is contained in:
@@ -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) \
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user