From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id CX+4KXDN2GlAXhAAWB0awg (envelope-from ) for ; Fri, 10 Apr 2026 06:14:08 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=eLk3/TFa; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=pk6yrPzj; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=eLk3/TFa; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=pk6yrPzj; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id A543D1E0BC; Fri, 10 Apr 2026 06:14:08 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 B53341E08C for ; Fri, 10 Apr 2026 06:14:07 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 3E8DC4BA2E3C for ; Fri, 10 Apr 2026 10:14:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3E8DC4BA2E3C Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=eLk3/TFa; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=pk6yrPzj; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=eLk3/TFa; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=pk6yrPzj Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by sourceware.org (Postfix) with ESMTPS id DF96F4BA2E1B for ; Fri, 10 Apr 2026 10:13:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DF96F4BA2E1B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DF96F4BA2E1B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775815989; cv=none; b=ck+2tvO+VkJr2jFH+2f4o4kzRieifR/c5Ci7D35nnaOp6Ll1ANYUAZ07+uKTN2f9lp+mwWmrWwBvK1YXrGoTyCBc5kicxlp3DUBBtRtVtO5TxrVxuwLV1QugC0vaZWvPywcdtRrcThEga+Jpirxtj7HUJc9W+niUooL7Yl8FLsc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775815989; c=relaxed/simple; bh=HbKgYIov/UqmmTEPobE2IbRLOKLxcyPPgwX7ZuziuB8=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-ID:MIME-Version; b=qX4MFf4xVFKc2eqifT/Y2e+F2x+P5ukzrKpxdlyKJYvIUD6QazV8BfyDNHOD/Z2D/gWowsp9OgoXLRf/w1ZJy+1a42zVhqWMyE9p3AtcsUVp4WNvkXFybYZGGrzUVzUOdoPqcjPcR6ov3HfNb9LMb6BmBArjfnjWZ5fc+FyNFvA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DF96F4BA2E1B Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 86DAE6A7EE for ; Fri, 10 Apr 2026 10:12:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1775815973; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZqoIaPmWCpxAItEq92U7Pi2wXk2Xaabw4ofETsv5450=; b=eLk3/TFaNEGClxf9Uw45eL97fZmQUeJLJyb9puRSn3YY2WxnyuMJERMHjRKwKrQgQI3jgv gw/jpQX3y8J0jnNZXNFKtc063JJGS0QFJypRQiXaqgiZ8wRlC6vHCdZ/zzUgAJ0hXH466m THG20DtWZcZv/cDVgRhiiTiKR0nmFuA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1775815973; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZqoIaPmWCpxAItEq92U7Pi2wXk2Xaabw4ofETsv5450=; b=pk6yrPzjPFvaIQoTap4dZajp4Dw1FLb6j94EzpAvXjvvT45wFy1bp7v/Qcv6qAjplr3eJB g/fxS8B9SzB0jXAg== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b="eLk3/TFa"; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=pk6yrPzj DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1775815973; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZqoIaPmWCpxAItEq92U7Pi2wXk2Xaabw4ofETsv5450=; b=eLk3/TFaNEGClxf9Uw45eL97fZmQUeJLJyb9puRSn3YY2WxnyuMJERMHjRKwKrQgQI3jgv gw/jpQX3y8J0jnNZXNFKtc063JJGS0QFJypRQiXaqgiZ8wRlC6vHCdZ/zzUgAJ0hXH466m THG20DtWZcZv/cDVgRhiiTiKR0nmFuA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1775815973; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZqoIaPmWCpxAItEq92U7Pi2wXk2Xaabw4ofETsv5450=; b=pk6yrPzjPFvaIQoTap4dZajp4Dw1FLb6j94EzpAvXjvvT45wFy1bp7v/Qcv6qAjplr3eJB g/fxS8B9SzB0jXAg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 7386C4A0B4 for ; Fri, 10 Apr 2026 10:12:53 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id yLMEGyXN2GlFaQAAD6G6ig (envelope-from ) for ; Fri, 10 Apr 2026 10:12:53 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH v4 4/4] gdb: use get_current_frame consistently in print_stop_location Date: Fri, 10 Apr 2026 12:12:52 +0200 Message-ID: <20260410101252.1805303-5-tdevries@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260410101252.1805303-1-tdevries@suse.de> References: <20260410101252.1805303-1-tdevries@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:mid,suse.de:email]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_TLS_ALL(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Queue-Id: 86DAE6A7EE 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 From: Andrew Burgess In print_stop_location, in the PRINT_UNKNOWN case we currently use a strange mix of get_current_frame and get_selected_frame. This works fine because at the point print_stop_location is called the selected frame will always be the current frame, but calling these two different functions is confusing, at least for me. Since bpstat_print selects the frame to print (which usually is the current frame, but not always), the correct frame to use is the selected frame after the bpstat_print call. Assign the selected frame to a variable print_frame, and use it throughout the function. There should be no user visible changes after this commit. Co-Authored-By: Tom de Vries --- gdb/infrun.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/gdb/infrun.c b/gdb/infrun.c index dea2a2cbd48..19836c4d89e 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -9349,7 +9349,12 @@ print_stop_location (const target_waitstatus &ws) struct thread_info *tp = inferior_thread (); bpstat_ret = bpstat_print (tp->control.stop_bpstat, ws.kind ()); - switch (bpstat_ret) + /* Function bpstat_print selects the frame to print. Typically, that is the + stop frame, in other words get_current_frame (). But bpstat_print may + select a different frame, see for instance ada_catchpoint::print_it. */ + frame_info_ptr print_frame = get_selected_frame (nullptr); + + switch (bpstat_ret) { case PRINT_UNKNOWN: /* FIXME: cagney/2002-12-01: Given that a frame ID does (or @@ -9357,10 +9362,10 @@ print_stop_location (const target_waitstatus &ws) that when doing a frame comparison. */ if (tp->control.stop_step && (tp->control.step_frame_id - == get_frame_id (get_current_frame ())) - && tp->control.in_step_start_function (get_current_frame ())) + == get_frame_id (print_frame)) + && tp->control.in_step_start_function (print_frame)) { - symtab_and_line sal = find_frame_sal (get_selected_frame (nullptr)); + symtab_and_line sal = find_frame_sal (print_frame); if (sal.symtab != tp->current_symtab) { /* Finished step in same frame but into different file, print @@ -9403,7 +9408,7 @@ print_stop_location (const target_waitstatus &ws) LOCATION: Print only location SRC_AND_LOC: Print location and source line. */ if (do_frame_printing) - print_stack_frame (get_selected_frame (nullptr), 0, source_flag, 1); + print_stack_frame (print_frame, 0, source_flag, 1); } /* See `print_stop_event` in infrun.h. */ -- 2.51.0