www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Ddbg 0.0.2 alpha release

reply Jascha Wetzel <"[firstname]" mainia.de> writes:
Ddbg is a Win32 D Debugger

http://ddbg.mainia.de/releases.html

This release supports evaluation of structs and classes.
Feb 21 2007
next sibling parent reply torhu <fake address.dude> writes:
Looks interesting.  Something that's simpler to use for quick D 
debugging than windbg and msvc.  As long as the docs will continue to 
fit on one page, at least.

I tried this:

import std.stdio;
import std.c.stdlib;

void main()
{
	writefln("hello 1");
	free(cast(void*)1);
	writefln("hello 2");
}

I tried setting breakpoints on line 4 and 6, and others too.  But ddbg 
just crashes when I use the 'bp' command.


Hang on... This is odd, now it crashes when I try to set a breakpoint at 
line 79 of debuggee.d too.  It didn't do that five minutes ago.  Weird.
Feb 21 2007
parent reply Jascha Wetzel <"[firstname]" mainia.de> writes:
it doesn't crash when i do that. maybe you can use the debug build to
get more info (included in the new archive).
there was another issue, though: the source line wasn't detected
correctly with your program. that should be fixed in 0.0.2.2.

http://ddbg.mainia.de/Ddbg-0.0.2.2-alpha.zip

when i debug your program, it looks like this:

C>ddbg.exe torhu.exe
Process started
ntdll.dll loaded
KERNEL32.dll loaded
USER32.dll loaded
GDI32.dll loaded
Unknown breakpoint hit at ntdll.dll (0x7c901230)
->bp t:4
Breakpoint set: torhu.d:4 0x402010
->bp t:6
Breakpoint set: torhu.d:6 0x402013
->r
IMM32.dll loaded
ADVAPI32.dll loaded
RPCRT4.dll loaded
LPK.dll loaded
USP10.dll loaded
msvcrt.dll loaded
Breakpoint 0 hit torhu.d:4 0x402010
void main()
->r
Breakpoint 1 hit torhu.d:6 0x402013
    writefln("hello 1");
->ov
hello 1
torhu.d:7 0x40202a
    free(cast(void*)1);
->
Unhandled Exception: EXCEPTION_ACCESS_VIOLATION(0xc0000005) at multpool
(0x0040bda1)
->q

torhu wrote:
 Looks interesting.  Something that's simpler to use for quick D
 debugging than windbg and msvc.  As long as the docs will continue to
 fit on one page, at least.
 
 I tried this:
 
 import std.stdio;
 import std.c.stdlib;
 
 void main()
 {
     writefln("hello 1");
     free(cast(void*)1);
     writefln("hello 2");
 }
 
 I tried setting breakpoints on line 4 and 6, and others too.  But ddbg
 just crashes when I use the 'bp' command.
 
 
 Hang on... This is odd, now it crashes when I try to set a breakpoint at
 line 79 of debuggee.d too.  It didn't do that five minutes ago.  Weird.
Feb 21 2007
parent reply torhu <fake address.dude> writes:
I tried the new version, still with the small test example I posted.  I 
tried to debug the debugger with itself.  Not sure if that's what I'm 
really doing here, though.


I start with: ddbg ddbg_debug.exe crash.exe

->bp 4
Unhandled Exception: EXCEPTION_ACCESS_VIOLATION(0xc0000005) at MFAaZb 
dbugger.dbugger.parseCommand src\dbugger.d:323 (0x004082ec)



This only happened the first time I tried this.  When I restart the 
debugger and try again, it just crashes, with an access violation.  This 
is probably the kind of error that goes away when I reboot windows. 
Maybe I'll do that later today.

By the way, are you using dmd 1.007?
Feb 21 2007
parent reply Jascha Wetzel <"[firstname]" mainia.de> writes:
ah, ok that's partially a bug, partially a bad command.
the correct syntax for bp is "bp [<source file>:<line>] [index]", so
you're missing the source file name. it shouldn't crash either, though...
i'll add this convenience syntax (if only one source file is available)
in the next release. until then use something like bp cr:4, "cr" being a
substring of the source file/module name. use "lsm" to list all
available source module names.

