From 2ab4e8b155339a7d8bb9bf9e3e6c17be95307605 Mon Sep 17 00:00:00 2001 From: Jaby Date: Mon, 17 Jul 2023 18:41:15 +0200 Subject: [PATCH] Scan and print sections - prepare for SymbolTable --- src/Tools/readmap/src/lib.rs | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/src/Tools/readmap/src/lib.rs b/src/Tools/readmap/src/lib.rs index 543bd42a..932a58d9 100644 --- a/src/Tools/readmap/src/lib.rs +++ b/src/Tools/readmap/src/lib.rs @@ -7,17 +7,32 @@ pub fn scan Option>(mut next_line: F) -> Result Option>(next_line: &mut F) -> Result, Error> { +fn scan_sections Option>(next_line: &mut F, sections: &mut Vec
) -> Result { while let Some(_) = next_line() { // We read every other line let line = next_line().ok_or(Error::from_str("Failed skipping section line"))?; @@ -27,15 +42,15 @@ fn scan_sections Option>(next_line: &mut F) -> Result 0x{:X}", name, adr, (adr + size)); + sections.push(Section::new(name.to_string(), adr, size as usize)); } else { - return Err(Error::from_str("")); + return Ok(line); } } - Err(Error::not_implemented("scan")) + Err(Error::not_implemented("Failed obtaining complete section")) } fn split_line_radix<'a>(split_line: &mut std::str::SplitWhitespace<'a>, radix: u32, value_name: &str) -> Result {