News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Show local variables in the debugger

Started by alexchen, July 30, 2013, 12:22:41 AM

Previous topic - Next topic

alexchen

How do I get the debugger to show local variables?  I can only find a debugger 'watch' window that allows me to enter a variable in a function to see its content.  But I cannot find any other way to have the debugger automatically fills in all local variables in a function, or the content of 'this' in a class method when execution steps into the function.

oBFusCATed

You can't find it because it is not available at the moment...
(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!]

alexchen

Is there is timetable when this functionality will be available?  This is a very important feature supported by Windows Visual Studio, MacOS Xcode, and Eclipse C++.  It makes life so much easier to debug at source code level.

MortenMacFly

Quote from: alexchen on July 30, 2013, 06:18:25 AM
Is there is timetable when this functionality will be available?  This is a very important feature supported by Windows Visual Studio, MacOS Xcode, and Eclipse C++.  It makes life so much easier to debug at source code level.
I think I posted a patch that restores this functionality some times back to this forums. You could apply it yourself.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

oBFusCATed

Quote from: alexchen on July 30, 2013, 06:18:25 AM
Is there is timetable when this functionality will be available?  This is a very important feature supported by Windows Visual Studio, MacOS Xcode, and Eclipse C++.  It makes life so much easier to debug at source code level.
No
(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!]

alexchen

Quote from: MortenMacFly on July 30, 2013, 07:46:09 AM
Quote from: alexchen on July 30, 2013, 06:18:25 AM
Is there is timetable when this functionality will be available?  This is a very important feature supported by Windows Visual Studio, MacOS Xcode, and Eclipse C++.  It makes life so much easier to debug at source code level.
I think I posted a patch that restores this functionality some times back to this forums. You could apply it yourself.
Where can I find the patch?  I assume it requires a rebuild of Codeblocks from source?

MortenMacFly

Quote from: alexchen on July 30, 2013, 06:19:59 PM
Where can I find the patch?  I assume it requires a rebuild of Codeblocks from source?
For the original version, please search the forums.

However, I believe meanwhile its outdated as we continued work in trunk. So I need to update it anyways. So please stay tuned... I'll post here.

And yes, it requires you to self-compile C::B which is easy.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

alexchen

Thank you sooooo much!  This will be a life saver to anyone who is serious in source code level debugging.

oBFusCATed

Quote from: alexchen on August 02, 2013, 09:08:55 PM
This will be a life saver to anyone who is serious in source code level debugging.
I doubt it, in the current implementation this will cause only slowness and random crashes...
(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!]

alexchen

At least we have something to work on.  Bugs can be fixed, but lack of functionality needed for a debugger to be useful will cripple the IDE and render it an editor and code compiler, not a debugger.  I was frustrated by lack of local variable display window I ended up using gdb directly.  Although it is not better but at lease I can go very low level and get the work done.

Jenna

Quote from: alexchen on August 02, 2013, 10:09:04 PM
At least we have something to work on.  Bugs can be fixed, but lack of functionality needed for a debugger to be useful will cripple the IDE and render it an editor and code compiler, not a debugger.  I was frustrated by lack of local variable display window I ended up using gdb directly.  Although it is not better but at lease I can go very low level and get the work done.

If I remember correctly the  crashes came from gdb, if it tries to access not initialized variables.
If this in not fixed in gdb sources, there is no way for the IDE to fix this or even work around it easily.

killerbot

QuoteIf I remember correctly the  crashes came from gdb, if it tries to access not initialized variables.
If this in not fixed in gdb sources, there is no way for the IDE to fix this or even work around it easily.

If this really is the case, then we should bring the feature back. People might say, hey CB crashes, while it was actually GDB, but then that same remark goes for eg Eclipse and other IDE's.

Next to that, from a programmers view, not initializing your variables, all hell should go loose upon you ;-)

As said, if that is the cause, the good programmers should not be punished.


I will try the patch when updated too, do we have an example code on how to reproduce such crash, will ask a colleague who uses eclipse to reproduce the crash too.

oBFusCATed

Quote from: killerbot on August 03, 2013, 09:45:37 AM
If this really is the case, then we should bring the feature back. People might say, hey CB crashes, while it was actually GDB, but then that same remark goes for eg Eclipse and other IDE's.
This is not the case.

Quote from: killerbot on August 03, 2013, 09:45:37 AMNext to that, from a programmers view, not initializing your variables, all hell should go loose upon you ;-)
std::vector is always initialized, but after the constructor is called. If you inspect it before the constructor it is not.

Quote from: killerbot on August 03, 2013, 09:45:37 AMNext to that, from a programmers view, not initializing your variables, all hell should go
I will try the patch when updated too, do we have an example code on how to reproduce such crash, will ask a colleague who uses eclipse to reproduce the crash too.
Won't happen in Eclipse, they use GDB/mi and probably aren't evaluating all elements, but have limits.
(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!]

ollydbg

The bug report and my patch is posted here: GDB crash under Windows, I don't have GDB crash now.  :), but GDB devs seems are not interested to fix bugs under Windows. :(
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

killerbot

it only occurs on windows ? or also on linux ?