@@ -57,7 +57,7 @@ static mbed_error_ctx first_error_ctx = {0};
57
57
static mbed_error_ctx last_error_ctx = {0 };
58
58
static mbed_error_hook_t error_hook = NULL ;
59
59
static void print_error_report (mbed_error_ctx * ctx , const char * );
60
- static mbed_error_status_t handle_error (mbed_error_status_t error_status , unsigned int error_value , const char * filename , int line_number );
60
+ 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 );
61
61
62
62
//Helper function to halt the system
63
63
static void mbed_halt_system (void )
@@ -82,7 +82,7 @@ WEAK void error(const char *format, ...)
82
82
}
83
83
84
84
//Call handle_error/print_error_report permanently setting error_in_progress flag
85
- handle_error (MBED_ERROR_UNKNOWN , 0 , NULL , 0 );
85
+ handle_error (MBED_ERROR_UNKNOWN , 0 , NULL , 0 , MBED_CALLER_ADDR () );
86
86
ERROR_REPORT (& last_error_ctx , "Fatal Run-time error" );
87
87
error_in_progress = 1 ;
88
88
@@ -96,7 +96,7 @@ WEAK void error(const char *format, ...)
96
96
}
97
97
98
98
//Set an error status with the error handling system
99
- static mbed_error_status_t handle_error (mbed_error_status_t error_status , unsigned int error_value , const char * filename , int line_number )
99
+ 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 )
100
100
{
101
101
mbed_error_ctx current_error_ctx ;
102
102
@@ -123,7 +123,7 @@ static mbed_error_status_t handle_error(mbed_error_status_t error_status, unsign
123
123
memset (& current_error_ctx , sizeof (mbed_error_ctx ), 0 );
124
124
//Capture error information
125
125
current_error_ctx .error_status = error_status ;
126
- current_error_ctx .error_address = (uint32_t )MBED_CALLER_ADDR () ;
126
+ current_error_ctx .error_address = (uint32_t )caller ;
127
127
current_error_ctx .error_value = error_value ;
128
128
#ifdef MBED_CONF_RTOS_PRESENT
129
129
//Capture thread info
@@ -193,14 +193,14 @@ int mbed_get_error_count(void)
193
193
//Sets a fatal error
194
194
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 )
195
195
{
196
- return handle_error (error_status , error_value , filename , line_number );
196
+ return handle_error (error_status , error_value , filename , line_number , MBED_CALLER_ADDR () );
197
197
}
198
198
199
199
//Sets a fatal error, this function is marked WEAK to be able to override this for some tests
200
200
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 )
201
201
{
202
202
//set the error reported and then halt the system
203
- if (MBED_SUCCESS != handle_error (error_status , error_value , filename , line_number )) {
203
+ if (MBED_SUCCESS != handle_error (error_status , error_value , filename , line_number , MBED_CALLER_ADDR () )) {
204
204
return MBED_ERROR_FAILED_OPERATION ;
205
205
}
206
206
0 commit comments