@@ -5910,7 +5910,7 @@ create both breakpoints and watchpoints. The second accepts separate Python
arguments similar to @ref{Explicit Locations}, and can only be used to create
breakpoints.
-@defun Breakpoint.__init__ (spec @r{[}, type @r{][}, wp_class @r{][}, internal @r{][}, temporary @r{][}, qualified @r{]})
+@defun Breakpoint.__init__ (spec @r{[}, type @r{][}, wp_class @r{][}, internal @r{][}, temporary @r{][}, qualified @r{][}, announce @r{]})
Create a new breakpoint according to @var{spec}, which is a string naming the
location of a breakpoint, or an expression that defines a watchpoint. The
string should describe a location in a format recognized by the @code{break}
@@ -5940,9 +5940,15 @@ the function passed in @code{spec} as a fully-qualified name. It is equivalent
to @code{break}'s @code{-qualified} flag (@pxref{Linespec Locations} and
@ref{Explicit Locations}).
+The optional @var{announce} argument is a boolean that controls
+whether @var{GDBN} announces the existence of the breakpoint. The
+default is to announce, meaning that a message is printed. Setting
+this argument to false will suppress all output from breakpoint
+creation.
+
@end defun
-@defun Breakpoint.__init__ (@r{[} source @r{][}, function @r{][}, label @r{][}, line @r{]}, @r{][} internal @r{][}, temporary @r{][}, qualified @r{]})
+@defun Breakpoint.__init__ (@r{[} source @r{][}, function @r{][}, label @r{][}, line @r{]}, @r{][} internal @r{][}, temporary @r{][}, qualified @r{][}, announce @r{]})
This second form of creating a new breakpoint specifies the explicit
location (@pxref{Explicit Locations}) using keywords. The new breakpoint will
be created in the specified source file @var{source}, at the specified
@@ -903,7 +903,8 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
{
static const char *keywords[] = { "spec", "type", "wp_class", "internal",
"temporary","source", "function",
- "label", "line", "qualified", NULL };
+ "label", "line", "qualified",
+ "announce", nullptr };
const char *spec = NULL;
enum bptype type = bp_breakpoint;
int access_type = hw_write;
@@ -918,13 +919,15 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
char *function = NULL;
PyObject *qualified_obj = nullptr;
int qualified = 0;
+ PyObject *announce_obj = nullptr;
+ int announce = 1;
- if (!gdb_PyArg_ParseTupleAndKeywords (args, kwargs, "|siiOOsssOO", keywords,
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kwargs, "|siiOOsssOOO", keywords,
&spec, &type, &access_type,
&internal,
&temporary, &source,
&function, &label, &lineobj,
- &qualified_obj))
+ &qualified_obj, &announce_obj))
return -1;
@@ -963,6 +966,13 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
return -1;
}
+ if (announce_obj != nullptr)
+ {
+ announce = PyObject_IsTrue (announce_obj);
+ if (announce == -1)
+ return -1;
+ }
+
if (bppy_init_validate_args (spec, source, function, label, line.get (),
type) == -1)
return -1;
@@ -973,9 +983,17 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
try
{
- bppy_create_breakpoint (type, access_type, temporary_bp, internal_bp,
- spec, qualified, source, function, label,
- line.get ());
+ if (announce)
+ bppy_create_breakpoint (type, access_type, temporary_bp, internal_bp,
+ spec, qualified, source, function,
+ label, line.get ());
+ else
+ execute_fn_to_ui_file (&null_stream, [&] ()
+ {
+ bppy_create_breakpoint (type, access_type, temporary_bp,
+ internal_bp, spec, qualified,
+ source, function, label, line.get ());
+ });
}
catch (const gdb_exception &except)
{
@@ -544,7 +544,8 @@ proc_with_prefix test_bkpt_address {} {
proc_with_prefix test_bkpt_pending {} {
delete_breakpoints
- gdb_breakpoint "nosuchfunction" allow-pending
+ gdb_test_no_output "python gdb.Breakpoint(\"nosuchfunction\", announce=False)" \
+ "create pending breakpoint"
gdb_test "python print (gdb.breakpoints()\[0\].pending)" "True" \
"Check pending status of pending breakpoint"
}