gdb: SIGTRAP on std::string::c_str() call
- by sheepsimulator
So I've been trying to use gdb to return the value of a string I have by calling
> print <member variable name>.c_str()
But everytime I do so, I get this:
Program received signal SIGTRAP, Trace/breakpoint trap.
<some address> in std::string::c_str() from /usr/lib/libstdc++.so.6
GDB remains in the frame where the signal was received.
To change this behavior use "set unwindonsignal on"
Evaluation of the expression containing the function (std::string::c_str() const) will be abandoned.
Two questions:
Why/how is the standard library throwing SIGTRAP? I checked basic_string.h and c_str() is defined as:
const _CharT*
c_str() const
{ return _M_data(); }
I don't see any SIGTRAP-throwing here... is there a way to get around this SIGTRAP?
How can I read the text value of the std::string out (without getting some crazy extension library) in gdb?