mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-18 19:03:16 +00:00
Simplify QR stacktrace (#121)
This commit is contained in:
parent
34f99205ca
commit
43714b2355
@ -14,13 +14,15 @@ std::string getUrlFromCrashData() {
|
||||
for (int i = 0; i < crash_data->callstackLength; ++i) {
|
||||
const CallstackFrame&frame = crash_data->callstack[i];
|
||||
uint32_t pc = esp_cpu_process_stack_pc(frame.pc);
|
||||
#if CRASH_DATA_INCLUDES_SP
|
||||
uint32_t sp = frame.sp;
|
||||
#endif
|
||||
stack_buffer[i * 2] = pc;
|
||||
#if CRASH_DATA_INCLUDES_SP
|
||||
stack_buffer[(i * 2) + 1] = sp;
|
||||
#endif
|
||||
}
|
||||
|
||||
assert(sizeof(CallstackFrame) == 8);
|
||||
|
||||
std::stringstream stream;
|
||||
|
||||
stream << "https://oops.bytewelder.com?";
|
||||
@ -31,8 +33,11 @@ std::string getUrlFromCrashData() {
|
||||
|
||||
for (int i = crash_data->callstackLength - 1; i >= 0; --i) {
|
||||
uint32_t pc = stack_buffer[(i * 2)];
|
||||
stream << std::hex << pc;
|
||||
#if CRASH_DATA_INCLUDES_SP
|
||||
uint32_t sp = stack_buffer[(i * 2) + 1];
|
||||
stream << std::hex << pc << std::hex << sp;
|
||||
stream << std::hex << sp;
|
||||
#endif
|
||||
}
|
||||
|
||||
free(stack_buffer);
|
||||
|
||||
@ -27,10 +27,11 @@ void __wrap_esp_panic_handler(void* info) {
|
||||
|
||||
esp_backtrace_get_start(&frame.pc, &frame.sp, &frame.next_pc);
|
||||
crashData.callstack[0].pc = frame.pc;
|
||||
#if CRASH_DATA_INCLUDES_SP
|
||||
crashData.callstack[0].sp = frame.sp;
|
||||
#endif
|
||||
crashData.callstackLength++;
|
||||
|
||||
uint32_t max_framecount = (1024 - 1) / sizeof(esp_backtrace_frame_t);
|
||||
crashData.callstackCorrupted = !(esp_stack_ptr_is_sane(frame.sp) &&
|
||||
(esp_ptr_executable((void *)esp_cpu_process_stack_pc(frame.pc)) ||
|
||||
/* Ignore the first corrupted PC in case of InstrFetchProhibited */
|
||||
@ -43,7 +44,9 @@ void __wrap_esp_panic_handler(void* info) {
|
||||
) {
|
||||
if (esp_backtrace_get_next_frame(&frame)) {
|
||||
crashData.callstack[crashData.callstackLength].pc = frame.pc;
|
||||
#if CRASH_DATA_INCLUDES_SP
|
||||
crashData.callstack[crashData.callstackLength].sp = frame.sp;
|
||||
#endif
|
||||
crashData.callstackLength++;
|
||||
} else {
|
||||
crashData.callstackCorrupted = true;
|
||||
|
||||
@ -4,11 +4,14 @@
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#define CRASH_DATA_CALLSTACK_LIMIT 32 // bytes
|
||||
#define CRASH_DATA_CALLSTACK_LIMIT 64
|
||||
#define CRASH_DATA_INCLUDES_SP false
|
||||
|
||||
struct CallstackFrame {
|
||||
uint32_t pc = 0;
|
||||
#if CRASH_DATA_INCLUDES_SP
|
||||
uint32_t sp = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct CrashData {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user