MCPcopy Create free account
hub / github.com/encounter/objdiff / infer_function_size

Method infer_function_size

objdiff-core/src/arch/arm.rs:461–479  ·  view source on GitHub ↗
(
        &self,
        symbol: &Symbol,
        section: &Section,
        mut next_address: u64,
    )

Source from the content-addressed store, hash-verified

459 }
460
461 fn infer_function_size(
462 &self,
463 symbol: &Symbol,
464 section: &Section,
465 mut next_address: u64,
466 ) -> Result<u64> {
467 // TODO: This should probably check the disasm mode and trim accordingly,
468 // but self.disasm_modes isn't populated until post_init, so it needs a refactor.
469
470 // Trim any trailing 2-byte zeroes from the end (padding)
471 while next_address >= symbol.address + 2
472 && let Some(data) = section.data_range(next_address - 2, 2)
473 && data == [0u8; 2]
474 && section.relocation_at(next_address - 2, 2).is_none()
475 {
476 next_address -= 2;
477 }
478 Ok(next_address.saturating_sub(symbol.address))
479 }
480}
481
482#[derive(Clone, Copy, Debug)]

Callers 1

infer_symbol_sizesFunction · 0.45

Calls 3

data_rangeMethod · 0.80
is_noneMethod · 0.80
relocation_atMethod · 0.80

Tested by

no test coverage detected