From patchwork Tue Jun 26 06:53:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Buettner X-Patchwork-Id: 28043 Received: (qmail 49221 invoked by alias); 26 Jun 2018 06:53:31 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 49200 invoked by uid 89); 26 Jun 2018 06:53:30 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 26 Jun 2018 06:53:29 +0000 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 39E58308FBA4 for ; Tue, 26 Jun 2018 06:53:28 +0000 (UTC) Received: from pinnacle.lan (ovpn-117-99.phx2.redhat.com [10.3.117.99]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1B4E85975E for ; Tue, 26 Jun 2018 06:53:28 +0000 (UTC) Date: Mon, 25 Jun 2018 23:53:26 -0700 From: Kevin Buettner To: gdb-patches@sourceware.org Subject: [PATCH 6/8] Use BLOCK_ENTRY_PC to find function entry pc in infrun.c Message-ID: <20180625235326.2aa421f2@pinnacle.lan> In-Reply-To: <20180625233239.49dc52ea@pinnacle.lan> References: <20180625233239.49dc52ea@pinnacle.lan> MIME-Version: 1.0 X-IsSubscribed: yes find_pc_partial_function() still returns the lowest and highest address of a function even when that function contains non-contiguous ranges. In cases where greater discrimination is required, the BLOCK parameter may be examined to determine the actual entry PC. This patch uses the BLOCK return value from find_pc_partial_function() to obtain the entry PC. If no block is found - which can happen when only minimal symbols are available - then the start address provided by find_pc_partial_function() will still be used (as before). gdb/ChangeLog: * infrun.c (fill_in_stop_func): Use BLOCK_ENTRY_PC to determine stop_func_start in the execution control state. --- gdb/infrun.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gdb/infrun.c b/gdb/infrun.c index f455af2..88d8fdc 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -4297,10 +4297,20 @@ fill_in_stop_func (struct gdbarch *gdbarch, { if (!ecs->stop_func_filled_in) { + const struct block *block; + /* Don't care about return value; stop_func_start and stop_func_name will both be 0 if it doesn't work. */ find_pc_partial_function (stop_pc, &ecs->stop_func_name, - &ecs->stop_func_start, &ecs->stop_func_end); + &ecs->stop_func_start, &ecs->stop_func_end, + &block); + + /* If a block is returned, prefer the block's entry point instead of + the lowest address of the block - these aren't necessarily the + same. */ + if (block) + ecs->stop_func_start = BLOCK_ENTRY_PC (block); + ecs->stop_func_start += gdbarch_deprecated_function_start_offset (gdbarch);