🧑💻 Improve POSTMORTEM_DEBUGGING (#26374)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
@@ -55,7 +55,12 @@ static const char *UnwTabGetFunctionName(const UnwindCallbacks *cb, uint32_t add
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if ((flag_word & 0xFF000000) == 0xFF000000) {
|
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;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@@ -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)
|
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
|
// 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
|
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->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
|
frame->lr = 0xDEADBEEF; // If our handler returns (it shouldn't), let's make it trigger an exception immediately
|
||||||
|
Reference in New Issue
Block a user