aboutsummaryrefslogtreecommitdiff
path: root/gdb/breakpoint.c
diff options
context:
space:
mode:
authorPhil Muldoon <pmuldoon@redhat.com>2011-03-14 16:09:55 +0000
committerPhil Muldoon <pmuldoon@redhat.com>2011-03-14 16:09:55 +0000
commit7371cf6d8db5a0c04550fc95b1acc87857ac348c (patch)
tree9efe92bd981241731fcdae40a017da24e0c30ed0 /gdb/breakpoint.c
parent34e77a920a469734b88c8efc79be94be955b1029 (diff)
downloadgdb-7371cf6d8db5a0c04550fc95b1acc87857ac348c.zip
gdb-7371cf6d8db5a0c04550fc95b1acc87857ac348c.tar.gz
gdb-7371cf6d8db5a0c04550fc95b1acc87857ac348c.tar.bz2
2011-03-14 Phil Muldoon <pmuldoon@redhat.com>
* gdb.texinfo (Breakpoints In Python): Add description and example of Python stop function operation. 2010-03-14 Phil Muldoon <pmuldoon@redhat.com> * gdb.python/py-breakpoint.exp: Add Python stop operations tests. 2011-03-14 Phil Muldoon <pmuldoon@redhat.com> * python/python.h: Declare gdbpy_should_stop and gdbpy_breakpoint_has_py_cond. * python/python.c: Add python.h to includes. Remove python.h from HAVE_PYTHON definition (gdbpy_should_stop): New dummy function. (gdbpy_breakpoint_has_py_cond): New dummy function. * python/py-breakpoint.c (bppy_init): Rewrite to allow sub-classing capabilities. (gdbpy_should_stop): New function. (gdbpy_breakpoint_has_py_cond): New function. (local_setattro): New function. * breakpoint.c (condition_command): Add check for Python 'stop' operation. (bpstat_check_breakpoint_conditions): Execute Python 'stop' operation function as part of stop/continue tests.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r--gdb/breakpoint.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index d9e5b1e..c55e5c0 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -72,6 +72,7 @@
#undef savestring
#include "mi/mi-common.h"
+#include "python/python.h"
/* Arguments to pass as context to some catch command handlers. */
#define CATCH_PERMANENT ((void *) (uintptr_t) 0)
@@ -643,6 +644,14 @@ condition_command (char *arg, int from_tty)
ALL_BREAKPOINTS (b)
if (b->number == bnum)
{
+ /* Check if this breakpoint has a Python object assigned to
+ it, and if it has a definition of the "stop"
+ method. This method and conditions entered into GDB from
+ the CLI are mutually exclusive. */
+ if (b->py_bp_object
+ && gdbpy_breakpoint_has_py_cond (b->py_bp_object))
+ error (_("Cannot set a condition where a Python 'stop' "
+ "method has been defined in the breakpoint."));
set_breakpoint_condition (b, p, from_tty);
return;
}
@@ -4070,6 +4079,11 @@ bpstat_check_breakpoint_conditions (bpstat bs, ptid_t ptid)
int value_is_zero = 0;
struct expression *cond;
+ /* Evaluate Python breakpoints that have a "stop"
+ method implemented. */
+ if (b->py_bp_object)
+ bs->stop = gdbpy_should_stop (b->py_bp_object);
+
if (is_watchpoint (b))
cond = b->cond_exp;
else