From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id mDVtKQpuimdcYhIAWB0awg (envelope-from ) for ; Fri, 17 Jan 2025 09:49:46 -0500 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=YRnpRGaS; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id A61441E100; Fri, 17 Jan 2025 09:49:46 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.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 autolearn=ham autolearn_force=no version=4.0.0 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (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 0940D1E08E for ; Fri, 17 Jan 2025 09:49:46 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 809E73847721 for ; Fri, 17 Jan 2025 14:49:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 809E73847721 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=YRnpRGaS 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 AB65F384770B for ; Fri, 17 Jan 2025 14:49:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AB65F384770B 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 AB65F384770B 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=1737125347; cv=none; b=w02Y+NrjAs2+nvnErfigWA4CAlmu2NGLNHQzDLNj6UHNEJW9smW2ApscgbnTiGYAyj5HJPE+Kc13JNndms1Izd9yan34l7yxR+jNgRn4iy0nY+pgliIWN56xfHhvXRoYG13MHk3g2FQmGDkx5Vhqy5JSrSjOn9PywEqVufhCDO8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1737125347; c=relaxed/simple; bh=fN/342Ef4/+4pbyPg0PheXO6ZHKVTjsukozYn1DMbp0=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=gMrrRFbqE8arXAxbx6k2x4gB4Vu8+CuT/I/qVp54UxKifDX80lshGyYuUm+dzNm8ujWZaoOcn4dldGurbFqv6GcoAae74OT+CYUhPl8n4H5L4zZSE4/vTzMvcEUl4tRHDjBoynQ96HLAls731yn24TXtaQiJAUX66aq0ifkgwAo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AB65F384770B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737125347; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SYfIIVD1LCN05BQH1pWDCb6uJtzvV9MOLKiABcgvg1E=; b=YRnpRGaSaxXNeQgcfiYlKDlAKxZwz/0BET4BJHgMfhzfFZrNrTqWKbF+ExUXSiYvsEhp9x 41SclFMZiKvLEMHAmJxv8rU2jChKu8glVwQfXXrQpczIBZCUjNDV8eBM6j92Rfyq6UUSz3 8imXRCNruxaN9ENS7vrCTtcEtF/vuNw= Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-32-WBNmkeadP769jS1X7L9ScA-1; Fri, 17 Jan 2025 09:49:06 -0500 X-MC-Unique: WBNmkeadP769jS1X7L9ScA-1 X-Mimecast-MFC-AGG-ID: WBNmkeadP769jS1X7L9ScA Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2163dc0f5dbso43537415ad.2 for ; Fri, 17 Jan 2025 06:49:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737125345; x=1737730145; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SYfIIVD1LCN05BQH1pWDCb6uJtzvV9MOLKiABcgvg1E=; b=BvYAM9NJuLsof8Btv98/TngqDq5l0qL0EZkbx9IhoK98Z/gs3cR4eYgLVquLb5mvT8 PI2Zb5FTJWsi7wwu5qESWdltTs9hkqppOwN0VYT7+oL3CUj+tLu8zjW48Y8Luzc2ekmc RaTO/K/x4H+XgN/byknX2NkC9m9pVTHfNftmW81TGNB9VmzB4rW4tnPOYwsv6K5Ts2Zt x52g+h0Sl5R6MJPAee2N5JoWt5wwE+xU9EM0aB3QIBzr+OO+NJHXzGuC0y8vRZ8ev+N6 pgJ3C5e6KE2FTZUYvtCXXjf5RsCHDYCxmPKvfGbeuUjfTmH888CfHYu/EbscM2r9Zd/b aogA== X-Gm-Message-State: AOJu0YwtcfCVReciSGa89ODY9EoNyyxPyGgKbd4cxbGol9/zIltxyjVN SZHQgHmjT5S+HM6kPNTUg17EoIxdoxstkSzVYtFmwj7SbqLaAqbOaOwWuph0fAnkpJRnQfYAFFo P8gSPXqHKvjMUhgIZ30vDMDqBH12n4xjpX+TFSXbU+p23W2kaaf7n7johQxzampeHGhBztfdOj5 zkpd+Wua9NCddHz2KTXEC1BFZnJGlbh2jF0+GS5FJhuQ0b X-Gm-Gg: ASbGncvyrxglPNUq/bwXto9wihi+NNyGVF//ZtFZ4k3LDQbD/7q2kjb4dMrtmNOiVLc /36f854u1g3puU3oENkOvwReL9L+vg9zfvsCs2GF/SN+0V6m5x8C5Buuj8s2j2HhpT5bWbAtCke iAYSU9RsbtQrQsSHDXgkQvL9gd82ssAQ3Cn8UW1AAl+Y7Oo9oZa0pSPWdkRFhJlB74bVKo/UtkM VpbLr4ndL9VwICoAgLfa0Q02deFsEOKbf+jduHJYc5HTs3aXPIVNUX3jGK1AS3Ek3Pw X-Received: by 2002:a05:6a20:734f:b0:1e0:bb0d:b1f4 with SMTP id adf61e73a8af0-1eb2147e6b8mr4955126637.11.1737125344995; Fri, 17 Jan 2025 06:49:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IGzUqhl7Fd4wcDsTijShVexR9vVZNFQlz+AykuyXQ3eUihkyD3LB0kNGSnBuxGXQq4m2dWCqw== X-Received: by 2002:a05:6a20:734f:b0:1e0:bb0d:b1f4 with SMTP id adf61e73a8af0-1eb2147e6b8mr4955068637.11.1737125344478; Fri, 17 Jan 2025 06:49:04 -0800 (PST) Received: from ?IPV6:2804:14d:8084:9a69::1002? ([2804:14d:8084:9a69::1002]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-a9bcdcf6154sm1663084a12.33.2025.01.17.06.49.03 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Jan 2025 06:49:04 -0800 (PST) Message-ID: <979602e3-a35d-498e-bada-19d4ebba5800@redhat.com> Date: Fri, 17 Jan 2025 11:49:02 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v8 0/5] Modernize frame unwinders and add disable feature To: gdb-patches@sourceware.org References: <20241210195115.3046370-1-guinevere@redhat.com> From: Guinevere Larsen In-Reply-To: <20241210195115.3046370-1-guinevere@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 3w9WysQOwSV0MSq5yA36o-6H1gvaecrTjZrDiCfkV3o_1737125345 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 Now that Andrew approved all patches, I pushed this series! If there are any issues, please let me know! -- Cheers, Guinevere Larsen She/Her/Hers On 12/10/24 4:51 PM, Guinevere Larsen wrote: > 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, still accessed > throught the registry subsystem. This isn't required (like I originally > thought it was), but it does make the whole system more readable in my > opinion. > > Patch 2 adds a new field for frame unwinders, their "class", which > roughly correlates to which area of GDB adds that unwinder. They were > chosen rather arbitrarily based on my understanding, where the unwinder > is added and its name. This class will be used to simplify bulk > disabling of unwinders introduced by patch 4. > > 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. > > Patch 4 adds the possibility to disable unwinders based on their name or > class, and disable all unwinders at once if desired. It also reverts > commit 3c3bb0580be0 since that patch pointed out that if a more generic > system was implemented it could be reverted. > > Patch 5 adds the test I was trying to upstream all along. > > All the documentation has been approved by Eli already. Patches 2 and 3 > were already approved by Simon. > > Changes for v8: > * Simplified the loop printing the table for "maint info > frame-unwinders". > * Used gdb::option to parse the options for "maint frame-unwinder > disable" > * Changed error message when no unwinder is found but some unwinders > were disabled > * Cosmetic fixes. > > Changes for v7: > * Moved the std::vector back to being accessed through the registry system > Removed the approvals from patch 1 because I think this change is > reasonably big, and needs another review. > * Several cosmetic changes to the code, following feedback from Simon > and Thiago. > * Fixed the test from patch 4, following Thiago's suggestion > * Users can no longer specify the unwinder class with the > FRAME_UNWINDER_ prefix > > 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/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 | 420 ++++++++++++++---- > gdb/frame-unwind.h | 173 +++++++- > gdb/frame.c | 21 +- > gdb/frv-linux-tdep.c | 6 +- > gdb/frv-tdep.c | 5 +- > gdb/ft32-tdep.c | 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/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 | 8 +- > gdb/testsuite/gdb.base/frame-unwind-disable.c | 22 + > .../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 | 35 +- > gdb/windows-tdep.h | 16 +- > gdb/xstormy16-tdep.c | 5 +- > gdb/xtensa-tdep.c | 7 +- > gdb/z80-tdep.c | 7 +- > 97 files changed, 1339 insertions(+), 551 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 >