[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 26/35] tests/avocado: reverse-debugging cope with re-executing bre
From: |
Cédric Le Goater |
Subject: |
[PULL 26/35] tests/avocado: reverse-debugging cope with re-executing breakpoints |
Date: |
Mon, 4 Sep 2023 11:06:21 +0200 |
From: Nicholas Piggin <npiggin@gmail.com>
The reverse-debugging test creates a trace, then replays it and:
1. Steps the first 10 instructions and records their addresses.
2. Steps backward and verifies their addresses match.
3. Runs to (near) the end of the trace.
4. Sets breakpoints on the first 10 instructions.
5. Continues backward and verifies execution stops at the last
breakpoint.
Step 5 breaks if any of the other 9 breakpoints are re-executed in the
trace after the 10th instruction is run, because those will be
unexpectedly hit when reverse continuing. This situation does arise
with the ppc pseries machine, the SLOF bios branches to its own entry
point.
Deal with this by switching steps 3 and 4, so the trace will be run to
the end *or* one of the breakpoints being re-executed. Step 5 then
reverses from there to the 10th instruction will not hit a breakpoint in
between, by definition.
Another step is added between steps 2 and 3, which steps forward over
the first 10 instructions and verifies their addresses, to support this.
Reviewed-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
tests/avocado/reverse_debugging.py | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/tests/avocado/reverse_debugging.py
b/tests/avocado/reverse_debugging.py
index 680c314cfccf..7d1a478df143 100644
--- a/tests/avocado/reverse_debugging.py
+++ b/tests/avocado/reverse_debugging.py
@@ -150,16 +150,33 @@ def reverse_debugging(self, shift=7, args=None):
self.check_pc(g, addr)
logger.info('found position %x' % addr)
- logger.info('seeking to the end (icount %s)' % (last_icount - 1))
- vm.qmp('replay-break', icount=last_icount - 1)
- # continue - will return after pausing
- g.cmd(b'c', b'T02thread:01;')
+ # visit the recorded instruction in forward order
+ logger.info('stepping forward')
+ for addr in steps:
+ self.check_pc(g, addr)
+ self.gdb_step(g)
+ logger.info('found position %x' % addr)
+ # set breakpoints for the instructions just stepped over
logger.info('setting breakpoints')
for addr in steps:
# hardware breakpoint at addr with len=1
g.cmd(b'Z1,%x,1' % addr, b'OK')
+ # this may hit a breakpoint if first instructions are executed
+ # again
+ logger.info('continuing execution')
+ vm.qmp('replay-break', icount=last_icount - 1)
+ # continue - will return after pausing
+ # This could stop at the end and get a T02 return, or by
+ # re-executing one of the breakpoints and get a T05 return.
+ g.cmd(b'c')
+ if self.vm_get_icount(vm) == last_icount - 1:
+ logger.info('reached the end (icount %s)' % (last_icount - 1))
+ else:
+ logger.info('hit a breakpoint again at %x (icount %s)' %
+ (self.get_pc(g), self.vm_get_icount(vm)))
+
logger.info('running reverse continue to reach %x' % steps[-1])
# reverse continue - will return after stopping at the breakpoint
g.cmd(b'bc', b'T05thread:01;')
--
2.41.0
- [PULL 17/35] hw/ppc: Always store the decrementer value, (continued)
- [PULL 17/35] hw/ppc: Always store the decrementer value, Cédric Le Goater, 2023/09/04
- [PULL 18/35] target/ppc: Migrate DECR SPR, Cédric Le Goater, 2023/09/04
- [PULL 19/35] hw/ppc: Reset timebase facilities on machine reset, Cédric Le Goater, 2023/09/04
- [PULL 20/35] hw/ppc: Read time only once to perform decrementer write, Cédric Le Goater, 2023/09/04
- [PULL 21/35] target/ppc: Fix CPU reservation migration for record-replay, Cédric Le Goater, 2023/09/04
- [PULL 22/35] target/ppc: Fix timebase reset with record-replay, Cédric Le Goater, 2023/09/04
- [PULL 23/35] spapr: Fix machine reset deadlock from replay-record, Cédric Le Goater, 2023/09/04
- [PULL 24/35] spapr: Fix record-replay machine reset consuming too many events, Cédric Le Goater, 2023/09/04
- [PULL 25/35] tests/avocado: boot ppc64 pseries replay-record test to Linux VFS mount, Cédric Le Goater, 2023/09/04
- [PULL 27/35] tests/avocado: ppc64 reverse debugging tests for pseries and powernv, Cédric Le Goater, 2023/09/04
- [PULL 26/35] tests/avocado: reverse-debugging cope with re-executing breakpoints,
Cédric Le Goater <=
- [PULL 29/35] target/ppc: Flush inputs to zero with NJ in ppc_store_vscr, Cédric Le Goater, 2023/09/04
- [PULL 28/35] target/ppc: Fix LQ, STQ register-pair order for big-endian, Cédric Le Goater, 2023/09/04
- [PULL 31/35] target/ppc: Fix the order of kvm_enable judgment about kvmppc_set_interrupt(), Cédric Le Goater, 2023/09/04
- [PULL 32/35] ppc/xive: Use address_space routines to access the machine RAM, Cédric Le Goater, 2023/09/04
- [PULL 33/35] ppc/xive: Introduce a new XiveRouter end_notify() handler, Cédric Le Goater, 2023/09/04
- [PULL 30/35] hw/ppc/e500: fix broken snapshot replay, Cédric Le Goater, 2023/09/04
- [PULL 35/35] ppc/xive: Add support for the PC MMIOs, Cédric Le Goater, 2023/09/04
- [PULL 34/35] ppc/xive: Handle END triggers between chips with MMIOs, Cédric Le Goater, 2023/09/04
- Re: [PULL 00/35] ppc queue, Cédric Le Goater, 2023/09/06