www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How do you guys debug large programs?

reply "Gary Willoughby" <dev kalekold.net> writes:
This is quite an open ended question but i wondered how you guys 
debug your D programs (i'm talking about stepping through code, 
setting breakpoints, etc). The lack of nice IDE's with integrated 
debuggers is worrying when working with D but up until now i 
haven't need one.

Now i've started to write much larger programs, i'm wondering 
which debuggers do you use? Especially using Linux.
May 27 2013
next sibling parent "mimi" <4.deniz.z.z gmail.com> writes:
On Monday, 27 May 2013 at 19:55:57 UTC, Gary Willoughby wrote:
 This is quite an open ended question but i wondered how you 
 guys debug your D programs (i'm talking about stepping through 
 code, setting breakpoints, etc). The lack of nice IDE's with 
 integrated debuggers is worrying when working with D but up 
 until now i haven't need one.

 Now i've started to write much larger programs, i'm wondering 
 which debuggers do you use? Especially using Linux.
I am use Geany + gdb in Linux. A little frustrating that the Geany's GUI don't shows CPU registers, but . Need to compile with this arguments for working with gdb: dmd -unittest -gc -debug -debug=5
May 27 2013
prev sibling next sibling parent "Adam D. Ruppe" <destructionator gmail.com> writes:
On Monday, 27 May 2013 at 19:55:57 UTC, Gary Willoughby wrote:
 Now i've started to write much larger programs, i'm wondering 
 which debuggers do you use? Especially using Linux.
I just use gdb with dmd's -gc -debug flags, when I use a debugger at all. tbh I kinda prefer just littering assert()'s and sometimes invariant(){}'s throughout the code as a kind of printf debugging, then leave them there once the bug is fixed so hopefully it doesn't come back. But when that doesn't help, gdb is pretty trusty on linux.
May 27 2013
prev sibling next sibling parent "Nathan M. Swan" <nathanmswan gmail.com> writes:
On Monday, 27 May 2013 at 19:55:57 UTC, Gary Willoughby wrote:
 This is quite an open ended question but i wondered how you 
 guys debug your D programs (i'm talking about stepping through 
 code, setting breakpoints, etc). The lack of nice IDE's with 
 integrated debuggers is worrying when working with D but up 
 until now i haven't need one.

 Now i've started to write much larger programs, i'm wondering 
 which debuggers do you use? Especially using Linux.
I know Alexander Bothe of Mono-D fame is working on debugging support for it: http://mono-d.alexanderbothe.com/?p=997 It's still in alpha, but getting there. NMS
May 28 2013
prev sibling next sibling parent reply "nazriel" <spam dzfl.pl> writes:
On Monday, 27 May 2013 at 19:55:57 UTC, Gary Willoughby wrote:
 This is quite an open ended question but i wondered how you 
 guys debug your D programs (i'm talking about stepping through 
 code, setting breakpoints, etc). The lack of nice IDE's with 
 integrated debuggers is worrying when working with D but up 
 until now i haven't need one.

 Now i've started to write much larger programs, i'm wondering 
 which debuggers do you use? Especially using Linux.
If I suspect what block of code may be causing a problem: 1) printf's / asserts 2) comment out 3) Duck partner When it is getting worse: 4) GDB GDB plays nice with D so it is smooth.
May 28 2013
parent reply Timothee Cour <thelastmammoth gmail.com> writes:
On Tue, May 28, 2013 at 12:32 AM, nazriel <spam dzfl.pl> wrote:

 On Monday, 27 May 2013 at 19:55:57 UTC, Gary Willoughby wrote:

 This is quite an open ended question but i wondered how you guys debug
 your D programs (i'm talking about stepping through code, setting
 breakpoints, etc). The lack of nice IDE's with integrated debuggers is
 worrying when working with D but up until now i haven't need one.

 Now i've started to write much larger programs, i'm wondering which
 debuggers do you use? Especially using Linux.
If I suspect what block of code may be causing a problem: 1) printf's / asserts 2) comment out 3) Duck partner When it is getting worse: 4) GDB GDB plays nice with D so it is smooth.
not on OSX, where demangling doesn't work (but the OP mentioned linux).
May 28 2013
parent reply "estew" <estewh gmail.com> writes:
Then (12 months ago):
If you're on linux and after VStudio style debugging in the GUI 
then I found QtCreator worked well.

I was just using the Qt SDK bundle but it should work just from 
the QtCreator download (saves installing the monolithic Qt 
development libs).

I would build the D application with -gc for C symbols and it 
just worked, expect for one small caveat. I had to load the D 
source file containing main() into the IDE editor, set a 
breakpoint (F9) anywhere and then:

Debug->Start Debugging->Start and Debug External Application

Reason for this was that QtCreator's "break at main" function 
would break at the real main() not _Dmain. To be expected I guess 
as QtCreator (aka GDB) knows nothing about D startup.


Now:
I haven't tried QtCreator for a while as the D compile time is so 
fast debugging with printfs seems to be quicker and stepping 
through code in the IDE.

Cheers,
Stewart
May 28 2013
parent "estew" <estewh gmail.com> writes:
Sorry, ignore the two lines stating "Then (12 months ago):" and 
"Now:". They are a cut-paste schmozzle and shouldn't be 
there...no edits of posts?.

My middle mouse button is both a blessing an a curse :)

Stewart
May 28 2013
prev sibling parent Timon Gehr <timon.gehr gmx.ch> writes:
On 05/27/2013 09:55 PM, Gary Willoughby wrote:
 This is quite an open ended question but i wondered how you guys debug
 your D programs (i'm talking about stepping through code, setting
 breakpoints, etc). The lack of nice IDE's with integrated debuggers is
 worrying when working with D but up until now i haven't need one.

 Now i've started to write much larger programs, i'm wondering which
 debuggers do you use? Especially using Linux.
writeln, assert, gdb.
May 28 2013