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
feat: Access embedded PortablePDB in DLL #752
Conversation
The metadata buffer is in ECMA 335 format and should contain one module record with a Module Version ID that we are ultimately interested in.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #752 +/- ##
==========================================
+ Coverage 73.82% 73.88% +0.05%
==========================================
Files 69 69
Lines 14884 14951 +67
==========================================
+ Hits 10988 11046 +58
- Misses 3896 3905 +9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome work! Reminds me that I have m4b/goblin#319 just laying there since half a year :-D
As for the Symbolicator integration, I believe there are two ways to approach this.
Given that we (at this time) are not using the outer PE for anything, I would recommend to just go with 1 and unpack directly when downloading. |
I was thinking of a combination of both. The first point for actual symbolication, and the second one (or just a part of it) to display the correct information in the UI (that it has sources). On the other hand, doing an unpack just to check whether there are sources doesn't sound like a great idea and maybe we should skip that for now... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
almost there :-)
let mut signature: [u8; 4] = [0; 4]; | ||
self.data | ||
.gread_inout(&mut offset, &mut signature) | ||
.map_err(PeError::new)?; | ||
if signature != "MPDB".as_bytes() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let mut signature: [u8; 4] = [0; 4]; | |
self.data | |
.gread_inout(&mut offset, &mut signature) | |
.map_err(PeError::new)?; | |
if signature != "MPDB".as_bytes() { | |
let signature: [u8; 4] = self.data | |
.gread(&mut offset) | |
.map_err(PeError::new)?; | |
if signature != b"MPDB" { |
First time I saw gread_inout
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not the same thing - gread
doesn't work with slices
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error[E0277]: the trait bound `[u8; 4]: TryFromCtx<'_, _>` is not satisfied
--> symbolic-debuginfo\src\pe.rs:313:42
|
313 | let signature: [u8; 4] = self.data.gread(&mut offset).map_err(PeError::new)?;
| ^^^^^^^^^ ----- required by a bound introduced by this call
| |
| the trait `TryFromCtx<'_, _>` is not implemented for `[u8; 4]`
|
= help: the trait `TryFromCtx<'a, usize>` is implemented for `&'a [u8]`
note: required by a bound in `gread`
--> C:\Users\dlugo\.cargo\registry\src\github.com-1ecc6299db9ec823\scroll-0.11.0\src\pread.rs:88:21
|
88 | fn gread<'a, N: TryFromCtx<'a, Ctx, Self, Error = E>>(
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `gread`
```
replaces & closes #659
PE (a.k.a a .dll) may contain embedded Portable PDB (when built with
<DebugType>embedded</DebugType>
) as shown in the following screenshot from dotPeekWe need to access that but it seems it's currently impossible with the used PE reader, see the tracking issue: m4b/goblin#314