From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 66720385781D for ; Sat, 15 May 2021 06:12:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 66720385781D Received: from fencepost.gnu.org ([2001:470:142:3::e]:32888) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lhnX7-0000WC-Sm for gdb@sourceware.org; Sat, 15 May 2021 02:12:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48880) by fencepost.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhnX7-00020p-HJ for gdb@gnu.org; Sat, 15 May 2021 02:12:17 -0400 Received: from mail.ispras.ru ([83.149.199.84]:39092) by eggs.gnu.org with esmtps (TLS1.2:DHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhnX4-0000Q7-NX for gdb@gnu.org; Sat, 15 May 2021 02:12:17 -0400 Received: from [192.168.0.92] (unknown [62.118.138.151]) by mail.ispras.ru (Postfix) with ESMTPSA id EB3E040D403E; Sat, 15 May 2021 06:12:08 +0000 (UTC) Subject: Re: Best approach for supporting snapshots for QEMU's gdbstub? To: =?UTF-8?Q?Alex_Benn=c3=a9e?= , gdb@gnu.org, QEMU Developers , Luis Machado Cc: =?UTF-8?Q?Daniel_P=2e_Berrang=c3=a9?= References: <87y2chjmsf.fsf@linaro.org> From: Pavel Dovgalyuk Message-ID: <4dd935c3-fe40-6ecc-f037-e6eaf7dc7821@ispras.ru> Date: Sat, 15 May 2021 09:12:08 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <87y2chjmsf.fsf@linaro.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=83.149.199.84; envelope-from=pavel.dovgalyuk@ispras.ru; helo=mail.ispras.ru X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, KAM_DMARC_NONE, KAM_DMARC_STATUS, NICE_REPLY_A, SPF_FAIL, SPF_HELO_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-List-Received-Date: Sat, 15 May 2021 06:12:20 -0000 On 14.05.2021 19:06, Alex Bennée wrote: > 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= command which could be used manually. However that would be > a QEMU gdbstub specific approach. For now you can just use 'monitor savevm sn1' in gdb. But something like 'bookmark' seems more convenient. > 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? >