0
0
Fork 0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2025-03-13 01:40:09 +00:00

🧑‍💻 Improve POSTMORTEM_DEBUGGING (#26374)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
Chris 2023-11-01 01:10:37 +01:00 committed by GitHub
parent e0767f8675
commit 41a6f2bc8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View file

@ -55,7 +55,12 @@ static const char *UnwTabGetFunctionName(const UnwindCallbacks *cb, uint32_t add
return nullptr;
if ((flag_word & 0xFF000000) == 0xFF000000) {
return (const char *)(address - 4 - (flag_word & 0x00FFFFFF));
const uint32_t fn_name_addr = address - 4 - (flag_word & 0x00FFFFFF);
// Ensure the address is readable to avoid returning a bogus pointer
uint8_t dummy = 0;
if (cb->readB(fn_name_addr, &dummy))
return (const char *)fn_name_addr;
}
return nullptr;
}

View file

@ -279,8 +279,6 @@ void CommonHandler_C(ContextStateFrame * frame, unsigned long lr, unsigned long
if (!faulted_from_exception) { // Not sure about the non_usage_fault, we want to try anyway, don't we ? && !non_usage_fault_occurred)
// Try to resume to our handler here
CFSR |= CFSR; // The ARM programmer manual says you must write to 1 all fault bits to clear them so this instruction is correct
// The frame will not be valid when returning anymore, let's clean it
savedFrame.CFSR = 0;
frame->pc = (uint32_t)resume_from_fault; // Patch where to return to
frame->lr = 0xDEADBEEF; // If our handler returns (it shouldn't), let's make it trigger an exception immediately