Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: goetz on November 15, 2006, 10:31:46 pm
-
This version of Codeblocks worked fine for compiling. However for debugging, the run to cursor did not work. Setting a breakpoint or running to a cursor position does not work properly. The debugger just sits there doing nothing. Instead of running to a line in the program right away, I needed to select the main function as the line to run to. Then I could have the program run to a new point in the program.
Lawrence
-
Then I could have the program run to a new point in the program.
...please search the forum before posting. There are basically (usually) 3 reasons for this:
1.) you forgot to compile with the debugger switch (-g)
2.) you did not *re*compile the project after setting this switch
3.) you are using a debugger that is not supported by C::B (only gdb and cdb are)
I bet one of these is the root of your problem.
With regards, Morten.
-
Thanks for helping.
-
I tried what you suggested. I setup the debugging flags, I did a clean and rebuild, and I am using the gdb debugger. If I run to a line that uses cout, it runs to it, but when I go to the next line, no output window opens. If I run to a cursor that is an assignment line, such as i=10, the debugger says:
Debugger name and version: GNU gdb Red Hat Linux (6.5-13.fc6rh)
Program exited normally.
Debugger finished with status 0
Thanks for any help,
Lawrence
-
Turn off ALL optimization; I am not knowledgeable about GCC debugger, but it sounds like you are trying to debug code that the compiler is removing.
Tim S
-
I have the exact same problem, debugger flags are set. I am not sure that this is even supported at this time, looking at the bug tracker. Really nice IDE, please make this option a priority.
Great work
-
when I go to the next line, no output window opens.
I am not sure that this is even supported at this time, looking at the bug tracker.
What do you mean??? What window shall open? C::B informs about debugging events in the debug log. I have no experiences with debugger versions above 6.3.x but this maybe a feature I don't know.
Please (if possible) create a very simple demo project and post it (zipped) into this thread including a step-by-step instruction what you do and what you expect to happen. I guess I simply don't understand.
Another option: Do you try to debug into a constructor? This is *not* supported natively by gdb but there is a work-around for this... Again: A demo project would be of much help.
With regards, Morten.
-
I think he expects a console window that shows the text which he is pushing to cout.
@goetz:
After you made sure that you enabled debugging symbols, did you also make sure you disabled stripping?
This may sound like a stupid thing, but it actually happens that you forget to turn off stripping, and then you try and try, and it just won't work... I've had it happen many times.
-
Maybe I was not clear enough, what I'm talking about is on FC6 C::B does not have a console to take input for the debugger. debugging works for the most part, with that exception...it shows the symbols, etc.
-
Well CB does not show a console window on linux. You are just going to have live with it or (like Xcode) create a debugger terminal which lets you interact with GDB from the command line (way better than the "send command" message box), as well as handle stdin/stdout.
-
It is not that you don't get a window under all circumstances. When for example, you "build and run" the hello world program, then a console window appears and when yoy hit return it completes and the window goes away. The problem comes up when you single step through the code. No console window comes up. Also, it doesn't seem to stop at break points, when setting them. So for example, when setting the cursor on line 3 ( see below) and clicking on "run to cursor" the program stops at line 5. Then clicking on Next line, it goes to the next line, but no console window comes up. When continuing to click on next line, it does step through the program, but no console comes up as it does when just clicking on build and run. There are some other problems with the debugger, but one problem at a time. Is this a bug or is there some setup that needs to be paid attention to?
1. #include <iostream>
2.
3. int main()
4. {
5. std::cout << "Hello world!" << std::endl;
6. return 0;
7. }
-
In your example lines 1, 2, 3, 4 and 7 are not instructions so the debugger won't stop there. If you add a breakpoint on line 3, 4 or 5 it'll stop on line 5 'cause it's the first instruction in that block. It's not a bug, it's just normal behavior.
-
The question was: why doesn't the console window come up as it steps through the program? It comes up when build and run is clicked.
-
The question was: why doesn't the console window come up as it steps through the program? It comes up when build and run is clicked.
You don't seem to be listening to what people are saying:
The debugger will not launch a separate console window under non-windows platforms. This is a known issue and patches that rectify it are welcome.
-
Thank you.