3

I'm debugging a program written in C++, and I would like to have an intuitive representation of objects I deal with.

Is there a specific method that C++ debuggers (gdb in particular) would expect a class to implement for them to use at runtime?

For instance, operator const char* () const seems to be a viable candidate.

If it depends on the SDK, I have to say I'm using Xcode.

1
  • 1
    @πάνταῥεῖ I've never called a conversion operator from a debugger, but in my experience, operator+ and similar could be called by saying a.operator+(b) (spelling out the operator function), though I may be remembering wrong.
    – Justin
    Commented May 21, 2017 at 19:51

1 Answer 1

0

Have a look at "Pretty Printing" in the gdb documentation. I think that's far better then a hard coded to_string function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.