码迷,mamicode.com
首页 > 其他好文 > 详细

使用gdb的watch机制

时间:2018-03-17 23:25:53      阅读:955      评论:0      收藏:0      [点我收藏+]

标签:form   zed   代码   debug   $2   link   print   tar   tree   

测试代码: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机制

标签:form   zed   代码   debug   $2   link   print   tar   tree   

原文地址:https://www.cnblogs.com/honpey/p/8593167.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!