Author Topic: Debugging on the Fedora Core 6 Nov 11 version  (Read 5191 times)

Offline goetz

  • Multiple posting newcomer
  • *
  • Posts: 13
Debugging on the Fedora Core 6 Nov 11 version
« 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

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9493
Re: Debugging on the Fedora Core 6 Nov 11 version
« Reply #1 on: November 15, 2006, 10:40:07 pm »
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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline goetz

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Debugging on the Fedora Core 6 Nov 11 version
« Reply #2 on: November 15, 2006, 11:09:54 pm »
Thanks for helping.

Offline goetz

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Debugging on the Fedora Core 6 Nov 11 version
« Reply #3 on: November 16, 2006, 12:01:39 am »
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

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6539
    • My Best Post
Re: Debugging on the Fedora Core 6 Nov 11 version
« Reply #4 on: November 16, 2006, 07:07:09 am »
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
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Tornado

  • Single posting newcomer
  • *
  • Posts: 4
Re: Debugging on the Fedora Core 6 Nov 11 version
« Reply #5 on: November 16, 2006, 08:58:43 am »
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

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9493
Re: Debugging on the Fedora Core 6 Nov 11 version
« Reply #6 on: November 16, 2006, 10:40:11 am »
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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Debugging on the Fedora Core 6 Nov 11 version
« Reply #7 on: November 16, 2006, 12:36:35 pm »
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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Tornado

  • Single posting newcomer
  • *
  • Posts: 4
Re: Debugging on the Fedora Core 6 Nov 11 version
« Reply #8 on: November 16, 2006, 08:12:59 pm »
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.


Offline Game_Ender

  • Lives here!
  • ****
  • Posts: 551
Re: Debugging on the Fedora Core 6 Nov 11 version
« Reply #9 on: November 16, 2006, 08:15:42 pm »
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.

Offline nsiprof

  • Single posting newcomer
  • *
  • Posts: 4
Re: Debugging on the Fedora Core 6 Nov 11 version
« Reply #10 on: November 17, 2006, 01:47:54 am »
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. }

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1442
    • CenizaSOFT
Re: Debugging on the Fedora Core 6 Nov 11 version
« Reply #11 on: November 17, 2006, 03:21:10 am »
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.

Offline nsiprof

  • Single posting newcomer
  • *
  • Posts: 4
Re: Debugging on the Fedora Core 6 Nov 11 version
« Reply #12 on: November 17, 2006, 06:01:57 am »
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.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: Debugging on the Fedora Core 6 Nov 11 version
« Reply #13 on: November 17, 2006, 08:28:45 am »
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.
Be patient!
This bug will be fixed soon...

Offline nsiprof

  • Single posting newcomer
  • *
  • Posts: 4
Re: Debugging on the Fedora Core 6 Nov 11 version
« Reply #14 on: November 19, 2006, 05:40:10 am »
Thank you.