mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 05:42:29 +00:00
Fine tune crash reports for llama.com
This commit is contained in:
parent
1f2a5a8fc1
commit
ca19ecf49c
2 changed files with 20 additions and 11 deletions
|
@ -16,6 +16,7 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "ape/sections.internal.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/struct/rusage.internal.h"
|
||||
#include "libc/calls/struct/siginfo.h"
|
||||
|
@ -55,6 +56,10 @@ struct Buffer {
|
|||
int i;
|
||||
};
|
||||
|
||||
static bool IsCode(uintptr_t p) {
|
||||
return _base <= (uint8_t *)p && (uint8_t *)p < _etext;
|
||||
}
|
||||
|
||||
static void Append(struct Buffer *b, const char *fmt, ...) {
|
||||
va_list va;
|
||||
va_start(va, fmt);
|
||||
|
@ -224,18 +229,19 @@ relegated void __oncrash_arm64(int sig, struct siginfo *si, void *arg) {
|
|||
Append(b, "\n");
|
||||
|
||||
// PRINT LINKED LOCATION
|
||||
pc = ctx->uc_mcontext.regs[30];
|
||||
Append(b, " %016lx sp %lx lr", ctx->uc_mcontext.sp, pc);
|
||||
if (pc && (symbol = __get_symbol(st, pc))) {
|
||||
addend = pc - st->addr_base;
|
||||
addend -= st->symbols[symbol].x;
|
||||
Append(b, " ");
|
||||
if (!AppendFileLine(b, addr2line, debugbin, pc)) {
|
||||
Append(b, "%s", __get_symbol_name(st, symbol));
|
||||
if (addend) Append(b, "%+d", addend);
|
||||
if (IsCode((pc = ctx->uc_mcontext.regs[30]))) {
|
||||
Append(b, " %016lx sp %lx lr", ctx->uc_mcontext.sp, pc);
|
||||
if (pc && (symbol = __get_symbol(st, pc))) {
|
||||
addend = pc - st->addr_base;
|
||||
addend -= st->symbols[symbol].x;
|
||||
Append(b, " ");
|
||||
if (!AppendFileLine(b, addr2line, debugbin, pc)) {
|
||||
Append(b, "%s", __get_symbol_name(st, symbol));
|
||||
if (addend) Append(b, "%+d", addend);
|
||||
}
|
||||
}
|
||||
Append(b, "\n");
|
||||
}
|
||||
Append(b, "\n");
|
||||
|
||||
// PRINT FRAME POINTERS
|
||||
fp = (struct StackFrame *)ctx->uc_mcontext.regs[29];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue