Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* warning: RTTI symbol not found for class
@ 2012-11-21 18:08 ali_anwar
  2012-11-21 18:32 ` Jan Kratochvil
  0 siblings, 1 reply; 6+ messages in thread
From: ali_anwar @ 2012-11-21 18:08 UTC (permalink / raw)
  To: gdb-patches, keiths, Jan Kratochvil

[-- Attachment #1: Type: text/plain, Size: 1377 bytes --]

Hi,

While debugging a cpp demo (containing the std::cout call) when I issue 
"p std::cout", I get following warning: "warning: RTTI symbol not found 
for class 'std::ostream'".

Even after setting the print object off.

set print object off
p std::cout
$4 = warning: RTTI symbol not found for class 'std::ostream'


Attached patch is a work around for it.

I also came across following mail thread:
http://www.sourceware.org/ml/gdb-patches/2011-08/msg00474.html

I have verified that this work around also works for the bug 1266 
mentioned in the mail:

b calltest(std::basic_string<char, std::char_traits<char>, 
std::allocator<char> >)
Breakpoint 11 at 0x1d58: file ../src/cpp_.cpp, line 5.
b calltest(foo)
Note: breakpoint 11 also set at pc 0x1d58.
Breakpoint 12 at 0x1d58: file ../src/cpp_.cpp, line 5.
b calltest(std::string)
Note: breakpoints 11 and 12 also set at pc 0x1d58.
Breakpoint 13 at 0x1d58: file ../src/cpp_.cpp, line 5.

Do we have any fix for this issue if not then is it ok to have this work 
around until we get a proper fix?

I have not added the DMGL_VERBOSE to dwarf2_physname and 
lookup_symbol_in_language as I saw the Keith's mail thread after testing 
my patch. Also as I have not seen that part of the code (I thought to 
share the patch before doing so) so I am not sure why its going to be 
useful to have DMGL_VERBOSE added there.

Thanks,
-Ali

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gdb_demangle.patch --]
[-- Type: text/x-patch; name="gdb_demangle.patch", Size: 1056 bytes --]

Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.14849
diff -u -r1.14849 ChangeLog
--- ChangeLog	21 Nov 2012 14:09:03 -0000	1.14849
+++ ChangeLog	21 Nov 2012 16:38:10 -0000
@@ -1,3 +1,7 @@
+2012-11-21  Ali Anwar  <ali_anwar@codesourcery.com>
+
+	* gdbtypes.c (symbol_find_demangled_name): Add DMGL_VERBOSE.
+
 2012-11-21  Yao Qi  <yao@codesourcery.com>
 
 	PR tdep/7438
Index: symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.323
diff -u -r1.323 symtab.c
--- symtab.c	20 Nov 2012 22:51:04 -0000	1.323
+++ symtab.c	21 Nov 2012 16:38:12 -0000
@@ -593,7 +593,7 @@
       || gsymbol->language == language_auto)
     {
       demangled =
-        cplus_demangle (mangled, DMGL_PARAMS | DMGL_ANSI);
+        cplus_demangle (mangled, DMGL_PARAMS | DMGL_ANSI | DMGL_VERBOSE);
       if (demangled != NULL)
 	{
 	  gsymbol->language = language_cplus;

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

* Re: warning: RTTI symbol not found for class
  2012-11-21 18:08 warning: RTTI symbol not found for class ali_anwar
@ 2012-11-21 18:32 ` Jan Kratochvil
  2012-11-26 19:14   ` ali_anwar
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Kratochvil @ 2012-11-21 18:32 UTC (permalink / raw)
  To: ali_anwar; +Cc: gdb-patches, keiths

Hello Ali,

On Wed, 21 Nov 2012 19:06:22 +0100, ali_anwar wrote:
> While debugging a cpp demo (containing the std::cout call) when I
> issue "p std::cout", I get following warning: "warning: RTTI symbol
> not found for class 'std::ostream'".

I do not have it reproducible.  When you have not provided a GDB testcase
could you at least provide OS and a reproducer there?  This way the patch does
not fix anything to me.

Fedora 18 x86_64
GNU gdb (GDB) 7.5.50.20121120-cvs
cat >cout.C <<HERE
#include <iostream>
int main () { std::cout << "foo" << std::endl; }
HERE
g++ -o cout cout.C -Wall -g
gdb -q ./cout -ex start -ex 'p std::cout' -ex c -ex q
$1 = {<std::basic_ios<char, std::char_traits<char> >> = <invalid address>, _vptr.basic_ostream = 0x0}

(<invalid address> does not look great but this patch does not fix it)


> Do we have any fix for this issue if not then is it ok to have this
> work around until we get a proper fix?

It has a regression:

-PASS: gdb.cp/bs15503.exp: print s.length()
-PASS: gdb.cp/bs15503.exp: print s[0]
-PASS: gdb.cp/bs15503.exp: print s[s.length()-1]
+FAIL: gdb.cp/bs15503.exp: print s.length()
+FAIL: gdb.cp/bs15503.exp: print s[0]
+FAIL: gdb.cp/bs15503.exp: print s[s.length()-1]
-PASS: gdb.cp/bs15503.exp: print (const char *) s.substr(0,4)
-PASS: gdb.cp/bs15503.exp: print (const char *) (s=s.substr(0,4))
+FAIL: gdb.cp/bs15503.exp: print (const char *) s.substr(0,4)
+FAIL: gdb.cp/bs15503.exp: print (const char *) (s=s.substr(0,4))


It has also a second regression but I understand that can be ignored as it
just tests what you have changed:

-PASS: gdb.cp/no-dmgl-verbose.exp: DMGL_VERBOSE-demangled f(std::string) is not defined
+FAIL: gdb.cp/no-dmgl-verbose.exp: DMGL_VERBOSE-demangled f(std::string) is not defined


I do not find the patch finished for a review when it still regresses.

(It regresses on Fedora 18 x86_64 in the case it does not regress for you.)


Thanks,
Jan


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

* Re: warning: RTTI symbol not found for class
  2012-11-21 18:32 ` Jan Kratochvil
