From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id UaOZGEzY/WmocyMAWB0awg (envelope-from ) for ; Fri, 08 May 2026 08:34:20 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=RqQLOcC2; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 5FB4A1E0BA; Fri, 08 May 2026 08:34:20 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id C605C1E067 for ; Fri, 08 May 2026 08:34:19 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 455F54BA2E1A for ; Fri, 8 May 2026 12:34:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 455F54BA2E1A Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=RqQLOcC2 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 9E6604BA2E10 for ; Fri, 8 May 2026 12:33:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9E6604BA2E10 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9E6604BA2E10 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778243632; cv=none; b=lwgt1H1Da99d77LD2JaGewAEbo2zZSQYbIbI95RrONeLacsKb1wY/LVjnjDoOgEcXFgYxAZ+Ww+oEQjTTHoSXgOqfPa3ylbNRpnXFQuijja1k+xSJLlsnwg7PR2EZeHNyJlmBGACdJx2Ya8fYsp5PsbllSKGi4mO2bTR/Ab7TIY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778243632; c=relaxed/simple; bh=JxbXgqaSaUnWFxNzq54Ou5Wynj9tcsAgISfuQsbdauE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=b2iT3uoU0GsNJ+T9O4+6rdbiztRlF3myhkpxvgEBzXDh/fJLpUFLLDIOKN+3+FQKukpX0RQNsDjRCYkfdnUkLRT51Wo0i15Dmss2LG5aMkdDTn7sE8cIliI2nrC5MjD3XAKRXVuhc8f1QLgerGToonj7Yb/kI2VitbNi4H4rgkk= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=RqQLOcC2 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9E6604BA2E10 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778243632; 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: in-reply-to:in-reply-to:references:references; bh=bNv4dI/3tFg0amZilxCUzW5YERfbUXdFJvFSLRTt5XI=; b=RqQLOcC2UeXlTXaQFtScYJd9aQVDiugOxhHnCxeM/Dv3xGNj24gfZ2SYw1WdmjGCfn4RyR 0CpnEqzbbMWQcJRt+XkCyvrcfzw3UlxTXRBr3bCb/64XA3FLSmvgw1syqec+muoEW7gMhR h72Isjy2SCI13rhGQaR4WcdEQ1fWEWQ= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-439-FSInO3IlMVmsjujKO9PSmQ-1; Fri, 08 May 2026 08:33:51 -0400 X-MC-Unique: FSInO3IlMVmsjujKO9PSmQ-1 X-Mimecast-MFC-AGG-ID: FSInO3IlMVmsjujKO9PSmQ_1778243630 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-48e51dc35a3so15535685e9.1 for ; Fri, 08 May 2026 05:33:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778243629; x=1778848429; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=bNv4dI/3tFg0amZilxCUzW5YERfbUXdFJvFSLRTt5XI=; b=iBUThvAmnzH2DHTgIhSqZedi/EpC5FK1KEnNl5TdR5SUiglf7ToKM6J4dLmnJXNdby y5At9AiMCvMou0rs8qvIxk1A6ESYKUbpWtWRv48tAsvI3ECc6IrvJanI3+ZHUAHHebHZ z/L5wv/P+ehG7a3uiTSR5S40VU77j3Sgt2Pz+zzcXaVE9JPSo+7sTvRFM8xcX5QElT9q LcdjzU/AKiwr54zFSAaFfVLhVvLdHhspk/4EUL4wUTpzP33tVWJdQ+7wLcLXxVLa7ROe dVn8y5LiJL9v3CgFGPiKnEvL56C+gSD4sruKTaMw9rtuDTvsVoenxc/AgF/mzbbpmBLD JxwA== X-Forwarded-Encrypted: i=1; AFNElJ9nEwOFBeTWaV1E4qvxku1JR46htbg8OX3JJcD1R5zU6IZuMkhIIolbkwqNofwdXtVtVzgmhEuKpJjQUw==@sourceware.org X-Gm-Message-State: AOJu0YyR7OnI0hs7dCiYQ4sNGQjjuCrY7nNfriqlD4UlNukyzdicmRHm 6GkcwluLLDLU3n9W8gJ1sNjs68XZq0ltOIf2Hirncc9MV4ROFCogIsB++8BlSO610gfjlQjroXd y0blafqHI5q7iKUgWOSB4DvTdnnmeUvg6mPczhLS0mPHRZ2EGI5AdxW8XEjqIiLWqtmuzdiY= X-Gm-Gg: AeBDietT8ssT8Mw3ZqAYugZCw4Ez5O6bvIkmSdabn83tr/2ryEb4kydKxbCjOjxAqaE +6sm90fppaEF4x2iBbaToeJVUULfTJ6AK61spUTr2ylU2U57ksYcmDbLtu6V0GSmNXesqN+Yh8V tFDlt6Tqu3bxYYNFvH+6FbDQWNsTH2k6PeOOcFWgjimxSOIhyw11J0P/s17YOPB3tx9JWI2YIxP 8GaMyT73wuX5SsYBIsdpiNTcB6O4HKuSYSfWKqKUIeuUZsWfrs0no/A2TAJXgiUz2UjTuRes97n Sx3hs+sctuZhPQafFwQftGXeQFpWLZiVYR7PEh/mne5l//pxKLeH5sCT5osFE/kwuax3I9ReaGZ uc4azKLqPxZs1pzOD X-Received: by 2002:a05:600c:4888:b0:48e:526e:1012 with SMTP id 5b1f17b1804b1-48e526e10a2mr107323045e9.5.1778243629491; Fri, 08 May 2026 05:33:49 -0700 (PDT) X-Received: by 2002:a05:600c:4888:b0:48e:526e:1012 with SMTP id 5b1f17b1804b1-48e526e10a2mr107322665e9.5.1778243629013; Fri, 08 May 2026 05:33:49 -0700 (PDT) Received: from localhost ([31.111.84.232]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48e68f43ba0sm54497655e9.11.2026.05.08.05.33.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2026 05:33:48 -0700 (PDT) From: Andrew Burgess To: Tom Tromey , gdb-patches@sourceware.org Cc: Tom Tromey Subject: Re: [PATCH 2/2] C++-ify print_variable_and_value_data In-Reply-To: <20260424-print-var-and-cleanup-v1-2-7b6a2861ccb5@adacore.com> References: <20260424-print-var-and-cleanup-v1-0-7b6a2861ccb5@adacore.com> <20260424-print-var-and-cleanup-v1-2-7b6a2861ccb5@adacore.com> Date: Fri, 08 May 2026 13:33:47 +0100 Message-ID: <87fr42dqs4.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: uAKugO16pVQMt4AYTnwi8ooUvS8ZZhuqLrFGIqXUK6c_1778243630 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Hi Tom, This mostly looks fine, there's just one thing that I think I wanted to discus... Tom Tromey writes: > While working on a different patch, I decided to C++-ify > print_variable_and_value_data somewhat. This patch gives it a > constructor and changes it to use bool. > > Also, I noticed that this code does not really need to use a frame_id. > Using a frame_info_ptr is just as good due to the "reinflation" > behavior of that class. This is a super slim edge case, but I think it might be worth mentioning at this point in the commit message. I'm kind of aware of this right now because I'm looking at some frame related problems, so I'm thinking a log about frame_info_ptr, and reinflation... > @@ -2276,32 +2291,25 @@ print_variable_and_value_data::operator() (const char *print_name, > if (language_def (sym->language ())->symbol_printing_suppressed (sym)) > return; > > - frame = frame_find_by_id (frame_id); > - if (frame == NULL) > - { > - warning (_("Unable to restore previously selected frame.")); > - return; > - } > - This code handles the case where we cannot re-find the frame for FRAME_ID. But if we look in frame_info_ptr::reinflate, there's no such handling. We just: gdb_assert (m_ptr != nullptr), in the above code it would be like replacing the `if` block with gdb_assert (frame != NULL); I think this is a bug in the reinflate logic which has existed since it was added. What would actually need to happen to trigger this bug? In this case I think something like a Python pretty printer would need to change the inferior state in such a way that the backtrace changed, and then flush the frame cache. I don't think this is something a well written pretty printed should be doing. But it is possible, and GDB shouldn't be asserting if it did. But also, I don't think this issue is limited to your code, so I don't think this is something you need to fix. But it might be worth mentioning in the commit message, that with this change, this isn't a pure refactor, there is a small edge case which changes behaviour. Otherwise, this looks great. Approved-By: Andrew Burgess Thanks, Andrew