Add debug symbol support for disassembler

This commit is contained in:
2019-04-03 13:22:04 +02:00
parent 4d618efe42
commit 21b6fc4e64
2 changed files with 121 additions and 16 deletions

View File

@@ -45,6 +45,24 @@ impl Block {
self.pointer = location;
Ok(())
}
pub fn read_string(&mut self) -> Result<String> {
let mut bytes = vec![];
loop {
let c = self.get()?;
if c == 0 {
return match String::from_utf8(bytes) {
Ok(string) => Ok(string),
_ => Err("Invalid string in block")
}
}
bytes.push(c);
}
}
}
impl ops::Index<usize> for Block {