From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id URdSATXr/GJbiigAWB0awg (envelope-from ) for ; Wed, 17 Aug 2022 09:20:53 -0400 Received: by simark.ca (Postfix, from userid 112) id F0AAB1E5EA; Wed, 17 Aug 2022 09:20:52 -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=fBYebHTb; 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=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 826C11E222 for ; Wed, 17 Aug 2022 09:20:52 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 96B673858C50 for ; Wed, 17 Aug 2022 13:20:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 96B673858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1660742451; bh=lTIVdfvP5jyBnxKp23lXWFGwUGzsU1UDe4MiOjFE9C4=; h=To:Subject:In-Reply-To:References:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=fBYebHTb3Q0Egs8vog8CCFtaGqwXHzJHOB63lzADP8tNSIVX3LoysaC1yl8HGwIuk 8FReJ+0j2Qix4lpfNqTjTFEtSjFmnGouPtNPBLxG3do+yRoVzW0//U/EH94Qcum6+p nWj8K7PDbArPvcX6Mjji94Z245aTOsB1kCWq4pqM= 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 6FF703858284 for ; Wed, 17 Aug 2022 13:20:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6FF703858284 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-509-81YAcZOyMa6vldtxskP6-w-1; Wed, 17 Aug 2022 09:20:26 -0400 X-MC-Unique: 81YAcZOyMa6vldtxskP6-w-1 Received: by mail-wr1-f72.google.com with SMTP id r17-20020adfa151000000b00224f8e2a2edso2017188wrr.0 for ; Wed, 17 Aug 2022 06:20:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :x-gm-message-state:from:to:cc; bh=lTIVdfvP5jyBnxKp23lXWFGwUGzsU1UDe4MiOjFE9C4=; b=uosAHIJQe1hAEe6PTY52+U61EUKMSDvZUHfh01jOkOseakq5MQ4v2rBQAeEPhZ9dnP iMjENTrici3fJior1DwxuslvsKy+BXfmX8bBJ2oap5iYb6LsZGR58yYdEd9jyPmXcz8c /VvHxLC64chu+aBnIcC9NhBFEIFGzKjGBTJ7JNkmf0D4cjVxbqUVPEtHWw0pyVspWh/c HV1l7IaVbeSyGKim04QDrI65mRNremqXiZ/WwPclg+A6HAeKR+Pny7qFMPlvcLyAOyrp xemh0jXUsIQY+S2gmq4Kf7IvvaTB6wormw8kdaSnyHA2jybwklL2wRwGFzUyMXyxA6Gw +3xw== X-Gm-Message-State: ACgBeo3p3R45TVVntpbucJuYE0oXEyh9rIr5j7Xv0nJlp/hQyA024hKW zwFalRU8MLKhxMkskuFT6uZVrT5oFibDrANSab6lV2h46yqUBt7bLvGiFUZaWzzzjZVAlEzIJ95 2O5ouOUupbG0Fhh7YLLqPYA== X-Received: by 2002:a05:6000:904:b0:21a:3dca:4297 with SMTP id bz4-20020a056000090400b0021a3dca4297mr14281053wrb.487.1660742425479; Wed, 17 Aug 2022 06:20:25 -0700 (PDT) X-Google-Smtp-Source: AA6agR5Z18KODuX1+amRj94JkZWdhlLBNNxpc8SCZrt6tPJTZYVqG6Sh75el8UlZU2yEZdXn6MduMw== X-Received: by 2002:a05:6000:904:b0:21a:3dca:4297 with SMTP id bz4-20020a056000090400b0021a3dca4297mr14281042wrb.487.1660742425202; Wed, 17 Aug 2022 06:20:25 -0700 (PDT) Received: from localhost ([31.111.84.229]) by smtp.gmail.com with ESMTPSA id bo12-20020a056000068c00b0021d7b41255esm13420481wrb.98.2022.08.17.06.20.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 06:20:23 -0700 (PDT) To: Bruno Larsen , gdb-patches@sourceware.org Subject: Re: [PATCH] gdb: new 'maint print frame-id' command In-Reply-To: <3e6931c5-6ec3-4672-475e-a7cd3e5399dd@redhat.com> References: <20220816171822.3315660-1-aburgess@redhat.com> <3e6931c5-6ec3-4672-475e-a7cd3e5399dd@redhat.com> Date: Wed, 17 Aug 2022 14:20:22 +0100 Message-ID: <875yirypk9.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain 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: Andrew Burgess via Gdb-patches Reply-To: Andrew Burgess Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Bruno Larsen via Gdb-patches writes: > 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@} Thanks. I've fixed this locally, and will include this fix when I check this in (after giving others a chance to comment). Thanks, Andrew