From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id H/bTLuymnmA5IQAAWB0awg (envelope-from ) for ; Fri, 14 May 2021 12:35:56 -0400 Received: by simark.ca (Postfix, from userid 112) id B381C1F11C; Fri, 14 May 2021 12:35:56 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id D7B531E783 for ; Fri, 14 May 2021 12:35:55 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 64C113945C2D; Fri, 14 May 2021 16:35:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 64C113945C2D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1621010155; bh=wa0LctnWLaNix2TizHcbAunBy+Cfh5UBxqNmim232nA=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=P6LnsIpGl9SCZG/UDK7kV8SI7C4awpEUxT5BvbUEexcUcBDMeaf7NTw6vrDePhnTv M5fFsgeJZJJ43i4HecpzuSXr1C5Jc03KGDZaM3rPuvu++cNrRLoA0IU/cI5O7/E/P7 gr2UqeOXqz1EvV9MCumXy2x+OMFAuMLhd89rFcLo= Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 1C13D386FC2A for ; Fri, 14 May 2021 16:35:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1C13D386FC2A Received: from fencepost.gnu.org ([2001:470:142:3::e]:33558) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lhan1-0002NL-Cz for gdb@sourceware.org; Fri, 14 May 2021 12:35:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43042) by fencepost.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhan1-0007d0-8p for gdb@gnu.org; Fri, 14 May 2021 12:35:51 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:42761) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lhamz-0002MC-8T for gdb@gnu.org; Fri, 14 May 2021 12:35:51 -0400 Received: by mail-wr1-x42f.google.com with SMTP id x8so8308166wrq.9 for ; Fri, 14 May 2021 09:35:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:user-agent:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=wa0LctnWLaNix2TizHcbAunBy+Cfh5UBxqNmim232nA=; b=h7zIFAEpuxINmLyxiz4NQjw7kMaPEI/Bd1PvS3s1Dfrl92C1gFBfwVqSuP8fkWaQkc +xN2ve2xaQw0eCO8j0XXpghjgLhrQHYLUWsjk41+yi2AhzfQwAJW/IWZphFyUChUcWJ6 +aDrxi8lUn7H0ebflPmW+TOXLusad4UDulqETGb6G8myK31GmWjqwEetNfK0Y6TpwhOD iSfz8RC4wR42FRT5+x5+/O4JN6SvdMZkg2xnXbtKvdS5VNmOYjDcNC79pWFeGifbsZH/ WQdyHTaLGAeWvVUyNSZlZg0IjdzYxHPmZ4pVwvGFyKStzQYtGBD04HsoGLcVH7bnEuQl Thkg== X-Gm-Message-State: AOAM530MytTI1i8PpVzswXK4fRM8iKX+AsBWee5gACgHKh7B6ecmeTwE xPG85m7+VhQoJv5zgN9HMgrST0/F9kEJOA== X-Google-Smtp-Source: ABdhPJzjah7Jx/6AOgOTFOGzFigWMQmo+lU739ZjXQIFCryPDT9mOjyULgJvPIomvXI2Av0Ljzw8lQ== X-Received: by 2002:adf:ce02:: with SMTP id p2mr8204442wrn.156.1621010145752; Fri, 14 May 2021 09:35:45 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id c8sm6790432wrx.4.2021.05.14.09.35.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 09:35:44 -0700 (PDT) Received: from zen (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 367C01FF7E; Fri, 14 May 2021 17:35:44 +0100 (BST) User-agent: mu4e 1.5.13; emacs 28.0.50 To: gdb@gnu.org, QEMU Developers , Pavel Dovgalyuk , Luis Machado Subject: Best approach for supporting snapshots for QEMU's gdbstub? Date: Fri, 14 May 2021 17:06:32 +0100 Message-ID: <87y2chjmsf.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42f.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: =?utf-8?q?Alex_Benn=C3=A9e_via_Gdb?= Reply-To: Alex =?utf-8?Q?Benn=C3=A9e?= Cc: =?utf-8?Q?Daniel_P=2E_Berrang=C3=A9?= Errors-To: gdb-bounces@sourceware.org Sender: "Gdb" Hi, I've been playing around with QEMU's reverse debugging support which I have working with Pavel's latest patches for supporting virtio with record/replay. Once you get the right command line it works well enough although currently each step backwards requires replaying the entire execution history until you get to the right point. QEMU can quite easily snapshot the entire VM state so I was looking to see what the best way to integrate this would be. As far as I can tell there are two interfaces gdb supports: bookmarks and checkpoints. As far as I can tell bookmarks where added as part of GDB's reverse debugging support but attempting to use them from the gdbstub reports: (gdb) bookmark You can't do that when your target is `remote' so I guess that would need an extension to the stub protocol to support? The other option I found was checkpoints which seem to predate support for reverse debugging. However: (gdb) checkpoint checkpoint: can't find fork function in inferior. I couldn't tell what feature needs to be negotiated but I suspect it's something like fork-events if the checkpoint mechanism is designed for user space with a fork/freeze approach. We could of course just add a custom monitor command like the qemu.sstep=3D command which could be used manually. However that would be a QEMU gdbstub specific approach. The other thing would be to be more intelligent on QEMU's side and save snapshots each time we hit an event, for example each time we hit a given breakpoint. However I do worry that might lead to snapshots growing quite quickly. Any thoughts/suggestions? --=20 Alex Benn=C3=A9e