From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id uSrHGVXN2GlAXhAAWB0awg (envelope-from ) for ; Fri, 10 Apr 2026 06:13:41 -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=MCb4/fUG; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=vkNfYtnL; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=MCb4/fUG; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=vkNfYtnL; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 653AF1E0BC; Fri, 10 Apr 2026 06:13:41 -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 9B7151E08C for ; Fri, 10 Apr 2026 06:13:40 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 33B964BA23C9 for ; Fri, 10 Apr 2026 10:13:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 33B964BA23C9 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=MCb4/fUG; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=vkNfYtnL; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=MCb4/fUG; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=vkNfYtnL Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) by sourceware.org (Postfix) with ESMTPS id 5CCE54BA2E1B for ; Fri, 10 Apr 2026 10:12:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5CCE54BA2E1B 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 5CCE54BA2E1B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775815975; cv=none; b=DZHr/FYZZcOiwjee/pOvsEopppXjS38sXXWFmyV4VgFZhVh6AgWFldjkCWiDcFlW7r813OySoVEwAh5jACSqmWvjpf7kvAaoqPVCaWb+KJSi8zBIR0sKRVtz5R0dYwcTmdiqcqZABeSVlffP4ZlRwESBxphKy09djad+p6SBEcc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775815975; c=relaxed/simple; bh=nDoZRWtFS9zkGjLmWnW6KklhziLX7oRiSb2pYVLmmCM=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-ID:MIME-Version; b=q10ibrssMLwu/eL81Zugs5vsU8OvtuB+KNJWUvr0KpNDvRdFvEyZp0WfnoM4lAbZir5UlPJuWE1sSBQQuqIQzCSvzzEDAJP+d78ZOJeC/lPd1n+b2l/VKkx4ytJahN+bEMJdyfP0n3lVXfibPqKH8ECduzB9taIxXczXE3FBNRg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5CCE54BA2E1B Received: from imap1.dmz-prg2.suse.org (unknown [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 569106A7EC 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=DQkiV5jBUrvia/UalG8s6WvTKETHPds+DOYdZBOSe/c=; b=MCb4/fUG+uOwte6w9AuDRJ8sU2Gr9ZLjkIQ5JIwTaXH4cjyYldIMki0H0D2ODsJYU80HgX aDPgH5y1IudcXmQqV3CirgmLsJy+Jpc7iaEvBQwJAi+tSe/ZCf9LnfMAnVJIrSFYNqXeGS /EYo3Ny3PgJPm23e5J7LZgBjR2UOpx4= 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=DQkiV5jBUrvia/UalG8s6WvTKETHPds+DOYdZBOSe/c=; b=vkNfYtnLkLrwNlbYC7i15NyosK0s1XLUzql8xD0TEjaxnDOtO0Rnc4pWNfef+nZOTGuvZR ZFlUCVks8PRmx0Dw== Authentication-Results: smtp-out1.suse.de; none 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=DQkiV5jBUrvia/UalG8s6WvTKETHPds+DOYdZBOSe/c=; b=MCb4/fUG+uOwte6w9AuDRJ8sU2Gr9ZLjkIQ5JIwTaXH4cjyYldIMki0H0D2ODsJYU80HgX aDPgH5y1IudcXmQqV3CirgmLsJy+Jpc7iaEvBQwJAi+tSe/ZCf9LnfMAnVJIrSFYNqXeGS /EYo3Ny3PgJPm23e5J7LZgBjR2UOpx4= 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=DQkiV5jBUrvia/UalG8s6WvTKETHPds+DOYdZBOSe/c=; b=vkNfYtnLkLrwNlbYC7i15NyosK0s1XLUzql8xD0TEjaxnDOtO0Rnc4pWNfef+nZOTGuvZR ZFlUCVks8PRmx0Dw== 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 40C974A0B4 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 aHidDiXN2GlFaQAAD6G6ig (envelope-from ) for ; Fri, 10 Apr 2026 10:12:53 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH v4 2/4] [gdb] Add thread_control_state::step_start_function methods Date: Fri, 10 Apr 2026 12:12:50 +0200 Message-ID: <20260410101252.1805303-3-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-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; RCVD_TLS_ALL(0.00)[] 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 Factor out all uses of thread_control_state::step_start_function into methods, and make the field private. Tested on x86_64-linux. Co-Authored-By: Andrew Burgess --- gdb/gdbthread.h | 36 ++++++++++++++++++++++++++++++++++-- gdb/infcmd.c | 2 +- gdb/infrun.c | 13 ++++++------- 3 files changed, 41 insertions(+), 10 deletions(-) diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h index d64bf6e5a01..224e6e4b657 100644 --- a/gdb/gdbthread.h +++ b/gdb/gdbthread.h @@ -154,8 +154,36 @@ struct thread_control_state CORE_ADDR step_range_start = 0; /* Inclusive */ CORE_ADDR step_range_end = 0; /* Exclusive */ - /* Function the thread was in as of last it started stepping. */ - struct symbol *step_start_function = nullptr; + /* Set m_step_start_function according to PC. */ + void set_step_start_function (CORE_ADDR pc) + { + m_step_start_function = find_symbol_for_pc (pc); + } + + /* Reset m_step_start_function. */ + void reset_step_start_function () + { + m_step_start_function = nullptr; + } + + /* Return true if the function symbol for PC matches + m_step_start_function. */ + bool in_step_start_function (CORE_ADDR pc) + { + return m_step_start_function == find_symbol_for_pc (pc); + } + + /* Return true if m_step_start_function is set. */ + bool step_start_function_p () + { + return m_step_start_function != nullptr; + } + + /* Return m_step_start_function. */ + struct symbol *step_start_function () + { + return m_step_start_function; + } /* If GDB issues a target step request, and this is nonzero, the target should single-step this thread once, and then continue @@ -208,6 +236,10 @@ struct thread_control_state /* True if the thread is evaluating a BP condition. */ bool in_cond_eval = false; + +private: + /* Function the thread was in as of last it started stepping. */ + struct symbol *m_step_start_function = nullptr; }; /* Inferior thread specific part of `struct infcall_suspend_state'. */ diff --git a/gdb/infcmd.c b/gdb/infcmd.c index fa7b273ae57..a1df59e09f2 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -899,7 +899,7 @@ set_step_frame (thread_info *tp) set_step_info (tp, frame, sal); CORE_ADDR pc = get_frame_pc (frame); - tp->control.step_start_function = find_symbol_for_pc (pc); + tp->control.set_step_start_function (pc); } /* Step until outside of current statement. */ diff --git a/gdb/infrun.c b/gdb/infrun.c index 2c9a27325af..becd68a21ad 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -3098,7 +3098,7 @@ clear_proceed_status_thread (struct thread_info *tp) tp->control.step_frame_id = null_frame_id; tp->control.step_stack_frame_id = null_frame_id; tp->control.step_over_calls = STEP_OVER_UNDEBUGGABLE; - tp->control.step_start_function = nullptr; + tp->control.reset_step_start_function (); tp->stop_requested = false; tp->control.stop_step = 0; @@ -7745,9 +7745,9 @@ process_event_stop_test (struct execution_control_state *ecs) if (execution_direction != EXEC_REVERSE && ecs->event_thread->control.step_over_calls == STEP_OVER_UNDEBUGGABLE && in_solib_dynsym_resolve_code (ecs->event_thread->stop_pc ()) - && (ecs->event_thread->control.step_start_function == nullptr + && (!ecs->event_thread->control.step_start_function_p () || !in_solib_dynsym_resolve_code ( - ecs->event_thread->control.step_start_function->value_block () + ecs->event_thread->control.step_start_function ()->value_block () ->entry_pc ()))) { CORE_ADDR pc_after_resolver = @@ -7871,8 +7871,8 @@ process_event_stop_test (struct execution_control_state *ecs) == ecs->event_thread->control.step_stack_frame_id) && ((ecs->event_thread->control.step_stack_frame_id != outer_frame_id) - || (ecs->event_thread->control.step_start_function - != find_symbol_for_pc (ecs->event_thread->stop_pc ()))))) + || !ecs->event_thread->control.in_step_start_function + (ecs->event_thread->stop_pc ())))) { CORE_ADDR stop_pc = ecs->event_thread->stop_pc (); CORE_ADDR real_stop_pc; @@ -9359,8 +9359,7 @@ print_stop_location (const target_waitstatus &ws) if (tp->control.stop_step && (tp->control.step_frame_id == get_frame_id (get_current_frame ())) - && (tp->control.step_start_function - == find_symbol_for_pc (tp->stop_pc ()))) + && tp->control.in_step_start_function (tp->stop_pc ())) { symtab_and_line sal = find_frame_sal (get_selected_frame (nullptr)); if (sal.symtab != tp->current_symtab) -- 2.51.0