@ 2012-11-26 19:14   ` ali_anwar
  2012-11-26 19:23     ` Tom Tromey
  0 siblings, 1 reply; 6+ messages in thread
From: ali_anwar @ 2012-11-26 19:14 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches, keiths

On 11/21/2012 11:32 PM, Jan Kratochvil wrote:
> Hello Ali,
>
> On Wed, 21 Nov 2012 19:06:22 +0100, ali_anwar wrote:
>> While debugging a cpp demo (containing the std::cout call) when I
>> issue "p std::cout", I get following warning: "warning: RTTI symbol
>> not found for class 'std::ostream'".
>
> I do not have it reproducible.  When you have not provided a GDB testcase
> could you at least provide OS and a reproducer there?  This way the patch does
> not fix anything to me.
>
> Fedora 18 x86_64
> GNU gdb (GDB) 7.5.50.20121120-cvs
> cat>cout.C<<HERE
> #include<iostream>
> int main () { std::cout<<  "foo"<<  std::endl; }
> HERE
> g++ -o cout cout.C -Wall -g
> gdb -q ./cout -ex start -ex 'p std::cout' -ex c -ex q
> $1 = {<std::basic_ios<char, std::char_traits<char>  >>  =<invalid address>, _vptr.basic_ostream = 0x0}
>
> (<invalid address>  does not look great but this patch does not fix it)
>

I tried it for powerpc-eabi. But following should reproduce the issue in 
your scenario as well:

gdb -q ./cout -ex start -ex s -ex fin -ex c -ex q
[snip]
2	int main () { std::cout << "foo" << std::endl; }
Value returned is $1 = warning: RTTI symbol not found for class 
'std::ostream'
[snip]


I am on Ubuntu 10.04 32 bit.

>
>> Do we have any fix for this issue if not then is it ok to have this
>> work around until we get a proper fix?
>
> It has a regression:
>
> -PASS: gdb.cp/bs15503.exp: print s.length()
> -PASS: gdb.cp/bs15503.exp: print s[0]
> -PASS: gdb.cp/bs15503.exp: print s[s.length()-1]
> +FAIL: gdb.cp/bs15503.exp: print s.length()
> +FAIL: gdb.cp/bs15503.exp: print s[0]
> +FAIL: gdb.cp/bs15503.exp: print s[s.length()-1]
> -PASS: gdb.cp/bs15503.exp: print (const char *) s.substr(0,4)
> -PASS: gdb.cp/bs15503.exp: print (const char *) (s=s.substr(0,4))
> +FAIL: gdb.cp/bs15503.exp: print (const char *) s.substr(0,4)
> +FAIL: gdb.cp/bs15503.exp: print (const char *) (s=s.substr(0,4))
>
>
I am facing following 6 failures without the proposed change on Ubuntu 
10.04 32 bit.

FAIL: gdb.cp/bs15503.exp: print s.length()
FAIL: gdb.cp/bs15503.exp: print s[0]
FAIL: gdb.cp/bs15503.exp: print s[s.length()-1]
FAIL: gdb.cp/bs15503.exp: print (const char *) s
FAIL: gdb.cp/bs15503.exp: print (const char *) s.substr(0,4)
FAIL: gdb.cp/bs15503.exp: print (const char *) (s=s.substr(0,4))

After applying patch I faced only following 5 issue:

FAIL: gdb.cp/bs15503.exp: print s.length()
FAIL: gdb.cp/bs15503.exp: print s[0]
FAIL: gdb.cp/bs15503.exp: print s[s.length()-1]
FAIL: gdb.cp/bs15503.exp: print (const char *) s.substr(0,4)
FAIL: gdb.cp/bs15503.exp: print (const char *) (s=s.substr(0,4))


> It has also a second regression but I understand that can be ignored as it
> just tests what you have changed:
>
> -PASS: gdb.cp/no-dmgl-verbose.exp: DMGL_VERBOSE-demangled f(std::string) is not defined
> +FAIL: gdb.cp/no-dmgl-verbose.exp: DMGL_VERBOSE-demangled f(std::string) is not defined
>
>
> I do not find the patch finished for a review when it still regresses.
>
> (It regresses on Fedora 18 x86_64 in the case it does not regress for you.)
>
Let me try on some other machine and verify it.

