Results 1 to 3 of 3

Thread: How to watch data of actual type in debugger?

  1. #1
    Join Date
    Jun 2007
    Posts
    23
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to watch data of actual type in debugger?

    Very simple example with classes hierarchy:
    Qt Code:
    1. class Object {
    2. public:
    3. Object(int id_) : id(id_) {}
    4. virtual ~Object() {}
    5.  
    6. private:
    7. int id;
    8. };
    9.  
    10. class Point: public Object {
    11. public:
    12. Point(double x_, double y_, int id_)
    13. : Object(id_), x(x_), y(y_) {}
    14.  
    15. private:
    16. double x, y;
    17. };
    18.  
    19. class Circle: public Point {
    20. public:
    21. Circle(double x_, double y_, double r_, int id_)
    22. : Point(x_, y_, id_), r(r_) {}
    23.  
    24. private:
    25. double r;
    26. };
    27.  
    28. int test(Object *obj)
    29. {
    30. return 0; // <== break point here
    31. }
    32.  
    33. int main()
    34. {
    35. test(new Circle(1.5, -2.5, 3.0, 15));
    36. return 0;
    37. }
    To copy to clipboard, switch view to plain text mode 

    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:


    And I would like to see something like in MSVC debugger:


    How can I configure QtCreator to show the actual runtime data?

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default 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

  3. #3
    Join Date
    May 2008
    Posts
    155
    Thanked 15 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default 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.

Similar Threads

  1. Replies: 9
    Last Post: 22nd April 2013, 13:21
  2. Replies: 9
    Last Post: 14th February 2013, 20:39
  3. Replies: 11
    Last Post: 29th May 2012, 16:00
  4. Debugger problem retrieving data for watch view hangs
    By frenk_castle in forum Installation and Deployment
    Replies: 0
    Last Post: 6th May 2010, 00:09
  5. Data type error
    By MrShahi in forum Qt Programming
    Replies: 1
    Last Post: 16th July 2008, 15:01

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.