Can my app arrange a gdb breakpoint or watch?

Posted by Larry Gritz on Stack Overflow See other posts from Stack Overflow or by Larry Gritz
Published on 2010-04-18T22:34:10Z Indexed on 2010/04/18 22:43 UTC
Read the original article Hit count: 239

Filed under:
|
|
|

Is there a way for my code to be instrumented to insert a break point or watch on a memory location that will be honored by gdb? (And presumably have no effect when gdb is not attached.)

I know how to do such things as gdb commands within the gdb session, but for certain types of debugging it would be really handy to do it "programmatically", if you know what I mean -- for example, the bug only happens with a particular circumstance, not any of the first 11,024 times the crashing routine is called, or the first 43,028,503 times that memory location is modified, so setting a simple break point on the routine or watch point on the variable is not helpful -- it's all false positives.

I'm concerned mostly about Linux, but curious about if similar solutions exist for OS X (or Windows, though obviously not with gdb).

© Stack Overflow or respective owner

Related posts about gdb

Related posts about c