问题描述
可能重复:结果
我在内存中的特定位置,这是获得损坏,我希望能够清楚地看到,当事情写入该位置。有什么办法,我可以对内存访问GDB突破到特定的地址?
I have a specific location in memory that is getting corrupted, and I'd like to be able to see exactly when things write to that location. Is there any way that I can make gdb break on memory access to that particular address?
推荐答案
是结果
使用观察点:结果
看 - 只有打破写上(且仅当值的变化)结果
rwatch - 在阅读休息,和结果
awatch - 在读/写符
Yes.
Using Watchpoints:
watch - only breaks on write (and only if the value changes)
rwatch - breaks on read, and
awatch - breaks on read/write.
这是一些网络资源的更详细的介绍:
A more detailed brief from some internet sources:
看的结果
手表是设置数据断点,如果存储在指定位置的变化,这将阻止程序的执行GDB的方式。
watch
watch is gdb’s way of setting data breakpoints which will halt the execution of a program if memory changes at the specified location.
监视断点,可以在变量名或地址位置进行设置。
watch breakpoints can either be set on the variable name or any address location.
watch my_variable
watch *0x12345678
where 0x12345678 is a valid address.
rwatch 的结果
当程序试图从一个变量或内存位置读rwatch(读表)断点突破code的执行。
rwatch
rwatch (read-watch) breakpoints break the execution of code when the program tries to read from a variable or memory location.
rwatch iWasAccessed
rwatch *0x12345678
where 0x12345678 is a valid address.
awatch 的结果
如果一个变量或存储器位置写入或读取awatch或接入手表中断程序的执行。综上所述,awatches是手表和rwatches尽在其中。它创建不是两个独立的个断点的简便方式。
awatch
awatch or access watches break execution of the program if a variable or memory location is written to or read from. In summary, awatches are watches and rwatches all in one. It is a handy way of creating one breakpoint than two separate ones.
awatch *0x12345678
where 0x12345678 is a valid address.
这篇关于我可以对读GDB中断/从地址写?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!