From patchwork Wed Oct 18 10:53:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 56251 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3F3683870C20 for ; Wed, 18 Oct 2023 10:53:43 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org 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 44A9E3858408 for ; Wed, 18 Oct 2023 10:53:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 44A9E3858408 Authentication-Results: sourceware.org; dmarc=pass (p=none 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 44A9E3858408 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697626411; cv=none; b=gmlK0SSuenEVqq7832XOtxywUevWQxSa8m2ZTgBTnStGzRDzbP35NQ7VDa4ZnJxTqyLQFkKa1W/VhDuudnOO1KFn6+I5qdbmXkWtf7oXm0yjBvfFgLZXEAEH39iG8i6WJk5okKsGcoSW768Crc8EiQyoWs0Sc3YUDyRd2SaG2gk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697626411; c=relaxed/simple; bh=xABFv84a6ppcLPyViRvmOvdSnpP6ulhjnMo1+HBP+FQ=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=ZsyDqzBB7135jR7k5AOlCHPZTRhkXKkm4Hp8mDaqHUZ8gmL5/DZKKZU3M1blMinlQiDZawz+2zqjrP23bOFV5L/Ppati9P+RfFuyNk5LtvCD0ruYa8XVePM7k2xAQ3eKxRKSefBq5TD8jrrwija9mUawoe6n49q0VBkPRdnmHSQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697626409; 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: content-transfer-encoding:content-transfer-encoding; bh=8us4ZWlz+aLpBFhjF86YU8LtDyinEm8r3/sSPxshPW0=; b=H0ZH9srLjRZPBKgUcS65t8qIMQnEwK8I4f1FSEzIzVVasExnaoNETx5RYrBXWAXTQ/jSKn JFjQsvrd0naE9KBcBp2w0Lwy47wVHGTIeWHo9YoJDOgj4oDm3WYpToppiHqqEOrwAnqmY5 zf+M1L56WxTZPI8bvgXP3Az1o4DNM44= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-561-HRboEmeUM-q8Fpv7NUuUZA-1; Wed, 18 Oct 2023 06:53:28 -0400 X-MC-Unique: HRboEmeUM-q8Fpv7NUuUZA-1 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-41b8299aad9so17985981cf.2 for ; Wed, 18 Oct 2023 03:53:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697626408; x=1698231208; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8us4ZWlz+aLpBFhjF86YU8LtDyinEm8r3/sSPxshPW0=; b=qrg1qkRyYsddEKxygQvcvt/YxHdsonOVi/zcvhOxTTUlGWadPewD+RPCKVTHrB9UQy KiFbRjT7ic8ER/63mXAvS8NXKig3CS2HDshvtyywA57MOflc0x+ZJUGEoYU+s3lHGn2M 5fKlQXwPMV5hWjtz00lzNJDh9gD3WkXu7Fkxxkkgjd/EG3X8kphQOLttEOJ0VaqQJc3z x/XiVlA63KIy+LOGV2eV4Cm3mc2f2rSwAHn6fQGtSn/shT4xQrSK/vjDgmGw0bvKHAL7 YOmowdNh3AyoDJ/+32LSFdCx1DzVjgBbcRuaku6a9trmYGxJyXX+GF/9ybKbenIz2V/p PfWw== X-Gm-Message-State: AOJu0YzbQxvNY77UVW+tolufPPYsNGdo16Nsf79lnHzUZW4TFc2E/hjk K2ZwF2ifRM0mCuY3r6uVW0caDEAIhVJWlgM5A4DdZpcnGUV7TzqEJf3DJ9sMFuaGeGPusU23dx8 jWFUrBARGUmt+PA5qYCp2dMpRw0O7SK+uIYXPD9ZFs5VPHtuSgYVV9+ueQTMcPyVgQ3BkRk84+U cXUNTGrw== X-Received: by 2002:a05:622a:608:b0:418:1ea6:5530 with SMTP id z8-20020a05622a060800b004181ea65530mr5447453qta.40.1697626408049; Wed, 18 Oct 2023 03:53:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHiqoS42dVsFYsHzxDAXH9w1uM7i6aJK/yr72gzKvpDcqGLJdzzGJNwJ6pUlT1gCxDRErsUJg== X-Received: by 2002:a05:622a:608:b0:418:1ea6:5530 with SMTP id z8-20020a05622a060800b004181ea65530mr5447438qta.40.1697626407718; Wed, 18 Oct 2023 03:53:27 -0700 (PDT) Received: from localhost ([31.111.84.209]) by smtp.gmail.com with ESMTPSA id l24-20020ac848d8000000b0041b016faf7esm1296307qtr.58.2023.10.18.03.53.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 03:53:27 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH 0/5] New Python hook for missing debug information Date: Wed, 18 Oct 2023 11:53:18 +0100 Message-Id: X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP 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.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org This series adds a new Python hook to GDB, this hook allows a user to register a handler object which will be called whenever GDB fails to locate any debug information for an objfile it is loading. These handler objects can (potentially) perform host or project specific actions to help GDB locate the missing debug information. Commits #1 and #2 are refactoring. These merge the separate debug information lookup code from coffread.c and elfread.c. Commit #3 is more refactoring, this simplifies the now merged code. Commit #4 implements the framework for the new hook within GDB, but doesn't implement the Python side of things yet. Commit #5 is where I add the Python side of things, it's only at this point that a user can actually hook into GDB. --- Andrew Burgess (5): gdb/coffread: bring separate debug file logic into line with elfread.c gdb: merge debug symbol file lookup code from coffread & elfread paths gdb: refactor objfile::find_and_add_separate_symbol_file gdb: add an extension language hook for missing debug info gdb: implement missing debug handler hook for Python gdb/NEWS | 26 + gdb/coffread.c | 28 +- gdb/data-directory/Makefile.in | 2 + gdb/doc/python.texi | 136 +++++ gdb/elfread.c | 57 +-- gdb/extension-priv.h | 7 + gdb/extension.c | 19 + gdb/extension.h | 62 +++ gdb/objfiles.h | 10 + gdb/python/lib/gdb/__init__.py | 41 ++ gdb/python/lib/gdb/command/missing_debug.py | 226 +++++++++ gdb/python/lib/gdb/missing_debug.py | 169 +++++++ gdb/python/py-progspace.c | 51 ++ gdb/python/python.c | 83 ++- gdb/symfile-debug.c | 154 ++++++ gdb/testsuite/gdb.python/py-missing-debug.c | 22 + gdb/testsuite/gdb.python/py-missing-debug.exp | 473 ++++++++++++++++++ gdb/testsuite/gdb.python/py-missing-debug.py | 120 +++++ 18 files changed, 1608 insertions(+), 78 deletions(-) create mode 100644 gdb/python/lib/gdb/command/missing_debug.py create mode 100644 gdb/python/lib/gdb/missing_debug.py create mode 100644 gdb/testsuite/gdb.python/py-missing-debug.c create mode 100644 gdb/testsuite/gdb.python/py-missing-debug.exp create mode 100644 gdb/testsuite/gdb.python/py-missing-debug.py base-commit: 5d4a870e05ac45e3f5a301c672a4079995b5db7a