Integrate all the progress into master #6
|
@ -26,12 +26,28 @@ pub fn scan<F: FnMut() -> Option<String>>(mut next_line: F) -> Result<MemoryMap,
|
|||
}
|
||||
}
|
||||
|
||||
// Print them off for now!
|
||||
println!("Name: <Global> ({})", memory_map.global.len());
|
||||
for section in memory_map.sections {
|
||||
println!("Name: {} ({})", section.name, section.symbols.len());
|
||||
sort_memory_map(&mut memory_map);
|
||||
Ok(memory_map)
|
||||
}
|
||||
|
||||
fn sort_memory_map(memory_map: &mut MemoryMap) {
|
||||
fn sort_symbol_vec(symbol_vec: &mut Vec<Symbol>) {
|
||||
symbol_vec.sort_by(|a, b| {
|
||||
a.adr.cmp(&b.adr)
|
||||
});
|
||||
}
|
||||
|
||||
fn sort_section_vec(section_vec: &mut Vec<Section>) {
|
||||
section_vec.sort_by(|a, b| {
|
||||
a.adr.cmp(&b.adr)
|
||||
});
|
||||
}
|
||||
|
||||
sort_section_vec(&mut memory_map.sections);
|
||||
sort_symbol_vec(&mut memory_map.global);
|
||||
for section in &mut memory_map.sections {
|
||||
sort_symbol_vec(&mut section.symbols);
|
||||
}
|
||||
Err(Error::from_str("Symbols should be sorted by address now - not implemented yet"))
|
||||
}
|
||||
|
||||
fn scan_symbols<F: FnMut() -> Option<String>>(next_line: &mut F, memory_map: &mut MemoryMap) -> Result<String, Error> {
|
||||
|
|
Loading…
Reference in New Issue