开发者

How to break on access of a specific global variable in gdb? [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

Can 开发者_开发问答I set a breakpoint on 'memory access' in GDB?

I want to trace how a specific variable is initialized,

can gdb do this kind of job?


The gdb command watch <expr> sets a breakpoint on write, rwatch on read, and awatch on read or write. You can use them as you would with breakpoints, with two considerations:

  • You can't use gdb expressions in them (like $esp+...)
  • You need support for them. Software support is much, much slower than hardware. To find out if your gdb can use hardware watchpoints, see the output of show can-use-hw-watchpoints.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