From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id G+OGNRuz/GKTcigAWB0awg (envelope-from ) for ; Wed, 17 Aug 2022 05:21:31 -0400 Received: by simark.ca (Postfix, from userid 112) id CF7A61E5EA; Wed, 17 Aug 2022 05:21:31 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=ftaKoHwV; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_DYNAMIC, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.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 6B89C1E222 for ; Wed, 17 Aug 2022 05:21:31 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A5CDA3858418 for ; Wed, 17 Aug 2022 09:21:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A5CDA3858418 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1660728090; bh=CCPhrObqLN9iSQuF4FXc3RKO/BwfOrZYz9wg+UYm//g=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=ftaKoHwVTq5y4HJlizbTzqlPw25GQFtKIbh1zYrf5VaKE3+dqFgL1sXzP1CmrjSry vChddo+hKSn3k8UP/RUVXLmcL2lXnQ6A8gTN5ltC0eDRezg1qRZaZaWrNx7MuuRuuJ 9DSo1EPc+pCcPb2TSJjE9Lxu+iKexF9bCwHw8Mpc= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 8B0033858CDB for ; Wed, 17 Aug 2022 09:21:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8B0033858CDB Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-663-4JKL2F_dOlibui6sjDHcDA-1; Wed, 17 Aug 2022 05:21:09 -0400 X-MC-Unique: 4JKL2F_dOlibui6sjDHcDA-1 Received: by mail-ed1-f72.google.com with SMTP id r12-20020a05640251cc00b00440647ec649so8515270edd.21 for ; Wed, 17 Aug 2022 02:21:09 -0700 (PDT) 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:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=CCPhrObqLN9iSQuF4FXc3RKO/BwfOrZYz9wg+UYm//g=; b=Fji9YPP/VmgDW/l2DSOWmGSAdgph11wL4NTH1XuIsMHMMkApYOQwvWG+YDjxXM/ajh Aa7Ml7uJL0qdFrCeUte+Kyldr+Mscjc9+kQqe6XkMO1gcSgyTr2l1Izfiv1ThpPYmR5K WvGnRGXXyvJ+eo3wPR2slwGW1Z9DCBfSK0HNMMxjmsyql2GUgCKB5MoO8IA5lmqY0/WE YfB9iD/rgzra2cpl1+oBQ0u7XpMSgtyOIOd4l9RgKwHuD/u7F0HilLpzIrOMs9RtF7L5 zwla0QaBLWNPGFdSv/oQM/oRnQFFinaPqvUpfu260JxMpo89PgJ1YBY4lEKyS4VpKSO5 NNXQ== X-Gm-Message-State: ACgBeo2/L+99i8gxZGHJZo48p3K6e+9voQCU0CB5vBgz7Ol9pSY3ClMJ SZy8C1XqQN27VF356nAKVHcpeTvNoHG1A4b1MfZxnoI6Rf0TeNKs3DlTZ9xMyNtLckN6lqcphjf 7OwybPXLN4eqO2iyVuvF32A== X-Received: by 2002:a05:6402:351:b0:445:9f7a:2866 with SMTP id r17-20020a056402035100b004459f7a2866mr4511085edw.252.1660728068580; Wed, 17 Aug 2022 02:21:08 -0700 (PDT) X-Google-Smtp-Source: AA6agR5egzLXLgApyYeP2dCFwykPPHQzCKuIlQIVtYoQNtQFG/nJolXxWKgF0hvl3BxIA9I9MWP5iw== X-Received: by 2002:a05:6402:351:b0:445:9f7a:2866 with SMTP id r17-20020a056402035100b004459f7a2866mr4511081edw.252.1660728068364; Wed, 17 Aug 2022 02:21:08 -0700 (PDT) Received: from [10.43.2.105] (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id b13-20020a170906194d00b007304924d07asm6571048eje.172.2022.08.17.02.21.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 17 Aug 2022 02:21:07 -0700 (PDT) Message-ID: <3e6931c5-6ec3-4672-475e-a7cd3e5399dd@redhat.com> Date: Wed, 17 Aug 2022 11:21:07 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH] gdb: new 'maint print frame-id' command To: Andrew Burgess , gdb-patches@sourceware.org References: <20220816171822.3315660-1-aburgess@redhat.com> In-Reply-To: <20220816171822.3315660-1-aburgess@redhat.com> 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-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Bruno Larsen via Gdb-patches Reply-To: Bruno Larsen Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 16/08/2022 19:18, Andrew Burgess via Gdb-patches wrote: > When debugging a certain class of GDB bug, I often end up wanting to > know what GDB thinks the frame-id is in a particular frame. It's > not too hard to pull this from some debug output, but I thought it > might be nice if there was a maintenance command that could tell us. > > This commit adds 'maint print frame-id' which prints the frame-id of > the currently selected frame. You can also pass a frame level number > to find the frame-id for a specific frame. > > There's a new test too. Hi Andrew, Thanks for this, it coincidentally really helps my current situation! All the C code looks fine to me, but the texinfo failed to compile (details below). Fixing that, this patch looks great, I'd encourage you to approve your patch! > --- > gdb/NEWS | 4 ++ > gdb/doc/gdb.texinfo | 17 +++++ > gdb/frame.c | 28 ++++++++ > gdb/testsuite/gdb.base/maint-print-frame-id.c | 40 +++++++++++ > .../gdb.base/maint-print-frame-id.exp | 68 +++++++++++++++++++ > 5 files changed, 157 insertions(+) > create mode 100644 gdb/testsuite/gdb.base/maint-print-frame-id.c > create mode 100644 gdb/testsuite/gdb.base/maint-print-frame-id.exp > > diff --git a/gdb/NEWS b/gdb/NEWS > index f2040e26c0c..49ac714efda 100644 > --- a/gdb/NEWS > +++ b/gdb/NEWS > @@ -91,6 +91,10 @@ show style disassembler symbol > The 'disassembler address' and 'disassembler symbol' styles are > aliases for the 'address' and 'function' styles respectively. > > +maintenance print frame-id [ LEVEL ] > + Print GDB's internal frame-id for the frame at LEVEL. If LEVEL is > + not given, then print the frame-id for the currently selected frame. > + > * Changed commands > > maintenance info line-table > diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo > index 82cb1c8d668..ca958173b57 100644 > --- a/gdb/doc/gdb.texinfo > +++ b/gdb/doc/gdb.texinfo > @@ -40142,6 +40142,23 @@ > > Takes an optional file parameter. > > +@kindex maint print frame-id > +@item maint print frame-id > +@itemx maint print frame-id @var{level} > +Print @value{GDBN}'s internal frame-id for the frame at relative > +@var{level}, or for the currently selected frame when @var{level} is > +not given. > + > +If used, @var{level} should be an integer, as displayed in the > +@command{backtrace} output. > + > +@smallexample > +(@value{GDBP}) maint print frame-id > +frame-id for frame #0: {stack=0x7fffffffac70,code=0x0000000000401106,!special} > +(@value{GDBP}) maint print frame-id 2 > +frame-id for frame #2: {stack=0x7fffffffac90,code=0x000000000040111c,!special} In this line and 2 lines above, makeinfo was complaining about misplaced { and }; Looking at the example above, it looks like it should be frame-id for frame #2: @{stack=0x7fffffffac90,code=0x000000000040111c,!special@} -- Cheers, Bruno