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

时间:2022-06-05 23:18:43

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).

我找不到在静态库项目中使用Debugging Tools for Windows的源服务器工具的方法,该项目是与实际使用该库的解决方案分开构建的:“ssindex.cmd”的输出始终显示“零源”找到“为库生成的PDB文件的文件(使用编译器选项/ ZI和/ 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.

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

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!

谢谢你的任何建议!

3 个解决方案

#1


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.

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

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),

索引库解决方案时,指定“/ Save”标志,其中包含一个目录,用于存储有关库源文件的索引信息。例如(假设您使用Subversion进行源代码管理),

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,

稍后索引包含库的项目时,可以使用包含库的源文件信息的目录指定“/ Load”标志。例如,

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.

有两个潜在的问题可能会影响您使用此技术的能力。首先,似乎某些源控制提供程序可能不支持保存和加载源控制信息。我知道Subversion提供程序确实如此,它看起来像SourceSafe提供程序,但我还没有检查任何其他提供程序。

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.

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

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.

另外,请注意,如上所述,如果您的库是作为单独解决方案的一部分构建的,则只需执行此操作。如果静态库是要编制索引的解决方案的一部分,则如果它们位于“/ Source”选项指定的路径中,则将包含其源文件。

#2


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!

这可能意味着你在运行“ssindex”时没有输入正确的目录,所以对于你需要的ssindex:/ source = C:/ SourceCode / / symbols = C:/ SourceCode / bin / Debug我不确定是否“来源”有一个大写字母S或不是,但应该是它!

#3


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

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

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

经过svn.pm的痛苦挖掘(用于处理svn的perl模块)后,我发现:

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

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

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

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

  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

    svnindex.cmd调用srctool -r获取* .pdb中的所有源文件信息,并使用源文件名作为查询在步骤2中保存的信息的键

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"

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

fixup:

change svn.pm line 162:

更改svn.pm第162行:

$LocalFile = lc $1;

$ LocalFile = lc $ 1;

to   

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

$ LocalFile = $ SourceRoot。 “\”。 lc $ 1; #make path absolute

#1


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.

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

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),

索引库解决方案时,指定“/ Save”标志,其中包含一个目录,用于存储有关库源文件的索引信息。例如(假设您使用Subversion进行源代码管理),

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,

稍后索引包含库的项目时,可以使用包含库的源文件信息的目录指定“/ Load”标志。例如,

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.

有两个潜在的问题可能会影响您使用此技术的能力。首先,似乎某些源控制提供程序可能不支持保存和加载源控制信息。我知道Subversion提供程序确实如此,它看起来像SourceSafe提供程序,但我还没有检查任何其他提供程序。

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.

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

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.

另外,请注意,如上所述,如果您的库是作为单独解决方案的一部分构建的,则只需执行此操作。如果静态库是要编制索引的解决方案的一部分,则如果它们位于“/ Source”选项指定的路径中,则将包含其源文件。

#2


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!

这可能意味着你在运行“ssindex”时没有输入正确的目录,所以对于你需要的ssindex:/ source = C:/ SourceCode / / symbols = C:/ SourceCode / bin / Debug我不确定是否“来源”有一个大写字母S或不是,但应该是它!

#3


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

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

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

经过svn.pm的痛苦挖掘(用于处理svn的perl模块)后,我发现:

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

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

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

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

  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

    svnindex.cmd调用srctool -r获取* .pdb中的所有源文件信息,并使用源文件名作为查询在步骤2中保存的信息的键

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"

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

fixup:

change svn.pm line 162:

更改svn.pm第162行:

$LocalFile = lc $1;

$ LocalFile = lc $ 1;

to   

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

$ LocalFile = $ SourceRoot。 “\”。 lc $ 1; #make path absolute