From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id KPlKHLTm/mYIMwAAWB0awg (envelope-from ) for ; Thu, 03 Oct 2024 14:47:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1727981236; bh=UwIpLTPntGoiOZjHswX4XTQZ6yUZCxLPbvUQ6aejovg=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=cB1sA2eJ5gfmcmz2U3hq5ERQQCS2zp/xrVZWlJLcwmkqH1L9FyakobcUOY4GdrRdV FSY56y9vowOBdBPY+ZR4OlyJw6KbHFZPpzDqO8n/mBauxWlSXKRMsjK8tBfnbW758f vSQPr+640NWgYW8QAT2/3ZVhWak99wP47fhDaZmU= Received: by simark.ca (Postfix, from userid 112) id 5A7951E355; Thu, 3 Oct 2024 14:47:16 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.8 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,URIBL_BLOCKED,URIBL_DBL_BLOCKED_OPENDNS autolearn=unavailable autolearn_force=no version=4.0.0 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=u0j8U0Mi; dkim=pass (1024-bit key) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=qSS0W4id; dkim-atps=neutral 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 8241C1E05C for ; Thu, 3 Oct 2024 14:47:15 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 38D52384A836 for ; Thu, 3 Oct 2024 18:47:15 +0000 (GMT) Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id C317C385DDD1 for ; Thu, 3 Oct 2024 18:46:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C317C385DDD1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C317C385DDD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727981216; cv=none; b=cjJPRjm7XCatGAuwgNqEpUdJtPOqIS2b11kEwKnYTBHZtDKzXn5MmVlu9iQN9SAwe7P8Y5ZxCaIUo+Zpt1znltxyyDPAiQ7/ZLZ8sfTdt3YI6Fg1stwgktwPwuTmYJkP7pdKhkQXCsn6oPUwgQ6OMkFUkDeEHUz91+cnLkQHLl0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727981216; c=relaxed/simple; bh=UwIpLTPntGoiOZjHswX4XTQZ6yUZCxLPbvUQ6aejovg=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:MIME-Version: Subject:To:From; b=ChYyfwu7l7M1m2nNpHngZG3OgrYKseFCQKbPd+Sd3itLDqTa+pdUuRgvawZ+2e5fk8H/Uu6TO3Ng8zibPOJSof4Ux+L/xI/wgJbqilaEPrxNx20BRQvp0SIJxCVyI09aL/1EQBvLxPocoUuU85AlVscBt3ab5LP3ISYXUWigGzI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1727981214; bh=UwIpLTPntGoiOZjHswX4XTQZ6yUZCxLPbvUQ6aejovg=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=u0j8U0MiK8NZn3mWGJ9o1Zkl92RQDAOeRwEqqIj1fQSxX3W3fiMkROzl6vivO/MQE EvXoEqqCSrRbzZ10Ojz+sZQpCbRD+AoVhujH2KmbG85nn9Z1867sk6biO5czd40wgc M2e+xxX5imZIM1GMOOu/q57W/pNlISnOxaoOEEss= Received: by simark.ca (Postfix, from userid 112) id 563281E356; Thu, 3 Oct 2024 14:46:54 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1727981213; bh=UwIpLTPntGoiOZjHswX4XTQZ6yUZCxLPbvUQ6aejovg=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=qSS0W4idOivtSpip3AYzpRrlYURqtkhVnT0iwm24I+HDwzzdRClV7ljn6yxsV0Azn WR5IXvLrbMr6DlGDXHFvV0ETLLzkYKdSxIlPO0A2Yzit2Qr1rExjHTohohbO/F0THM pm1iljcVe7P2vBZPqLI4IY4dgU09iSv8dX2mR7HQ= Received: from [172.16.0.192] (96-127-217-162.qc.cable.ebox.net [96.127.217.162]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id D5EE31E05C; Thu, 3 Oct 2024 14:46:52 -0400 (EDT) Message-ID: Date: Thu, 3 Oct 2024 14:46:52 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 2/5] gdb: add "unwinder class" to frame unwinders To: Guinevere Larsen , gdb-patches@sourceware.org Cc: Guinevere Larsen , Eli Zaretskii References: <20241001184235.3710608-1-guinevere@redhat.com> <20241001184235.3710608-3-guinevere@redhat.com> Content-Language: fr From: Simon Marchi In-Reply-To: <20241001184235.3710608-3-guinevere@redhat.com> Content-Type: text/plain; charset=UTF-8 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 On 10/1/24 2:42 PM, Guinevere Larsen wrote: > From: Guinevere Larsen > > A future patch will add a way to disable certain unwinders based on > different characteristics. This patch aims to make it more convenient > to disable related unwinders in bulk, such as architecture specific > ones, by indentifying all unwinders by which part of the code adds it. indentifying -> identifying > diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c > index b69ae8596a2..afc1258c6a9 100644 > --- a/gdb/frame-unwind.c > +++ b/gdb/frame-unwind.c > @@ -30,6 +30,17 @@ > #include "dwarf2/frame-tailcall.h" > #include "cli/cli-cmds.h" > #include "inferior.h" > +#include > + > +/* Conversion list between the enum for frame_unwind_class and > + string. */ > +static std::map unwind_class_conversion = > +{ > + {FRAME_UNWIND_GDB, "GDB"}, > + {FRAME_UNWIND_ARCH, "ARCH"}, > + {FRAME_UNWIND_EXTENSION, "EXTENSION"}, > + {FRAME_UNWIND_DEBUGINFO, "DEBUGINFO"}, > +}; It's not reaaally a big deal, but using an std::map for this is kind of heavyweight. It could probably be a simple array, still indexed by the enum value. Personally, I used functions with switches to handle cases this (see target_waitkind_str), because compilers can warn you if you forget to handle an enumerator (which can easily happen when a new one is added). Otherwise, a more medium-term but clean solution would be to integrate one of these libs in GDB: https://github.com/Neargye/magic_enum https://github.com/quicknir/wise_enum I use the latter in another project, and it works nicely. Otherwise, LGTM: Approved-By: Simon Marchi Simon