Add debug symbol support for disassembler
This commit is contained in:
18
src/block.rs
18
src/block.rs
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user