public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/45690]  New: broken debuginfo with dwarf4?
@ 2010-09-16 14:01 pluto at agmk dot net
  2010-09-16 14:02 ` [Bug c++/45690] " pluto at agmk dot net
  2010-09-16 21:03 ` pluto at agmk dot net
  0 siblings, 2 replies; 8+ messages in thread
From: pluto at agmk dot net @ 2010-09-16 14:01 UTC (permalink / raw)
  To: gcc-bugs

hi,

on the recent 4.5 branch i have a problems with dwarf4 and pretty printers.
here's steps to reproduce:

$ make
/local/devel/toolchain45/x86_64-gnu-linux.mt_alloc/bin/x86_64-gnu-linux-g++
t.cpp -gdwarf-3 -g2 -o t-dw3
/local/devel/toolchain45/x86_64-gnu-linux.mt_alloc/bin/x86_64-gnu-linux-g++
t.cpp -gdwarf-4 -g2 -o t-dw4

$ gdb ./t-dw3
(gdb) r
Breakpoint 1, main () at t.cpp:4
4               std::string s( "foo" );
(gdb) n
5               s.size();
(gdb) p s
$1 = "foo"

$ gdb ./t-dw4
(gdb) r
Breakpoint 1, main () at t.cpp:4
4               std::string s( "foo" );
(gdb) n
5               s.size();
(gdb) p s
$1 = Traceback (most recent call last):
  File
"/local/devel/toolchain45/x86_64-gnu-linux.mt_alloc/share/gcc-4.5.2/python/libstdcxx/v6/printers.py",
line 547, in to_string
    reptype = gdb.lookup_type (str (realtype) + '::_Rep').pointer ()
RuntimeError: No type named std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::_Rep.

$ readelf --debug-dump=pubtypes t-dw3                                           
Contents of the .debug_pubtypes section:

  Length:                              443
  Version:                             2
  Offset into .debug_info section:     0x0
  Size of area in .debug_info section: 13545

    Offset      Name
    2d          ptrdiff_t
    3f          size_t
    6bf         __FILE
    6ca         __va_list_tag
    709         wint_t
    770         mbstate_t
    fa4         char_traits
    121c        __pthread_internal_list
    1243        __pthread_list_t
    12ed        __compar_fn_t
    b99         tm
    161c        __gthread_mutex_t
    1627        _Atomic_word
    163a        __pool_base
    17c5        __pool
    1998        __mt_alloc_base
    1a8e        __common_pool
    1adb        __common_pool_base
    1b2f        __common_pool_policy
    1b57        __mt_alloc
    1c62        allocator
    1cf0        lconv
    1e5c        __numeric_traits_integer
    1ecc        basic_string
    3293        _Rep_base
    32c4        _Rep

$ readelf --debug-dump=pubtypes t-dw4
Contents of the .debug_pubtypes section:

  Length:                              394
  Version:                             2
  Offset into .debug_info section:     0x0
  Size of area in .debug_info section: 3926

    Offset      Name
    2d          ptrdiff_t
    3f          size_t
    41e         __FILE
    25          __va_list_tag
    42b         wint_t
    43e         mbstate_t
    34          char_traits
    25          __pthread_internal_list
    b7f         __compar_fn_t
    25          tm
    34          __pool_base
    34          __pool
    34          __mt_alloc_base
    34          __common_pool
    34          __common_pool_base
    34          __common_pool_policy
    34          __mt_alloc
    34          allocator
    25          lconv
    34          __numeric_traits_integer
    25          rebind
    34          basic_string
    34          _Rep_base
    34          _Rep

as you can see few types have the same "offset 34". looks like a bug.


-- 
           Summary: broken debuginfo with dwarf4?
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pluto at agmk dot net
 GCC build triplet: x86_64-gnu-linux
  GCC host triplet: x86_64-gnu-linux
GCC target triplet: x86_64-gnu-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45690


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/45690] broken debuginfo with dwarf4?
  2010-09-16 14:01 [Bug c++/45690] New: broken debuginfo with dwarf4? pluto at agmk dot net
@ 2010-09-16 14:02 ` pluto at agmk dot net
  2010-09-16 21:03 ` pluto at agmk dot net
  1 sibling, 0 replies; 8+ messages in thread
From: pluto at agmk dot net @ 2010-09-16 14:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pluto at agmk dot net  2010-09-16 14:01 -------
Created an attachment (id=21811)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21811&action=view)
source, makefile and precompiled binaries.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45690


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/45690] broken debuginfo with dwarf4?
  2010-09-16 14:01 [Bug c++/45690] New: broken debuginfo with dwarf4? pluto at agmk dot net
  2010-09-16 14:02 ` [Bug c++/45690] " pluto at agmk dot net
@ 2010-09-16 21:03 ` pluto at agmk dot net
  1 sibling, 0 replies; 8+ messages in thread