debugging the debugger isn't tested, yet. atm ddbg debugs the debuggee
and all it's child processes. to successfully debug the debugger, it has
 to stay away from the child processes, as those are debugged by the
child - the debugged debugger :)

 By the way, are you using dmd 1.007?
yes. also the 0.0.2 releases are compiled with 1.007 thanks for that feedback. torhu wrote:
 I tried the new version, still with the small test example I posted.  I
 tried to debug the debugger with itself.  Not sure if that's what I'm
 really doing here, though.
 
 
 I start with: ddbg ddbg_debug.exe crash.exe
 
 ->bp 4
 Unhandled Exception: EXCEPTION_ACCESS_VIOLATION(0xc0000005) at MFAaZb
 dbugger.dbugger.parseCommand src\dbugger.d:323 (0x004082ec)
 
 
 
 This only happened the first time I tried this.  When I restart the
 debugger and try again, it just crashes, with an access violation.  This
 is probably the kind of error that goes away when I reboot windows.
 Maybe I'll do that later today.
 
 By the way, are you using dmd 1.007?
Feb 21 2007
parent reply torhu <fake address.dude> writes:
Jascha Wetzel wrote:
 ah, ok that's partially a bug, partially a bad command.
 the correct syntax for bp is "bp [<source file>:<line>] [index]", so
 you're missing the source file name. it shouldn't crash either, though...
 i'll add this convenience syntax (if only one source file is available)
 in the next release. until then use something like bp cr:4, "cr" being a
 substring of the source file/module name. use "lsm" to list all
 available source module names.
Oops. Another question. My crash example crashes at line 7, at 'free(cast(void*)1);' But ddbg seems to say it crashes at line 8. Is this intended? Unhandled Exception: EXCEPTION_ACCESS_VIOLATION(0xc0000005) at multpool (0x0040bda1) ->us _Dmain crash.d:8 (0x00402031) dmain2 (0x0040213c) constart (0x0040a115) KERNEL32.dll (0x7c816fd7) ->q
Feb 21 2007
parent Jascha Wetzel <"[firstname]" mainia.de> writes:
to be precise, ddbg says that it crashes in multpool, which is some
function/segment (from minit.obj) free uses. when you unwind the stack
after the exception occured, it holds the return address of the call
that caused the exception, which is free. therefore the resulting source
address is after that call to free.

torhu wrote:
 Jascha Wetzel wrote:
 ah, ok that's partially a bug, partially a bad command.
 the correct syntax for bp is "bp [<source file>:<line>] [index]", so
 you're missing the source file name. it shouldn't crash either, though...
 i'll add this convenience syntax (if only one source file is available)
 in the next release. until then use something like bp cr:4, "cr" being a
 substring of the source file/module name. use "lsm" to list all
 available source module names.
Oops. Another question. My crash example crashes at line 7, at 'free(cast(void*)1);' But ddbg seems to say it crashes at line 8. Is this intended? Unhandled Exception: EXCEPTION_ACCESS_VIOLATION(0xc0000005) at multpool (0x0040bda1) ->us _Dmain crash.d:8 (0x00402031) dmain2 (0x0040213c) constart (0x0040a115) KERNEL32.dll (0x7c816fd7) ->q
Feb 21 2007
prev sibling next sibling parent reply Sean Kelly <sean f4.ca> writes:
Jascha Wetzel wrote:
 Ddbg is a Win32 D Debugger
 
 http://ddbg.mainia.de/releases.html
 
 This release supports evaluation of structs and classes.
Nice work! If someone sort out emacs integration I'm sold :-) Sean
Feb 21 2007
parent reply Bill Baxter <dnewsgroup billbaxter.com> writes:
Sean Kelly wrote:
 Jascha Wetzel wrote:
 Ddbg is a Win32 D Debugger

 http://ddbg.mainia.de/releases.html

 This release supports evaluation of structs and classes.
