Re: 'b ::new' causes gdb 8.1 to coredump ?

Jason Vas Dias <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
RE:
> start
...
> (gdb) b ::new
> cp-namespace.c:177: internal-error: block_symbol cp_lookup_bare_symbol(const language_defn*, const char*, const block*, domain_enum, int): Assertion `strstr (name, "::") == NULL' failed.
> A problem internal to GDB has been detected,


This occurs both when I built & linked the program with the 5.4.0 compiler ,
with
'-Wl,-rpath=${PATH_TO_5_4_0_LIBS},-rpath-link=${PATH_TO_5_4_0_LIBS}' ,
while GDB 8.1.11 is built with GCC 7.3.1 , and 
when built with GCC 7.3.1, with
'-Wl,-rpath=${PATH_TO_7_3_1_LIBS},-rpath-link=${PATH_TO_7_3_1_LIBS}' ,
(the two paths are quite different in my setup).

In both cases, GDB coredumps on 'b ::new' (after starting), and
fails to resolve any of:
  'b ::new(std::size_t)'
  'b operator ::new(std::size_t)'
  'b "operator::new(std::size_t)"
  'b extern "C++" "operator::new(::std::size_t)"
  
So how is one able to break on libstd++ C++ symbols in GDB ?
Especially 'operator ::new' -  I can break on any of
  { ::malloc, ::posix_memalign, ::memalign, ::sbrk .. }
but not any form of new() . Why ?

new is a proper symbol in libstdc++ :

$ nm -C /usr/lib64/gcc/x86_64-pc-linux-gnu/7.3.1/libstdc++.so.6.0.24 | grep 'new'
...
0000000000097680 T operator new(unsigned long)

Aha! It was the '::' namespace colons!

(gdb) b "operator new(std::size_t)"
Breakpoint 2 at 0x155554c30680: file ../../../../gcc-gcc-7-branch/libstdc++-v3/libsupc++/new_op.cc, line 43.
(gdb) q


But I don't think the presence or absence of leading global namespace
'::' colons should cause GDB to coredump or fail to resolve operator
new() .

Doesn't GDB understand C++ namespaces ?

Thanks, Jason
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.