Implement crash reporting for AARCH64

The ShowCrashReports() feature for aarch64 should work even better than
the x86 crash reports. Thanks to the benefit of hindsight these reports
should be rock solid reliable and beautiful to read.

This change also improves the syscall polyfills for aarch64. Some of the
sys_foo() functions have been removed, usually because they're legacy or
downright footguns not worth building.
This commit is contained in:
Justine Tunney 2023-05-12 05:47:54 -07:00
parent 285e8a2348
commit 1f2a5a8fc1
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
42 changed files with 540 additions and 247 deletions

View file

@ -67,25 +67,33 @@ noinstrument noasan int PrintBacktraceUsingSymbols(int fd,
break;
}
addr = frame->addr;
if (!addr) break;
if (addr == (intptr_t)_weaken(__gc)) {
do {
--gi;
} while ((addr = garbage->p[gi].ret) == (intptr_t)_weaken(__gc));
}
/*
* we subtract one to handle the case of noreturn functions with a
* call instruction at the end, since %rip in such cases will point
* to the start of the next function. generally %rip always points
* to the byte after the instruction. one exception is in case like
* __restore_rt where the kernel creates a stack frame that points
* to the beginning of the function.
*/
if ((symbol = __get_symbol(st, addr - 1)) != -1 ||
(symbol = __get_symbol(st, addr - 0)) != -1) {
addend = addr - st->addr_base;
addend -= st->symbols[symbol].x;
if (addr) {
if (
#ifdef __x86_64__
/*
* we subtract one to handle the case of noreturn functions
* with a call instruction at the end, since %rip in such
* cases will point to the start of the next function.
* generally %rip always points to the byte after the
* instruction. one exception is in case like __restore_rt
* where the kernel creates a stack frame that points to the
* beginning of the function.
*/
(symbol = __get_symbol(st, addr - 1)) != -1 ||
#endif
(symbol = __get_symbol(st, addr)) != -1) {
addend = addr - st->addr_base;
addend -= st->symbols[symbol].x;
} else {
addend = 0;
}
} else {
symbol = 0;
addend = 0;
}
kprintf("%012lx %lx %s%+d\n", frame, addr, __get_symbol_name(st, symbol),