Diff data symbols & improve symbol match logic

This commit is contained in:
2024-05-20 23:52:59 -06:00
parent 854dc9e4f5
commit 22a24f37f5
9 changed files with 190 additions and 50 deletions

View File

@@ -1,6 +1,6 @@
use std::borrow::Cow;
use anyhow::{bail, Result};
use anyhow::{anyhow, bail, Result};
use object::{elf, Endian, Endianness, File, Object, Relocation, RelocationFlags};
use rabbitizer::{config, Abi, InstrCategory, Instruction, OperandType};
@@ -35,6 +35,7 @@ impl ObjArch for ObjArchMips {
config: &DiffObjConfig,
) -> Result<ProcessCodeResult> {
let (section, symbol) = obj.section_symbol(symbol_ref);
let section = section.ok_or_else(|| anyhow!("Code symbol section not found"))?;
let code = &section.data
[symbol.section_address as usize..(symbol.section_address + symbol.size) as usize];

View File

@@ -1,6 +1,6 @@
use std::borrow::Cow;
use anyhow::{bail, Result};
use anyhow::{anyhow, bail, Result};
use object::{elf, File, Relocation, RelocationFlags};
use ppc750cl::{Argument, InsIter, GPR};
@@ -36,6 +36,7 @@ impl ObjArch for ObjArchPpc {
config: &DiffObjConfig,
) -> Result<ProcessCodeResult> {
let (section, symbol) = obj.section_symbol(symbol_ref);
let section = section.ok_or_else(|| anyhow!("Code symbol section not found"))?;
let code = &section.data
[symbol.section_address as usize..(symbol.section_address + symbol.size) as usize];

View File

@@ -33,6 +33,7 @@ impl ObjArch for ObjArchX86 {
config: &DiffObjConfig,
) -> Result<ProcessCodeResult> {
let (section, symbol) = obj.section_symbol(symbol_ref);
let section = section.ok_or_else(|| anyhow!("Code symbol section not found"))?;
let code = &section.data
[symbol.section_address as usize..(symbol.section_address + symbol.size) as usize];