Reputation: 28316
I've got a C# DLL with native exports, which is called from some Delphi 2009 code. The Delphi code uses LoadLibrary
and GetProcAddress
to access the exported functions. I'd like to debug the managed part of the code at runtime, but I'm running into trouble.
When I launch the application, the breakpoints appear properly, but fail to be hit.
My current setup is the following:
I've tried enabling unmanaged code debugging, but that causes an error saying "binary was built without debug information". If I continue, all breakpoints are disabled.
When I checked the modules list, the executable shows as having no debug symbols. Delphi doesn't generate a PDB (it can't, since it's a closed-spec proprietary format) but it generates a MAP file instead. I had a look around for MAP-to-PDB converter tools, but it seems there's only a tool for doing the reverse of what I need.
I'm not really interested in debugging the Delphi code from Visual Studio, since I can already do that in the CodeGear Delphi IDE, but is there a way to debug the managed code at runtime in this situation?
Upvotes: 3
Views: 2132
Reputation: 28316
Ok, I found a solution. The issue wasn't with debug symbols, but rather the type of code being debugged. If you launch an application from your project startup settings, the debugger starts in mixed mode, which requires native symbols to be available in order to catch C# code invoked from native code.
I wasn't able to get Visual Studio to accept the pdb files created by tds2dbg, so I found a workaround. In order to ensure that the debugger launches in managed mode, attach to the process instead of launching it, like so:
After this, all breakpoints should work nicely :)
Upvotes: 4
Reputation: 9112
There is a "tds2pdb" you can try to create a .pdb file: http://code.google.com/p/map2dbg/downloads/detail?name=tds2pdb102.zip
Note: it's not a complete .pdb file (specs aren't available) but at least it is working for stack traces. However, not all symbols (classes, variables, parameters) are exported. But you can always try...
Upvotes: 1