add more debug info in error
This commit is contained in:
parent
fe0dd2d6c8
commit
d906c4d3d2
1 changed files with 12 additions and 5 deletions
|
|
@ -503,9 +503,14 @@ impl DexWriter {
|
|||
// for context
|
||||
}
|
||||
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"))?;
|
||||
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_min_max_addrs
|
||||
.keys()
|
||||
.map(|string| string.as_str())
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ")
|
||||
))?;
|
||||
let size = Instruction::goto_size_from_branch_offset_interval(
|
||||
addr, *min_addr, *max_addr,
|
||||
)?;
|
||||
|
|
@ -948,7 +953,8 @@ impl DexWriter {
|
|||
// No if let because ownership gunfooterie
|
||||
let code_off = if class.direct_methods.get(id).unwrap().code.is_some() {
|
||||
let code_off = self.section_manager.get_aligned_size(Section::CodeItem);
|
||||
self.insert_code_item(id.clone(), true)?;
|
||||
self.insert_code_item(id.clone(), true)
|
||||
.with_context(|| format!("Failed to serialize code of {}", id.__str__()))?;
|
||||
Uleb128(code_off + 1)
|
||||
} else {
|
||||
Uleb128(0)
|
||||
|
|
@ -983,7 +989,8 @@ impl DexWriter {
|
|||
// No if let because ownership gunfooterie
|
||||
let code_off = if class.virtual_methods.get(id).unwrap().code.is_some() {
|
||||
let code_off = self.section_manager.get_aligned_size(Section::CodeItem);
|
||||
self.insert_code_item(id.clone(), false)?;
|
||||
self.insert_code_item(id.clone(), false)
|
||||
.with_context(|| format!("Failed to serialize code of {}", id.__str__()))?;
|
||||
Uleb128(code_off + 1)
|
||||
} else {
|
||||
Uleb128(0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue