Message ID | 20241010172220.3700189-1-guinevere@redhat.com |
---|---|
Headers |
Return-Path: <gdb-patches-bounces~patchwork=sourceware.org@sourceware.org> 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 D7F513857823 for <patchwork@sourceware.org>; Thu, 10 Oct 2024 17:23:16 +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.133.124]) by sourceware.org (Postfix) with ESMTP id 632393858D37 for <gdb-patches@sourceware.org>; Thu, 10 Oct 2024 17:22:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 632393858D37 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 632393858D37 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728580966; cv=none; b=ANyKLnu0W9F84GVkDmr1lso04+uEh35g2jI2Ixx1yatEhfcoO4plJPXESR/KUxg9ipRna8DsGbID0edlASoHDgAwQQaakvG/CG5524nSoQIViOBZAW8Tmc7DmGinRFs1xRWtH0yUjr44xEFVhCGaubmSArKUiSSTRiUgWFUTx0k= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728580966; c=relaxed/simple; bh=efudktFKMHv3P7oaEOG6qlZiwvYBNvCQP7NmfhY4/no=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=wnfVdwQoAag+dub7lTdgqjiPAFcdG4sDYLW9etkaK6hJDs0fELv9aTtUQS30QDguJmzpJLjI6dOUc/Cuz6WKOMJ4OroUO7hwx7fj8alRHBZ0Rc0uz7exvXWwxKGCkKI4n7DYAGo/oHBR6ZJQiUv+LsaT9IZuFCfVYgDQIhgPl+I= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728580964; 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=SmPFq0HkfB6yfIltb6wf2bSLiNS9n6/11dWfqF8rYGo=; b=Xot9+eJZnfuw8eJNa+y0ONq8GhRJ4A9HqMakYrntEB9HUPLiAA7YnfVgjaLNsuV/vjGPdT mIs3IvH0/wi4KmA3df6uD0eWOFDluG12Lbx68i5s88Gq+9xjsIZi/KOCBnhPyfz1Gl5mlG NI7vXefo+Ybh2E+/LMjmuzQD/VrYjJw= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-628-TQXL-5aLNa2PKvDJVpm9rg-1; Thu, 10 Oct 2024 13:22:42 -0400 X-MC-Unique: TQXL-5aLNa2PKvDJVpm9rg-1 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (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 mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id F12CA1955F44 for <gdb-patches@sourceware.org>; Thu, 10 Oct 2024 17:22:41 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.34.10]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7AD1A19560AA; Thu, 10 Oct 2024 17:22:40 +0000 (UTC) From: Guinevere Larsen <guinevere@redhat.com> To: gdb-patches@sourceware.org Cc: Guinevere Larsen <guinevere@redhat.com> Subject: [PATCH v6 0/5] Modernize frame unwinders and add disable feature Date: Thu, 10 Oct 2024 14:22:15 -0300 Message-ID: <20241010172220.3700189-1-guinevere@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-5.2 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_H3, 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 <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org |
Series |
Modernize frame unwinders and add disable feature
|
|
Message
Guinevere Larsen
Oct. 10, 2024, 5:22 p.m. UTC
This patch series started with me trying to make it easier to test GDB's ability to unwind using CFI data, to improve a previous patch I sent to the list. The first patch is just a minor change, storing frame unwinders in a vector instead of through an unwinder table accessible using the registry system. This isn't required (like I originally thought it was), but it does make the whole system more readable in my opinion. Patch 3 has the real meat of the modernization, making GDB use polymorphism to handle frame unwinders. This is slightly slower than using function pointers, but much more readable in my opinion. Also, as noted by Thiago Bauermann, no frame unwinders that use the legacy class ever pass a frame_data pointer, so that field was removed from those unwinders. As for the unwinder classes, they were chosen somewhat arbitrarily, mostly based on where I found an unwinder and its name. Patch 4 also reverts commit 3c3bb0580be0 since that patch pointed out that if a more generic system was implemented it could be reverted. All the documentation has been approved by Eli already. Changes for v6: * Patches 1 and 2 were approved by Simon * Several cosmetic changes to patch 3 and 4 * New dealloc_cache default implementation (noop), and frame_unwind_legacy defaults to it if no function pointer is given. * New prev_arch default implementation (getting the current arch), and frame_unwind_legacy defaults to it if no pointer is given * Renamed "sniffer" to "sniff", to make it more clear what the method does * Fixed some problems with the testcase. Changes for v5: * Reverted commit 3c3bb0580be0, with patch 4 following the advice on that commit * on patch 3, some of the original functions were converted into the classes' methods instead of just passing the call along. * some methods of frame_unwind_legacy were switched to be purely virtual Changes for v4: * Rebase on current master (No changes needed) * improved documentation of unwinder classes follow Eli feedback * added KFAIL to new test on patch 5 if running on 32 bit arm Changes for v3: * Fixed Linaro CI issue in 32 bit arm * Fixed the few comments from Eli. * Documented addition of unwinder class in the patch that adds it. Changes for v2: * Added back the test that checks if GDB can handle a mix of CUs with and without debuginfo in a single backtrace. * Fixed all the nitpicks for style. * Removed FRAME_UNWIND_ prefix when talking about classes * Thoroughly changed the documentation, to be more readable Guinevere Larsen (5): gdb: make gdbarch store a vector of frame unwinders gdb: add "unwinder class" to frame unwinders gdb: Migrate frame unwinders to use C++ classes gdb: introduce ability to disable frame unwinders gdb/testsuite: Test for a backtrace through object without debuginfo gdb/NEWS | 21 + gdb/aarch64-tdep.c | 12 +- gdb/alpha-mdebug-tdep.c | 6 +- gdb/alpha-tdep.c | 12 +- gdb/amd64-obsd-tdep.c | 6 +- gdb/amd64-tdep.c | 24 +- gdb/amd64-windows-tdep.c | 6 +- gdb/amdgpu-tdep.c | 7 +- gdb/arc-tdep.c | 10 +- gdb/arch-utils.c | 8 + gdb/arm-tdep.c | 29 +- gdb/avr-tdep.c | 5 +- gdb/bfin-tdep.c | 6 +- gdb/bpf-tdep.c | 6 +- gdb/cris-tdep.c | 12 +- gdb/csky-tdep.c | 10 +- gdb/doc/gdb.texinfo | 64 +-- gdb/dummy-frame.c | 8 +- gdb/dummy-frame.h | 2 +- gdb/dwarf2/frame-tailcall.c | 9 +- gdb/dwarf2/frame-tailcall.h | 2 +- gdb/dwarf2/frame.c | 46 +-- gdb/dwarf2/frame.h | 6 - gdb/frame-unwind.c | 375 ++++++++++++++---- gdb/frame-unwind.h | 157 +++++++- gdb/frame.c | 21 +- gdb/frv-linux-tdep.c | 6 +- gdb/frv-tdep.c | 5 +- gdb/ft32-tdep.c | 6 +- gdb/gdbarch-gen.c | 6 + gdb/gdbarch.h | 5 + gdb/gdbarch.py | 6 + gdb/h8300-tdep.c | 5 +- gdb/hppa-linux-tdep.c | 5 +- gdb/hppa-tdep.c | 17 +- gdb/i386-obsd-tdep.c | 5 +- gdb/i386-tdep.c | 30 +- gdb/ia64-tdep.c | 24 +- gdb/inline-frame.c | 5 +- gdb/inline-frame.h | 2 +- gdb/iq2000-tdep.c | 5 +- gdb/jit.c | 6 +- gdb/lm32-tdep.c | 5 +- gdb/loongarch-tdep.c | 7 +- gdb/m32c-tdep.c | 5 +- gdb/m32r-linux-tdep.c | 5 +- gdb/m32r-tdep.c | 5 +- gdb/m68hc11-tdep.c | 5 +- gdb/m68k-linux-tdep.c | 6 +- gdb/m68k-tdep.c | 6 +- gdb/mep-tdep.c | 5 +- gdb/microblaze-tdep.c | 6 +- gdb/mips-sde-tdep.c | 6 +- gdb/mips-tdep.c | 24 +- gdb/mn10300-tdep.c | 5 +- gdb/moxie-tdep.c | 5 +- gdb/msp430-tdep.c | 5 +- gdb/nds32-tdep.c | 14 +- gdb/nios2-tdep.c | 12 +- gdb/or1k-tdep.c | 7 +- gdb/ppc-fbsd-tdep.c | 5 +- gdb/ppc-obsd-tdep.c | 5 +- gdb/python/py-unwind.c | 61 ++- gdb/record-btrace.c | 12 +- gdb/record.h | 4 +- gdb/riscv-tdep.c | 8 +- gdb/rl78-tdep.c | 6 +- gdb/rs6000-aix-tdep.c | 5 +- gdb/rs6000-tdep.c | 12 +- gdb/rx-tdep.c | 10 +- gdb/s12z-tdep.c | 7 +- gdb/s390-linux-tdep.c | 5 +- gdb/s390-tdep.c | 10 +- gdb/sentinel-frame.c | 8 +- gdb/sentinel-frame.h | 2 +- gdb/sh-tdep.c | 11 +- gdb/sparc-netbsd-tdep.c | 6 +- gdb/sparc-obsd-tdep.c | 6 +- gdb/sparc-sol2-tdep.c | 6 +- gdb/sparc-tdep.c | 6 +- gdb/sparc64-fbsd-tdep.c | 6 +- gdb/sparc64-netbsd-tdep.c | 6 +- gdb/sparc64-obsd-tdep.c | 12 +- gdb/sparc64-sol2-tdep.c | 6 +- gdb/sparc64-tdep.c | 6 +- .../backtrace-through-cu-nodebug-caller.c | 28 ++ .../backtrace-through-cu-nodebug-main.c | 32 ++ .../gdb.base/backtrace-through-cu-nodebug.exp | 95 +++++ .../gdb.base/frame-info-consistent.exp | 6 +- gdb/testsuite/gdb.base/frame-unwind-disable.c | 21 + .../gdb.base/frame-unwind-disable.exp | 137 +++++++ gdb/testsuite/gdb.base/maint.exp | 4 - gdb/tic6x-tdep.c | 12 +- gdb/tilegx-tdep.c | 5 +- gdb/tramp-frame.c | 70 +++- gdb/v850-tdep.c | 5 +- gdb/vax-tdep.c | 6 +- gdb/windows-tdep.c | 34 +- gdb/windows-tdep.h | 16 +- gdb/xstormy16-tdep.c | 5 +- gdb/xtensa-tdep.c | 7 +- gdb/z80-tdep.c | 7 +- 102 files changed, 1315 insertions(+), 547 deletions(-) create mode 100644 gdb/testsuite/gdb.base/backtrace-through-cu-nodebug-caller.c create mode 100644 gdb/testsuite/gdb.base/backtrace-through-cu-nodebug-main.c create mode 100644 gdb/testsuite/gdb.base/backtrace-through-cu-nodebug.exp create mode 100644 gdb/testsuite/gdb.base/frame-unwind-disable.c create mode 100644 gdb/testsuite/gdb.base/frame-unwind-disable.exp