]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb: add first gdbreplay test, connect.exp
authorAlexandra Hájková <ahajkova@redhat.com>
Wed, 23 Oct 2024 12:18:43 +0000 (14:18 +0200)
committerAlexandra Hájková <ahajkova@redhat.com>
Thu, 30 Jan 2025 19:37:12 +0000 (20:37 +0100)
commit202655d42a51c2de665b023710a4bfc76b6f5db7
tree87ae11042fa5c4569848ac107fb425d1d69bc301
parentf77f3d6d9cef650cf1c3aaf51d91eb9af9cd026d
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>
gdb/testsuite/gdb.replay/connect.c [new file with mode: 0644]
gdb/testsuite/gdb.replay/connect.exp [new file with mode: 0644]
gdb/testsuite/lib/gdbreplay-support.exp [new file with mode: 0644]
gdbserver/gdbreplay.cc