I wanted to understand how arm link register works and how is it helpful in debugging. I started by writing a simple function.
#define MACRO_TEST() (event_log__add_args(MACRO_TEST,__return_address()))
static void do_print_r14(void) {
printf_all("return address 0x%08X \n",__return_address()); //prints 0x823194BB
MACRO_TEST();
printf_all("return address 0x%08X \n",__return_address()); //prints 0x823194BB
}
The event log prints the following : Return Address: 0x0000ABAB
My question is why the prints in the do_print_r14 function prints the same value. Wouldn't it be more helpful if I just login the Line number and function name , that will point to the exact location of the code. Why do developers use r14 in debugging?
This question might sound very basic to you all but I am not at all sure why we need r14 register.