Dll debug question

  • Thread starter Thread starter Vadym Stetsyak
  • Start date Start date
V

Vadym Stetsyak

Hello!

When I am debugging, I call the app, which loads the dll and then I can
trace the dll. In this scenario everything is ok. But when my dll calls an
app which loads another dll, that then lods mine, - I am not able to trace
my dll.

In short, the scheme looks like this: App -> SomeDLL -> MyDll.

How can I trace my dll?
 
Vadym Stetsyak said:
When I am debugging, I call the app, which loads the dll and then I can
trace the dll. In this scenario everything is ok. But when my dll calls an
app which loads another dll, that then lods mine, - I am not able to trace
my dll.

Debuggers like the one VC++ uses can debug a single process at a time. If
another process loads your DLL you need another instance of the debugger.

I see that Nishant has already pointed out that you can instrument your code
with an

_asm int 3

to force a JIT debugger to attach at runtime. DebugBreak() does the same
thing.

Regards.
Will
 
William said:
Debuggers like the one VC++ uses can debug a single process at a
time. If another process loads your DLL you need another instance of
the debugger.

VC7 and above, as well as the system debuggers (WinDbg, ntsd, cdb) can
attach to multiple processes at once, just in case you do need to debug two
processes both using your DLL at the same time.

-cd
 
Carl Daniel said:
VC7 and above, as well as the system debuggers (WinDbg, ntsd, cdb) can
attach to multiple processes at once, just in case you do need to debug two
processes both using your DLL at the same time.

Thanks for that.

I thought such shenanigans were the province of windbag and co. and
SoftIce. Guess I should spend more time with VC7. :-)

Regards,
Will
 
I already have 1 process. Maybe the trouble is that the real picture looks
like this:

Managed App -> ManagedDll(Some P/Invoke method) -> C-style Dll

When the scheme is ManagedApp -> C-style Dll everything is ok - I can trace
C_Dll.
 
Vadym said:
I already have 1 process. Maybe the trouble is that the real picture
looks like this:

Managed App -> ManagedDll(Some P/Invoke method) -> C-style Dll

When the scheme is ManagedApp -> C-style Dll everything is ok - I can
trace C_Dll.

Maybe you can start the app and then attach to the app with the debugger
and then you HAVE TO select "nativ" and "managed" (optional) to debug your
DLL.

You also could try to start the app from the debugger, but you have to
choose somehow to debug also nativ code.

--
Greetings
Jochen

Do you need a memory-leak finder ?
http://www.codeproject.com/useritems/leakfinder.asp
 
Back
Top