Skip to content

Commit 0a9ffbb

Browse files
committed
Draft
1 parent 2d643eb commit 0a9ffbb

File tree

17 files changed

+4680
-71
lines changed

17 files changed

+4680
-71
lines changed

objdiff-cli/src/views/function_diff.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,7 @@ impl FunctionDiffUi {
570570
DiffTextColor::Normal => Color::Gray,
571571
DiffTextColor::Dim => Color::DarkGray,
572572
DiffTextColor::Bright => Color::White,
573+
DiffTextColor::DataFlow => Color::LightCyan,
573574
DiffTextColor::Replace => Color::Cyan,
574575
DiffTextColor::Delete => Color::Red,
575576
DiffTextColor::Insert => Color::Green,

objdiff-core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ time = { version = "0.3", optional = true }
174174
encoding_rs = "0.8.35"
175175

176176
[target.'cfg(windows)'.dependencies]
177-
winapi = { version = "0.3", optional = true }
177+
winapi = { version = "0.3", optional = true, features = ["winbase"] }
178178

179179
# For Linux static binaries, use rustls
180180
[target.'cfg(target_os = "linux")'.dependencies]

objdiff-core/config-schema.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@
2525
}
2626
]
2727
},
28+
{
29+
"id": "showDataFlow",
30+
"type": "boolean",
31+
"default": true,
32+
"name": "Show data flow",
33+
"description": "When information is known about the value in a register, show that info instead of the register name"
34+
},
2835
{
2936
"id": "spaceBetweenArgs",
3037
"type": "boolean",

objdiff-core/src/arch/mod.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
use alloc::{borrow::Cow, boxed::Box, format, string::String, vec::Vec};
2-
use core::{ffi::CStr, fmt, fmt::Debug};
2+
use core::{ffi::CStr, fmt::{self, Debug}};
33

44
use anyhow::{Result, bail};
55
use encoding_rs::SHIFT_JIS;
66
use object::Endian as _;
77

88
use crate::{
99
diff::{
10-
DiffObjConfig,
11-
display::{ContextItem, HoverItem, InstructionPart},
10+
display::{ContextItem, HoverItem, InstructionPart}, DiffObjConfig
1211
},
1312
obj::{
14-
InstructionArg, InstructionRef, Object, ParsedInstruction, Relocation, RelocationFlags,
15-
ResolvedInstructionRef, ResolvedSymbol, Section, Symbol, SymbolFlagSet, SymbolKind,
13+
FlowAnalysisResult, InstructionArg, InstructionRef, Object, ParsedInstruction, Relocation, RelocationFlags, ResolvedInstructionRef, ResolvedSymbol, Section, Symbol, SymbolFlagSet, SymbolKind
1614
},
1715
util::ReallySigned,
1816
};
@@ -31,6 +29,7 @@ pub mod superh;
3129
pub mod x86;
3230

3331
/// Represents the type of data associated with an instruction
32+
#[derive(PartialEq)]
3433
pub enum DataType {
3534
Int8,
3635
Int16,
@@ -325,14 +324,14 @@ pub trait Arch: Send + Sync + Debug {
325324
) -> Result<()>;
326325

327326
/// Generate a list of fake relocations from the given code that represent pooled data accesses.
328-
fn generate_pooled_relocations(
327+
fn data_flow_analysis(
329328
&self,
330-
_address: u64,
329+
_obj: &Object,
330+
_symbol: &Symbol,
331331
_code: &[u8],
332332
_relocations: &[Relocation],
333-
_symbols: &[Symbol],
334-
) -> Vec<Relocation> {
335-
Vec::new()
333+
) -> (Vec<Relocation>, Option<Box<dyn FlowAnalysisResult>>) {
334+
(Vec::new(), None)
336335
}
337336

338337
fn implcit_addend(

0 commit comments

Comments
 (0)