From: pluto at agmk dot net @ 2010-09-16 21:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pluto at agmk dot net  2010-09-16 21:02 -------
ha, my gcc was built with: export CXXFLAGS="-O2"; ./configure
--disable-shared..."
and this CXXFLAGS afaics affects libstdc++.a debuginfo level.
with CXXFLAGS="-O2 -g2" the python pretty printer works fine.

testcase compiled with -gdwarf-4 -g2 and linked with stripped libstdc++.a
ends with undebugable std::string. of course with -gdwarf-3 everything
works fine.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45690


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/45690] broken debuginfo with dwarf4?
       [not found] <bug-45690-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2011-10-18 14:30 ` jakub at gcc dot gnu.org
@ 2012-01-20 15:47 ` tromey at gcc dot gnu.org
  4 siblings, 0 replies; 8+ messages in thread
From: tromey at gcc dot gnu.org @ 2012-01-20 15:47 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45690

--- Comment #7 from Tom Tromey <tromey at gcc dot gnu.org> 2012-01-20 14:59:51 UTC ---
gdb doesn't read .debug_pubtypes.
So the problem must be something else.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/45690] broken debuginfo with dwarf4?
       [not found] <bug-45690-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2011-10-18 11:37 ` paolo.carlini at oracle dot com
@ 2011-10-18 14:30 ` jakub at gcc dot gnu.org
  2012-01-20 15:47 ` tromey at gcc dot gnu.org
  4 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-10-18 14:30 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45690

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-10-18 14:28:51 UTC ---
The problem is that the DWARF4 standard says that .debug_pubtypes resp.
.debug_pubnames refer to .debug_info section offsets and this hasn't been
updated for the (optional) .debug_types section addition.  If a type (resp.
name) DIE is instead in .debug_types section, it is unclear what should be
done.
Either such a type shouldn't be added into .debug_pubtypes at all, or we'd need
to refer to something.  I don't see anything to refer to in .debug_info section
though, usually it just contains DW_AT_type with DW_FORM_sig8 containing the
.debug_types hash with the type.  And it isn't possible to refer to
.debug_types section offsets, because the consumers would need a way to
differentiate between what is a .debug_info offset in the header (relative to
start of .debug_info) and what is a .debug_types offset (relative to start of
.debug_types).
I think currently what you see is gcc emitting offsets within containing
.debug_types section in .debug_pubtypes chunks corresponding to .debug_info.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/45690] broken debuginfo with dwarf4?
       [not found] <bug-45690-4@http.gcc.gnu.org/bugzilla/>
  2010-10-14 11:13 ` pluto at agmk dot net
  2010-10-14 11:18 ` pluto at agmk dot net
@ 2011-10-18 11:37 ` paolo.carlini at oracle dot com
  2011-10-18 14:30 ` jakub at gcc dot gnu.org
  2012-01-20 15:47 ` tromey at gcc dot gnu.org
  4 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-18 11:37 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45690

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|gcc-bugs at gcc dot gnu.org |tromey at gcc dot gnu.org

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-18 11:36:19 UTC ---
Maybe Tom can have a look, see if something (still) makes sense here.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/45690] broken debuginfo with dwarf4?
       [not found] <bug-45690-4@http.gcc.gnu.org/bugzilla/>
  2010-10-14 11:13 ` pluto at agmk dot net
@ 2010-10-14 11:18 ` pluto at agmk dot net
  2011-10-18 11:37 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: pluto at agmk dot net @ 2010-10-14 11:18 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45690

--- Comment #4 from Pawel Sikora <pluto at agmk dot net> 2010-10-14 11:17:55 UTC ---
attached gcc build script builds libstdc++.a with dwarf3 debuginfo
which works with testcase compiled with dwarf3 or dwarf4.
if you change CUSTOM_FLAGS in build script to emit dwarf4 for libstdc++.a
then you'll get runtime error in python gdb printer.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/45690] broken debuginfo with dwarf4?
       [not found] <bug-45690-4@http.gcc.gnu.org/bugzilla/>
@ 2010-10-14 11:13 ` pluto at agmk dot net
  2010-10-14 11:18 ` pluto at agmk dot net
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: pluto at agmk dot net @ 2010-10-14 11:13 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45690

--- Comment #3 from Pawel Sikora <pluto at agmk dot net> 2010-10-14 11:13:10 UTC ---
Created attachment 22036
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22036
my gcc build script.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-01-20 15:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-16 14:01 [Bug c++/45690] New: broken debuginfo with dwarf4? pluto at agmk dot net
2010-09-16 14:02 ` [Bug c++/45690] " pluto at agmk dot net
2010-09-16 21:03 ` pluto at agmk dot net
     [not found] <bug-45690-4@http.gcc.gnu.org/bugzilla/>
2010-10-14 11:13 ` pluto at agmk dot net
2010-10-14 11:18 ` pluto at agmk dot net
2011-10-18 11:37 ` paolo.carlini at oracle dot com
2011-10-18 14:30 ` jakub at gcc dot gnu.org
2012-01-20 15:47 ` tromey at gcc dot gnu.org

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).