This patch adds a "pending" attribute to gdb.Breakpoint.
Built and regtested on x86-64 Fedora 23.
2016-07-13 Tom Tromey <tom@tromey.com>
PR python/17698:
* NEWS: Update.
* python/py-breakpoint.c (bppy_get_pending): New function.
(breakpoint_object_getset): Add entry for "pending".
* breakpoint.h (pending_breakpoint_p): Declare.
* breakpoint.c (pending_breakpoint_p): New function.
2016-07-13 Tom Tromey <tom@tromey.com>
PR python/17698:
* python.texi (Breakpoints In Python): Document
Breakpoint.pending.
2016-07-13 Tom Tromey <tom@tromey.com>
PR python/17698:
* gdb.python/py-breakpoint.exp (test_bkpt_basic): Add "pending"
test.
(test_watchpoints): Likewise.
(test_bkpt_pending): New proc.
+2016-07-13 Tom Tromey <tom@tromey.com>
+
+ PR python/17698:
+ * NEWS: Update.
+ * python/py-breakpoint.c (bppy_get_pending): New function.
+ (breakpoint_object_getset): Add entry for "pending".
+ * breakpoint.h (pending_breakpoint_p): Declare.
+ * breakpoint.c (pending_breakpoint_p): New function.
+
2016-07-13 Tom Tromey <tom@tromey.com>
* python/py-breakpoint.c (bppy_get_visibility)
Start a new user interface instance running INTERP as interpreter,
using the TTY file for input/output.
+* Python Scripting
+
+ ** gdb.Breakpoint objects have a new attribute "pending", which
+ indicates whether the breakpoint is pending.
+
* Support for tracepoints and fast tracepoints on s390-linux and s390x-linux
was added in GDBserver, including JIT compiling fast tracepoint's
conditional expression bytecode into native code.
return b->number > 0;
}
+/* See breakpoint.h. */
+
+int
+pending_breakpoint_p (struct breakpoint *b)
+{
+ return b->loc == NULL;
+}
+
/* Print information on user settable breakpoint (watchpoint, etc)
number BNUM. If BNUM is -1 print all user-settable breakpoints.
If ALLFLAG is non-zero, include non-user-settable breakpoints. If
extern int user_breakpoint_p (struct breakpoint *);
+/* Return true if this breakpoint is pending, false if not. */
+extern int pending_breakpoint_p (struct breakpoint *);
+
/* Attempt to determine architecture of location identified by SAL. */
extern struct gdbarch *get_sal_arch (struct symtab_and_line sal);
+2016-07-13 Tom Tromey <tom@tromey.com>
+
+ PR python/17698:
+ * python.texi (Breakpoints In Python): Document
+ Breakpoint.pending.
+
2016-07-13 Tom Tromey <tom@tromey.com>
* python.texi (Breakpoints In Python): Move table of types and
@code{silent} attribute.
@end defvar
+@defvar Breakpoint.pending
+This attribute is @code{True} if the breakpoint is pending, and
+@code{False} otherwise. @xref{Set Breaks}. This attribute is
+read-only.
+@end defvar
+
@anchor{python_breakpoint_thread}
@defvar Breakpoint.thread
If the breakpoint is thread-specific, this attribute holds the
Py_RETURN_FALSE;
}
+/* Python function to determine if the breakpoint is a pending
+ breakpoint. */
+
+static PyObject *
+bppy_get_pending (PyObject *self, void *closure)
+{
+ gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
+
+ BPPY_REQUIRE_VALID (self_bp);
+
+ if (is_watchpoint (self_bp->bp))
+ Py_RETURN_FALSE;
+ if (pending_breakpoint_p (self_bp->bp))
+ Py_RETURN_TRUE;
+
+ Py_RETURN_FALSE;
+}
+
/* Python function to get the breakpoint's number. */
static PyObject *
bppy_get_number (PyObject *self, void *closure)
"Whether the breakpoint is visible to the user."},
{ "temporary", bppy_get_temporary, NULL,
"Whether this breakpoint is a temporary breakpoint."},
+ { "pending", bppy_get_pending, NULL,
+ "Whether this breakpoint is a pending breakpoint."},
{ NULL } /* Sentinel. */
};
+2016-07-13 Tom Tromey <tom@tromey.com>
+
+ PR python/17698:
+ * gdb.python/py-breakpoint.exp (test_bkpt_basic): Add "pending"
+ test.
+ (test_watchpoints): Likewise.
+ (test_bkpt_pending): New proc.
+
2016-07-13 Tom Tromey <tom@tromey.com>
PR cli/18053:
"<gdb.Breakpoint object at $hex>" "Check obj exists @main"
gdb_test "python print (blist\[0\].location)" \
"main." "Check breakpoint location @main"
+ gdb_test "python print (blist\[0\].pending)" "False" \
+ "Check pending status of main breakpoint"
set mult_line [gdb_get_line_number "Break at multiply."]
gdb_breakpoint ${mult_line}
gdb_py_test_silent_cmd "python wp1 = gdb.Breakpoint (\"result\", type=gdb.BP_WATCHPOINT, wp_class=gdb.WP_WRITE )" \
"Set watchpoint" 0
+ gdb_test "python print (wp1.pending)" "False"
gdb_test "continue" \
".*\[Ww\]atchpoint.*result.*Old value = 0.*New value = 25.*main.*" \
"Test watchpoint write"
".*Breakpoint ($decimal)+ at .*$srcfile, line ($decimal)+\."
}
+proc test_bkpt_pending {} {
+ delete_breakpoints
+ gdb_breakpoint "nosuchfunction" allow-pending
+ gdb_test "python print (gdb.breakpoints()\[0\].pending)" "True" \
+ "Check pending status of pending breakpoint"
+}
+
test_bkpt_basic
test_bkpt_deletion
test_bkpt_cond_and_cmds
test_bkpt_eval_funcs
test_bkpt_temporary
test_bkpt_address
+test_bkpt_pending