From nobody Thu Nov 28 16:51:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1691468536; cv=none; d=zohomail.com; s=zohoarc; b=GODhV3xPVSuHPHPwjb2ArTKsPzOTNp+3bxmY7+yzo2W5EvYXRtQ28Nvff29vi0xjwTmrL/yL/TZWpqKwgsK4PsjF1WTU9K8MivWilXMb3Y7XyeNnER77aCGwHZ84GXXHHQNFB3PgxBClvpng5pj7HTzW/HM/yRK30Tsg49nZi60= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691468536; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eUxtws3efJ/zcMLuM2mcZXvJskxwLw3PDsxQvmIrbn0=; b=QO/pemc2doDn1EluRuBZ9MTKZpQKucOOoyxxiJR6KMBc8Wc4UpDNulJf38FfDQqJkop84136pmbRtVRunPOckx1NsXGGDeCK5jC6cFyY5mg0f7qKNt1ckLZLEmzJFh/c0m0jLqeYTbkqyIB+hwTzHqDOFiAlRkcOlLsDoxyE9RQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1691468536699750.3428630375669; Mon, 7 Aug 2023 21:22:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qTEE3-0000yx-BT; Tue, 08 Aug 2023 00:21:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qTEE0-0000eP-OH; Tue, 08 Aug 2023 00:21:40 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qTEDz-0007rH-0X; Tue, 08 Aug 2023 00:21:40 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-686f1240a22so5071786b3a.0; Mon, 07 Aug 2023 21:21:38 -0700 (PDT) Received: from wheely.local0.net (61-68-137-140.tpgi.com.au. [61.68.137.140]) by smtp.gmail.com with ESMTPSA id fk10-20020a056a003a8a00b0068718f6a035sm6979207pfb.33.2023.08.07.21.21.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 21:21:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691468497; x=1692073297; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eUxtws3efJ/zcMLuM2mcZXvJskxwLw3PDsxQvmIrbn0=; b=LjM2pNRekJYwK7hy7FKjtTZ1riuTzOeLtC3XJOXWIEM/Gsa6d8s/Q/dt2UElkSWoS0 1Ak8/Q/5qxK51YT/0/X80zaVfCnZIK/Nm+RQ0KGF4ma06g/0GZOtOHLO3tUe39+8oNAB IJunZ56aHV+LBedhV/1cOfzxA3U7LTnYXYrNiYm+TREB3P4l7fQTGMIrVRUUQN1eCxqX +UCjf0inpxpQvRlDiK1Oth1br+KB0F/BDoiYXyFGHPaQAhYLcrYM8l86PLC7+baj9S9c q6rb4b/uMnLlWItPOp3mJ8huJ9JM14Z86Jl0AxM+tRcgt+yW5RmNIlA0ZU0eXfWoqIdj SXmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691468497; x=1692073297; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eUxtws3efJ/zcMLuM2mcZXvJskxwLw3PDsxQvmIrbn0=; b=FGs2LVPYzC80M7FeKrIHgho3IH4eGX66LWcw0didlNjVu3KSFD4bVMbU5062P3saF7 7vW/RA2Ehr3EFkso7MU24TamwiAQknjNRXcKncU084VIjLrLAbfX6od42AgmPqckBFhz MZPTWuEDaEahoWqdFO/eECYWRbf4EWyyJT1XMmb+gXTunc4KF52HvmaHJsqfU/PeBuqq kJGE9vKoprsT2JQDpdle+90OKNJtvk6T9PCzP6vCtr+GEdAyagyCZZjHk8W9wApCwDS0 4h+nWU+XUVHcUdh31lbpRgFoNe6rtvyCZkCLXXge3xXCKNw/7JBOgUuPo63EV7D/+X9B l5OQ== X-Gm-Message-State: AOJu0YxV68hTaB+U0pc/RaHDKId9ywhl708ESi3W7Y6xWXYhCYBmBCFj N6t/cROWle+Lp3Qf4ScTNu8= X-Google-Smtp-Source: AGHT+IHjv4Gc16NkZgpaPjtLvgzcVJ/gFSkDdV7hiAqvJ+ypUA/RfGOHEbNdBGzP+bkBDqbRpY1/5g== X-Received: by 2002:a05:6a00:b90:b0:681:50fd:2b98 with SMTP id g16-20020a056a000b9000b0068150fd2b98mr14446971pfj.31.1691468497333; Mon, 07 Aug 2023 21:21:37 -0700 (PDT) From: Nicholas Piggin To: Daniel Henrique Barboza Cc: Nicholas Piggin , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , David Gibson , Greg Kurz , Harsh Prateek Bora , Pavel Dovgalyuk , Paolo Bonzini , qemu-ppc@nongnu.org, qemu-devel@nongnu.org, Pavel Dovgalyuk Subject: [PATCH v2 18/19] tests/avocado: reverse-debugging cope with re-executing breakpoints Date: Tue, 8 Aug 2023 14:20:00 +1000 Message-Id: <20230808042001.411094-19-npiggin@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230808042001.411094-1-npiggin@gmail.com> References: <20230808042001.411094-1-npiggin@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=npiggin@gmail.com; helo=mail-pf1-x436.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1691468537999100003 Content-Type: text/plain; charset="utf-8" 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 Signed-off-by: Nicholas Piggin --- 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_deb= ugging.py index 680c314cfc..7d1a478df1 100644 --- a/tests/avocado/reverse_debugging.py +++ b/tests/avocado/reverse_debugging.py @@ -150,16 +150,33 @@ def reverse_debugging(self, shift=3D7, args=3DNone): self.check_pc(g, addr) logger.info('found position %x' % addr) =20 - logger.info('seeking to the end (icount %s)' % (last_icount - 1)) - vm.qmp('replay-break', icount=3Dlast_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) =20 + # set breakpoints for the instructions just stepped over logger.info('setting breakpoints') for addr in steps: # hardware breakpoint at addr with len=3D1 g.cmd(b'Z1,%x,1' % addr, b'OK') =20 + # this may hit a breakpoint if first instructions are executed + # again + logger.info('continuing execution') + vm.qmp('replay-break', icount=3Dlast_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) =3D=3D 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;') --=20 2.40.1