How to Debug a COM Component in VC++ ????

Hi All,
  I have  written a COM component in VC++ named   "Test.dll" and I have used that component in "Test.exe".

Now I have to Debug the COM component "Test.dll", How can I  acheive this in VC++ editor???

Its pretty straight forward in Delphi, but if any body can give me the setps to Debug in VC++, it will be really helpful.

Thanks for ur earliest attention.

Regards,

Manjesh


LVL 1
ManjeshAsked:
Who is Participating?
 
nonubikCommented:
If you use VC++.NET, menu->debug->processes and attach to test.exe.
For 6.0 rightclick on test.exe in task manager and choose debug.
0
 
nonubikCommented:
Set the active project the "Test.dll" one. In the 'debug' section of the projects settings set as exuctable the Test.exe. Then start debugging.
0
 
ManjeshAuthor Commented:
Sry for the incomplete question.

I dont want to specify the exe .  Assuming that the EXE will be a service i.e, its already running. I want to debug on fly.

Scenario.

1) Test.exe is already running
2) OnButtonClick the Test.dl will be used.

I want to attach the exe, to the DLL project, before buttonClick.

Thank you for your earliest attention.

Regards,

Manjesh
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
ManjeshAuthor Commented:
I dont have .Net and I want to debug in  MS VC++.
0
 
nonubikCommented:
There is a confusion: .NET has VC++ also. v7.0 (2002) or v7.1(2003)
What you are talking about is v6.0
0
 
ManjeshAuthor Commented:
I have  " Microsoft Visual Studio 6.0 ", which does not have .NET.

Now i cant get v7 or upper.   With in this regime , I want to debug. So can u please come up with a way do it .

Regards,
Manjesh
0
 
nonubikCommented:
I think you did *NOT* read well my comments:

>For 6.0 rightclick on test.exe in task manager and choose debug.
0
 
ManjeshAuthor Commented:
Yup.. sry.. for i overlooked that line.

I tried the stuff..

But i could see only some Disassemly code. So using the Debug option in  "Task Manager " , how can I get into my "Test.dll" code , so that i can put the break poing and continue further debugging.
0
 
nonubikCommented:
Make sure that the debugged service (test.exe) uses the debug version of your test.dll. After heving started the debugger, even if you see assembly, load one of the dll's cpp and place breakpoints. If they are disabled means that you're not debugging the right dll.
0
 
ManjeshAuthor Commented:
Sry Nonubik,
 
   I tried in and out, but could not find the option to load the DLL (cpp's) to the debug project.

If you have any other alternative, please let me know.

FYI ::  Test.exe    is build in Delphi ( Debug Version )
          Test.dll      is build in VC++ ( Debug Version )
             
0
 
nonubikCommented:
File->open->my.cpp
0
 
ManjeshAuthor Commented:
Nonubik,
   I tried that, its not working. Atleast , I cant even put the break point.  If you want i can mail u then sample project, you can just check it.

Regards,
Manjesh

0
 
DanRollinsCommented:
Did you try
  Build > Start Debug > Attach to process...
  [x] Show System Processes
  Select Test.Exe
  Go
  When Test.Exe loads the COM module, you should be able to breakpoint in it.  What I have done in the past is add a
    Sleep(30000);
in the COM object module to give time to bring up the project and set breakpoints, etc.
 
You could also try adding
    DebugBreak();
in the COM module.
0
 
Cezariusz MarekSystems AnalystCommented:
1. Make sure you COM is build with debug information and .PDB file is in the same directory as .dll
2. In your COM, at the beginning of code you want do debug insert ASSERT(FALSE).
3. When the service will start your COM and reach the assert, it will display assert dialog with Abort, Retry, Cancel buttons
4. Press "Retry" and it will start debugging of the process at the line with assert in the default system debugger, which sould be Visual C++ 6.0.

If you will see assembly code, open call stack window (Alt+7 or View -> Debug Windows -> Call Stack) and double click on the top line of the call stack.
0
 
ManjeshAuthor Commented:
Hi Cezariusz ,
  I tried ur way, but  it did not work.
0
 
Cezariusz MarekSystems AnalystCommented:
>> I tried ur way, but  it did not work.

What didn't work?
- did the ASSERT(FALSE) appear when executing?
- did "Retry" start debugging?
- did you see the source code?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.