This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug python/14235] verbose RTTI message polluting traces


http://sourceware.org/bugzilla/show_bug.cgi?id=14235

--- Comment #10 from Tom Tromey <tromey at redhat dot com> 2013-02-16 02:29:47 UTC ---
This also appears to be valid:

void f()
{
  {
    struct Z { virtual ~Z() { } };
    Z zz;
  }
  {
    struct Z { virtual ~Z() { } };
    Z zz;
  }
}

Yielding:

barimba. nm dt.o
00000000000000db T _Z1fv
0000000000000040 r _ZTIZ1fvE1Z
0000000000000050 r _ZTIZ1fvE1Z_0
000000000000006b r _ZTSZ1fvE1Z
0000000000000060 r _ZTSZ1fvE1Z_0
                 U _ZTVN10__cxxabiv117__class_type_infoE
0000000000000020 r _ZTVZ1fvE1Z
0000000000000000 r _ZTVZ1fvE1Z_0
00000000000000c6 t _ZZ1fvEN1ZC1E_0v
0000000000000058 t _ZZ1fvEN1ZC1Ev
00000000000000c6 t _ZZ1fvEN1ZC2E_0v
0000000000000058 t _ZZ1fvEN1ZC2Ev
00000000000000a0 t _ZZ1fvEN1ZD0E_0v
0000000000000032 t _ZZ1fvEN1ZD0Ev
000000000000006e t _ZZ1fvEN1ZD1E_0v
0000000000000000 t _ZZ1fvEN1ZD1Ev
000000000000006e t _ZZ1fvEN1ZD2E_0v
0000000000000000 t _ZZ1fvEN1ZD2Ev
                 U _ZdlPv


barimba. nm -C dt.o | grep vtable
                 U vtable for __cxxabiv1::__class_type_info
0000000000000020 r vtable for f()::Z
0000000000000000 r vtable for f()::Z

(Also, note the "()"s.  In the earlier example there was a
hidden trick: main is extern "C".)


Furthermore it seems to me that we can't rely on ever having
read debuginfo for the scope in which the class is defined.
We have to expand the CU holding the function first, then
find the type in the function.

A multi-step approach:

First, use the demangler to dissect the vtable's mangled name.
>From this deduce whether a function scope must be read.

Then construct the name of the function and look up its symbol,
causing the desired CU expansion.

Then search all the blocks of that function looking for the
appropriate type.  This is tricky due to the example above.
In fact it isn't clear to me how it can reliably be done given
the debuginfo currently emitted.  I don't see a way to determine
which type to use based on just the name of its vtable.
(And if we added some ad hoc attribute I wonder how it would work
for partially constructed objects.)

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]