From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id bW4FDGVUl2mutQEAWB0awg (envelope-from ) for ; Thu, 19 Feb 2026 13:20:21 -0500 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=lu6wDoq5; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 128731E0BA; Thu, 19 Feb 2026 13:20:21 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (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 2EF0B1E08D for ; Thu, 19 Feb 2026 13:20:20 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 4EA184B9DB6D for ; Thu, 19 Feb 2026 18:20:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4EA184B9DB6D Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=lu6wDoq5 Received: from omta40.uswest2.a.cloudfilter.net (omta40.uswest2.a.cloudfilter.net [35.89.44.39]) by sourceware.org (Postfix) with ESMTPS id 3B9DB4BA2E0B for ; Thu, 19 Feb 2026 18:19:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3B9DB4BA2E0B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3B9DB4BA2E0B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1771525192; cv=none; b=p5BoJVHEXI1eoHuus9samGk/T0Bw3bqRYYtp3mGD+8TtRB/kzFv4DHKOVIoFMyo+zxkktssHAAXq1aiLJfixbYvfJofZBP0v4ZurpNiFbPbJeS98Wy+fP5CWhnZRLfSsNQKIhEsx+D6/SVHingV2coKqmjpLaLPoPXoWBXtnN40= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1771525192; c=relaxed/simple; bh=ri+r19qGTcsRTA06eWlDcv/Vb5MlkPsOK6+A97YFX5g=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=awGfxJXwPGl0MpOSNlRgxSDJvNLqYFfw/0RXsKU+6pL2a+dQVKcqnElBaHYSwLd5LD1hbxWjFnGG8o3LRHjnv04a0VK+g0/prGfzbufqgnXuyNN/q1alRVW1gG5HGmRRspJ6fQd/BSD2S+nNxN6VO2+t6RsOw5jS0ycNVPOdOk0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3B9DB4BA2E0B Received: from eig-obgw-6003b.ext.cloudfilter.net ([10.0.30.175]) by cmsmtp with ESMTPS id t2hQv7KPpaPqLt8cxv9vw8; Thu, 19 Feb 2026 18:19:51 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id t8cwvuLsZhoT4t8cwvTIfl; Thu, 19 Feb 2026 18:19:50 +0000 X-Authority-Analysis: v=2.4 cv=XZyJzJ55 c=1 sm=1 tr=0 ts=69975447 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=HzLeVaNsDn8A:10 a=ItBw4LHWJt0A:10 a=QyXUC8HyAAAA:8 a=Jpe3xpVvq9SEUO2TWNgA:9 a=DCx65vhANUyCzuf5D8fC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=0Ila7StCUQqViF8gGRU6g5ECPHmXAiyeExPVLVzhXJw=; b=lu6wDoq5t47n6SWDAQqYAPQvlK HjCfN/xe3PRNDOBl8WRiBAkwDNvw170hl6UXgiSLcVTz/iI9nUsoxrG3ODQPYNbOWYrKpCjUYdXvR LY9oJH/hJQawOmXsVuZiJ7nZ7; Received: from 97-122-122-234.hlrn.qwest.net ([97.122.122.234]:57160 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vt8cw-00000002LKP-0T2Z; Thu, 19 Feb 2026 11:19:50 -0700 From: Tom Tromey To: Christina Schimpe Cc: gdb-patches@sourceware.org, thiago.bauermann@linaro.org Subject: Re: [PATCH v2 6/9] gdb: Add command option 'bt -shadow' to print the shadow stack backtrace. In-Reply-To: <20260123080532.878738-7-christina.schimpe@intel.com> (Christina Schimpe's message of "Fri, 23 Jan 2026 08:05:28 +0000") References: <20260123080532.878738-1-christina.schimpe@intel.com> <20260123080532.878738-7-christina.schimpe@intel.com> X-Attribution: Tom Date: Thu, 19 Feb 2026 11:19:48 -0700 Message-ID: <87a4x461ff.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.122.234 X-Source-L: No X-Exim-ID: 1vt8cw-00000002LKP-0T2Z X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-122-234.hlrn.qwest.net (bapiya) [97.122.122.234]:57160 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfF9TQDelrIQhwoB+Su01sW/ejbOYQSvkvXNTSnUQPPWU0F27vk3iGzUmXGTpG7caKFtL6Gbu553cEJtw3NGr7Eww7nrMo6yUxNq/pUL7Vsjn6C6b85F8 l9exUCZPjmy/u3jTQ309YvW7BwxkWYECtbX+DPwkWq1ywsBRDsa3ph9xDbpRY313HhjiOKI0fEwvb4OyyhJZ7pwaMr0xjVClixk= 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 >>>>> Christina Schimpe writes: > Add command option '-shadow" to the backtrace command to print the shadow > stack backtrace instead of the normal backtrace. Thanks. > -annotate_frame_function_name (void) > +annotate_frame_function_name (bool shadowstack_frame) > { > if (annotation_level == 2) > - printf_unfiltered (("\n\032\032frame-function-name\n")); > + { > + if (!shadowstack_frame) > + printf_unfiltered (("\n\032\032frame-function-name\n")); > + else > + printf_unfiltered (("\n\032\032shadow-stack-frame-function-name\n")); > + } I think it is fine to just drop all the annotation changes. As far as I know, no client even uses annotation_level > 1. Emacs, maybe the only existing user of annotations, passes --fullname which uses: case 'f': annotation_level = 1; > + if (should_print_location (print_what) || sal.symtab == nullptr) > + { > + gdb::unique_xmalloc_ptr funname = find_pc_funname (frame.value); > + > + { /* Extra scope to print frame tuple. */ > + ui_out_emit_tuple tuple_emitter (uiout, "shadow-stack-frame"); The extra scope doesn't really look necessary here, since: > + } /* Extra scope to print frame tuple. */ > + > + uiout->text ("\n"); ... it seems fine to emit this text before the tuple emitter is destroyed? And there's already an extras scope from the "then" block. > + gdb_flush (gdb_stdout); Is flushing really needed? I feel like I saw this in a different patch in the series as well, and forgot to ask about it there. > + > +/* Read the memory at shadow stack pointer SSP and assign it to > + RETURN_VALUE. In case we cannot read the memory, set REASON to > + ssp_unwind_stop_reason::memory_read_error and return false. */ It seems odd to combine a bool return and an out parameter when the enum has a "no_error" value. Maybe just a bool return would be more appropriate and then the callers could set their own out parameters. Especially since one caller doesn't even need this. > -static const char *const print_frame_info_choices[] = > +const char *const print_frame_info_choices[] = This is public now but I didn't see other uses of it. Tom