mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #7609 from bremoran/patch-2
Make location meaningful in print_error_reportpull/7620/head
commit
8292affb53
|
@ -57,7 +57,7 @@ static mbed_error_ctx first_error_ctx = {0};
|
|||
static mbed_error_ctx last_error_ctx = {0};
|
||||
static mbed_error_hook_t error_hook = NULL;
|
||||
static void print_error_report(mbed_error_ctx *ctx, const char *);
|
||||
static mbed_error_status_t handle_error(mbed_error_status_t error_status, unsigned int error_value, const char *filename, int line_number);
|
||||
static mbed_error_status_t handle_error(mbed_error_status_t error_status, unsigned int error_value, const char *filename, int line_number, void *caller);
|
||||
|
||||
//Helper function to halt the system
|
||||
static void mbed_halt_system(void)
|
||||
|
@ -82,7 +82,7 @@ WEAK void error(const char *format, ...)
|
|||
}
|
||||
|
||||
//Call handle_error/print_error_report permanently setting error_in_progress flag
|
||||
handle_error(MBED_ERROR_UNKNOWN, 0, NULL, 0);
|
||||
handle_error(MBED_ERROR_UNKNOWN, 0, NULL, 0, MBED_CALLER_ADDR());
|
||||
ERROR_REPORT(&last_error_ctx, "Fatal Run-time error");
|
||||
error_in_progress = 1;
|
||||
|
||||
|
@ -96,7 +96,7 @@ WEAK void error(const char *format, ...)
|
|||
}
|
||||
|
||||
//Set an error status with the error handling system
|
||||
static mbed_error_status_t handle_error(mbed_error_status_t error_status, unsigned int error_value, const char *filename, int line_number)
|
||||
static mbed_error_status_t handle_error(mbed_error_status_t error_status, unsigned int error_value, const char *filename, int line_number, void *caller)
|
||||
{
|
||||
mbed_error_ctx current_error_ctx;
|
||||
|
||||
|
@ -123,7 +123,7 @@ static mbed_error_status_t handle_error(mbed_error_status_t error_status, unsign
|
|||
memset(¤t_error_ctx, sizeof(mbed_error_ctx), 0);
|
||||
//Capture error information
|
||||
current_error_ctx.error_status = error_status;
|
||||
current_error_ctx.error_address = (uint32_t)MBED_CALLER_ADDR();
|
||||
current_error_ctx.error_address = (uint32_t)caller;
|
||||
current_error_ctx.error_value = error_value;
|
||||
#ifdef MBED_CONF_RTOS_PRESENT
|
||||
//Capture thread info
|
||||
|
@ -193,14 +193,14 @@ int mbed_get_error_count(void)
|
|||
//Sets a fatal error
|
||||
mbed_error_status_t mbed_warning(mbed_error_status_t error_status, const char *error_msg, unsigned int error_value, const char *filename, int line_number)
|
||||
{
|
||||
return handle_error(error_status, error_value, filename, line_number);
|
||||
return handle_error(error_status, error_value, filename, line_number, MBED_CALLER_ADDR());
|
||||
}
|
||||
|
||||
//Sets a fatal error, this function is marked WEAK to be able to override this for some tests
|
||||
WEAK mbed_error_status_t mbed_error(mbed_error_status_t error_status, const char *error_msg, unsigned int error_value, const char *filename, int line_number)
|
||||
{
|
||||
//set the error reported and then halt the system
|
||||
if (MBED_SUCCESS != handle_error(error_status, error_value, filename, line_number)) {
|
||||
if (MBED_SUCCESS != handle_error(error_status, error_value, filename, line_number, MBED_CALLER_ADDR())) {
|
||||
return MBED_ERROR_FAILED_OPERATION;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue