Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add source index to PDBs #1871

Closed
ge0rdi opened this issue Oct 13, 2023 · 6 comments
Closed

Add source index to PDBs #1871

ge0rdi opened this issue Oct 13, 2023 · 6 comments

Comments

@ge0rdi
Copy link
Contributor

ge0rdi commented Oct 13, 2023

Description of the feature, modification, idea or suggestion

It seems that you are finally providing PDBs for SystemInformer builds (at least looking at release assets in si-builds repo). Which is cool and I hope it is intentional 😄

It will be great to have also source index in those PDBs so that debuggers will be able to automatically fetch proper version of source files from github. This makes analysis of crash dumps a lot easier as there is no need to look for proper revision of given file manually.

Here is nice guide that explains how the source index works and how to add it to PDBs:
https://gist.github.com/baldurk/c6feb31b0305125c6d1a#source-indexing

I have some experience with that as I did similar thing (based on that guide) for project I'm maintaining.
So I'd like to help with the implementation in SystemInformer if you are interested in it.

Proposed implementation details (optional)

No response

@MagicAndre1981
Copy link
Contributor

new way is to use sourcelink, which adds a json to the PDB which includes url to the source and debugger can use this url to fetch source files.

@ge0rdi
Copy link
Contributor Author

ge0rdi commented Oct 14, 2023

@MagicAndre1981
Thank you for pointing this out.

Unfortunately, SystemInformer uses deterministic builds where relative source paths are stored in PDB (such as SystemInformer\main.c).
Source Link seems to not support that. It always generates json file with absolute source paths. At least I wasn't able to convince it to do otherwise.
This issue should be related Epic: Deterministic build support.

Though I think we don't even need to use Source Link toolset.
We can just generate simple json file like this at the beginning of build:

{"documents":{"*":https://raw.githubusercontent.com/winsiderss/systeminformer/155715a8ae3f3499f0a3480aa8c6de1c4be85de4/*"}}

And then include it in PDBs using /sourcelink:sourcelink.json linker switch.

This will basically map all local paths (relative to repo root) to actual remote repo paths.
It seems to work nicely (at least in WinDbg).

@MagicAndre1981
Copy link
Contributor

sourcelink works with deterministic builds as it is done with this package for .net libs.

And source link generates this json on its own

@ge0rdi
Copy link
Contributor Author

ge0rdi commented Oct 14, 2023

It still generates json with absolute local paths. But it seems it doesn't matter.
I haven't tested it originally as I thought it cannot match the path if there is absolute path to repo root in json and relative repo paths in PDB. But now I tried and it somehow works 😅

Even with original Using Source Link in C++ projects instructions.

So it should be really just about adding few nuget packages to the projects.
Which is cool.
Thanks again.

@MagicAndre1981
Copy link
Contributor

But now I tried and it somehow works 😅

MS added source link support in VS2017 times to VS and windbg and VS is using source link in "go to definition" to get the source with the help of source link.

So it should be really just about adding few nuget packages to the projects. Which is cool. Thanks again.

yes, great idea and improved debugging of 3rd party libs a lot.

@dmex
Copy link
Member

dmex commented Oct 15, 2023

@ge0rdi

https://www.kenmuse.com/blog/an-intro-to-sourcelink/

@jxy-s jxy-s closed this as completed in 767c3a0 Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants