mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-29 04:53:56 +08:00
"source", foreground execution commands, and target-async
Sourcing a GDB script that runs foreground execution commands in
succession fails if the target can async:
Breakpoint 1, main () at ../../../src/gdb/testsuite/gdb.base/source-execution.c:36
36 func1 ();
(gdb) source ../../../src/gdb/testsuite/gdb.base/source-execution.gdb
../../../src/gdb/testsuite/gdb.base/source-execution.gdb:21: Error in sourced command file:
Cannot execute this command while the selected thread is running.
(gdb) FAIL: gdb.base/source-execution.exp: source source-execution.gdb
That is, after a foreground execution command, GDB moves on to the
following command immediately before waiting for the previous command
to complete.
https://sourceware.org/ml/gdb-patches/2011-09/msg00037.html (b4a14fd0
)
addressed this for command lists, Python's gdb.execute, etc., but
missed "source". Fixed now in the same way.
gdb/
2014-03-25 Pedro Alves <palves@redhat.com>
* cli/cli-script.c (script_from_file): Force the interpreter to
sync mode.
gdb/testsuite/
2014-03-25 Pedro Alves <palves@redhat.com>
Doug Evans <dje@google.com>
* gdb.base/source-execution.c: New file.
* gdb.base/source-execution.exp: New file.
* gdb.base/source-execution.gdb: New file.
This commit is contained in:
parent
c955de363b
commit
d3839ede05
@ -1,3 +1,8 @@
|
||||
2014-03-25 Pedro Alves <palves@redhat.com>
|
||||
|
||||
* cli/cli-script.c (script_from_file): Force the interpreter to
|
||||
sync mode.
|
||||
|
||||
2014-03-24 Pierre Langlois <pierre.langlois@embecosm.com>
|
||||
|
||||
* avr-tdep.c (avr_scan_prologue): Accept push r1 instruction for
|
||||
|
@ -1667,6 +1667,9 @@ script_from_file (FILE *stream, const char *file)
|
||||
source_line_number = 0;
|
||||
source_file_name = file;
|
||||
|
||||
make_cleanup_restore_integer (&interpreter_async);
|
||||
interpreter_async = 0;
|
||||
|
||||
{
|
||||
volatile struct gdb_exception e;
|
||||
|
||||
|
@ -1,3 +1,10 @@
|
||||
2014-03-25 Pedro Alves <palves@redhat.com>
|
||||
Doug Evans <dje@google.com>
|
||||
|
||||
* gdb.base/source-execution.c: New file.
|
||||
* gdb.base/source-execution.exp: New file.
|
||||
* gdb.base/source-execution.gdb: New file.
|
||||
|
||||
2014-03-24 Doug Evans <dje@google.com>
|
||||
|
||||
* gdb.linespec/macro-relative.exp: Mark the test as unsupported if
|
||||
|
41
gdb/testsuite/gdb.base/source-execution.c
Normal file
41
gdb/testsuite/gdb.base/source-execution.c
Normal file
@ -0,0 +1,41 @@
|
||||
/* This testcase is part of GDB, the GNU debugger.
|
||||
|
||||
Copyright 2014 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/>. */
|
||||
|
||||
static void
|
||||
func1 (void)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
func2 (void)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
func3 (void)
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
func1 ();
|
||||
func2 ();
|
||||
func3 ();
|
||||
|
||||
return 0;
|
||||
}
|
33
gdb/testsuite/gdb.base/source-execution.exp
Normal file
33
gdb/testsuite/gdb.base/source-execution.exp
Normal file
@ -0,0 +1,33 @@
|
||||
# This testcase is part of GDB, the GNU debugger.
|
||||
|
||||
# Copyright 2014 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 sourcing a script that runs execution commands.
|
||||
|
||||
standard_testfile
|
||||
|
||||
if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
|
||||
return -1
|
||||
}
|
||||
|
||||
if ![runto_main] then {
|
||||
fail "Can't run to main"
|
||||
return 0
|
||||
}
|
||||
|
||||
gdb_test "source ${srcdir}/${subdir}/source-execution.gdb" \
|
||||
"func2.*func3.*" \
|
||||
"source source-execution.gdb"
|
21
gdb/testsuite/gdb.base/source-execution.gdb
Normal file
21
gdb/testsuite/gdb.base/source-execution.gdb
Normal file
@ -0,0 +1,21 @@
|
||||
# This testcase is part of GDB, the GNU debugger.
|
||||
#
|
||||
# Copyright 2014 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/>.
|
||||
|
||||
# A couple synchronous execution commands in succession, to make sure
|
||||
# GDB waits for the first to complete before moving to the second.
|
||||
next
|
||||
next
|
Loading…
Reference in New Issue
Block a user