1
0
Fork 0
forked from koniifer/ableos

disasm now displays literal string value

This commit is contained in:
mlokr 2024-09-04 18:38:32 +02:00
parent 1a162af06b
commit 69f362b53d

View file

@ -8,7 +8,7 @@ use {
parser::{self, find_symbol, idfl, CtorField, Expr, ExprRef, FileId, Pos},
HashMap,
},
std::{fmt::Display, ops::Range, rc::Rc},
std::{fmt::Display, ops::Range, rc::Rc, usize},
};
type Offset = u32;
@ -3275,12 +3275,19 @@ impl Codegen {
)
}),
)
.chain(
self.output
.strings
.iter()
.map(|s| (s.range.start, ("string", s.range.len() as _, DisasmItem::Global))),
.chain(self.output.strings.iter().map(|s| {
(
s.range.start,
(
std::str::from_utf8(
&self.output.code[s.range.start as usize..s.range.end as usize - 1],
)
.unwrap_or("!!!!invalid string"),
s.range.len() as _,
DisasmItem::Global,
),
)
}))
.collect::<HashMap<_, _>>();
crate::disasm(&mut sluce, &functions, output, |bin| {
if self.ct.active()