diff options
author | Alexandra Hájková <ahajkova@redhat.com> | 2024-10-23 14:18:43 +0200 |
---|---|---|
committer | Alexandra Hájková <ahajkova@redhat.com> | 2025-01-30 20:37:12 +0100 |
commit | 202655d42a51c2de665b023710a4bfc76b6f5db7 (patch) | |
tree | 87ae11042fa5c4569848ac107fb425d1d69bc301 /gdbserver | |
parent | f77f3d6d9cef650cf1c3aaf51d91eb9af9cd026d (diff) | |
download | gdb-202655d42a51c2de665b023710a4bfc76b6f5db7.zip gdb-202655d42a51c2de665b023710a4bfc76b6f5db7.tar.gz gdb-202655d42a51c2de665b023710a4bfc76b6f5db7.tar.bz2 |
gdb: add first gdbreplay test, connect.exp
When the changes on the remote protocol are made,
we want to test all the corner cases to prevent
regressions. Currently it can be tricky to simulate
some corner case conditions that would expose possible
regressions. When I want to add or change the remote
protocol packet, I need to hack gdbserver to send a
corrupted packet or an error to make sure GDB is able
to handle such a case.
This test makes it easy to send a corruped packet or
an error message to GDB using the gdbreplay tool and
check GDB deals with it as we expect it to.
This test starts a communication with gdbsever setting
the remotelog file. Then, it modifies the remotelog with
update_log proc, injects an error message instead of
the expected replay to the vMustReplyEmpty packet in order
to test GDB reacts to the error response properly. After
the remotelog modification, this test restarts GDB and starts
communication with gdbreply instead of the gdbserver using
the remotelog.
Add a lib/gdbreplay-support.exp. update_log proc matches lines
from GDB to gdbserver in a remotelogfile. Once a match is found then
the custom line is used to build a replacement line to send from
gdbserver to GDB.
Approved-By: Andrew Burgess <aburgess@redhat.com>
Diffstat (limited to 'gdbserver')
-rw-r--r-- | gdbserver/gdbreplay.cc | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/gdbserver/gdbreplay.cc b/gdbserver/gdbreplay.cc index 5c7821a..58e584b 100644 --- a/gdbserver/gdbreplay.cc +++ b/gdbserver/gdbreplay.cc @@ -205,6 +205,8 @@ remote_open (const char *name) if (bind (tmp_desc, p->ai_addr, p->ai_addrlen) != 0) perror_with_name ("Can't bind address"); + fprintf (stderr, "Replay logfile using %s\n", name); + fflush (stderr); if (p->ai_socktype == SOCK_DGRAM) remote_desc_in = tmp_desc; else @@ -258,9 +260,6 @@ remote_open (const char *name) fcntl (remote_desc_in, F_SETFL, FASYNC); #endif remote_desc_out = remote_desc_in; - - fprintf (stderr, "Replay logfile using %s\n", name); - fflush (stderr); } static int |