API confusion re: watchpoints

Christian Convey christian.convey@gmail.com
Thu Jul 28 17:38:00 GMT 2016


I'm new to gdb's Python API, and I was hoping someone could clarify
watchpoints for me...

Question 1:
I'm defining my own subclass of 'gdb.Breakpoint' (initialized to be a
watchpoint).  I'd like to perform some processing every time its
expression becomes invalid.  I.e., every time gdb would print the
message "Watchpoint n deleted because the program has left the block
in which its expression is valid."

Does the Python API give me a way to run code at those times?

Question 2:
The documentation for 'gdb.Breakpoint.delete()' warns that once that
method is called, it's not valid to call any other method on that
object.  My question is: will gdb ever call that method itself, or
will that method only get called if some user/script explicitly does
it explicitly?

My concern is that if gdb automatically deletes its internal version
of a watchpoint object when the watched expression becomes invalid, I
might find the corresponding gdb.Breakpoint object becoming unusable
without warning.

Thanks,
Christian



More information about the Gdb mailing list