使用gdb的watch机制

Posted honpey

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用gdb的watch机制相关的知识,希望对你有一定的参考价值。

测试代码:https://github.com/honpey/codebox/tree/master/dlink

(gdb) watch *601030
Hardware watchpoint 2: *601030
(gdb) watch *0x601030
Hardware watchpoint 3: *0x601030
(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/hon/codebox/dlink/fun
warning: the debug information found in "/lib64/ld-2.23.so" does not match "/lib64/ld-linux-x86-64.so.2" (CRC mismatch).


Breakpoint 1, main () at fun.c:4
4        printf("hello world\n");
(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/hon/codebox/dlink/fun
warning: the debug information found in "/lib64/ld-2.23.so" does not match "/lib64/ld-linux-x86-64.so.2" (CRC mismatch).


Breakpoint 1, main () at fun.c:4
4        printf("hello world\n");
(gdb) c
Continuing.
hello world

Hardware watchpoint 3: *0x601030

Old value = 4195910
New value = -138586046
_dl_fixup (l=<optimized out>, reloc_arg=<optimized out>)
    at ../elf/dl-runtime.c:149
149    ../elf/dl-runtime.c: 没有那个文件或目录.
(gdb) p/x -138586046
$1 = 0xf7bd5842
(gdb) p sayhello
$2 = {<text variable, no debug info>} 0x7ffff7bd5842 <sayhello>
(gdb)

以上是关于使用gdb的watch机制的主要内容,如果未能解决你的问题,请参考以下文章

全角半角字符对照表

关于HTML5代码总结。

vue+vuex+axios从webpack-server获取模拟数据存入vuex并取回展示到页面

Java基础(正式上课第二天)

对称加密算法和非对称加密算法

HTML常用标签