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

get_sourceLink appears to need the same optional bindings as get_checksum #22

Closed
JeromySt opened this issue Apr 4, 2024 · 6 comments · Fixed by #23
Closed

get_sourceLink appears to need the same optional bindings as get_checksum #22

JeromySt opened this issue Apr 4, 2024 · 6 comments · Fixed by #23

Comments

@JeromySt
Copy link

JeromySt commented Apr 4, 2024

Thank you for your help as I stumble through some fun projects using .pdb's.

I've come to ask for some assistance with get_sourceLink. Since this method also needs to be called twice, once to get the length to allocate, then again to get the contents I wanted to see if the same fix applied for get_checksum is applicable here.

The second question is that I just don't see which symbol to actually call get_sourceLink on. My understanding was the sourceLink is an entire table of json formatted information and I could use a bit of hand-holding if you folks have the time on the proper way to invoke this to extract the information.

Thank you very much in advance. This is the last piece of my PDB puzzle.

  • Jeromy
@riverar
Copy link
Collaborator

riverar commented Apr 4, 2024

I wanted to see if the same fix applied for get_checksum is applicable here.

Yep, appears so!

The second question is that I just don't see which symbol to actually call get_sourceLink on.

It's hanging off IDiaSymbol10, which you need to QI for.

Example:

// ...
let symbol: IDiaSymbol10 = symbol.cast()?;
symbol.get_sourceLink(...)?;

@riverar
Copy link
Collaborator

riverar commented Apr 5, 2024

Heads up, DIA SDK public API doesn't provide IDiaSession13 and possibly other requisite types needed for a complete source link solution. You'll probably have to shell out to C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\srcsrv\pdbstr.exe to retrieve that information.

Also be sure to upvote https://developercommunity.visualstudio.com/t/Is-there-an-API-for-reading-Source-Link-/1468642.

@JeromySt
Copy link
Author

JeromySt commented Apr 8, 2024

Heads up, DIA SDK public API doesn't provide IDiaSession13 and possibly other requisite types needed for a complete source link solution. You'll probably have to shell out to C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\srcsrv\pdbstr.exe to retrieve that information.

Also be sure to upvote https://developercommunity.visualstudio.com/t/Is-there-an-API-for-reading-Source-Link-/1468642.

Would it be possible to expose these com api’s as well as a crate?
https://github.com/dotnet/symreader/blob/main/src/Microsoft.DiaSymReader/Reader/ISymUnmanagedReader4.cs

  • Jeromy

@kennykerr
Copy link
Collaborator

This project is just a sample to show how such Rust bindings can be generated from metadata. Let's not feature creep this into something else. 😀 Our best bet is to get the DIA folks to update their SDK.

@JeromySt
Copy link
Author

JeromySt commented Apr 9, 2024

Totally understandable. I wasn’t asking to scope creep this crate. I was asking potentially if a new crate for that other com interface could be auto-generated using similar methods.

Alternatively, if there is a guide on how to generate these, I would be more than happy to create one myself.

@riverar
Copy link
Collaborator

riverar commented Apr 9, 2024

Here's a guide that walks through generating this very crate: https://withinrafael.com/2023/01/18/generating-metadata-for-the-windows-crate/

But this won't help you with Microsoft.DiaSymReader. It appears that team is focused squarely on .NET-only bindings; I can't find any C++ headers, libs, or IDL. It's a feasible project, but will require some extra work to deal with this. Still thinking through it.

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 a pull request may close this issue.

3 participants