How to debug in Visual studio?
Daniel Keep
daniel.keep.lists at gmail.com
Fri Mar 30 05:01:38 PDT 2007
Patrick Byrne wrote:
> Jascha Wetzel wrote:
>>> [1] That said, ddbg works beautifully with Code::Blocks. A pity, then,
>>> that Code::Blocks is incapable of passing arguments to the D compiler at
>>> the moment, which makes it totally useless... -_-
>
> I am trying to get dmd/ddbg/cblocks working at the moment. It seems to
> compile and link ok, and if I run my program from the command line it
> works:
>
> hello world
> args.length = 1
> args[0] = 'C:\d\hworld\bin\Debug\hworld.exe'
>
> .....but when I try to step in (having set up ddbg_gdb.exe as the
> debugger), it just terminates, with this in the output window:
>
> Building to ensure sources are up-to-date
> Build succeeded
> Selecting target: Debug
> Adding source dir: c:\d\hworld\
> Adding source dir: c:\d\hworld\
> Adding file: bin\Debug\hworld.exe
> Starting debugger: done
> Registered new type: wxString
> Registered new type: STL String
> Registered new type: STL Vector
> Setting breakpoints
> Program exited
> Debugger finished with status 0
>
> ....can someone please shed light on why the debugger is not playing ball?
>
> Thanks
>
> -P
>
> PS Code::Blocks looks like a worthy replacement for Visual Studio, if
> only I could get the debugger working.....
IIRC, there are a number of things you need to do to get DDBG to work in
Code::Blocks. The two that I can remember off the top of my head are:
1. Make sure you have "gdb" in ddbg's filename somewhere. I just
copied ddbg.exe to ddbg_gdb.exe, and told CB to use that.
2. Code::Block's D template is a little iffy atm. You need to go in to
linker options and add the '-g' switch; can't remember where, exactly.
The reason is that dmd is both compiler and linker, and it seems that if
you link debug code without '-g', OPTLINK will actually drop the
debugging info.
Hope that helps :)
-- Daniel
--
int getRandomNumber()
{
return 4; // chosen by fair dice roll.
// guaranteed to be random.
}
http://xkcd.com/
v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D
i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/
More information about the Digitalmars-d
mailing list