From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 719613858C50 for ; Thu, 9 Feb 2023 13:07:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 719613858C50 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 63D1A5CE9B for ; Thu, 9 Feb 2023 13:06:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1675948019; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=AhUlpKQkG0hjmupummQL+c/XhsToO2PVpVrE9I0hCcc=; b=fB7Jmv/y8AamYV+RbYEgqTbbuB77Zy8jHUXt70Ig4+fOUjt1XEM9ECgnoJN3/O2upRGxRT rTUs21MnQEPtRR4F/FOnUN1eUaZ5X7lRIoDRxqKXauG5YDOUEfzuAViK1vV8LiPuMGlxLq gDqzLwFUp3PEeUDijLk0wABJ22HeyPI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1675948019; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=AhUlpKQkG0hjmupummQL+c/XhsToO2PVpVrE9I0hCcc=; b=AErGJCY9JEbmGvioyj0iT80hiLQMnpFRajOGrgVf0I6pBQUckqTLXGC1jadLpAWcKUpnWB DmuyjPYumDppdDDw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 414181339E for ; Thu, 9 Feb 2023 13:06:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 8YDMDvPv5GMvaQAAMHmgww (envelope-from ) for ; Thu, 09 Feb 2023 13:06:59 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [RFC] [gdb/cli] Add maint info frame-unwinders Date: Thu, 9 Feb 2023 14:06:58 +0100 Message-Id: <20230209130658.4860-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,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 List-Id: Add a new command "maint info frame-unwinders" ... (gdb) help maint info frame-unwinders List frame unwinders, starting with the highest priority. ... Output for i386: ... $ gdb -q -batch -ex "set arch i386" -ex "maint info frame-unwinders" The target architecture is set to "i386". dummy DUMMY_FRAME dwarf2 tailcall TAILCALL_FRAME inline INLINE_FRAME i386 epilogue NORMAL_FRAME dwarf2 NORMAL_FRAME dwarf2 signal SIGTRAMP_FRAME i386 stack tramp NORMAL_FRAME i386 sigtramp SIGTRAMP_FRAME i386 prologue NORMAL_FRAME ... Output for x86_64: ... $ gdb -q -batch -ex "set arch i386:x86-64" -ex "maint info frame-unwinders" The target architecture is set to "i386:x86-64". dummy DUMMY_FRAME dwarf2 tailcall TAILCALL_FRAME inline INLINE_FRAME python NORMAL_FRAME amd64 epilogue NORMAL_FRAME i386 epilogue NORMAL_FRAME dwarf2 NORMAL_FRAME dwarf2 signal SIGTRAMP_FRAME amd64 sigtramp SIGTRAMP_FRAME amd64 prologue NORMAL_FRAME i386 stack tramp NORMAL_FRAME i386 sigtramp SIGTRAMP_FRAME i386 prologue NORMAL_FRAME ... Tested on x86_64-linux. --- gdb/doc/gdb.texinfo | 4 ++++ gdb/frame-unwind.c | 28 ++++++++++++++++++++++++++++ gdb/frame.c | 4 ++-- gdb/frame.h | 4 ++++ 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index eebb6dd422a..709d4766317 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -40986,6 +40986,10 @@ with the DWARF frame unwinders enabled. If DWARF frame unwinders are not supported for a particular target architecture, then enabling this flag does not cause them to be used. +@kindex maint info frame-unwinders +@item maint info frame-unwinders +List frame unwinders, starting with the highest priority. + @kindex maint set worker-threads @kindex maint show worker-threads @item maint set worker-threads diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c index b708c64f967..43321e22230 100644 --- a/gdb/frame-unwind.c +++ b/gdb/frame-unwind.c @@ -28,6 +28,7 @@ #include "target.h" #include "gdbarch.h" #include "dwarf2/frame-tailcall.h" +#include "cli/cli-cmds.h" struct frame_unwind_table_entry { @@ -337,3 +338,30 @@ frame_unwind_got_address (frame_info_ptr frame, int regnum, register_type (gdbarch, regnum), addr); return reg_val; } + +/* Implement "maintenance info frame-unwinders" command. */ + +static void +maintenance_info_frame_unwinders (const char *args, int from_tty) +{ + struct gdbarch *gdbarch = target_gdbarch (); + struct frame_unwind_table *table = get_frame_unwind_table (gdbarch); + + for (struct frame_unwind_table_entry *entry = table->list; entry != NULL; + entry = entry->next) + { + const char *name = entry->unwinder->name; + const char *type = frame_type_str (entry->unwinder->type); + + gdb_printf (gdb_stdout, "%-16s\t%-16s\n", name, type); + } +} + +void _initialize_frame_unwind (); +void +_initialize_frame_unwind () +{ + add_cmd ("frame-unwinders", class_maintenance, maintenance_info_frame_unwinders, + _("List frame unwinders, starting with the highest priority."), + &maintenanceinfolist); +} diff --git a/gdb/frame.c b/gdb/frame.c index 9235a2ceb38..c69a3ea0cb0 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -439,9 +439,9 @@ frame_id::to_string () const return res; } -/* Return a string representation of TYPE. */ +/* See frame.h. */ -static const char * +const char * frame_type_str (frame_type type) { switch (type) diff --git a/gdb/frame.h b/gdb/frame.h index 4a99bd660df..6ed8db0af56 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -203,6 +203,10 @@ enum frame_type SENTINEL_FRAME }; +/* Return a string representation of TYPE. */ + +extern const char *frame_type_str (frame_type type); + /* A wrapper for "frame_info *". frame_info objects are invalidated whenever reinit_frame_cache is called. This class arranges to invalidate the pointer when appropriate. This is done to help base-commit: c920e5cc604c5b20f9af7c75402eea94aa1e11c6 -- 2.35.3