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

Simon Marchi simon.marchi@polymtl.ca
Mon Apr 23 00:59:00 GMT 2018

On 2018-04-21 16:57, Jason Vas Dias wrote:
> 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 ?

GDB does understand namespaces, just try "b std::string::find" for 

Maybe it's my knowledge of C++ that is lacking, but I don't think 
'operator ::new' is right.  It would be like writing 'operator ::+'.  So

   (gdb) b 'operator new'

sounds right to me.  This:

   (gdb) b '::operator new'

should probably work too (not sure), since you could have other 
operators in namespaces (foo::operator==(hello&, hello&)), but it also 
hits the assert.  In any case, no input should ever hit an assert, so 
it's still a bug (it should be cleanly rejected).


More information about the Gdb mailing list