+2020-12-07 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
+
+ * main.c (catch_command_errors): Add a flag parameter; invoke
+ `bpstat_do_actions` if the flag is set.
+ (execute_cmdargs): Update a call to `catch_command_errors`.
+
2020-12-07 Tom de Vries <tdevries@suse.de>
* ada-lang.c (replace_operator_with_call): Handle shrink resize.
static int
catch_command_errors (catch_command_errors_const_ftype command,
- const char *arg, int from_tty)
+ const char *arg, int from_tty,
+ bool do_bp_actions = false)
{
try
{
command (arg, from_tty);
maybe_wait_sync_command_done (was_sync);
+
+ /* Do any commands attached to breakpoint we stopped at. */
+ if (do_bp_actions)
+ bpstat_do_actions ();
}
catch (const gdb_exception &e)
{
!batch_flag);
else if (cmdarg_p.type == cmd_type)
*ret = catch_command_errors (execute_command, cmdarg_p.string,
- !batch_flag);
+ !batch_flag, true);
}
}
+2020-12-07 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
+
+ * gdb.base/bp-cmds-run-with-ex.c: New file.
+ * gdb.base/bp-cmds-run-with-ex.exp: New file.
+ * gdb.base/bp-cmds-run-with-ex.gdb: New file.
+ * gdb.gdb/python-interrupts.exp: Update the call to
+ 'catch_command_errors' with the new argument.
+ * gdb.gdb/python-selftest.exp: Ditto.
+
2020-12-04 Simon Marchi <simon.marchi@efficios.com>
* gdb.arch/amd64-disp-step-avx.exp: Adjust pattern.
--- /dev/null
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2020 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+int
+main ()
+{
+ return 0;
+}
--- /dev/null
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2020 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test that breakpoint commands are taken into account when the
+# debuggee program is executed with a "run" command given through the
+# '-ex' option.
+
+standard_testfile
+
+if {[build_executable "failed to prepare" $testfile $srcfile]} {
+ return -1
+}
+
+set script_file $srcdir/$subdir/$testfile.gdb
+
+save_vars { GDBFLAGS } {
+ append GDBFLAGS " -x ${script_file}"
+ append GDBFLAGS " -ex run"
+ append GDBFLAGS " --args ${binfile}"
+
+ gdb_exit
+ if {[gdb_spawn] != 0} {
+ fail "spawn gdb"
+ return -1
+ }
+}
+
+gdb_test_multiple "" "execute bp commands" {
+ -re " = 123\r\n$gdb_prompt $" {
+ pass $gdb_test_name
+ }
+ -re "Don't know how to run.*$gdb_prompt $" {
+ unsupported $gdb_test_name
+ }
+}
--- /dev/null
+# Copyright 2020 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+break main
+commands
+ print 123
+end
}
gdb_breakpoint set_active_ext_lang temporary
- gdb_test "call catch_command_errors(execute_command, \"python print(5)\", 0)" \
+ gdb_test "call catch_command_errors(execute_command, \"python print(5)\", 0, true)" \
"Temporary breakpoint.*silently stop."
gdb_test "signal SIGINT" \
"KeyboardInterrupt.*Error while executing Python code."
}
gdb_test_no_output "set variable gdb_python_initialized = 0"
- gdb_test "call catch_command_errors(execute_command, \"python print(5)\", 0)" \
+ gdb_test "call catch_command_errors(execute_command, \"python print(5)\", 0, true)" \
"Python not initialized.* = 0"
return 0
}