app_error_fault_handler line and PC zero when NDEBUG

I was trying to debug an issue with a release build on our firmware. I modified app_error_fault_handler inverting the NDEBUG logic so that the error code, line number and PC were printed.

However, I don't get the line number of PC:

<error> app: ERROR 12 [NRF_ERROR_DATA_SIZE] at :0
PC at: 0x00000000
<error> app: End of error report

I assume this is due to optimisation somewhere, is it possible to modify the project to include the line and PC in a release build?

Working with SES and nRF SDK 17.1.0, removed my copy of app_error_fault_handler and reverted to app_error.weak.c's implementation, same behaviour.

Related