From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id URPgBsY8mWotqSMAWB0awg (envelope-from ) for ; Thu, 03 Sep 2026 05:24:22 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=CKCTZlPE; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id F04C91E166; Thu, 03 Sep 2026 05:24:21 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::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 6CE781E09B for ; Thu, 03 Sep 2026 05:24:20 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 521464BAE7E1 for ; Thu, 3 Sep 2026 09:24:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 521464BAE7E1 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=CKCTZlPE Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by sourceware.org (Postfix) with ESMTPS id 51BED4B9DB54 for ; Thu, 3 Sep 2026 09:23:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 51BED4B9DB54 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 51BED4B9DB54 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::330 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788427434; cv=none; b=QaWKUP6fWpTT6ZaLCCgWzjiZOx1RgqsP8rTAZP7zZIZmaAa8fk9bBPvh24O1PEAFx+2BzczpbO4WA1h/+QA3kOxap7JJF4oKjVFwwHfMKAD7JsS7Ad8oi4SGXMe/vQvyjLcFOG0/iQH3tMiw4y3KpBDohw2KJCvNnXYzAnwzK3I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788427434; c=relaxed/simple; bh=uDgc67iRhDT1ymWkgE/JZM35UOKck0yxYc6XjshxzX8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=MJ56MAOfj7IKHgfPUrE1BR0pQqtpQH2RlvbHoQ3B0NzPfZO3BCgPcPpUvd90ubIVQd8OC8SU8NLTY3KfTEGRVApOx1/O2QMTZHkL4jDPd147IRD9FwdYPh/BfLZrm92SRO2MocjgsUGk0ynh4lF+TrDV4Ab1jvoEQPHu+jtlFv0= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=CKCTZlPE DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 51BED4B9DB54 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-49ccfae359fso15240825e9.3 for ; Thu, 03 Sep 2026 02:23:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788427433; x=1789032233; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=NDPjNCrim4TxhPZr2tIHZEdPFY0p79ceeUUMpefwOZE=; b=CKCTZlPEBPLTbHWvAa9/6z9zdhh1eT59xLpweFYmIJ911tiMksd4T2LnEjtWKJwjPN crQgrvwyFJs5sZPVsU86rh+cy5AvPDYLR1mKfActMrQdWVkcm+5L+vVccP3i5ZmO5Qnq qQ55ZPQKBi0P4y4YqBpc7yBlQvgtDw4pDz9jLq+47jraKpo9jN3PIz0swdWAaqyPpFv0 HjyDvaE7aqTdJ4PWmGIdgxrWLhxa+8eKeqaWJ40xY1U9CdLc1SvecYxKRkCAaeXzB8Is 94yNZRxqwD8Wq2c6QLy5n5ShPPAJq8BIXJsZVpW0HFwlIZJnMxJna3/9pTfF+0nkp8vI xvRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788427433; x=1789032233; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=NDPjNCrim4TxhPZr2tIHZEdPFY0p79ceeUUMpefwOZE=; b=jeitm69XIRlb7TGBzdAhmT54pPDOqazgC7ruAfH0jtKdtQwtJU4DHPEq6p1vASmhUm JvszHqLaJ7MM3RAYGyMfy1kr3V0SWPS2eUrcEEFLpvPKsXnhyFiqF2Jwt2lIoVtwjWsV jQBnVmNRWk9UmJPYjbjne7zvmFgTjqcS0Vod2OKmStNT4s8GFSKtvUMb96uHtnKHoo5j JqCx+DiTQzdZGReXNSKY+odVOuiQMeRQ0dBYy5jQ5H9mPKU8J3GRNSaOcqrlOoNTNmEq OfQwQn7vClPyWROwMmg0N7C48NHfrtVoHiHm8ExL8a6ar2Jng9zeNArfz3+7jTOxulZY KV4A== X-Gm-Message-State: AFuF++ky3TMrSfrv5cVeg8TB08PVa5To6XXIw40sduDdwf9MrdKB8rh3 hTVkH3Hu2bJyDvEP0QKWO5eaqtUJ59vEc4qRDreRQhqzHdR0xYbuSgODTmZ6ITN5BbQ= X-Gm-Gg: AYBFou26bTelkohX/cYEAnAOU0h3dzj0cblKVESBxSuxdNwdR9iES9Rrc7R26YPaLQ4 Mb9bi0VF2IG+TcTK4QKzefNwOdw9Z2GZpfqlC0U4DOJXAu/OGsHu/M8PUPv8iCEz9eQXJZV5o2U pOiStlMJYTR+m9N7gxHQrLCEdmsClTjinyv5TecUJ2J80mkU2R1/xQx6jYx9pJy4Jc/4dwUaY9P KdKf3zAQoH5wOgcz+rxfVMK1joUcJO/TmhXAvm6Fvn4Eq2lUtgbhdN9z7rWBWOWdrlt2Q/PeTjR BhMw9934+I75aYkZgim9I64VX/leGsD+b17QiRMBGYJpe1bq0/PqCsPcCArCKhIe1EagXeuLqLG htw2IRYJlDFFIeE/Kwd7YjJEIYs33WVUFu1qRf5M4btgxLjmQu0aoWNj1bs+kMr3MNeMKfLrACu MbBoMgbR7aCIMqV273UpZkQ9pBH+jVzTyI6UselivLyhno1ZxLBltP8tb/OrJzSLAdr9GqmwEZP 7cNwjLCuMWMOnygjsh72/g= X-Received: by 2002:a05:600c:3152:b0:499:900c:9c69 with SMTP id 5b1f17b1804b1-49ce5815e71mr200809685e9.9.1788427432902; Thu, 03 Sep 2026 02:23:52 -0700 (PDT) Received: from amwld-tmagires1.us.drwholdings.com ([149.14.21.6]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49ce58d1c9esm51532415e9.0.2026.09.03.02.23.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2026 02:23:52 -0700 (PDT) From: Tudor-Stefan Magirescu To: gdb-patches@sourceware.org Cc: tudor.magirescu@gmail.com Subject: [PATCH v2 0/2] Fix auto-load script loading after safe-path is widened Date: Thu, 3 Sep 2026 11:21:59 +0200 Message-ID: <20260903092201.663063-1-tudor.magirescu@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260901140602.3287196-1-tudor.magirescu@gmail.com> References: <20260901140602.3287196-1-tudor.magirescu@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 GDB's safe-path mechanism makes it inconvenient to work with scripts embedded in .debug_gdb_scripts sections. Once a script is blocked, GDB never retries loading it even if the safe-path is widened. This occurs because the hash table entry inserted for the first declined load prevents any further attempt. Working around this requires reloading the binary via the file command or restarting GDB entirely. Patch 1 fixes the hash table issue. For shared library scripts, which are re-examined on each run of the inferior, a re-run after widening the safe-path is sufficient. Scripts embedded in the main executable still require a reload via file or a GDB restart, since their objfile is not reloaded for a re-run. Patch 2 further addresses the problem by changing add-auto-load-safe-path to immediately retry previously blocked scripts. This allows the user to load a rejected script without exiting the current GDB session or re-running the inferior. Changes since v1: - Change the return type of maybe_add_script_file and maybe_add_script_text to bool, making it return whether the script was previously loaded. - Add Patch 2 (add-auto-load-safe-path immediate retry). Tudor-Stefan Magirescu (2): [gdb] Fix auto-load script re-execution on subsequent runs [gdb] Retry blocked auto-load scripts when safe-path is widened gdb/auto-load.c | 130 +++++++----- gdb/auto-load.h | 13 +- gdb/extension.c | 7 +- gdb/extension.h | 3 +- ...ers-in-newobjfile-event-objfile.so-gdb.py} | 0 ...s-in-newobjfile-event-dotdebug-filename.py | 43 ++++ ...-newobjfile-event-lib-dotdebug-filename.cc | 39 ++++ ...s-in-newobjfile-event-lib-dotdebug-text.cc | 49 +++++ ...inters-in-newobjfile-event-lib-objfile.cc} | 0 ...ed-pretty-printers-in-newobjfile-event.exp | 187 +++++++++++++----- 10 files changed, 361 insertions(+), 110 deletions(-) rename gdb/testsuite/gdb.python/{libpy-autoloaded-pretty-printers-in-newobjfile-event.so-gdb.py => libpy-autoloaded-pretty-printers-in-newobjfile-event-objfile.so-gdb.py} (100%) create mode 100644 gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event-dotdebug-filename.py create mode 100644 gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event-lib-dotdebug-filename.cc create mode 100644 gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event-lib-dotdebug-text.cc rename gdb/testsuite/gdb.python/{py-autoloaded-pretty-printers-in-newobjfile-event-lib.cc => py-autoloaded-pretty-printers-in-newobjfile-event-lib-objfile.cc} (100%) -- 2.43.0