Thread overview
How do you guys debug large programs?
May 27, 2013
Gary Willoughby
May 27, 2013
mimi
May 28, 2013
Adam D. Ruppe
May 28, 2013
Nathan M. Swan
May 28, 2013
nazriel
May 28, 2013
Timothee Cour
May 28, 2013
estew
May 28, 2013
estew
May 28, 2013
Timon Gehr
May 27, 2013
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
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 28, 2013
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 28, 2013
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
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
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
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
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
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.