-
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
Add the ability to dump specific DIEs with --debug-info=0xdeadbeef. #564
base: master
Are you sure you want to change the base?
Conversation
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.
Can you please rebase to get CI passing.
@@ -386,7 +387,12 @@ fn main() { | |||
"print .eh-frame exception handling frame information", | |||
); | |||
opts.optflag("G", "", "show global die offsets"); | |||
opts.optflag("i", "", "print .debug_info and .debug_types sections"); | |||
opts.optflagopt( |
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.
I don't think optflagopt
is a good choice. Previously you could do dwarfdump -i filename
but now that doesn't work.
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.
So what should we do instead?
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.
dwarfdump -i -- filename
works but yeah that's not ideal.
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.
How about -o
/--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.
I guess we could do that, though the reason I chose this was to match llvm-dwarfdump
.
Maybe we should switch to structopt
instead. I think it can be made to do the right thing here.
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.
Ah okay, yeah matching llvm-dwarfdump
would be good (llvm-dwarfdump --help
didn't show that option). If you want, can leave this how it is and switch later.
let mut entries = unit.entries(); | ||
while let Some((delta_depth, entry)) = entries.next_dfs()? { | ||
depth += delta_depth; | ||
if let Some(o) = flags.info_offset { | ||
if o == entry.offset().to_debug_info_offset(&unit.header).unwrap() { |
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 will panic if there is a .debug_types
section.
@@ -427,6 +433,24 @@ fn main() { | |||
} | |||
if matches.opt_present("i") { | |||
flags.info = true; | |||
if let Some(offset) = matches.opt_str("i") { | |||
let offset = match offset | |||
.get(2..) |
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.
Would be nice if the 0x
was optional.
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.
My primary concern was that we were skipping the first two characters without checking what they were. llvm-dwarfdump
treats it as decimal if 0x
is missing, so I guess we need to match that, or give an error.
Some(offset) => offset, | ||
None => { | ||
writeln!( | ||
&mut io::stderr(), |
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.
Use eprintln!
(and there's an existing call that could be changed too).
No description provided.