Nice work! If someone sort out emacs integration I'm sold :-) Sean
Is ddbg's syntax compatible with any one of emacs' debugging modes? - gdb - dbx - xdb - jdb - sdb - pdb If so, then that mode should just work (in theory). If not then either a) ddbg needs a 'compatibility mode' that mimics one of those debugger's interfaces, or b) a new emacs mode needs to be written I think a) makes the most sense long term, because if ddbg supported gdb, dbx, or xdb syntax then it should be possible to also use a wide variety of other front-ends like ddd. (www.gnu.org/software/ddd/) --bb
Feb 21 2007
parent reply Jascha Wetzel <"[firstname]" mainia.de> writes:
yep, i was already thinking of mimicing gdb or MS dbg, but postponed
that. i'll add an API in one of the next releases, such that different
UIs can be added easily.

Bill Baxter wrote:
 Sean Kelly wrote:
 Jascha Wetzel wrote:
 Ddbg is a Win32 D Debugger

 http://ddbg.mainia.de/releases.html

 This release supports evaluation of structs and classes.
Nice work! If someone sort out emacs integration I'm sold :-) Sean
Is ddbg's syntax compatible with any one of emacs' debugging modes? - gdb - dbx - xdb - jdb - sdb - pdb If so, then that mode should just work (in theory). If not then either a) ddbg needs a 'compatibility mode' that mimics one of those debugger's interfaces, or b) a new emacs mode needs to be written I think a) makes the most sense long term, because if ddbg supported gdb, dbx, or xdb syntax then it should be possible to also use a wide variety of other front-ends like ddd. (www.gnu.org/software/ddd/) --bb
Feb 21 2007
next sibling parent Pragma <ericanderton yahoo.removeme.com> writes:
Jascha Wetzel wrote:
 yep, i was already thinking of mimicing gdb or MS dbg, but postponed
 that. i'll add an API in one of the next releases, such that different
 UIs can be added easily.
For what it's worth, the first thought that came to mind was: is this controllable by a GUI? While I'm not writing any such software myself, having a stand-alone debugger that can be utilized for an IDE (built-in or otherwise) would be a very nice thing to have. Keep up the excellent work. :) -- - EricAnderton at yahoo
Feb 21 2007
prev sibling parent Bill Baxter <dnewsgroup billbaxter.com> writes:
Jascha Wetzel wrote:
 yep, i was already thinking of mimicing gdb or MS dbg, but postponed
 that. i'll add an API in one of the next releases, such that different
 UIs can be added easily.
 
Excellent. I was telling someone about D just yesterday (current C++ user, former Java user) and he was getting really into the idea of giving D a try -- garbage collection? Great! Compiled? Great. clean syntax? Great! No C++ integration? Hmm... well you can call C pretty easily -- ok that'll do! No debugger? Oh. Forget it then. --bb
Feb 21 2007
prev sibling next sibling parent reply J Duncan <jtd514 nospam.ameritech.net> writes:
Jascha Wetzel wrote:
 Ddbg is a Win32 D Debugger
 
 http://ddbg.mainia.de/releases.html
 
 This release supports evaluation of structs and classes.
very cool! Where can I find the source for this?
Feb 21 2007
parent Jascha Wetzel <"[firstname]" mainia.de> writes:
i haven't decided about the license, yet. it'll be on the release page then.

J Duncan wrote:
 Jascha Wetzel wrote:
 Ddbg is a Win32 D Debugger

 http://ddbg.mainia.de/releases.html

 This release supports evaluation of structs and classes.
very cool! Where can I find the source for this?
Feb 21 2007
prev sibling next sibling parent Serg Kovrov <kovrov no.spam> writes:
Thank you. Keep up that great work! A debugger which could be used with 
a debugger-aware editor is one of very few things D really missing.

-- 
serg.
Feb 21 2007
prev sibling next sibling parent "Kristian Kilpi" <kjkilpi gmail.com> writes:
On Wed, 21 Feb 2007 13:36:38 +0200, Jascha Wetzel  
<"[firstname]" mainia.de> wrote:
 Ddbg is a Win32 D Debugger

 http://ddbg.mainia.de/releases.html

 This release supports evaluation of structs and classes.
