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
much improved debug output of BootInformation + enum TagType #76
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.
Just a few thoughts to start; I think this is probably an improvement. I'm away for the weekend but am happy to review after I get back.
src/lib.rs
Outdated
area.size() | ||
)?; | ||
} | ||
for _t in self.module_tags() { |
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.
module_tags
returns an ~impl Iterator
so this could just be self.module_tags().count
I think
src/lib.rs
Outdated
s.size(), | ||
s.flags().bits() | ||
)?; | ||
for _s in elf_sections_tag.sections() { |
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.
Same use of count
could be here I think
src/lib.rs
Outdated
.field("memory_areas", &self.memory_map_tag()) | ||
// so far, I didn't found a nice way to connect the iterator with ".field()" because | ||
// the iterator isn't Debug | ||
.field("module_tags (count)", &self.module_tags().count()) |
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 would prefer an implementation of Debug for the iterator if possible. In my experience, having module tags printed helps debugging. Also, you could try mapping over the iterator to Debug each element?
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 absolutely agree with you. The behaviour should be equal to Vec::iter()
which also prints all elements when debug-formatted. But with the current implementation of the ModuleIter
I can't achieve this because of different compile time errors, like lifetime and ownership problems :/
Hi @IsaacWoods @Caduser2020 I tried it to solve it like this: impl <'a> Debug for ModuleIter<'a> {
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
let mut list = f.debug_list();
self.iter.for_each(|ref e| {
list.entry(e);
});
list.finish()
}
} but this results in compile errors...
|
Hmm, could you use impl <'a> Debug for ModuleIter<'a> {
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
let mut list = f.debug_list();
self.iter.by_ref().for_each(|ref e| {
list.entry(e);
});
list.finish()
}
} |
Nope, |
Might as well take the easy way out and |
Yes it worked with Example debug output:
|
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.
Thanks for working on this - great changes overall I think, and I like the explicit enum for tag types. Just a few straggling changes left.
As one last suggestion, before we merge, it might be nice to squash into fewer commits that collect changes to specific areas together. Are you comfortable performing an interactive rebase or would you prefer me to do this?
No problem, I'm well familiar with this. I adjusted everything. Hope I didn't miss anything. @IsaacWoods |
Great - thanks @phip1611 for this work! I'll merge this and get it published when I get the chance. |
The current debug output of the BootInformation-struct is not optimal. It isn't nicely formatted (no spaces), doesn't include all relevant fields (like UEFI system table tag) and it outputs all ELF-sections, which can be pretty fast thousands of lines with pretty much useless output.
What do you think about my improvement?
POC with my multiboot2 Rust kernel in QEMU: