FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Debugging DDLs on Windows

 
Post new topic   Reply to topic     Forum Index -> DDL - D Dynamic Libraries
View previous topic :: View next topic  
Author Message
jascha



Joined: 17 Jun 2007
Posts: 13
Location: Aachen, Germany

PostPosted: Sun Jun 17, 2007 6:23 am    Post subject: Debugging DDLs on Windows Reply with quote

When a process loads a DLL, Windows generates a DebugEvent that notifies the debugger and supplies the DLL's filename and base address.
The DDL loader should do something similar. I suggest using the DebugString event to pass that information to the debugger.
This snippet will do that:

Code:

extern(Windows) void OutputDebugStringA(LPCSTR);
OutputDebugStringA(toStringz("DDL: load plugin.obj 0x00428500"));
Back to top
View user's profile Send private message
pragma



Joined: 28 May 2004
Posts: 607
Location: Washington, DC

PostPosted: Sun Jun 17, 2007 4:01 pm    Post subject: Reply with quote

Not a bad idea! I suppose I could just add this in on debug builds only - would that be acceptable?
_________________
-- !Eric.t.Anderton at gmail
Back to top
View user's profile Send private message Yahoo Messenger
jascha



Joined: 17 Jun 2007
Posts: 13
Location: Aachen, Germany

PostPosted: Sun Jun 17, 2007 6:48 pm    Post subject: Reply with quote

it would be nice if the loader could send the string if the DDL it loads has debug symbols. this way a DDL host compiled in release mode can still be used to host a debugging session if you just want to debug the DDL (typical plugin development situation).
Back to top
View user's profile Send private message
pragma



Joined: 28 May 2004
Posts: 607
Location: Washington, DC

PostPosted: Sun Jun 17, 2007 8:31 pm    Post subject: Reply with quote

jascha wrote:
it would be nice if the loader could send the string if the DDL it loads has debug symbols. this way a DDL host compiled in release mode can still be used to host a debugging session if you just want to debug the DDL (typical plugin development situation).


That can be done too, although DDL has no support for debug info at this point... that will have to change first.

Is there any convention for the formatting of the debug string, or does it just have to be well documented for other folks to use?
_________________
-- !Eric.t.Anderton at gmail
Back to top
View user's profile Send private message Yahoo Messenger
jascha



Joined: 17 Jun 2007
Posts: 13
Location: Aachen, Germany

PostPosted: Mon Jun 18, 2007 4:32 am    Post subject: Reply with quote

DDL doesn't need full debug symbol support. it'll just have to check whether there are some. for COFF files that means checking whether the DataDirectory with index IMAGE_DIRECTORY_ENTRY_DEBUG in the IMAGE_OPTIONAL_HEADER structure has non-zero size (names from platform sdk).
the code in ddl.coff already loads that information - the naming for the structures is just slightly different.

i made up that debug string. it'll be a DDL feature and debuggers supporting DDL would use the convention you set. the information that is needed in that string is the filename of the image and the base address. the rest is up to you.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> DDL - D Dynamic Libraries All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group