Thanks,
-Ali


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

* Re: warning: RTTI symbol not found for class
  2012-11-26 19:14   ` ali_anwar
@ 2012-11-26 19:23     ` Tom Tromey
  2012-11-26 20:47       ` ali_anwar
  0 siblings, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2012-11-26 19:23 UTC (permalink / raw)
  To: ali_anwar; +Cc: Jan Kratochvil, gdb-patches, keiths

>>>>> "Ali" == ali anwar <ali_anwar@codesourcery.com> writes:

Ali> gdb -q ./cout -ex start -ex s -ex fin -ex c -ex q
Ali> [snip]
Ali> 2	int main () { std::cout << "foo" << std::endl; }
Ali> Value returned is $1 = warning: RTTI symbol not found for class
Ali> std::ostream'

What would be best is a recipe for recreating the bug that does not rely
on the system libstdc++ or its debuginfo or lack thereof.
Both this short test and the bs15503 test are exposed to the system
libraries in this way.

Tom


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

* Re: warning: RTTI symbol not found for class
  2012-11-26 19:23     ` Tom Tromey
@ 2012-11-26 20:47       ` ali_anwar
  2012-11-26 20:53         ` ali_anwar
  0 siblings, 1 reply; 6+ messages in thread
From: ali_anwar @ 2012-11-26 20:47 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Jan Kratochvil, gdb-patches, keiths

On 11/27/2012 12:23 AM, Tom Tromey wrote:
>>>>>> "Ali" == ali anwar<ali_anwar@codesourcery.com>  writes:
>
> Ali>  gdb -q ./cout -ex start -ex s -ex fin -ex c -ex q
> Ali>  [snip]
> Ali>  2	int main () { std::cout<<  "foo"<<  std::endl; }
> Ali>  Value returned is $1 = warning: RTTI symbol not found for class
> Ali>  std::ostream'
>
> What would be best is a recipe for recreating the bug that does not rely
> on the system libstdc++ or its debuginfo or lack thereof.
> Both this short test and the bs15503 test are exposed to the system
> libraries in this way.
>

Yes, it seems so. I faced no failure on Ubuntu 12.04 without the change. 
But after the patch I faced the same 5 errors that Jan pointed. 
Following addition to the earlier patch removes all the regressions.

--- gdb/dwarf2read.c	26 Nov 2012 15:54:29 -0000	1.714
+++ gdb/dwarf2read.c	26 Nov 2012 20:43:59 -0000
@@ -7585,7 +7585,7 @@
        else
  	{
  	  demangled = cplus_demangle (mangled,
-				      (DMGL_PARAMS | DMGL_ANSI
+				      (DMGL_PARAMS | DMGL_ANSI | DMGL_VERBOSE


I will try to recreate the bug without using libstdc++.

Thanks,
-Ali


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

* Re: warning: RTTI symbol not found for class
  2012-11-26 20:47       ` ali_anwar
@ 2012-11-26 20:53         ` ali_anwar
  0 siblings, 0 replies; 6+ messages in thread
From: ali_anwar @ 2012-11-26 20:53 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Jan Kratochvil, gdb-patches, keiths

On 11/27/2012 01:45 AM, ali_anwar wrote:
> On 11/27/2012 12:23 AM, Tom Tromey wrote:
>>>>>>> "Ali" == ali anwar<ali_anwar@codesourcery.com> writes:
>>
>> Ali> gdb -q ./cout -ex start -ex s -ex fin -ex c -ex q
>> Ali> [snip]
>> Ali> 2 int main () { std::cout<< "foo"<< std::endl; }
>> Ali> Value returned is $1 = warning: RTTI symbol not found for class
>> Ali> std::ostream'
>>
>> What would be best is a recipe for recreating the bug that does not rely
>> on the system libstdc++ or its debuginfo or lack thereof.
>> Both this short test and the bs15503 test are exposed to the system
>> libraries in this way.
>>
>
> Yes, it seems so. I faced no failure on Ubuntu 12.04 without the change.
> But after the patch I faced the same 5 errors that Jan pointed.

I mean 5 failures/regressions.

> Following addition to the earlier patch removes all the regressions.
>
> --- gdb/dwarf2read.c 26 Nov 2012 15:54:29 -0000 1.714
> +++ gdb/dwarf2read.c 26 Nov 2012 20:43:59 -0000
> @@ -7585,7 +7585,7 @@
> else
> {
> demangled = cplus_demangle (mangled,
> - (DMGL_PARAMS | DMGL_ANSI
> + (DMGL_PARAMS | DMGL_ANSI | DMGL_VERBOSE
>
>
> I will try to recreate the bug without using libstdc++.
>

-Ali


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

end of thread, other threads:[~2012-11-26 20:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-21 18:08 warning: RTTI symbol not found for class ali_anwar
2012-11-21 18:32 ` Jan Kratochvil
2012-11-26 19:14   ` ali_anwar
2012-11-26 19:23     ` Tom Tromey
2012-11-26 20:47       ` ali_anwar
2012-11-26 20:53         ` ali_anwar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox