www.digitalmars.com         C & C++   DMDScript  

D - D Debugger?

reply J Anderson <REMOVEanderson badmama.com.au> writes:
Just doing the preliminary fiddling with in D to try and get some sort 
of D debugger working but I've hit a few snags.

1) DEBUG_EVENT debugEv; //Causes linking error
2) When debug mode is turned on, either on creation or after creation, 
the program doesn't appear to activate. It runs fine when it is off.  I 
first thought, right-o, the program is returning straight away and it 
needs to be continued.  However a while loop with a ContinueDebugEvent 
in does not help at all.

What am I doing wrong?

//The test2 program is the simple hello world program with an infinite 
loop after that.

import win32.winbase;

void main ()
{
   STARTUPINFOA startup;
   startup.cb=startup.sizeof;

   PROCESS_INFORMATION output;
 
   //CreateProccessA seems to do nothing
   //int result = CreateProcessA (null, "\"C:\\Program
Files\\DIDE\\Projects\\test\\test2.exe\"", null, null, false,
DEBUG_PROCESS | DEBUG_ONLY_THIS_PROCESS, null, null, &startup, &output);
//Causes program to return


   int result = CreateProcessA (null, "\"C:\\Program
Files\\DIDE\\Projects\\test\\test2.exe\"", null, null, false, 0, null,
null, &startup, &output);
 
   if ( !result )
       printf("Error %d occurred", GetLastError());
        if ( !DebugActiveProcess(output.dwProcessId) ) //If you get rid of
this line the program being debugged will run to completion
       printf("Error %d occurred\n", GetLastError());
   else
       printf("Debug Handle attached...\n");

   //ContinueDebugEvent(output.dwProcessId, output.dwThreadId,
DBG_CONTINUE);
 
 
   /*DEBUG_EVENT debugEv;    //Causes linking error
 
   while ( true )
   {
       WaitForDebugEvent(&debugEv, INFINITE);                  //Do 
stuff with debugEv
       //ie code is in
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/writing_the_debu
ger_s_main_loop.asp 

            ContinueDebugEvent(output.dwProcessId, output.dwThreadId,
DBG_CONTINUE);
   }*/
}

BTW: Me and Charles are considering setting up a group to write an 
independent debugger for D, in D, that will plug into DIDE, appearing 
integrated.

This project will be open to anyone who think they could be of help.

Charles may give further details (and/or is tracing some lead in visual 
studios).

-- 
-Anderson: http://badmama.com.au/~anderson/
Mar 31 2004
next sibling parent J Anderson <REMOVEanderson badmama.com.au> writes:
J Anderson wrote:

 Just doing the preliminary fiddling with in D to try and get some sort 
 of D debugger working but I've hit a few snags.

 1) DEBUG_EVENT debugEv; //Causes linking error
 2) When debug mode is turned on, either on creation or after creation, 
 the program doesn't appear to activate. It runs fine when it is off.  
 I first thought, right-o, the program is returning straight away and 
 it needs to be continued.  However a while loop with 
 ContinueDebugEvent in it, does not help at all.
Gramma correction. -- -Anderson: http://badmama.com.au/~anderson/
Mar 31 2004
prev sibling parent reply J Anderson <REMOVEanderson badmama.com.au> writes:
J Anderson wrote:

 Just doing the preliminary fiddling with in D to try and get some sort 
 of D debugger working but I've hit a few snags.

 1) DEBUG_EVENT debugEv; //Causes linking error
I should add that I only included the dmd include path. DEBUG_EVENT appears to be in winbase, so I can't see why it doesn't work. -- -Anderson: http://badmama.com.au/~anderson/
Mar 31 2004
parent reply C <dont respond.com> writes:
On Wed, 31 Mar 2004 22:02:13 +0800, J Anderson =

<REMOVEanderson badmama.com.au> wrote:

 J Anderson wrote:

 Just doing the preliminary fiddling with in D to try and get some sor=
t =
 of D debugger working but I've hit a few snags.

 1) DEBUG_EVENT debugEv; //Causes linking error
I should add that I only included the dmd include path. DEBUG_EVENT =
 appears to be in winbase, so I can't see why it doesn't work.
Hmm odd, it seems to work when linking to win32.lib, but NOT win32a.lib = , = the ansi versions not working for some reason ( even though DEBUG_EVENT = seems to be in both ansi.winbase and win32a.lib ) . Heres the basic she= ll = ( from the original code ) I have so far ( attached. ). It compiles , n= ot = much else. C -- = D Newsgroup.
Mar 31 2004
parent reply J Anderson <REMOVEanderson badmama.com.au> writes:
C wrote:

 On Wed, 31 Mar 2004 22:02:13 +0800, J Anderson 
 <REMOVEanderson badmama.com.au> wrote:

 J Anderson wrote:

 Just doing the preliminary fiddling with in D to try and get some 
 sort of D debugger working but I've hit a few snags.

 1) DEBUG_EVENT debugEv; //Causes linking error
