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 EBB5938582BE for ; Mon, 27 Jun 2022 18:52:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EBB5938582BE Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-448-xJ96GVKIMHSvxoax_rB4nA-1; Mon, 27 Jun 2022 14:52:19 -0400 X-MC-Unique: xJ96GVKIMHSvxoax_rB4nA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 55B9F80B70A; Mon, 27 Jun 2022 18:52:19 +0000 (UTC) Received: from [10.97.116.32] (ovpn-116-32.gru2.redhat.com [10.97.116.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D56D71121314; Mon, 27 Jun 2022 18:52:18 +0000 (UTC) Message-ID: <59a2b50b-0c7d-b272-9b58-a618e6e292ee@redhat.com> Date: Mon, 27 Jun 2022 15:52:17 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH v2] gdb/stack.c: avoid stale pointers when printing frame arguments From: Bruno Larsen To: Tom Tromey , Bruno Larsen via Gdb-patches References: <20220504191036.143360-1-blarsen@redhat.com> <87letyx78l.fsf@tromey.com> <3ff0c39a-ed56-2f58-d81a-9af7b9252bae@redhat.com> In-Reply-To: <3ff0c39a-ed56-2f58-d81a-9af7b9252bae@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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: 8bit X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, BODY_8BITS, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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: , X-List-Received-Date: Mon, 27 Jun 2022 18:52:24 -0000 On 6/20/22 10:12, Bruno Larsen wrote: > > > On 6/15/22 12:43, Tom Tromey wrote: >>>>>>> "Bruno" == Bruno Larsen via Gdb-patches writes: >> ... >> >> Bruno> +  /* print_frame can invalidate frame, so cache the frame_id to rebuild >> Bruno> +     the whole stack later, if needed.  */ >> Bruno> +  struct frame_id frame_id = get_frame_id (frame); >> >> This repeated code makes me wonder if perhaps the print_frame_info API >> ought to be changed instead. > > print_frame_info could return an updated pointer to the frame being printed, or receive a > frame_info** and update it in-place.  However, We'll still need to check for a null pointer > after calling, since we won't want print_frame_info to error out if a frame no longer > exists.  We might not care when printing. > > Does any of these options sound like a better option? Or would we always want to error out > if the frame disappears from under us? > I've spent a couple of days checking this, but to avoid repeating the code, there is just so much to be re-written that trying to fix the issues you had with making frame_info* smart pointers seems to be a better use of my time. Is this a blocking issue, or can the patch be merged with some repeated code and we fix this later? Cheers! Bruno Larsen > > Cheers! > Bruno Larsen >> >> Tom >>