views:

350

answers:

2

I am trying to attach to Word and set break points in the C++ (MFC) source code that I have just gotten access to. I have never done this before and hope that I have omitted some simple step. So far I have been able to:

  • Compile the source code in VS (this produces .obj files and a .pdb file, but no .wll file which is confusing)
  • Attach to Word in VS and when I run the add-in in Word I can break all and see disassembly code
  • Locate myAddin.wll that is running in VS's modules window (VS says no symbols loaded)

I have not been able to:

  • load debugging symbols. VS simply ignores me when I right click on myAddin.wll in the modules window and try to load myAddin.pdb
  • set a break point in myAddin.cpp and hit it

Anything obvious I am missing? Any good references on this that you know of?

+2  A: 

Instead of attaching to Word you can try setting Word as the application you want to run when you hit F5. Properties, Debugging, Command. At least that works for me.

danbystrom
+1 from me. That's how I do it too.
jussij
+1  A: 

The first guess I'd have is that the .wll file that Word is loading is not the one you've just built, so that Word is loading a version without any debugging information.

The first step would be to figure out where the .wdll file you're building in Visual Stdio is actually output. Open the project's Properties window and check in "General / Output Directory" and "Linker / General / Output File" to see what the project outputs. That should be enough for you to find it, and check with Explorer that it's being actually built.

When you attach to Word and load your add-in, you should see in the Visual Studio output a message indicating that your .wll file has been loaded. That message should give the full path to where it's being loaded from - if that's not the output of your project, that's the first problem. I'd suggest just copying your new .wll file to whereever Word is loading the .wll from.

DavidK