News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

How to debug program without creating a project

Started by wmaple, November 18, 2008, 08:35:43 AM

Previous topic - Next topic

wmaple


Hello,

   I have installed CodeBlock on my system, finding a problem with debugger. Within a project, I can start the debugger successfully; but without creating a project, namely coding a single source file, there is no way to start the debugger. Need any further setting or other something to do?  Thanks.

thomas

There is no support for debugging a single file in Code::Blocks. You can still start gdb from a commandline of course.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

wmaple


Is there any way I can give the developers some suggestion concerning debugging single source file?
I think many students will appreciate it.

CuteAlien

I usually use printfs (or cout) and gdb for single source files. But being able to compile&debug single sourcefiles in C::B without creating a project for that would indeed be a nifty feature.

dk

I am teaching high school students, and we make a lot of short and simple one-file programs.

Often the process of debugging one program requires just a couple of minutes, and creating project for debugging such programs need a lot of time.

So I also want to have a single-file debugging feature.



MortenMacFly

Quote from: dk on June 24, 2009, 04:12:26 PM
So I also want to have a single-file debugging feature.
This is not as easy as you would think.

Why don't you use the "default workspace" feature of C::B that opens a default workspace on startup of C::B. This could already include a dummy (empty / one file) project. Very easy and debugging is possible from scratch.
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]

dk

Quote from: MortenMacFly on June 24, 2009, 04:16:47 PM
Why don't you use the "default workspace" feature of C::B that opens a default workspace on startup of C::B. This could already include a dummy (empty / one file) project. Very easy and debugging is possible from scratch.

And every time we want to start new task, we should remove old source file from the project and add new file with the new task? It isn't so easy too...


MortenMacFly

Quote from: dk on June 24, 2009, 04:32:32 PM
It isn't so easy too...
Well - remove file (shortcut) + Drag&Drop. Alternativaly a script can do it for you.

Anyways: I'm afraid debugging a single file will not be supported any time soon.
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]

dk

Quote from: MortenMacFly on June 24, 2009, 04:48:33 PM
Well - remove file (shortcut) + Drag&Drop.

It is easy to say, but it isn't easy for young pupil to remember this actions.
Because in the most cases they don't need debugging, and they don't need the project at all.


Ceniza

Now that would be a gorgeous way to make the single-file-without-project functionality be really nice. However, it looks like I am the only developer supporting the idea to provide better... er... support for that. Morten, on the other hand, is actually suggesting to remove it altogether (he doesn't use it, so he doesn't care). Too bad I haven't been in the mood to do much lately (counting in months now), and the last few days I have been sick :(

Isn't really there any other developer who thinks the single file functionality should be improved?

I would also like to remind you of an old post where I suggested to have a mechanism to define compiler/linker options that could then be selected as global, for single file compilation or for projects. It would be something like the options sets (or whatever they are called) in Delphi 2009, just way better. I think it would be another nice addition that also happens to improve the single file functionality.

Yiannis: In a scale from 8 to 35 (8 being extremely easy, 35 being hardly possible), how would you rate modifying the debugger plugin to support that?