Improve debug binary location detection

This commit is contained in:
Justine Tunney 2023-11-16 23:26:05 -08:00
parent 68c7c9c1e0
commit 7a9e176ecf
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
17 changed files with 92 additions and 50 deletions

View file

@ -22,6 +22,7 @@
#include "libc/intrin/kprintf.h"
#include "libc/log/internal.h"
#include "libc/runtime/runtime.h"
#include "libc/runtime/symbols.internal.h"
#include "libc/str/str.h"
/**
@ -46,10 +47,9 @@ relegated wontreturn void __die(void) {
strcpy(host, "unknown");
gethostname(host, sizeof(host));
kprintf("%serror: %s on %s pid %d tid %d has perished%s\n"
"cosmoaddr2line %s%s %s\n",
"cosmoaddr2line %s %s\n",
__nocolor ? "" : "\e[1;31m", program_invocation_short_name, host,
getpid(), gettid(), __nocolor ? "" : "\e[0m", __argv[0],
endswith(__argv[0], ".com") ? ".dbg" : "",
getpid(), gettid(), __nocolor ? "" : "\e[0m", FindDebugBinary(),
DescribeBacktrace(__builtin_frame_address(0)));
_Exit(77);
}