From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 2fNtLxHf2Gn9eRAAWB0awg (envelope-from ) for ; Fri, 10 Apr 2026 07:29:21 -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=NpPhoilr; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=3Qd7wahV; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=NpPhoilr; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=3Qd7wahV; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id BE73B1E08C; Fri, 10 Apr 2026 07:29:21 -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 4B2711E08C for ; Fri, 10 Apr 2026 07:29:21 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 8F0FB4BA23F1 for ; Fri, 10 Apr 2026 11:29:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8F0FB4BA23F1 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=NpPhoilr; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=3Qd7wahV; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=NpPhoilr; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=3Qd7wahV Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) by sourceware.org (Postfix) with ESMTPS id 11DAF4BA2E2A for ; Fri, 10 Apr 2026 11:28:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 11DAF4BA2E2A 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 11DAF4BA2E2A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775820527; cv=none; b=wdN73bOLnIzMCImqQqq/pOCu4ZK8EW+/5E5K24WezLhRHGFxrgWs1Y4J7jZjqoNKYUyOHTDSKZueV3JqATbmmL6OZXlzJlV88uhm0BRv9EcYHLtqvutGfUDIK+vTtryCdjptZbG5de0MYmRabpkfhMcy3KgEiA0eqbeT9dADavc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775820527; c=relaxed/simple; bh=hZKsefwbOAmQIe12MUAS4iPE01+TbrZcVZP7UNgvXQ4=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-ID:MIME-Version; b=pOj4tfKWWsBz4Ai3lRbRt9x2ygQNFhSxUfdalnY5l85IjJHtIrl4prGYmEj2xBGNhZlO0mn30YyAWUc5uR4M3F2WKmHw8eznKPGN033n13MR7OYX7ibPyR2i6UzKyw8JILn+k1FeqjLbtr50eLKPup5H/89dHeqhQ03rkJRcZm0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 11DAF4BA2E2A 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-out2.suse.de (Postfix) with ESMTPS id 1203B5BD33 for ; Fri, 10 Apr 2026 11:28:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1775820526; 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=SsK/cIVyndQDXlfNyky8on/2GnK6Z0D+/A+zFmE6Qmo=; b=NpPhoilrDAvZAWOzOmapuJZSl8OgRh2yciYCVdL+o8v7hz1MwW9ZQJIXbaOv8YvBxdMouT nzNpVJYTcWKR/PMDz92ep5xImbf7JhjiucBEH/XR0o5a+3K1mkpjwu9g5yWZkgZw4wzU9b M0Qp9LSTbM0dKGQnHTgcR+XXoFdZpiM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1775820526; 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=SsK/cIVyndQDXlfNyky8on/2GnK6Z0D+/A+zFmE6Qmo=; b=3Qd7wahV8UcVvp1InHhzD1ZB+p2A6iUXA41pbnvFD8lpmAbBoZvqhote/jdMaxcpVflDbe vBsNupFjEj34EUCg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1775820526; 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=SsK/cIVyndQDXlfNyky8on/2GnK6Z0D+/A+zFmE6Qmo=; b=NpPhoilrDAvZAWOzOmapuJZSl8OgRh2yciYCVdL+o8v7hz1MwW9ZQJIXbaOv8YvBxdMouT nzNpVJYTcWKR/PMDz92ep5xImbf7JhjiucBEH/XR0o5a+3K1mkpjwu9g5yWZkgZw4wzU9b M0Qp9LSTbM0dKGQnHTgcR+XXoFdZpiM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1775820526; 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=SsK/cIVyndQDXlfNyky8on/2GnK6Z0D+/A+zFmE6Qmo=; b=3Qd7wahV8UcVvp1InHhzD1ZB+p2A6iUXA41pbnvFD8lpmAbBoZvqhote/jdMaxcpVflDbe vBsNupFjEj34EUCg== 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 ECD974A0B3 for ; Fri, 10 Apr 2026 11:28:45 +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 kKNwOO3e2GnVNQAAD6G6ig (envelope-from ) for ; Fri, 10 Apr 2026 11:28:45 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH 1/1] [gdb/symtab] Add find_symbol_for_pc_maybe_inline Date: Fri, 10 Apr 2026 13:28:44 +0200 Message-ID: <20260410112844.1814972-2-tdevries@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260410112844.1814972-1-tdevries@suse.de> References: <20260410112844.1814972-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 We have function find_symbol_for_pc: ... find_symbol_for_pc (CORE_ADDR pc) { return find_symbol_for_pc_sect (pc, find_pc_mapped_section (pc)); } ... which uses some standard way of getting the section for the given pc. Add a similar function find_symbol_for_pc_maybe_inline that calls find_symbol_for_pc_sect_maybe_inline, and use it in jump_command. Tested on x86_64-linux. --- gdb/blockframe.c | 8 ++++++++ gdb/infcmd.c | 3 +-- gdb/symtab.h | 6 ++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/gdb/blockframe.c b/gdb/blockframe.c index 59efa391604..ce28d99c7e4 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -152,6 +152,14 @@ find_symbol_for_pc (CORE_ADDR pc) /* See symtab.h. */ +struct symbol * +find_symbol_for_pc_maybe_inline (CORE_ADDR pc) +{ + return find_symbol_for_pc_sect_maybe_inline (pc, find_pc_mapped_section (pc)); +} + +/* See symtab.h. */ + struct symbol * find_symbol_for_pc_sect_maybe_inline (CORE_ADDR pc, struct obj_section *section) { diff --git a/gdb/infcmd.c b/gdb/infcmd.c index fa7b273ae57..f1edef534db 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1250,8 +1250,7 @@ jump_command (const char *arg, int from_tty) /* See if we are trying to jump to another function. */ fn = get_frame_function (get_current_frame ()); - sfn = find_symbol_for_pc_sect_maybe_inline (sal.pc, - find_pc_mapped_section (sal.pc)); + sfn = find_symbol_for_pc_maybe_inline (sal.pc); if (fn != nullptr && sfn != fn) { if (!query (_("Line %ps is not in `%ps'. Jump anyway? "), diff --git a/gdb/symtab.h b/gdb/symtab.h index 6e155192873..0db85bcf5ba 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -2201,6 +2201,12 @@ extern struct type *lookup_enum (const char *, const struct block *); extern struct symbol *find_symbol_for_pc (CORE_ADDR); +/* Lookup the function symbol corresponding to the address. The return value + will be the closest enclosing function, which might be an inline + function. */ + +extern struct symbol *find_symbol_for_pc_maybe_inline (CORE_ADDR pc); + /* lookup the function corresponding to the address and section. The return value will not be an inlined function; the containing function will be returned instead. */ -- 2.51.0