public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 6/8] Use BLOCK_ENTRY_PC to find function entry pc in infrun.c
Date: Tue, 26 Jun 2018 06:53:00 -0000	[thread overview]
Message-ID: <20180625235326.2aa421f2@pinnacle.lan> (raw)
In-Reply-To: <20180625233239.49dc52ea@pinnacle.lan>

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);
 

  parent reply	other threads:[~2018-06-26  6:53 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-26  6:32 [PATCH 0/8] Non-contiguous address range support Kevin Buettner
2018-06-26  6:42 ` [PATCH 1/8] Add block range data structure for blocks with non-contiguous address ranges Kevin Buettner
2018-08-01  1:36   ` Simon Marchi
2018-08-01 23:57     ` Kevin Buettner
2018-08-01  1:40   ` Simon Marchi
2018-06-26  6:44 ` [PATCH 2/8] Record explicit block ranges from dwarf2read.c Kevin Buettner
2018-08-01  1:41   ` Simon Marchi
2018-06-26  6:47 ` [PATCH 3/8] Add support for non-contiguous blocks to find_pc_partial_function Kevin Buettner
2018-07-19 18:52   ` Kevin Buettner
2018-08-01  2:01     ` Simon Marchi
2018-08-01 23:40       ` Kevin Buettner
2018-06-26  6:49 ` [PATCH 4/8] Disassemble blocks with non-contiguous ranges Kevin Buettner
2018-08-01  2:08   ` Simon Marchi
2018-06-26  6:51 ` [PATCH 5/8] Use BLOCK_ENTRY_PC in place of most uses of BLOCK_START Kevin Buettner
2018-08-01  2:22   ` Simon Marchi
2018-08-02  0:07     ` Kevin Buettner
2018-06-26  6:53 ` Kevin Buettner [this message]
2018-08-01  2:28   ` [PATCH 6/8] Use BLOCK_ENTRY_PC to find function entry pc in infrun.c Simon Marchi
2018-06-26  6:55 ` [PATCH 7/8] Relocate block range start and end addresses Kevin Buettner
2018-08-01  2:30   ` Simon Marchi
2018-06-26  6:57 ` [PATCH 8/8] Test case for functions with non-contiguous ranges Kevin Buettner
2018-08-01  2:56   ` Simon Marchi
2018-07-11 15:27 ` [PATCH 0/8] Non-contiguous address range support Kevin Buettner
2018-07-11 15:32   ` Keith Seitz
2018-07-12 19:12 ` Simon Marchi
2018-07-17  2:00   ` Kevin Buettner
2018-07-19 15:55     ` Simon Marchi
2018-07-19 19:07       ` Kevin Buettner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180625235326.2aa421f2@pinnacle.lan \
    --to=kevinb@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).