[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2005-04-27
19
Medium Priority
?
382 Views
Last Modified: 2013-11-25
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


0
Comment
Question by:Manjesh
  • 7
  • 6
  • 2
  • +1
16 Comments
 
LVL 16

Expert Comment

by:nonubik
ID: 13883303
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
 
LVL 1

Author Comment

by:Manjesh
ID: 13883407
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
 
LVL 16

Accepted Solution

by:
nonubik earned 100 total points
ID: 13883425
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:Manjesh
ID: 13883508
I dont have .Net and I want to debug in  MS VC++.
0
 
LVL 16

Expert Comment

by:nonubik
ID: 13883520
There is a confusion: .NET has VC++ also. v7.0 (2002) or v7.1(2003)
What you are talking about is v6.0
0
 
LVL 1

Author Comment

by:Manjesh
ID: 13883539
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
 
LVL 16

Expert Comment

by:nonubik
ID: 13883543
I think you did *NOT* read well my comments:

>For 6.0 rightclick on test.exe in task manager and choose debug.
0
 
LVL 1

Author Comment

by:Manjesh
ID: 13883642
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
 
LVL 16

Expert Comment

by:nonubik
ID: 13883670
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
 
LVL 1

Author Comment

by:Manjesh
ID: 13884328
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
 
LVL 16

Expert Comment

by:nonubik
ID: 13884334
File->open->my.cpp
0
 
LVL 1

Author Comment

by:Manjesh
ID: 13885087
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
 
LVL 49

Assisted Solution

by:DanRollins
DanRollins earned 100 total points
ID: 13890496
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
 
LVL 2

Expert Comment

by:Cezariusz
ID: 13892414
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
 
LVL 1

Author Comment

by:Manjesh
ID: 13925349
Hi Cezariusz ,
  I tried ur way, but  it did not work.
0
 
LVL 2

Expert Comment

by:Cezariusz
ID: 16298086
>> 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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question