gdbserver.exp revision 1.9
1# Copyright 2000-2020 Free Software Foundation, Inc.
2
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 3 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
16# Test framework for GDB (remote protocol) using a "gdbserver",
17# ie. a debug agent running as a native process on the same or
18# a different host.
19
20#
21# This module to be used for testing gdb with a "gdbserver"
22# built either from libremote or from gdb/gdbserver.
23#
24
25#
26# To be addressed or set in your baseboard config file:
27#
28#   set_board_info gdb_protocol "remote"
29#	Unles you have a gdbserver that uses a different protocol...
30#
31#   set_board_info use_gdb_stub 1
32#	This tells the rest of the test suite not to do things
33#	like "run" which don't work well on remote targets.
34#
35#   set_board_info gdb,do_reload_on_run 1
36#	Unles you have a gdbserver that can handle multiple sessions.
37#
38#   set_board_info noargs 1
39#	Set this if the board does not support passing arguments to the
40#	inferior process.
41#
42#   set_board_info gdb,noinferiorio 1
43#	Neither the traditional gdbserver nor the one in libremote
44#	can presently capture stdout and relay it to GDB via the
45#	'O' packet.  This means that tests involving printf will
46#	fail unles you set this varibale in your baseboard
47#	configuration file.
48#
49#   set_board_info gdb,no_hardware_watchpoints 1
50#	Unles you have a gdbserver that supports hardware watchpoints.
51#	FIXME: gdb should detect if the target doesn't support them,
52#	and fall back to using software watchpoints.
53#
54#   set_board_info gdb_server_prog
55#	This will be the path to the gdbserver program you want to test.
56#	Defaults to "gdbserver".
57#
58#   set_board_info sockethost
59#	The name of the host computer whose socket is being used.
60#	Defaults to "localhost".  Note: old gdbserver requires
61#	that you define this, but libremote/gdbserver does not.
62#
63#   set_board_info gdb,socketport
64#	Port id to use for socket connection.  If not set explicitly,
65#	it will start at "2345" and increment for each use.
66#
67
68# The guts live in gdbserver-support.exp now.
69
70load_lib gdbserver-support.exp
71
72proc gdbserver_gdb_load { } {
73    return [gdbserver_spawn ""]
74}
75
76proc gdb_reload { {inferior_args {}} } {
77    return [gdbserver_run $inferior_args]
78}
79
80proc gdb_reconnect { } {
81    return [gdbserver_reconnect]
82}
83