From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30340 invoked by alias); 6 Sep 2019 15:31:27 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 30327 invoked by uid 89); 6 Sep 2019 15:31:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 spammy=fname X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Sep 2019 15:31:25 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 9FB38AD69 for ; Fri, 6 Sep 2019 15:31:23 +0000 (UTC) Subject: [PING^2][PATCH][gdb/symtab] Handle gas-generated stabs with -fPIE/-pie From: Tom de Vries To: gdb-patches@sourceware.org References: <20190816155753.GA22229@delia> Openpgp: preference=signencrypt Message-ID: <6445bf85-e6b9-0d39-4f06-c6fdde81f9bf@suse.de> Date: Fri, 06 Sep 2019 15:31:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2019-09/txt/msg00066.txt.bz2 On 29-08-19 17:04, Tom de Vries wrote: > On 16-08-19 17:57, Tom de Vries wrote: >> Hi, >> >> With gdb.dwarf2/dw2-ranges.exp and target board unix/-fPIE/-pie, we run into: >> ... >> info line main3^M >> No line number information available for address 0x55555555464c ^M >> (gdb) FAIL: gdb.dwarf2/dw2-ranges.exp: info line main3 >> ... >> >> The main3 function in the executable comes from dw2-ranges3.o, which is >> generated like this (leaving out -fPIE -pie for clarity): >> ... >> $ gcc -S dw2-ranges3.c >> $ gcc dw2-ranges3.s -o dw2-ranges3.o -gstabs >> ... >> So, main3 is described in stabs format, generated by gas. >> >> The difference between gcc-generated and gas-generated SLINE stabs is that gcc >> generates a sequence SO (source), FUN (function), SLINE (source line) whereas >> gas generates SO, SLINE. >> >> The problem is that the line address relocation handling in process_one_symbol >> assumes an order of SO, FUN, SLINE. >> >> Fix this by also handling SO, SLINE. >> >> This also fixes FAILs in gdb.btrace/instruction_history.exp with >> target board stabs/-fPIE/-pie. >> >> Tested on x86_64-linux with target boards unix, unix/-fPIE/-pie, stabs, and >> stabs/-fPIE/-pie. >> >> OK for trunk? >> Ping^2. Thanks, - Tom >> [gdb/symtab] Handle gas-generated stabs with -fPIE/-pie >> >> gdb/ChangeLog: >> >> 2019-08-16 Tom de Vries >> >> PR symtab/12497 >> * dbxread.c (process_one_symbol): Handle relocation of SLINE address >> without preceding FUN/FNAME. >> >> --- >> gdb/dbxread.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/gdb/dbxread.c b/gdb/dbxread.c >> index e339d1f7ec..e0ab4ec19c 100644 >> --- a/gdb/dbxread.c >> +++ b/gdb/dbxread.c >> @@ -2626,6 +2626,9 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name, >> >> /* Relocate for dynamic loading and for ELF acc >> function-relative symbols. */ >> + if (function_start_offset == 0) >> + function_start_offset >> + = ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile)); >> valu += function_start_offset; >> >> /* GCC 2.95.3 emits the first N_SLINE stab somwehere in the >>