User forums > General (but related to Code::Blocks)

Debugging on Linux?

(1/2) > >>

agent86:
For many months now I have been tracking CodeBlocks' development.  I like almost everything about it, but I still can't use it for the following reason:  Debugging doesn't seem to work on my Linux systems.  Linux systems being 2 versions of Ubuntu, Debian Etch, and Fedora Core 6.  On Ubuntu I used Gnome, on the others its KDE.  The symptom is the same on all. 

First, I download the head of the svn repository, build and install CodeBlocks.  My installation is done to a directory that I own, so I don't need "root" to install. (I set the prefix= appropriately when configuring)

Build a simple C or C++ program with GCC including the -g option for debugging symbols.  Builds fine.

Go to Debug menu and say Start.  Some lines in the console output say that the debugger has started and the menu items for next, etc. are enabled.   Nothing happens in the edit window.  I would expect a highlighted line somewhere near the beginning of main().

Clicking on "Next Line" button in the toolbar or selecting that in the menu produces no output anywhere.  All I can do is select or click on "Continue" and the program terminates "normally", and the debugger ends.

Because of this situation, I currently use jEdit to write code, commandline and makefiles to build, and kdbg (a debugger using the KDE desktop) to debug it. Sometimes I use Eclipse for larger projects.  I'd really like to use CodeBlocks, but I want that debugging ability; it's how I verify that the code is doing what I want.

This issue was mentioned somewhere around svn version 1940, I believe.  From what I read, it sounded like it would be addressed soon.  So every once in a while, I update my code from the repository, rebuild Codeblocks and check debugging.  Still the same.  Its been a long time now so this time I thought I'd write and see if someone knows the story.  Surely somebody uses CodeBlocks and does debugging on Linux successfully.   Am I doing something wrong or am I not doing something I should?






mandrav:

--- Quote ---Am I doing something wrong or am I not doing something I should?
--- End quote ---

You 're not doing something you should: give us details about your project or (even better) provide a step-by-step procedure for reproducing this using a minimal sample :).
All I can say for now (until you provide more info) is that debugging works in linux, contrary to what you say.
Besides, I debug C::B in linux using C::B itself ;). And keep in mind that C::B is a complex project, with a mix of static/dynamic libraries and executables. Still, I 'm able to debug it just fine.

feisal:
Stupid question?  Did you set a breakpoint?

agent86:
It's nice to hear that it can be done.  I guess that somewhere I goofed.  Here is the scenario...

Checked out svn version 3256

set up wxGTK wx-config & wxwin.m4

./bootstrap
./configure --prefix=/d/linux/programs/cb --enable-contrib
I own /d

In this current case, Fedora Core 6, wxGTK 2.6.3, gcc 4.1.1 Linux/ANSI

make
make install

All seems to complete nicely.  This is true of all 3+ distros I have used.

Start it up.
Get the opening banner.

3 error dialogs in sequence...
Failed to display HTML document in ISO-8859-1 encoding 
This has always happened.

Tip of the Day

Create a New Project (from the Welcome screen)

Pick any directory, select C++ and take the template offered...
#include <iostream>

int main()
{
   std::cout << "Hello world!" << std::endl;
   return 0;
}

At this point, I can open files, edit, save, close...All the things that you would expect.

Build, then
Debug->Start

Console output
--------------------------
Building to ensure sources are up-to-date
Build succeeded
Selecting target: Debug
Adding source dir: /d/workspace/misc/proj/
Adding source dir: /d/workspace/misc/proj/
Adding file: ./proj
Starting debugger: done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb Red Hat Linux (6.5-13.fc6rh)
------------------------------------------

At this point, select Next Line or F7 key => nothing.

Select Step Out or Continue and something happens in the console output.  The following is added.
---------------------------------------------------
Continuing...
No line 10 in file "main.cpp".
Program exited normally.
Debugger finished with status 0
------------------------------------------------

Didn't get to debug anything.

agent86:
re: stupid question.

Yes and it blows right by it.  The breakpoint is shown in the "breakpoints" window but Run just ignores it.

I rebuilt and re-installed and the only new thing is that "run to cursor" seems to work, then I can F7 my way thru the program.

Navigation

[0] Message Index

[#] Next page

Go to full version