如何在 VS 2003 中调试 Word 加载项 (.wll)
我正在尝试附加到 Word 并在我刚刚访问的 C++ (MFC) 源代码中设置断点。 我以前从未这样做过,希望我省略了一些简单的步骤。 到目前为止,我已经能够:
- 在 VS 中编译源代码(这会生成 .obj 文件和 .pdb 文件,但不会产生令人困惑的 .wll 文件)
- 在 VS 中附加到 Word,并且当我在 Word 中运行加载项时我可以打破所有并查看反汇编代码
- 找到在 VS 模块窗口中运行的 myAddin.wll (VS 表示未加载任何符号)
我无法:
- 加载调试符号。 当我右键单击模块窗口中的 myAddin.wll 并尝试加载 myAddin.pdb 时,VS 只是忽略我,
- 在 myAddin.cpp 中设置断点并点击它,
我是否遗漏了任何明显的东西? 您知道这方面有什么好的参考吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试将 Word 设置为按 F5 时要运行的应用程序,而不是附加到 Word。 属性、调试、命令。 至少这对我有用。
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.
我的第一个猜测是 Word 正在加载的 .wll 文件不是您刚刚构建的文件,因此 Word 正在加载没有任何调试信息的版本。
第一步是找出您在 Visual Stdio 中构建的 .wdll 文件的实际输出位置。 打开项目的属性窗口并检查“常规/输出目录”和“链接器/常规/输出文件”以查看项目输出的内容。 这应该足以让您找到它,并使用资源管理器检查它是否确实正在构建。
当您附加到 Word 并加载加载项时,您应该在 Visual Studio 输出中看到一条消息,指示您的 .wll 文件已加载。 该消息应该给出加载位置的完整路径 - 如果这不是您项目的输出,那就是第一个问题。 我建议将新的 .wll 文件复制到 Word 加载 .wll 的位置。
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.