'Print out argument with GDB in the end if function

When I debug with GDB a Linux process I put a breakpoint in function

b 0xabcd

This function got an register r1 as argument and in the end of function it will store a value that I want to print

What is the right way to save the address of that register and print it on the end of function?



Solution 1:[1]

What is the right way to save the address of that register

Registers don't have an address (they aren't in memory, that's what makes them registers to begin with), so you can't.

and print it on the end of function?

See this answer on how to print the result of function execution. You would need to modify the example a bit from x86_64 to arm.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Employed Russian