Dmitry  Bakhtiyarov Dmitry Bakhtiyarov - 2 months ago 22
C++ Question

gdb can't call function

I have some problems with debugging my app - when I try to call parser::extractString(...) from gdb shell it return


No symbol "extractString" in namespace "parser".


When I execute


info functions extractString


I have this output


All functions matching regular expression "extractString":

File /home/dmitriy/Sources/transceiver/parser/json.cpp:
std::__cxx11::string
parser::extractString[abi:cxx11](rapidjson::GenericValue,
parser::MultithreadAllocator> const&);

Non-debugging symbols: 0x0000000000506500
parser::extractString[abi:cxx11](rapidjson::GenericValue,
parser::MultithreadAllocator> const&)@plt 0x00007ffff77e3640
parser::extractString[abi:cxx11](rapidjson::GenericValue,
parser::MultithreadAllocator> const&)@plt


What is the problem with calling this function? Function extractString defined in static library and called from the application without any problem.

Answer

gdb does not yet support C++11 ABI tags introduced in gcc 5. See these bugs:

The simplest workaround for you is probably to disable new gcc ABI by defining the macro _GLIBCXX_USE_CXX11_ABI to 0, see https://gcc.gnu.org/gcc-5/changes.html#libstdcxx.

Or alternatively you can try to apply workarounds from https://sourceware.org/bugzilla/show_bug.cgi?id=18601#c1 though they look a bit weird.