在 Visual C 中查找源文件的预设位置; 6.0

发布于 2024-07-05 17:52:22 字数 253 浏览 11 评论 0原文

由于我们的一些代码是遗留的,我们仍在使用 Microsoft Visual 6.0 (SP6)。 当我第一次附加到正在运行的进程来调试它时,它不知道我闯入该进程时源文件所在的位置。 因此,它要求我在给定源文件名的情况下导航到源树中的适当目录。 它会记住这些目录,因此我不必两次输入同一个目录,但这仍然很痛苦。

有没有办法用我的树中的所有源文件目录预先配置 VC6? 请注意,我们的项目是使用 makefile(使用 nmake)构建的,而不是通过 DSP。

Due to the legacy nature of some of our code, we're still using Microsoft Visual 6.0 (SP6). When I attach to a running process to debug it for the first time, it has no knowledge of where the source files are located when I break into the process. It therefore asks me to navigate to the appropriate directory in my source tree, given a source file name. It remembers these directories, so I don't have to enter the same directory twice, but it's still painful.

Is there a way of pre-configuring VC6 with all the source file directories in my tree? Note that our project is built using makefiles (using nmake), rather than via DSPs.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

人生百味 2024-07-12 17:52:22

源文件的路径记录在调试信息(程序数据库,.pdb)中。 使您机器上的构建树与其构建所在的机器相同。

The paths to the source files are recorded in the debugging information (Program Database, .pdb). Make the build tree on your machine the same as the machine it was built on.

茶花眉 2024-07-12 17:52:22

是的。

进入

工具

选项

目录(选项卡)

并且您可以设置 SOURCES/LIBRARIES/INCLUDE 目录位置。 这些值适用于工作区中的所有项目。

我不知道设置这些值是否允许使用直接 makefile 来查看信息。

Yes.

go into


TOOLS

OPTIONS

DIRECTORY (tab)


and you can set the SOURCES/LIBRARIES/INCLUDE directory locations. These values apply to all projects within the workspace.

I do not know if setting those values will allow the information to be seen using direct makefiles.

灵芸 2024-07-12 17:52:22

绝对路径信息不会记录在我们的 PDB 文件中,因为我们故意不希望将源代码树绑定到特定的顶级目录; 部署时,无法将源代码树放置在与构建机器上使用的位置相同的位置。

EvilTeach解决方案肯定能达到预期的效果,尽管我们的源代码树实际上由数百个目录组成,这使得手动输入它们有些麻烦。 还有一个问题是,开发人员可能在任何给定时间都有多个源代码树运行,因此在调试给定的可执行文件时能够在这些树之间切换是至关重要的。

我随后发现您可以通过直接更新注册表以编程方式(嗯,至少从命令行)切换一组源目录:

REGEDIT4

[HKEY_CURRENT_USER\Software\Microsoft\Devstudio\6.0\Build
System\Components\Platforms\Win32 (x86)\Directories]
"Source Dirs"="<path1>;<path2>"

这还不错,而且肯定会成功。

但是,我选择的解决方案是将 SOURCE 环境变量设置为包含所有源路径(作为以分号分隔的目录列表)。 一个非常简单的批处理文件就可以做到这一点,并允许在不同的树之间切换。 然后,从命令行运行 Visual C++,使用选项告诉它从环境中读取 SOURCE(以及 INCLUDE、LIB 和 PATH):

msdev /useenv

在 Tools->Options 下查看,您将看到 SOURCE 中的目录具有确实已经加载了。 然后,我能够附加到正在运行的进程,并且调试器能够找到我调试到的任何代码。

生活变得如此轻松!

Absolute path information is not recorded in our PDBs files, since we are deliberately not wanting to tie our source tree to a particular top-level directory; when it is deployed, it is not possible to drop the source tree in the same position as was used on the build machine.

EvilTeach's solution certainly gives the desired effect, though our source tree consists of literally hundreds of directories, making entering them manually somewhat cumbersome. There's also the problem that a developer may have multiple source trees that they're running from at any given time, so being able to switch between those trees when debugging a given executable is essential.

I subsequently found that you can programmatically (well, at least from the command line) switch a set of source directories by directly updating the registry:

REGEDIT4

[HKEY_CURRENT_USER\Software\Microsoft\Devstudio\6.0\Build
System\Components\Platforms\Win32 (x86)\Directories]
"Source Dirs"="<path1>;<path2>"

That's not too bad, and would certainly do the trick.

However, the solution I settled upon was setting the SOURCE environment variable to contain all the source paths (as a semicolon-separated list of directories). A very simple batch file could do this, and allow switching between different trees. Then, you run up Visual C++ from the command line, using the option telling it from read SOURCE (and INCLUDE, LIB and PATH) from the environment:

msdev /useenv

Looking under Tools->Options, you'll see that the directories from SOURCE have indeed been loaded. I was then able to attach to a running process, and the debugger was able to locate any code that I debugged into.

Life just got that much easier!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文