Skip to content

Commit 4b78958

Browse files
committed
Add "Relax shifted data diffs" option to objdiff-cli
Includes both a command line argument and a keyboard shortcut (S).
1 parent a28d108 commit 4b78958

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

objdiff-cli/src/cmd/diff.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ pub struct Args {
6666
#[argp(switch, short = 'x')]
6767
/// Relax relocation diffs
6868
relax_reloc_diffs: bool,
69+
#[argp(switch, short = 's')]
70+
/// Relax shifted data diffs
71+
relax_shifted_data_diffs: bool,
6972
#[argp(option, short = 'o')]
7073
/// Output file (one-shot mode) ("-" for stdout)
7174
output: Option<PathBuf>,
@@ -202,6 +205,7 @@ fn run_oneshot(
202205
let output_format = OutputFormat::from_option(args.format.as_deref())?;
203206
let config = diff::DiffObjConfig {
204207
relax_reloc_diffs: args.relax_reloc_diffs,
208+
relax_shifted_data_diffs: args.relax_shifted_data_diffs,
205209
..Default::default() // TODO
206210
};
207211
let target = target_path
@@ -230,6 +234,7 @@ pub struct AppState {
230234
pub reload_time: Option<time::OffsetDateTime>,
231235
pub time_format: Vec<time::format_description::FormatItem<'static>>,
232236
pub relax_reloc_diffs: bool,
237+
pub relax_shifted_data_diffs: bool,
233238
pub watcher: Option<Watcher>,
234239
pub modified: Arc<AtomicBool>,
235240
}
@@ -259,6 +264,7 @@ fn create_objdiff_config(state: &AppState) -> ObjDiffConfig {
259264
base_path: state.base_path.clone(),
260265
diff_obj_config: diff::DiffObjConfig {
261266
relax_reloc_diffs: state.relax_reloc_diffs,
267+
relax_shifted_data_diffs: state.relax_shifted_data_diffs,
262268
..Default::default() // TODO
263269
},
264270
symbol_mappings: Default::default(),
@@ -327,6 +333,7 @@ fn run_interactive(
327333
reload_time: None,
328334
time_format,
329335
relax_reloc_diffs: args.relax_reloc_diffs,
336+
relax_shifted_data_diffs: args.relax_shifted_data_diffs,
330337
watcher: None,
331338
modified: Default::default(),
332339
};

objdiff-cli/src/views/function_diff.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,12 @@ impl UiView for FunctionDiffUi {
374374
result.redraw = true;
375375
return EventControlFlow::Reload;
376376
}
377+
// Toggle relax shifted data diffs
378+
KeyCode::Char('s') => {
379+
state.relax_shifted_data_diffs = !state.relax_shifted_data_diffs;
380+
result.redraw = true;
381+
return EventControlFlow::Reload;
382+
}
377383
// Toggle three-way diff
378384
KeyCode::Char('3') => {
379385
self.three_way = !self.three_way;

0 commit comments

Comments
 (0)