From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PING][PATCH][gdb/symtab] Handle gas-generated stabs with -fPIE/-pie
Date: Thu, 29 Aug 2019 15:04:00 -0000 [thread overview]
Message-ID: <a77214d3-47d8-63c3-8b7c-c837c093838d@suse.de> (raw)
In-Reply-To: <20190816155753.GA22229@delia>
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 <main3>^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.
Thanks,
- Tom
> [gdb/symtab] Handle gas-generated stabs with -fPIE/-pie
>
> gdb/ChangeLog:
>
> 2019-08-16 Tom de Vries <tdevries@suse.de>
>
> 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
>
next prev parent reply other threads:[~2019-08-29 15:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-16 15:58 [PATCH][gdb/symtab] " Tom de Vries
2019-08-29 15:04 ` Tom de Vries [this message]
2019-09-06 15:31 ` [PING^2][PATCH][gdb/symtab] " Tom de Vries
2019-09-13 19:51 ` [PING^3][PATCH][gdb/symtab] " Tom de Vries
2019-10-09 14:47 ` [PATCH][gdb/symtab] " Tom Tromey
2019-10-15 10:18 ` [RFC] Do we need to support PIE + stabs? Tom de Vries
2019-10-25 14:39 ` Tom Tromey
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=a77214d3-47d8-63c3-8b7c-c837c093838d@suse.de \
--to=tdevries@suse.de \
--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).