From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 28963385DC0B for ; Thu, 23 Apr 2020 07:12:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 28963385DC0B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 96585AE81; Thu, 23 Apr 2020 07:12:28 +0000 (UTC) Date: Thu, 23 Apr 2020 09:12:27 +0200 From: Tom de Vries To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [committed][gdb/symtab] Fix disassembly of non-contiguous functions Message-ID: <20200423071225.GA684@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-29.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Apr 2020 07:12:31 -0000 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 * 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) {