add more debug info in error
This commit is contained in:
parent
d906c4d3d2
commit
e2dc3381b6
2 changed files with 14 additions and 4 deletions
|
|
@ -504,7 +504,7 @@ impl DexWriter {
|
|||
}
|
||||
Instruction::Goto { label } => {
|
||||
let (min_addr, max_addr) = label_min_max_addrs.get(label).ok_or(anyhow!(
|
||||
"Label {label} not found in label estimation map, known labels are {}",
|
||||
"Label {label} not found in label estimation map, known labels are [{}]",
|
||||
label_min_max_addrs
|
||||
.keys()
|
||||
.map(|string| string.as_str())
|
||||
|
|
@ -825,7 +825,7 @@ impl DexWriter {
|
|||
format!(
|
||||
"Failed to convert instruction {} (found in code of {}) to raw instruction",
|
||||
ins.__repr__(),
|
||||
method_id.__repr__()
|
||||
method_id.__str__()
|
||||
)
|
||||
})?;
|
||||
addr += ins.size() / 2;
|
||||
|
|
|
|||
|
|
@ -1978,8 +1978,13 @@ macro_rules! sanity_check_22b_or_22s {
|
|||
macro_rules! raw_ins_if {
|
||||
($ins_op:tt, $label_addrs:ident, $label:ident, $addr:ident, $r1:ident, $r2:ident) => {{
|
||||
let label_addr = $label_addrs.get($label).ok_or(anyhow!(
|
||||
"Label {} not found in code, but found `if` with this label",
|
||||
"Label {} not found in code, but found `if` with this label. Known labels are [{}].",
|
||||
$label,
|
||||
$label_addrs
|
||||
.keys()
|
||||
.map(|string| string.as_str())
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ")
|
||||
))?;
|
||||
let branch_offset = *label_addr as i32 - $addr as i32;
|
||||
if branch_offset > i16::MAX as i32 || branch_offset < i16::MIN as i32 {
|
||||
|
|
@ -1997,8 +2002,13 @@ macro_rules! raw_ins_if {
|
|||
macro_rules! raw_ins_ifz {
|
||||
($ins_op:tt, $label_addrs:ident, $label:ident, $addr:ident, $r1:ident) => {{
|
||||
let label_addr = $label_addrs.get($label).ok_or(anyhow!(
|
||||
"Label {} not found in code, but found `if` with this label",
|
||||
"Label {} not found in code, but found `if` with this label. Known labels are [{}].",
|
||||
$label,
|
||||
$label_addrs
|
||||
.keys()
|
||||
.map(|string| string.as_str())
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ")
|
||||
))?;
|
||||
let branch_offset = *label_addr as i32 - $addr as i32;
|
||||
if branch_offset > i16::MAX as i32 || branch_offset < i16::MIN as i32 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue