diff --git a/androscalpel/src/dex_writer.rs b/androscalpel/src/dex_writer.rs index 8dd0aaf..b74fd0b 100644 --- a/androscalpel/src/dex_writer.rs +++ b/androscalpel/src/dex_writer.rs @@ -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; diff --git a/androscalpel/src/instructions.rs b/androscalpel/src/instructions.rs index bfc5302..1aac5e1 100644 --- a/androscalpel/src/instructions.rs +++ b/androscalpel/src/instructions.rs @@ -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::>() + .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::>() + .join(", ") ))?; let branch_offset = *label_addr as i32 - $addr as i32; if branch_offset > i16::MAX as i32 || branch_offset < i16::MIN as i32 {