Author Topic: How to debug program without creating a project  (Read 4593 times)

Offline wmaple

  • Single posting newcomer
  • *
  • Posts: 3
How to debug program without creating a project
« on: November 18, 2008, 08:35:43 am »

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.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: How to debug program without creating a project
« Reply #1 on: November 18, 2008, 01:23:28 pm »
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."

Offline wmaple

  • Single posting newcomer
  • *
  • Posts: 3
Re: How to debug program without creating a project
« Reply #2 on: November 20, 2008, 08:10:47 am »

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

Offline CuteAlien

  • Multiple posting newcomer
  • *
  • Posts: 57
Re: How to debug program without creating a project
« Reply #3 on: November 20, 2008, 02:44:49 pm »
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.

Offline dk

  • Multiple posting newcomer
  • *
  • Posts: 55
    • Code::Blocks for ALT Linux Sisyphus
Re: How to debug program without creating a project
« Reply #4 on: June 24, 2009, 04:12:26 pm »
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.


Denis Kirienko
C::B maintainer for ALT Linux distribution (http://www.sisyphus.ru/srpm/codeblocks)

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9508
Re: How to debug program without creating a project
« Reply #5 on: June 24, 2009, 04:16:47 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: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline dk

  • Multiple posting newcomer
  • *
  • Posts: 55
    • Code::Blocks for ALT Linux Sisyphus
Re: How to debug program without creating a project
« Reply #6 on: June 24, 2009, 04:32:32 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...

Denis Kirienko
C::B maintainer for ALT Linux distribution (http://www.sisyphus.ru/srpm/codeblocks)

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9508
Re: How to debug program without creating a project
« Reply #7 on: June 24, 2009, 04:48:33 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: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline dk

  • Multiple posting newcomer
  • *
  • Posts: 55
    • Code::Blocks for ALT Linux Sisyphus
Re: How to debug program without creating a project
« Reply #8 on: June 24, 2009, 04:55:07 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.

Denis Kirienko
C::B maintainer for ALT Linux distribution (http://www.sisyphus.ru/srpm/codeblocks)

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1442
    • CenizaSOFT
Re: How to debug program without creating a project
« Reply #9 on: June 25, 2009, 07:56:00 am »
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?