1 # This testcase is part of GDB
, the GNU debugger.
3 # Copyright
2018-2019 Free Software Foundation
, Inc.
5 # This
program is free software
; you can redistribute it and
/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation
; either version
3 of the License
, or
8 #
(at your option
) any later version.
10 # This
program is distributed in the hope that it will be useful
,
11 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License
for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this
program.
If not
, see
<http
://www.gnu.org
/licenses
/>.
18 # Test backward compatibility with older GDBservers which did not
19 #
include ";thread:NNN" in T stop replies when debugging
20 # single
-threaded programs
, even though they
'd list the main thread in
21 # response to qfThreadInfo/qsThreadInfo. See PR remote/22597.
23 load_lib gdbserver-support.exp
25 if { [skip_gdbserver_tests] } {
26 verbose "skipping gdbserver tests"
31 if [prepare_for_testing "failed to prepare" $testfile $srcfile] {
35 # Make sure we're disconnected
, in case we
're testing with an
36 # extended-remote board, therefore already connected.
37 gdb_test "disconnect" ".*"
39 # Start GDBserver, with ";thread:NNN" in T stop replies disabled,
40 # emulating old gdbservers when debugging single-threaded programs.
41 set res [gdbserver_start "--disable-packet=Tthread" $binfile]
42 set gdbserver_protocol [lindex $res 0]
43 set gdbserver_gdbport [lindex $res 1]
45 # Disable XML-based thread listing, and multi-process extensions.
46 gdb_test_no_output "set remote threads-packet off"
47 gdb_test_no_output "set remote multiprocess-feature-packet off"
49 set res [gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport]
50 if ![gdb_assert {$res == 0} "connect"] {
54 # There should be only one thread listed.
55 set test "info threads"
56 gdb_test_multiple $test $test {
57 -re "2 Thread.*$gdb_prompt $" {
60 -re "has terminated.*$gdb_prompt $" {
63 -re "\\\* 1\[\t \]*Thread\[^\r\n\]*\r\n$gdb_prompt $" {
70 # Bad GDB behaved like this:
72 # Cannot execute this command without a live selected thread.
74 gdb_test "c" "Breakpoint $decimal, main.*" "continue to main"