-
Notifications
You must be signed in to change notification settings - Fork 109
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
More CFI stuff #241
More CFI stuff #241
Conversation
It had dang well better be signal safe to reset an initialized context ;)
Previously, we only enabled recovery of the unwinding context when operations would succeed. This commit enables recovery when operations fail as well. Things get a little funky because of the borrow checker, unfortunately.
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.
Approved once the build is working, looks like object crate version problems.
@@ -639,11 +641,15 @@ struct CfiEntryCommon<R: Reader> { | |||
/// end-of-entries sentinel, return `Ok(None)`. Otherwise, return | |||
/// `Ok(Some(tuple))`, where `tuple.0` is the start of the next entry and | |||
/// `tuple.1` is the parsed CFI entry data. | |||
fn parse_cfi_entry_common<Section, R>(input: &mut R) -> Result<Option<CfiEntryCommon<R>>> | |||
fn parse_cfi_entry_common<Section, R>( | |||
section: Section, |
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.
Nit: maybe passing &R
for the section would be better.
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.
By passing Section
, we know its pointing to the start of the whole section, whereas with an &R
, it could be at some offset within the section.
examples/dwarfdump.rs
Outdated
@@ -178,7 +192,7 @@ fn main() { | |||
let file = match object::File::parse(unsafe { file.as_slice() }) { | |||
Ok(file) => file, | |||
Err(err) => { | |||
println!("Failed to parse file '{}': {}", file_path, err); | |||
println!("Failed to parse file '{}': {}", file_path, Error::from(err)); |
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.
Why is this needed?
examples/dwarfdump.rs
Outdated
None => return Ok(()), | ||
Some(gimli::CieOrFde::Cie(cie)) => { | ||
println!(); | ||
// TODO: CIE offset |
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 something different from the offset on the next line?
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.
... no :-P
I just forgot to remove the TODO
examples/dwarfdump.rs
Outdated
@@ -8,6 +8,9 @@ extern crate memmap; | |||
extern crate object; | |||
|
|||
use fallible_iterator::FallibleIterator; | |||
use gimli::UnwindSection; | |||
use object::Object; |
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 deprecated, and object::Error
doesn't exist. Seems like you are using an old object
version? Cargo.toml specifies 0.4.0 though.
I think I must have either been working with an old Cargo.lock and a bug in cargo, or I must have forgotten to pull down new changes or something... |
This does most of the information that the canonical dwarfdump does. Still remaining are things like symbolicating the start addresses in address ranges, turning register numbers into the target architecture's register names, and printing augmentation data. None of this is impossible to implement for any reason right now, I just haven't done it. Fixes half of gimli-rs#116
1aa786b
to
3a01eda
Compare
Going to just go ahead and merge this. OSX backlogs on travis CI are super high again, but 2/3 of them succeeded, so I'm pretty confident the last one will as well. |
See each commit for details.
Holding off on any version bumps until I've verified down that all the APIs I need really are exposed now.