diff options
author | Phil Muldoon <pmuldoon@redhat.com> | 2013-11-07 12:04:45 +0000 |
---|---|---|
committer | Phil Muldoon <pmuldoon@redhat.com> | 2013-11-07 12:04:45 +0000 |
commit | f76c27b5bdd446964d9920464b2f761ae7a4f62a (patch) | |
tree | c0cd5e6ac770344136b01613ddd756710393a27a /gdb/python | |
parent | d52cd232cb3a7a9f6e6857110d9119c1675d2d32 (diff) | |
download | gdb-f76c27b5bdd446964d9920464b2f761ae7a4f62a.zip gdb-f76c27b5bdd446964d9920464b2f761ae7a4f62a.tar.gz gdb-f76c27b5bdd446964d9920464b2f761ae7a4f62a.tar.bz2 |
2013-11-07 Phil Muldoon <pmuldoon@redhat.com>
* python/py-breakpoint.c (bppy_get_temporary): New function.
(bppy_init): New keyword: temporary. Parse it and set breakpoint
to temporary if True.
2013-11-07 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-breakpoint.exp: Add temporary breakpoint tests.
2013-11-07 Phil Muldoon <pmuldoon@redhat.com>
* gdb.texinfo (Breakpoints In Python): Document temporary
option in breakpoint constructor, and add documentation to the
temporary attribute.
Diffstat (limited to 'gdb/python')
-rw-r--r-- | gdb/python/py-breakpoint.c | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c index 87f1fdc..e83471e 100644 --- a/gdb/python/py-breakpoint.c +++ b/gdb/python/py-breakpoint.c @@ -529,6 +529,23 @@ bppy_get_visibility (PyObject *self, void *closure) Py_RETURN_TRUE; } +/* Python function to determine if the breakpoint is a temporary + breakpoint. */ + +static PyObject * +bppy_get_temporary (PyObject *self, void *closure) +{ + breakpoint_object *self_bp = (breakpoint_object *) self; + + BPPY_REQUIRE_VALID (self_bp); + + if (self_bp->bp->disposition == disp_del + || self_bp->bp->disposition == disp_del_at_next_stop) + Py_RETURN_TRUE; + + Py_RETURN_FALSE; +} + /* Python function to get the breakpoint's number. */ static PyObject * bppy_get_number (PyObject *self, void *closure) @@ -594,16 +611,20 @@ bppy_get_ignore_count (PyObject *self, void *closure) static int bppy_init (PyObject *self, PyObject *args, PyObject *kwargs) { - static char *keywords[] = { "spec", "type", "wp_class", "internal", NULL }; + static char *keywords[] = { "spec", "type", "wp_class", "internal", + "temporary", NULL }; const char *spec; int type = bp_breakpoint; int access_type = hw_write; PyObject *internal = NULL; + PyObject *temporary = NULL; int internal_bp = 0; + int temporary_bp = 0; volatile struct gdb_exception except; - if (! PyArg_ParseTupleAndKeywords (args, kwargs, "s|iiO", keywords, - &spec, &type, &access_type, &internal)) + if (! PyArg_ParseTupleAndKeywords (args, kwargs, "s|iiOO", keywords, + &spec, &type, &access_type, + &internal, &temporary)) return -1; if (internal) @@ -613,6 +634,13 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs) return -1; } + if (temporary != NULL) + { + temporary_bp = PyObject_IsTrue (temporary); + if (temporary_bp == -1) + return -1; + } + bppy_pending_object = (breakpoint_object *) self; bppy_pending_object->number = -1; bppy_pending_object->bp = NULL; @@ -629,7 +657,7 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs) create_breakpoint (python_gdbarch, copy, NULL, -1, NULL, 0, - 0, bp_breakpoint, + temporary_bp, bp_breakpoint, 0, AUTO_BOOLEAN_TRUE, &bkpt_breakpoint_ops, @@ -973,6 +1001,8 @@ or None if no condition set."}, "Type of breakpoint."}, { "visible", bppy_get_visibility, NULL, "Whether the breakpoint is visible to the user."}, + { "temporary", bppy_get_temporary, NULL, + "Whether this breakpoint is a temporary breakpoint."}, { NULL } /* Sentinel. */ }; |