Author Topic: Debugger doesn't show certain things  (Read 798 times)

Offline 51423benam

  • Single posting newcomer
  • *
  • Posts: 7
Debugger doesn't show certain things
« 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?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11275
    • Travis build status
Re: Debugger doesn't show certain things
« Reply #1 on: July 30, 2018, 07:10:44 pm »
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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline 51423benam

  • Single posting newcomer
  • *
  • Posts: 7
Re: Debugger doesn't show certain things
« Reply #2 on: July 30, 2018, 09:15:09 pm »
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.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11275
    • Travis build status
Re: Debugger doesn't show certain things
« Reply #3 on: July 30, 2018, 11:02:47 pm »
You have to add 'this' in the watches window and do the right click operation or just add *this in the watches.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2105
Re: Debugger doesn't show certain things
« Reply #4 on: July 31, 2018, 11:40:50 am »
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....

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2105
Re: Debugger doesn't show certain things
« Reply #5 on: July 31, 2018, 11:52:55 am »
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...

Offline johne53

  • Regular
  • ***
  • Posts: 253
Re: Debugger doesn't show certain things
« Reply #6 on: September 01, 2018, 01:33:09 pm »
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  :(

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11275
    • Travis build status
Re: Debugger doesn't show certain things
« Reply #7 on: September 01, 2018, 02:35:55 pm »
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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline johne53

  • Regular
  • ***
  • Posts: 253
Re: Debugger doesn't show certain things
« Reply #8 on: September 01, 2018, 04:27:45 pm »
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).