This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: gdb: Incorrect stack unwinding if compressed debug info is used
- From: Paul Pluzhnikov <ppluzhnikov at google dot com>
- To: Vladimir Simonov <sv at sw dot ru>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 2 Feb 2011 11:55:00 -0800
- Subject: Re: gdb: Incorrect stack unwinding if compressed debug info is used
- References: <1296238472.3009.ezmlm@sourceware.org> <4D46D872.6080407@sw.ru>
On Mon, Jan 31, 2011 at 7:42 AM, Vladimir Simonov <sv@sw.ru> wrote:
> If I create -Od -g3 executable with -Wl,compressed-debug-sections=zlib
What is '-Od' ?
And you mean '-Wl,--compress-debug-sections=zlib', not
'-Wl,compressed-debug-sections=zlib'
> using gold linker or compress debug-info via objcopy I have problems with
> local variables and bacttraces in gdb.
Can you construct a small example showing the problem? I haven't been able
to reproduce it.
> Something like this:
> gdb: bt
> ....
> #11 0xb2356a74 in Core::WorkerImpl::WorkerThread (this=Could not find
> the frame base for "Core::WorkerImpl::WorkerThread()".
> )
> ....
>
> I've spend some time and, looks like, found the problem. It is in
> dwarf2_symbol_mark_computed function (dwarf2read.c). Check
> "DW_UNSND (attr) < dwarf2_per_objfile->loc.size"
> is incorrect if compressed section is used. In this case
> loc.size contains compressed section size, not decompressed one.
> It happens if the section has not been read via dwarf2_read_section yet.
> But dwarf2_locate_sections has been done.
I am curious how your GDB avoids dwarf2_read_section(). As far as I can
tell, it should always be called (indirectly) by dwarf2_initialize_objfile().
> As result symbols not passed above verification are left with
> size==0 and data==NULL after dwarf2_symbol_mark_computed function.
>
> The patch idea is to introduce uncompressed_size field in
> struct dwarf2_section_info. And fill it in dwarf2_locate_sections.
> Check in dwarf2_symbol_mark_computed function takes into
> account uncompressed_size. The patch is quite large cause I
> try to avoid code duplication with zlib_decompress section.
Assuming the patch makes sense (which I am not yet convinced) ...
+static void
+fill_dwarf2_section_info (struct dwarf2_section_info* info,
+ bfd *abfd, asection *sectp)
+{
+ bfd_size_type size;
+
+ info->asection = sectp;
+ info->size = bfd_get_section_size (sectp);
+ info->uncompressed_size = 0;
+ if (!is_compressed_section_name (sectp->name))
+ return;
+ read_uncompressed_size (abfd, sectp, &info->uncompressed_size);
+}
Would it make sense to just set uncompressed_size to size if the section
is not compressed? I think that would simplify the patch a bit.
+ fill_dwarf2_section_info(&dwarf2_per_objfile->info, abfd, sectp);
Missing space before '('.
Your patch is also missing ChangeLog entry.
Cheers,
--
Paul Pluzhnikov