libdragon icon indicating copy to clipboard operation
libdragon copied to clipboard

backtrace.c doesn't handle correctly 64-bit addresses

Open rasky opened this issue 1 year ago • 0 comments

Currently, the back trace code in backtrace.c is designed for 32-bit addresses. All registers like $ra, $fp are tracked only as 32-bit addresses. It would have to be reworked to work in a full 64-bit context.

Notice that the stack is probably forced by the ABI to be a 32-bit address, as variables on the stack must be accessed with C pointers. I'm not sure about the code. Probably we have the same problem because of C function pointers.

Probably the only case that would make sense to handle is when the code is jumping to a corrupted 64-bit address (corrupted register), so that we show the full address in the exception screen / backtrace.

rasky avatar Feb 12 '24 13:02 rasky