This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Adding a missing NT_FILES note to a core file so gdb can load solibs for it
- From: Bogdan Harjoc <harjoc at gmail dot com>
- To: gdb at sourceware dot org
- Date: Mon, 25 Jan 2016 17:56:53 +0200
- Subject: Re: Adding a missing NT_FILES note to a core file so gdb can load solibs for it
- Authentication-results: sourceware.org; auth=none
- References: <CAF4+tmrNC8WbrECU8jqx8cS3k_BE9kbvphc=4LYWs6WX5m_PUg at mail dot gmail dot com> <20160125142226 dot GA5665 at host1 dot jankratochvil dot net>
Thanks, a comment in elf_locate_base() confirms NT_FILES wouldn't work:
/* Look for DT_MIPS_RLD_MAP first. MIPS executables use this instead
of DT_DEBUG [...] */
Solib loading apparently fails here:
#0 read_memory_typed_address (info->debug_base + lmo->r_map_offset)
the map
#1 solib_svr4_r_map
because read_memory...() reads 0x0 from info->debug_base + lmo->r_map_offset.
What I can't figure out is where the rld map should be in the core file.
Thanks.
On Mon, Jan 25, 2016 at 4:22 PM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
> On Mon, 25 Jan 2016 15:06:05 +0100, Bogdan Harjoc wrote:
>> So I'd like to ask whether this has any chance of working.
>
> No. GDB does not support NT_FILE reading. GDB follows DT_DEBUG:
> readelf -d execbinary|grep -w DEBUG
>
> Besides that it would not be completely correct, depending on the point of
> view. mmap()ped shared library will be present in NT_FILE but GDB will not
> shows it as it was not dlopen()ed (either by a call or via DT_NEEDED).
>
> When GDB cannot read shared libraries it usually means your executable does
> not exactly match the one that was core dumped. To make them matching one
> should match build-id from the core file with that of the executable:
> eu-unstrip -n --core=corefile
> readelf -n execbinary|grep -A1 NT_GNU_BUILD_ID
> IIRC ld-linux.so also needs to match, I cannot remember why now.
>
>
> Jan