开发者

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

开发者 https://www.devze.com 2023-03-10 06:56 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: Can 开发者_开发问答I set a breakpoint on 'memory access' in GDB?
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

精彩评论

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

关注公众号