Nice! :)
Feb 21 2007
prev sibling parent reply Robin Allen <r.a3 ntlworld.com> writes:
Jascha Wetzel wrote:
 Ddbg is a Win32 D Debugger
 
 http://ddbg.mainia.de/releases.html
 
 This release supports evaluation of structs and classes.
Nice! One issue I had with the arguments, though; if I pass one argument to ddbg after my exe name, then my exe receives exactly one argument. By convention shouldn't it receive its own name *then* the argument? I bet a lot of programs just start checking for arguments at args[1]; I know mine do.
Feb 26 2007
parent reply Jascha Wetzel <"[firstname]" mainia.de> writes:
Robin Allen wrote:
 Nice! One issue I had with the arguments, though; if I pass one argument
 to ddbg after my exe name, then my exe receives exactly one argument. By
 convention shouldn't it receive its own name *then* the argument? I bet
 a lot of programs just start checking for arguments at args[1]; I know
 mine do.
hm, i can't reproduce that. could you give an example program and the command you use to call ddbg with it?
Feb 26 2007
parent reply Robin Allen <r.a3 ntlworld.com> writes:
Jascha Wetzel wrote:
 Robin Allen wrote:
 Nice! One issue I had with the arguments, though; if I pass one argument
 to ddbg after my exe name, then my exe receives exactly one argument. By
 convention shouldn't it receive its own name *then* the argument? I bet
 a lot of programs just start checking for arguments at args[1]; I know
 mine do.
hm, i can't reproduce that. could you give an example program and the command you use to call ddbg with it?
--- main.d: import std.stdio; void main(char[][] args) { writefln("%s args",args.length); foreach(arg; args) writefln(" %s",arg); } --- D:\Dev2\test>dmd -g main d:\dmd\bin\..\..\dm\bin\link.exe main,,,user32+kernel32/co/noi; D:\Dev2\test>d:\ddbg\ddbg main.exe spam1 spam2 spam3 ntdll.dll loaded KERNEL32.dll loaded USER32.dll loaded GDI32.dll loaded Unknown breakpoint hit at ntdll.dll (0x7c901230) ->r ShimEng.dll loaded IMM32.dll loaded ADVAPI32.dll loaded RPCRT4.dll loaded LPK.dll loaded USP10.dll loaded msvcrt.dll loaded 3 args D:\Dev2\test\main.exe spam2 spam3 Process terminated ->^C D:\Dev2\test> --- Shouldn't that be 4 args? What happened to spam1? :O -Rob
Feb 26 2007
parent Jascha Wetzel <"[firstname]" mainia.de> writes:
ah, k - got it.
fixed it in the upcoming release 0.0.3
thanks for the report!

Robin Allen wrote:
 Jascha Wetzel wrote:
 Robin Allen wrote:
 Nice! One issue I had with the arguments, though; if I pass one argument
 to ddbg after my exe name, then my exe receives exactly one argument. By
 convention shouldn't it receive its own name *then* the argument? I bet
 a lot of programs just start checking for arguments at args[1]; I know
 mine do.
hm, i can't reproduce that. could you give an example program and the command you use to call ddbg with it?
--- main.d: import std.stdio; void main(char[][] args) { writefln("%s args",args.length); foreach(arg; args) writefln(" %s",arg); } --- D:\Dev2\test>dmd -g main d:\dmd\bin\..\..\dm\bin\link.exe main,,,user32+kernel32/co/noi; D:\Dev2\test>d:\ddbg\ddbg main.exe spam1 spam2 spam3 ntdll.dll loaded KERNEL32.dll loaded USER32.dll loaded GDI32.dll loaded Unknown breakpoint hit at ntdll.dll (0x7c901230) ->r ShimEng.dll loaded IMM32.dll loaded ADVAPI32.dll loaded RPCRT4.dll loaded LPK.dll loaded USP10.dll loaded msvcrt.dll loaded 3 args D:\Dev2\test\main.exe spam2 spam3 Process terminated ->^C D:\Dev2\test> --- Shouldn't that be 4 args? What happened to spam1? :O -Rob
Feb 26 2007