Skip to content

feat(debuginfo): Extract srcsrv data from PDB for file mapping#943

Open
mujacica wants to merge 36 commits intomasterfrom
feat/perforce-srcsrv-support
Open

feat(debuginfo): Extract srcsrv data from PDB for file mapping#943
mujacica wants to merge 36 commits intomasterfrom
feat/perforce-srcsrv-support

Conversation

@mujacica
Copy link
Copy Markdown
Contributor

No description provided.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Nov 10, 2025

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against c144b3b

Copy link
Copy Markdown
Contributor

@loewenheim loewenheim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The approach of implementing the remapping as a transformer is fundamentally sound, but I believe the better approach is to integrate it into PdbDebugSession directly. This is for a few reasons:

  1. The transformer machinery is used in Symbolicator to incorporate information from supplementary files (BCSymbolMaps, il2cpp mapping files) into a symcache. These files are separate from the object file being converted to a symcache. By contrast, in this case, the information is already present in the object file itself.
  2. Symbolicator doesn't know about different object file types—it relies on symbolic to convert any object file into a symcache. This information is available to Symbolicator in principle, i.e. it could pattern match on what kind of object file it's dealing with and extract the source server information from PDB objects.

Comment thread symbolic-debuginfo/src/pdb.rs Outdated
Comment thread symbolic-debuginfo/src/pdb.rs Outdated
Comment thread symbolic-debuginfo/src/pdb.rs Outdated
Comment thread symbolic-debuginfo/src/pdb.rs Outdated
Comment thread symbolic-debuginfo/src/pdb.rs Outdated
Comment thread symbolic-debuginfo/src/pdb.rs Outdated
Comment thread symbolic-debuginfo/src/pdb/mod.rs
@mujacica mujacica force-pushed the feat/perforce-srcsrv-support branch from 2bc5c37 to 3a14467 Compare November 18, 2025 11:33
@mujacica mujacica force-pushed the feat/perforce-srcsrv-support branch from 3a14467 to a5afa5e Compare December 9, 2025 15:00
Comment thread symbolic-symcache/src/lib.rs
Comment thread symbolic-debuginfo/src/pdb.rs Outdated
Comment on lines +124 to +125
let depot_path = var_map.get("var3")?;
let changelist = var_map.get("var4").map(String::as_str);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my only feedback here is that if its expected that the layout uses very specific variables to house the path & revision information, you'll want to likely validate that the revision (changelist here, but I know this means revision) is a valid number (if that positional value exists). Our current layout has these at position 2 & 3 respectively, which means older pdbs from builds before we switch this position will try to map the path as the revision.

Please clearly document this layout:
<Absolute Path>*<User Data, likely Perforce server name>*<Depot Path>*<File Revision>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @BillFreist-ANET , I've now documented this in the code itself. More user-facing documentation to follow.

Comment thread symbolic-symcache/src/v8/mod.rs Outdated
Forgot do do this in the merge commit.
Comment thread symbolic-debuginfo/src/pdb.rs Outdated
Comment thread symbolic-debuginfo/src/pdb/mod.rs
Comment thread symbolic-debuginfo/src/pdb/srcsrv.rs Outdated
Comment thread symbolic-debuginfo/src/pdb/mod.rs Outdated
Comment thread symbolic-debuginfo/src/pdb/srcsrv.rs
Comment thread symbolic-symcache/src/lookup.rs Outdated
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 3 total unresolved issues (including 2 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit bcc01e1. Configure here.

Comment thread symbolic-symcache/src/lookup.rs
Comment on lines -255 to -279
/// Returns the SRCSRV VCS integration name if available.
///
/// This extracts the version control system identifier from the SRCSRV stream,
/// if present. Common values include "perforce", "tfs", "git", etc.
/// Returns `None` if no SRCSRV stream exists or if it cannot be parsed.
pub fn srcsrv_vcs_name(&self) -> Option<String> {
let mut pdb = self.pdb.write();

// Try to open the "srcsrv" named stream
let stream = match pdb.named_stream(b"srcsrv") {
Ok(stream) => stream,
Err(_) => return None,
};

// Parse the stream to extract VCS name
let stream_data = stream.as_slice();
if let Ok(parsed_stream) = srcsrv::SrcSrvStream::parse(stream_data) {
parsed_stream
.version_control_description()
.map(|s| s.to_string())
} else {
None
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding this function in the first place was probably a mistake. It parses a SrcSrvStream, which constructs various indices and maps. That's really more appropriate for a function on the debug session.

Since the symcache version bump causes a major release anyway, we can remove it.

Comment thread symbolic-debuginfo/src/pdb/mod.rs Outdated
.srcsrv
.as_deref()
.map(SourceServerMappings::parse)
.transpose()?;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The clankers are correct in that we could be more lenient here and not abort the entire debug_session if parsing the srcsrv stream fails since it's not essential. Any opinions on this?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels very much optional, but it would also be nice if errors would be visible to the caller. Is it an option to parse it lazily instead of the constructor and propagate an error on use that is not fatal?

Overall I'd more lean towards swallowing the error, we wouldn't want PDBs with srcsrv information we just don't understand to fail, I think.

@loewenheim loewenheim force-pushed the feat/perforce-srcsrv-support branch from 5b93649 to 4ef2e49 Compare April 15, 2026 15:18
Comment thread symbolic-debuginfo/src/pdb/mod.rs Outdated
Comment thread symbolic-debuginfo/src/pdb/mod.rs Outdated
.srcsrv
.as_deref()
.map(SourceServerMappings::parse)
.transpose()?;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels very much optional, but it would also be nice if errors would be visible to the caller. Is it an option to parse it lazily instead of the constructor and propagate an error on use that is not fatal?

Overall I'd more lean towards swallowing the error, we wouldn't want PDBs with srcsrv information we just don't understand to fail, I think.

Comment thread symbolic-debuginfo/src/pdb/mod.rs Outdated
Comment thread symbolic-debuginfo/src/pdb/mod.rs Outdated
Comment thread symbolic-debuginfo/src/pdb/srcsrv.rs Outdated
Comment thread symbolic-debuginfo/tests/test_pdb_srcsrv.rs Outdated
Comment thread symbolic-symcache/src/transform/mod.rs Outdated
Comment thread symbolic-symcache/src/lookup.rs Outdated
Comment thread symbolic-symcache/src/v9/lookup.rs
Comment thread symbolic-symcache/tests/test_cache.rs
Copy link
Copy Markdown
Member

@Dav1dde Dav1dde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for cleaning up the tests, I find it important that tests are written well, they do act as a bit of documentation and are there to help us in the future preventing regressions.

At the same time I really don't wanna be annoying about it, symbolic-symcache/tests/test_cache.rs could also use a pass, but it's also nbd to do this later/not at all.

Comment thread symbolic-debuginfo/src/pdb/mod.rs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants