上次把代码丢了很是郁闷,还好有gdb帮我patch程序。今天又想起来要用,竟想不起用法了,看来这人哪,记忆力是越来越有限了……
写下来备忘:
set write on
然后file 重新载入文件
然后使用地址或是变量名修改就可以了,不仅可以修改数据,代码也是一样改的,core文件也可以。
awatch — Set a watchpoint for an expression
rwatch — Set a read watchpoint for an expression
watch — Set a watchpoint for an expression
help里是这么写的,其实awatch是读写断点,内存被读或着写时都会断。而rwatch是读时断,watch 是写时断。