Click to See Complete Forum and Search --> : How to debug COM DLL
Chetan
May 16th, 1999, 04:22 PM
Hello Codegurus,
I am new to the COM programming and I have written two ATL COM DLLs A and B. I have Aggregated COM Object from B in A.
Now I want to debug these both dlls with the client which I have written, but unfortunately I can't debug these dlls.
Is there any way by which I can debug these DLLs?
Thanks in advance.
Chetan
Practice makes the man perfect.
mihai
May 17th, 1999, 08:17 AM
Compile your dll in debug mode, and add breakpoints with __asm int 3;
Sincerely, Mihai
PChetan
May 17th, 1999, 08:52 AM
Hi,
I am sorry for bothering you again, but can you explain me how to set the break point using _asm int 3.
Thanks for your help
Chetan
Nothing is impossible.
Dave Lorde
May 17th, 1999, 10:18 AM
You can use the Win32 function DebugBreak().
A better way is to run the executable from the COM DLL project you want to debug (Project/Settings/Debug/Executable for Debug session). This way you can have ordinary VC++ breakpoints active without needing DebugBreak().
Dave
PChetan
May 17th, 1999, 10:53 AM
Hello,
Yes I was debuging my dlls same way as you have suggested but now my problem is I have 2 COM DLLs A dll contains the object which is exposed to the User and B DLL contains the object which is aggregated in DLL A, and I want to debug both of these dlls.
Now my problem is if I will mention the Debug EXE path in DLL A then I can debug DLL A but when the call is going to DLL B I can not debug it. The exact opposite is happening if I will specify the Debug EXE path in B.
So now is there any way to test these 2 DLLs simultaneously or I must use DebugBreak.
Actually I afread to use DebugBreak because it generates an exception User Breakpoint, and the system displays the good old message box "Excpetion occured due want to Debug.....". Atleast for bigginers this message box may give Heart attack (Just kidding)...
Thanks in advance
Chetan
Nothing is impossible.
Dave Lorde
May 18th, 1999, 04:01 AM
As far as I recall, you should be able to set breakpoints in the DLL once it has been loaded, so a single DebugBreak in the InitInstance method ought to be sufficient (naturally this should be wrapped in _DEBUG conditional compilation, and possibly a command-line argument check, so that it can be switched on/off when you need it).
Other than that, I don't know of any easier way. If you think debugging COM DLLs is a pain, try debugging shell namespace extensions under Win95 - any bugs or unclean terminations crash Explorer and the desktop, requiring a reboot (under NT you can run Explorer windows as separate processes, which avoids this).
Dave
Prashanth Patali
May 18th, 1999, 04:59 AM
Hi Chetan,
I have faced this kind of problem. The solution I use is as follows.
Let us say you have MyApp, DLLA, DLLB as three diffrent projects, (the two DLLs being ATL component dlls). Am I right ?
Open The MyApp project workspace and to it add DLLA & DLLB projects also ('Add to workspace'). Now in your MyApp.dsw you have three projects(MyApp.dsp, DLLA.dsp, DLLB.dsp). Fine.
Now build all the projects in Debug mode. Set MyApp as active project and Click F5(Go) to debug the app. You can set the breakpoint at any point in any source file of these three projects. Try it out. It works for me..
Hope this will help you...
Prashanth
Chetan
May 18th, 1999, 08:12 PM
Hi Prashanth,
Thanks, your method helped me. Now I am able to debug my both the DLLs.
Chetan
Practice makes the man perfect.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.