源服务器(Windows 调试工具)可以与静态库项目一起使用吗?

发布于 2024-07-29 20:43:29 字数 349 浏览 11 评论 0原文

我找不到在静态库项目上使用 Windows 调试工具中的源服务器工具的方法, 它与实际使用该库的解决方案分开构建: 对于为库生成的 PDB 文件,“ssindex.cmd”的输出始终显示“找到零个源文件” (使用编译器选项 /ZI 和 /Fd)。

在此 PDB 上运行“srctool.exe -r”不会显示任何内容,这可能意味着 PDB 文件不包含任何源文件信息。 在测试应用程序的 PDB 文件上运行相同的命令,该应用程序也是作为同一解决方案的一部分构建的 生成所有预期源文件的列表。

当静态库项目应该与使用它的解决方案分开构建时,有没有办法对静态库项目使用源索引?

感谢您的任何建议!

I can't find a way to use the source server tools from the Debugging Tools for Windows on a static library project,
which is built separately from the solutions actually using that library:
The output of "ssindex.cmd" always displays "zero source files found" for the PDB file generated for the library
(using compiler options /ZI and /Fd).

Running "srctool.exe -r" on this PDB displays nothing, which probably means that the PDB file does not contain any source file information.
Running the same command on the PDB file of a test application which is also build as part of the the same solution
yields a list of all expected source files.

Is there a way to use source indexing for a static library project when it should be built seperately from the solutions using it?

Thanks for any suggestions!

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

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

发布评论

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

评论(3

带上头具痛哭 2024-08-05 20:43:29

您可以使用“/Save”和“/Load”选项分别存储和加载静态库的源信息。 使用这些选项允许您存储库的信息,然后在索引链接到您的库的项目时导入它。

为库解决方案建立索引时,您可以指定“/Save”标志以及用于存储有关库源文件的索引信息的目录。 例如(假设您使用 Subversion 进行源代码控制),

ssindex.cmd /System=SVN /Save=c:\source\libproj\srcinfo /Source=c:\source\libproj /Symbols=c:\source\libproj\Release\*.pdb 

当稍后对包含库的项目进行索引时,您可以指定“/Load”标志以及包含库的源文件信息的目录。 例如,

ssindex.cmd /System=SVN /Load=c:\source\libproj\srcinfo /Source=c:\source\binproj /Symbols=c:\source\binproj\Release\*.pdb 

有两个潜在问题可能会影响您使用此技术的能力。 首先,某些源代码控制提供程序可能不支持保存和加载源代码控制信息。 我知道 Subversion 提供程序可以这样做,而且看起来 SourceSafe 提供程序也可以这样做,但我还没有检查过任何其他提供程序。

其次,这种技术似乎只适用于一个开箱即用的外部静态库。 似乎没有办法从多个目录加载信息,并且当前每次使用“/Save”选项时脚本都会覆盖目录的内容。 您可能可以编辑源代码控制提供程序模块以附加到保存目录中的文件而不是覆盖它们,但我还没有尝试过。

另请注意,正如您上面提到的,仅当您的库是作为单独解决方案的一部分构建时才需要执行此操作。 如果静态库是您正在索引的解决方案的一部分,并且其源文件位于“/Source”选项指定的路径中,则将包含它们。

You can use the "/Save" and "/Load" options to store and load source information for a static library, respectively. Using these options allows you to store information for your library and then later import it when indexing a project that links against your library.

When indexing your library solution, you specify the "/Save" flag with a directory in which to store index information about the library's source files. For example (assuming you are using Subversion for source control),

ssindex.cmd /System=SVN /Save=c:\source\libproj\srcinfo /Source=c:\source\libproj /Symbols=c:\source\libproj\Release\*.pdb 

When later indexing your project that includes your library, you specify the "/Load" flag with the directory containing the library's source file information. For example,

ssindex.cmd /System=SVN /Load=c:\source\libproj\srcinfo /Source=c:\source\binproj /Symbols=c:\source\binproj\Release\*.pdb 

There are two potential issues that may affect your ability to use this technique. First, it appears that some source control providers may not support saving and loading source control information. I know that the Subversion provider does and it looks like the SourceSafe provider does, but I haven't checked any others.

Second, this technique appears to only work for one external static library out-of-the-box. There does not seem to be a way to load information from multiple directories and the scripts currently overwrite the contents of the directory each time you use the "/Save" option. You could probably edit the source control provider module to append to the files in the save directory rather than overwrite them, but I have not tried it.

Also, note as you mentioned above that you only need to do this if your library is being built as part of a separate solution. If the static library is part of the solution you are indexing, its source files will be included if they are in the path specified by the "/Source" option.

指尖微凉心微凉 2024-08-05 20:43:29

这可能意味着您在运行“ssindex”时没有输入正确的目录,因此对于 ssindex 您需要: /source=C:/SourceCode/ /symbols=C:/SourceCode/bin/Debug 我不确定是否“source”有没有大写的S,但应该是这样!

It probably means you haven't inputed the correct directories when running "ssindex" so for ssindex you need to have: /source=C:/SourceCode/ /symbols=C:/SourceCode/bin/Debug I'm not sure if the "source" has an upper case S or not but that should be it!

梦里人 2024-08-05 20:43:29

当运行 svnindex.cmd 时,它总是告诉你“找到零源文件”,

在痛苦地深入研究 svn.pm (处理 svn 的 Perl 模块)之后,我发现:

  1. 首先,svn.pm 调用“svn info” -R $SourceRoot" 获取 $SourceRoot 中文件的所有版本信息(由 /source 选项传递),

  2. 然后 svn.pm 将所有文件存储在使用本地文件路径作为键的字典中

  3. svnindex.cmd 调用 srctool -r 获取*.pdb中所有源文件信息,并以源文件名作为 key 查询step2中保存的信息

问题是:

svn.pm使用相对路径,而*.pdb使用绝对路径,所以永远找不到任何文件的 svn 日志信息,然后“找到零源文件”

修复:

更改 svn.pm 第 162 行:

$LocalFile = lc $1;

$LocalFile = $SourceRoot 。 “\”。 信用证 1 美元; #使路径绝对

when run svnindex.cmd, it always tell you "zero source files found"

after a painful diggin into svn.pm (the perl module to deal with svn), i found that:

  1. first, svn.pm invokes "svn info -R $SourceRoot" to get all version info of files in $SourceRoot (passed by /source option),

  2. then svn.pm stores all files in a dictionary which using the local file path as key

  3. svnindex.cmd call srctool -r to get all source files info in *.pdb, and use the source file name as a key to query info saved in step2

the problem is:

svn.pm uses relative path, but *.pdb uses absolute path, so you will never find a svn log info for any file, then "zero source files found"

fixup:

change svn.pm line 162:

$LocalFile = lc $1;

to   

$LocalFile = $SourceRoot . "\" . lc $1; #make path absolute

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