mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-03 01:38:30 +00:00
Improve backtraces
We're now able to rewind the instruction pointer in x86 backtraces. This helps ensure addr2line cannot print information about unrelated adjacent code. I've restored -fno-schedule-insns2 in most cases because it really does cause unpredictable breakage for backtraces.
This commit is contained in:
parent
cd672e251f
commit
9b6718ac99
11 changed files with 118 additions and 24 deletions
|
@ -24,6 +24,8 @@
|
|||
#include "libc/dce.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/fmt/itoa.h"
|
||||
#include "libc/intrin/describebacktrace.internal.h"
|
||||
#include "libc/intrin/iscall.internal.h"
|
||||
#include "libc/intrin/kprintf.h"
|
||||
#include "libc/intrin/promises.internal.h"
|
||||
#include "libc/intrin/weaken.h"
|
||||
|
@ -112,6 +114,8 @@ static int PrintBacktraceUsingAddr2line(int fd, const struct StackFrame *bp) {
|
|||
--gi;
|
||||
} while ((addr = garbage->p[gi].ret) == (uintptr_t)_weaken(__gc));
|
||||
}
|
||||
if (!kisdangerous((const unsigned char *)addr))
|
||||
addr -= __is_call((const unsigned char *)addr);
|
||||
#endif
|
||||
argv[i++] = buf + j;
|
||||
buf[j++] = '0';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue