public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Paul Pluzhnikov <ppluzhnikov@google.com>
To: Vladimir Simonov <sv@sw.ru>
Cc: gdb-patches@sourceware.org
Subject: Re: gdb: Incorrect stack unwinding if compressed debug info is used
Date: Wed, 02 Feb 2011 19:55:00 -0000	[thread overview]
Message-ID: <AANLkTi=D2U0YKCKynA5KMva_o3daGAw_M2kLEFhohZ+P@mail.gmail.com> (raw)
In-Reply-To: <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

  reply	other threads:[~2011-02-02 19:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1296238472.3009.ezmlm@sourceware.org>
2011-01-31 16:57 ` Vladimir Simonov
2011-02-02 19:55   ` Paul Pluzhnikov [this message]
2011-02-03 16:51     ` Vladimir Simonov
2011-02-04 16:35     ` Tom Tromey
2011-02-04 16:34   ` Tom Tromey
2011-02-04 17:47     ` Vladimir Simonov
2011-02-04 17:56       ` Tom Tromey
2011-02-04 18:43         ` Vladimir Simonov
2011-02-04 20:31           ` Tom Tromey
2011-02-05 13:53             ` Vladimir Simonov
2011-02-07 15:00               ` Tom Tromey
2011-02-01  7:34 ` gdb: Incorrect stack unwinding if debug info is compressed Vladimir Simonov

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='AANLkTi=D2U0YKCKynA5KMva_o3daGAw_M2kLEFhohZ+P@mail.gmail.com' \
    --to=ppluzhnikov@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sv@sw.ru \
    /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).