public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [committed][gdb/symtab] Fix disassembly of non-contiguous functions
Date: Thu, 23 Apr 2020 09:12:27 +0200	[thread overview]
Message-ID: <20200423071225.GA684@delia> (raw)

Hi,

When running test-case gdb.dwarf2/dw2-ranges-func.exp with target board
readnow, we have:
...
FAIL: gdb.dwarf2/dw2-ranges-func.exp: disassemble foo (pattern 2)
...

The function foo consists of two ranges:
...
 <1><12f>: Abbrev Number: 7 (DW_TAG_subprogram)
    <130>   DW_AT_external    : 1
    <131>   DW_AT_name        : foo
    <135>   DW_AT_ranges      : 0x40
...
which are listed here:
...
    00000040 00000000004004c1 00000000004004dc
    00000040 00000000004004ae 00000000004004ba
...

Normally the disassemble instruction lists both ranges, but with -readnow it
only lists the first.

This is due to function find_pc_partial_function, which only interacts with
partial symtabs, but not with expanded ones.

Fix this by using find_pc_sect_compunit_symtab in find_pc_partial_function.

Tested on x86_64, with native and target board readnow.

This fixes 19 FAILs for target board readnow, in test-cases
gdb.arch/amd64-entry-value.exp, gdb.base/multi-forks.exp,
gdb.dwarf2/dw2-ranges-func.exp and gdb.linespec/skip-two.exp.

Committed to trunk.

Thanks,
- Tom

[gdb/symtab] Fix disassembly of non-contiguous functions

gdb/ChangeLog:

2020-04-22  Tom de Vries  <tdevries@suse.de>

	* blockframe.c (find_pc_partial_function): Use
	find_pc_sect_compunit_symtab rather than
	objfile->sf->qf->find_pc_sect_compunit_symtab.

---
 gdb/blockframe.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index 4f8fa42dc6b..09c3eed48db 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -236,19 +236,7 @@ find_pc_partial_function (CORE_ADDR pc, const char **name, CORE_ADDR *address,
     goto return_cached_value;
 
   msymbol = lookup_minimal_symbol_by_pc_section (mapped_pc, section);
-  for (objfile *objfile : current_program_space->objfiles ())
-    {
-      if (objfile->sf)
-	{
-	  compunit_symtab
-	    = objfile->sf->qf->find_pc_sect_compunit_symtab (objfile, msymbol,
-							     mapped_pc,
-							     section,
-							     0);
-	}
-      if (compunit_symtab != NULL)
-	break;
-    }
+  compunit_symtab = find_pc_sect_compunit_symtab (mapped_pc, section);
 
   if (compunit_symtab != NULL)
     {

                 reply	other threads:[~2020-04-23  7:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20200423071225.GA684@delia \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /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).