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.

Arya Pourtabatabaie
  • 705
  • 2
  • 7
  • 22
  • 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 May 21 '17 at 19:51

1 Answers1

0

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