Skip to content

Commit

Permalink
Merge pull request gimli-rs#69 from gsolberg/DWARF-in-PE
Browse files Browse the repository at this point in the history
Issue gimli-rs#40 -- Support DWARF-in-PE
  • Loading branch information
philipc authored Oct 24, 2018
2 parents 939407f + 2808462 commit c93f6c2
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/pe.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use alloc::borrow::Cow;
use alloc::vec::Vec;
use std::cmp;
use std::slice;

use goblin::pe;
Expand Down Expand Up @@ -112,7 +113,7 @@ where
if name == section_name {
return Some(Cow::from(
&self.data[section.pointer_to_raw_data as usize..]
[..section.size_of_raw_data as usize],
[..cmp::min(section.virtual_size, section.size_of_raw_data) as usize]
));
}
}
Expand Down Expand Up @@ -156,10 +157,15 @@ where
true
}

#[inline]
fn has_debug_symbols(&self) -> bool {
// TODO: look at what the mingw toolchain does with DWARF-in-PE, and also
// whether CodeView-in-PE still works?
// TODO: check if CodeView-in-PE still works
for section in &self.pe.sections {
if let Ok(name) = section.name() {
if name == ".debug_info" {
return true;
}
}
}
false
}

Expand Down

0 comments on commit c93f6c2

Please sign in to comment.