Code::Blocks Forums
User forums => General (but related to Code::Blocks) => Topic started by: 51423benam on July 30, 2018, 06:36:27 pm
-
Hello,
the codeblocks debugger (gdb) doesn't show me things I want to watch. For example in the watch windows I would want to exand "this" like I can do in VS (so that I can view member vars easily. Also, I can not watch contents of standard datatypes well, for example of std::vector in VS I can just see all Datafields of it. And these are not the only thing. The watch windows is nearly useless for me. Is that the problem of gdb of of codeblocks?
-
For this -> right click and select dereference this
For vector: install and setup python pretty-printer enabled gdb.
C::B's integration of the debugger is miles away from the one VS. On windows it is more troublesome than on linux.
-
Thanls for the reply. Where do I have to click on this? It doesn't work in the watches, so do I have to do that in the code? That would mean that I would have a 'this' in every class object I want to examine.
-
You have to add 'this' in the watches window and do the right click operation or just add *this in the watches.
-
Here are some links that describe the activation of pretty printers:
http://wiki.codeblocks.org/index.php/Pretty_Printers
https://code.google.com/archive/p/qp-gcc/wikis/GDB.wiki
http://forums.codeblocks.org/index.php/topic,21998.msg149737.html#msg149737
we should integrate this better in the debugger plugin... But there are TONS of things to do....
If you have some trouble for one specific thing, please ask specific questions.... General questions are hard to answer and don't lead to a target....
-
Also if you try the steps it would be great if you could give some feedback, so that i can create a proper tutorial for this...
-
C::B's integration of the debugger is miles away from the one VS. On windows it is more troublesome than on linux.
Gosh that's quite sad... maybe about 10 years ago I made the effort to switch from MSVC to GCC (primarily because it's cross-platform) but I soon gave up when I tried to use the GCC debugger (GDB). Admittedly that was 10 years ago but it was truly dreadful compared to debugging in Visual C++.
The GCC compiler seems to have come a long way since then but from what I've read, GDB still isn't much use as a serious debugging tool :(
-
Why do you think GDB is not serious tool? As a pure debugger it is as powerful or sometimes more powerful than the VStudios debugger. The only part lacking is the UI at least in C::B.
-
Here are the main things I remember about using C::B with GDB (keep in mind that this was 10 years ago...) Maybe you can let me know if these issues are solved now..?
1) Starting a debug session seemed to take forever (in C::B on Windows). After trying to launch a debug session it would often be minutes before anything happened (and the more break points I set, the longer it would take to launch).
2) IIRC I couldn't set break points 'on-the-fly' (they all needed to get set before launching GDB). In fact I'm not sure if I could even enable & disable break points on-the-fly.
3) As 51423benam noted earlier, sometimes you couldn't inspect variable values easily (or maybe you could inspect the values but not change them?)
4) You couldn't change the order of execution on-the-fly (e.g. if I stopped at a break point, I couldn't skip a few lines or go back a few lines).