简体   繁体   English

如果 function 最后打印出参数 GDB

[英]Print out argument with GDB in the end if function

When I debug with GDB a Linux process I put a breakpoint in function当我使用 GDB 调试 Linux 进程时,我在 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这个 function 有一个寄存器 r1 作为参数,在 function 的末尾,它将存储一个我想打印的值

What is the right way to save the address of that register and print it on the end of function?保存该寄存器地址并将其打印在 function 末尾的正确方法是什么?

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 .寄存器没有地址(它们不在 memory 中,这就是使它们以寄存器开头的原因),所以你不能

and print it on the end of function?并打印在 function 的末尾?

See this answer on how to print the result of function execution.有关如何打印 function 执行结果的信息,请参阅此答案 You would need to modify the example a bit from x86_64 to arm .您需要将示例从x86_64稍微修改为arm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM