GDB - Setting Watchpoints

From EdWiki

Revision as of 09:31, 23 June 2015 by Jshankar (Talk | contribs) (1 revision imported: EdWiki -- Emsys pages from Shukra)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Setting Watchpoints

  • Whereas breakpoints interrupt the program at a particular line or function, watchpoints act on variables.
  • They pause the program whenever a watched variable’s value is modified. For example, the following watch command:
(gdb) watch my_var
  • Now, whenever my_var’s value is modified, the program will interrupt and print out the old and new values.