I should add that I only included the dmd include path. DEBUG_EVENT appears to be in winbase, so I can't see why it doesn't work.
Hmm odd, it seems to work when linking to win32.lib, but NOT win32a.lib , the ansi versions not working for some reason ( even though DEBUG_EVENT seems to be in both ansi.winbase and win32a.lib ) . Heres the basic shell ( from the original code ) I have so far ( attached. ). It compiles , not much else. C
I'm having trouble getting this to work. Can you please send your make file or DIDE instructions. Thanks. -- -Anderson: http://badmama.com.au/~anderson/
Apr 01 2004
parent reply C <dont respond.com> writes:
Sure his the dideexport ( use import project ).  Also found some old =

CodeView code thats no longer in the SDK ( attached ) .  Also Im looking=
 =

over wine I think they have some debugging stuff.  I emailed brad think =

hes setting up a project on dsource.

C

On Thu, 01 Apr 2004 16:18:16 +0800, J Anderson =

<REMOVEanderson badmama.com.au> wrote:

 C wrote:

 On Wed, 31 Mar 2004 22:02:13 +0800, J Anderson =
 <REMOVEanderson badmama.com.au> wrote:

 J Anderson wrote:

 Just doing the preliminary fiddling with in D to try and get some =
 sort of D debugger working but I've hit a few snags.

 1) DEBUG_EVENT debugEv; //Causes linking error
I should add that I only included the dmd include path. DEBUG_EVENT=
=
 appears to be in winbase, so I can't see why it doesn't work.
Hmm odd, it seems to work when linking to win32.lib, but NOT win32a.l=
ib =
 , the ansi versions not working for some reason ( even though =
 DEBUG_EVENT seems to be in both ansi.winbase and win32a.lib ) .  Here=
s =
 the basic shell ( from the original code ) I have so far ( attached. =
 ).  It compiles , not much else.

 C
I'm having trouble getting this to work. Can you please send your mak=
e =
 file or DIDE instructions. Thanks.
-- = D Newsgroup.
Apr 01 2004
parent reply C <dont respond.com> writes:
Also http://www.magma.ca/~wjr/ has a cool PE Viewer helps visually break=
 =

up the executable.  I think theres a function liek =

'TranslateFunctionAddressToSymbol' that will give us the line & number =

given the address in the executable, trying to find it.

C

On Thu, 01 Apr 2004 15:06:24 -0800, C <dont respond.com> wrote:

 Sure his the dideexport ( use import project ).  Also found some old
 CodeView code thats no longer in the SDK ( attached ) .  Also Im looki=
ng
 over wine I think they have some debugging stuff.  I emailed brad thin=
k
 hes setting up a project on dsource.

 C

 On Thu, 01 Apr 2004 16:18:16 +0800, J Anderson
 <REMOVEanderson badmama.com.au> wrote:

 C wrote:

 On Wed, 31 Mar 2004 22:02:13 +0800, J Anderson
 <REMOVEanderson badmama.com.au> wrote:

 J Anderson wrote:

 Just doing the preliminary fiddling with in D to try and get some
 sort of D debugger working but I've hit a few snags.

 1) DEBUG_EVENT debugEv; //Causes linking error
I should add that I only included the dmd include path. DEBUG_EVEN=
T
 appears to be in winbase, so I can't see why it doesn't work.
Hmm odd, it seems to work when linking to win32.lib, but NOT win32a.=
lib
 , the ansi versions not working for some reason ( even though
 DEBUG_EVENT seems to be in both ansi.winbase and win32a.lib ) .  Her=
es
 the basic shell ( from the original code ) I have so far ( attached.=
 ).  It compiles , not much else.

 C
I'm having trouble getting this to work. Can you please send your ma=
ke
 file or DIDE instructions. Thanks.
-- = D Newsgroup.
Apr 01 2004
parent reply J Anderson <REMOVEanderson badmama.com.au> writes:
If your there can you join me in D ICQ?  I'm still having trouble with 
getting the debugger working.  I've a feeling my win32.lib may be 
outdated (I don't even know where I got it from as its not part of dmd, 
at least anymore).

Anyway good job on the debugger so far, its starting to take shape.

-- 
-Anderson: http://badmama.com.au/~anderson/
Apr 01 2004
parent reply C <dont respond.com> writes:
What is D ICQ ?  u mean irc.dprogramming.com ?

C

On Fri, 02 Apr 2004 05:24:48 +0800, J Anderson =

<REMOVEanderson badmama.com.au> wrote:

 If your there can you join me in D ICQ?  I'm still having trouble with=
=
 getting the debugger working.  I've a feeling my win32.lib may be =
 outdated (I don't even know where I got it from as its not part of dmd=
, =
 at least anymore).

 Anyway good job on the debugger so far, its starting to take shape.
-- = D Newsgroup.
Apr 01 2004
parent J Anderson <REMOVEanderson badmama.com.au> writes:
C wrote:

 What is D ICQ ?  u mean irc.dprogramming.com ?

 C
Sorry, IRC. -- -Anderson: http://badmama.com.au/~anderson/
Apr 01 2004