These files are related to the symbol and source server.
To test changes to source_index.py you can use the following steps, adjusted to
the specific circumstances:
1) Build some binary, such as base_unittests.exe
2) Optionally modify the script to insert a break after the first
print("Still working, %d / %d files have been processed." since otherwise the
script may take a long time to run.
3) Copy the PDB (must still be in the output directory) to allow repeated
testing without rebuilding.
4) Make sure that you have origin/main checked out when testing because the
current commit hash will be embedded into the PDB and it must be a landed commit
or else the source-code retrieval will not work.
5) Run the script using a command similar to this (the hash at the end will
vary):
vpython3 tools\symsrc\source_index.py out\release\base_unittests.exe.pdb --build-dir=out\release --toolchain-dir=third_party\depot_tools\win_toolchain\vs_files\3bda71a11e
6) Rename the base directory so that the debugger cannot find its source files
so that it is forced to use source indexing.
ren base foo
7) Make sure source-server is enabled in your debugger, and optionally enable
verbose diagnostics. I used Visual Studio.
8) Debug base_unittests.exe. Step in to start debugging. Ideally the
source-server command to be executed will be shown, but that depends on your
debugger settings. A typical command would be:
cmd /c "mkdir "C:\Users\BRUCED~1\AppData\Local\SOURCE~1\base\test\run_all_unittests.cc\91280017b199c3d37c7ef48683cfae9c8371342b" & python3 -c "import urllib.request, base64;url = \"https://chromium.googlesource.com/chromium/src.git/+/91280017b199c3d37c7ef48683cfae9c8371342b/base/test/run_all_unittests.cc?format=TEXT\";u = urllib.request.urlopen(url);open(r\"C:\Users\BRUCED~1\AppData\Local\SOURCE~1\base\test\run_all_unittests.cc\91280017b199c3d37c7ef48683cfae9c8371342b\run_all_unittests.cc\", \"wb\").write(base64.b64decode(u.read()))"
You can manually run this command to confirm that it works.
9) After the debugger runs the source-server command it will have downloaded a
file and will display it. It should be in a path similar to this one:
C:\Users\brucedawson\AppData\Local\SourceServer\base\test\run_all_unittests.cc\91280017b199c3d37c7ef48683cfae9c8371342b\run_all_unittests.cc
10) You can manually inspect the results and look for unexpected changes by
using these commands:
set path=%path%;C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\srcsrv
pdbstr -r -p:out\release\base_unittests.exe.pdb -s:srcsrv >results.txt
In Chrome official builds this script is invoked in the official symbols step by
recipes\recipe_modules\chrome\resources\pdb_processing.py
which calls UpdatePDB. official_utils.py is found in
https://chrome-internal.googlesource.com/chrome/tools/release/scripts
The full path is:
https://chrome-internal.googlesource.com/chrome/tools/release/scripts/+/refs/heads/main/recipes/recipe_modules/chrome/resources/pdb_processing.py