View previous topic :: View next topic |
Author |
Message |
jascha
Joined: 17 Jun 2007 Posts: 13 Location: Aachen, Germany
|
Posted: Sun Jun 17, 2007 6:23 am Post subject: Debugging DDLs on Windows |
|
|
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 |
|
|
pragma
Joined: 28 May 2004 Posts: 607 Location: Washington, DC
|
Posted: Sun Jun 17, 2007 4:01 pm Post subject: |
|
|
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 |
|
|
jascha
Joined: 17 Jun 2007 Posts: 13 Location: Aachen, Germany
|
Posted: Sun Jun 17, 2007 6:48 pm Post subject: |
|
|
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 |
|
|
pragma
Joined: 28 May 2004 Posts: 607 Location: Washington, DC
|
Posted: Sun Jun 17, 2007 8:31 pm Post subject: |
|
|
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 |
|
|
jascha
Joined: 17 Jun 2007 Posts: 13 Location: Aachen, Germany
|
Posted: Mon Jun 18, 2007 4:32 am Post subject: |
|
|
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 |
|
|
|