How to watch data of actual type in debugger?
Very simple example with classes hierarchy:
Code:
class Object {
public:
Object(int id_) : id(id_) {}
virtual ~Object() {}
private:
int id;
};
class Point: public Object {
public:
Point(double x_, double y_, int id_)
: Object(id_), x(x_), y(y_) {}
private:
double x, y;
};
class Circle: public Point {
public:
Circle(double x_, double y_, double r_, int id_)
: Point(x_, y_, id_), r(r_) {}
private:
double r;
};
int test(Object *obj)
{
return 0; // <== break point here
}
int main()
{
test(new Circle(1.5, -2.5, 3.0, 15));
return 0;
}
When I set breakpoint in QtCreator and try to watch "obj" in debugger it doesn't show the actual (runtime instead of static) type and corresponding data. This is how it looks like:
http://i55.tinypic.com/33ogrjr.png
And I would like to see something like in MSVC debugger:
http://i52.tinypic.com/24fiucm.pnght...om/24fiucm.png
How can I configure QtCreator to show the actual runtime data?
Re: How to watch data of actual type in debugger?
You have to create your own debugging helper, and plug it into QtCreator, you can use C++ / Python to implement your own debugging helper for your custom types.
http://doc.qt.nokia.com/qtcreator-2....g-helpers.html
Re: How to watch data of actual type in debugger?
Seems to work as expected in builds made from 'master' branch, but not in 2.2.1.