This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH][gdb] Fix gdb.dwarf2/amd64-entry-value-param.exp with -fPIE/-pie
- From: Tom Tromey <tom at tromey dot com>
- To: Tom de Vries <tdevries at suse dot de>
- Cc: gdb-patches at sourceware dot org, Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Date: Fri, 09 Aug 2019 12:16:35 -0600
- Subject: Re: [PATCH][gdb] Fix gdb.dwarf2/amd64-entry-value-param.exp with -fPIE/-pie
- References: <20190809075424.GA15972@delia>
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
Tom> Fix this by eliminating baseaddr from read_call_site_scope, and handling the
Tom> relocation offset at the use sites in call_site_for_pc and
Tom> call_site_to_target_addr.
I like this approach, since it represents some small progress on the
objfile splitting project.
Tom> + {
Tom> + struct obj_section *sec;
Tom> + sec = find_pc_section (pc);
Tom> + if (sec != NULL)
Tom> + {
Tom> + struct objfile *objfile = sec->objfile;
Tom> + CORE_ADDR baseaddr
Tom> + = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
Why SECT_OFF_TEXT rather than the section "sec"?
Tom> + CORE_ADDR pc_unrelocated
Tom> + = gdbarch_adjust_dwarf2_addr (gdbarch, pc - baseaddr);
I am not sure gdbarch_adjust_dwarf2_addr can be used "bidirectionally"
like this. It is probably fine in practice but I wonder about the
documented contract.
Tom> + CORE_ADDR baseaddr
Tom> + = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
I guess this assumes the text section - but then can the call to
find_pc_section give anything else? Maybe it's just something to
comment and move on.
Tom> - pc = attr_value_as_address (attr) + baseaddr;
Tom> - pc = gdbarch_adjust_dwarf2_addr (gdbarch, pc);
Tom> + pc = attr_value_as_address (attr);
The approach taken elsewhere in dwarf2read.c is to bias, adjust, then
unbias:
CORE_ADDR low
= (gdbarch_adjust_dwarf2_addr (gdbarch, best_lowpc + baseaddr)
- baseaddr);
Maybe this would be better here as well, or at least consistent.
Tom