Dll debug question

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?
 
W

William DePalo [MVP VC++ ]

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
 
C

Carl Daniel [VC++ MVP]

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
 
W

William DePalo [MVP VC++ ]

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
 
V

Vadym Stetsyak

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.
 
J

Jochen Kalmbach

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Debugging 1
.NET and Native Dll Debugging 2
Stepping into vc++ dll from c# 2
How to debug a DLL? 1
Can't debug DLL 1
ATL trace tool 0
Debug VB6 ActiveX from VC++ 1
Debugging mixed DLL called from legacy code 3

Top