From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id CEA3D386E55A for ; Thu, 8 Dec 2022 08:45:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CEA3D386E55A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670489125; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=afyYFNw479jb5fD+V3yFhdmk9b2CnTBSv5OFh41xYgc=; b=aNKTpDRvEjNWCIDeeLGXCvPLNywgHgLk+VShx+luhtItHX4EISWke09xcnxVFamXbWpRqi JySdWvAI+E/Rl8lFduYDwpxdTK2jW0RH7okTW73trednxRLKeUXPsHZ8fNBTLV6OTyCOIJ vlJWRSSRB7sKdoD7tVLqyJz4B1dURq0= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-568-7o3ECJ96ONiIGLktXfRmqw-1; Thu, 08 Dec 2022 03:45:24 -0500 X-MC-Unique: 7o3ECJ96ONiIGLktXfRmqw-1 Received: by mail-wm1-f72.google.com with SMTP id b47-20020a05600c4aaf00b003d031aeb1b6so2089882wmp.9 for ; Thu, 08 Dec 2022 00:45:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=afyYFNw479jb5fD+V3yFhdmk9b2CnTBSv5OFh41xYgc=; b=EiMg+JfEdaXndENpsTk7pTYH3u44b497WREmgwcmJTdVzizh5rO4mDR0pSjpBywCcM 9gGKJxUQSdfkOfotfeIX/8ctydCTapMpHyfEKhyMnpgPBr141RUXOq25F57Jn7ibEJXK fmCOgyoBGvr2K01J8l2UT4IsvYroZzONv38MQGfUJ7wvvGt7IqS/Vb+eZd1Qja5T+FYI 75mcUPleMIfJFA+EC/4NddqG43HL+d7NdEr896NiLa90wmMrdHQT3bkkuGy+gqxppmbE 3Afxwhy0nZ5d8WFJrNBeVCp5HndSGx+PmUXmk05wFT37DsHNgSLetZSqHfMQ/IIf57gL IZkA== X-Gm-Message-State: ANoB5pncjcanwnjHt8/x8Qq866Gol/c0nM2hwu8rIC3s899nDWTfMLkK DIdSj6J+eeE0Gm5QKl/Ii0YmSU7ZKmusUelieYctoTUhPVOOVI0izsMVqIZiXvKvXpVsYmZ/HNE EyP9N6Q7ve6jkfNICdQHxwA== X-Received: by 2002:a05:600c:4d86:b0:3d1:e4ed:2719 with SMTP id v6-20020a05600c4d8600b003d1e4ed2719mr7393890wmp.147.1670489122769; Thu, 08 Dec 2022 00:45:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf6+VpTGPLguqxYtY5UjzS16JpZwUif+bKjIQIPT3nn/154xRlNfh6UUCgcQUCUXvvF3m1Ve5g== X-Received: by 2002:a05:600c:4d86:b0:3d1:e4ed:2719 with SMTP id v6-20020a05600c4d8600b003d1e4ed2719mr7393882wmp.147.1670489122489; Thu, 08 Dec 2022 00:45:22 -0800 (PST) Received: from [192.168.0.45] (ip-62-245-66-121.bb.vodafone.cz. [62.245.66.121]) by smtp.gmail.com with ESMTPSA id z16-20020a5d4d10000000b00241c712916fsm26247687wrt.0.2022.12.08.00.45.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Dec 2022 00:45:21 -0800 (PST) Message-ID: Date: Thu, 8 Dec 2022 09:45:21 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH] gdb: add 'maintenance print record-instruction' command To: Lancelot SIX Cc: gdb-patches@sourceware.org References: <20221207135000.1344331-1-blarsen@redhat.com> <20221207143731.uopir7l4ilssjkqv@ubuntu.lan> From: Bruno Larsen In-Reply-To: <20221207143731.uopir7l4ilssjkqv@ubuntu.lan> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 07/12/2022 15:37, Lancelot SIX wrote: > Hi, > > I do not not know this part well (to say the least), so my comments will > only focus on style > > On Wed, Dec 07, 2022 at 02:50:00PM +0100, Bruno Larsen via Gdb-patches wrote: >> While chasing some reverse debugging bugs, I found myself wondering what >> was recorded by GDB to undo and redo a certain instruction. This commit >> implements a simple way of printing that information. >> --- >> gdb/NEWS | 6 ++++ >> gdb/doc/gdb.texinfo | 8 +++++ >> gdb/record-full.c | 81 +++++++++++++++++++++++++++++++++++++++++++++ >> 3 files changed, 95 insertions(+) >> >> diff --git a/gdb/NEWS b/gdb/NEWS >> index c4ccfcc9e32..d6ce6bf86a0 100644 >> --- a/gdb/NEWS >> +++ b/gdb/NEWS >> @@ -103,6 +103,12 @@ >> >> * New commands >> >> +maintenance print record-instruction [ N ] >> + Print the recorded information for a given instruction. If N is not given >> + prints how GDB would undo the last instruction executed. If N is negative, >> + prints how GDB would undo the N-th previous instruction, and if N is >> + positive, it prints how GDB will redo the N-th following instruction. >> + >> maintenance set ignore-prologue-end-flag on|off >> maintenance show ignore-prologue-end-flag >> This setting, which is off by default, controls whether GDB ignores the >> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo >> index 5b566669975..807af351e79 100644 >> --- a/gdb/doc/gdb.texinfo >> +++ b/gdb/doc/gdb.texinfo >> @@ -40531,6 +40531,14 @@ that symbol is described. The type chain produced by this command is >> a recursive definition of the data type as stored in @value{GDBN}'s >> data structures, including its flags and contained types. >> >> +@kindex maint print record-instruction >> +@item maint print record-instruction >> +@itemx maint print record-instruction @var{N} >> +@cindex print how GDB recorded a given instruction. If N is not positive >> +number, it prints the values stored by the inferior before the N-th previous >> +instruction was exectued. If N is positive, print the values after the N-th >> +following instruction is executed. If N is not given, 0 is assumed. >> + >> @kindex maint selftest >> @cindex self tests >> @item maint selftest @r{[}-verbose@r{]} @r{[}@var{filter}@r{]} >> diff --git a/gdb/record-full.c b/gdb/record-full.c >> index 48b92281fe6..47cdf75eea4 100644 >> --- a/gdb/record-full.c >> +++ b/gdb/record-full.c >> @@ -2764,6 +2764,79 @@ set_record_full_insn_max_num (const char *args, int from_tty, >> } >> } >> >> +/* Implement the 'maintenance print record-instruction' command. */ >> + >> +static void >> +maintenance_print_record_instruction (const char *args, int from_tty) > I think, usually the command implementation have a _command suffix in > the name. I do not know if this is a hard rule. None maintenance_print functions end with _command, so I don't think it is a hard rule, but if you think I should add it, I can do it. I agree with everything else you said, it'll all be fixed in v2. -- Cheers, Bruno