mirror of
https://github.com/encounter/objdiff.git
synced 2025-06-28 17:33:31 +00:00
Migrate to Rust edition 2024
This commit is contained in:
parent
8eef37e8df
commit
799971d54e
@ -5,7 +5,7 @@ members = [
|
|||||||
"objdiff-gui",
|
"objdiff-gui",
|
||||||
"objdiff-wasm",
|
"objdiff-wasm",
|
||||||
]
|
]
|
||||||
resolver = "2"
|
resolver = "3"
|
||||||
|
|
||||||
[profile.release-lto]
|
[profile.release-lto]
|
||||||
inherits = "release"
|
inherits = "release"
|
||||||
@ -16,7 +16,7 @@ codegen-units = 1
|
|||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "3.0.0-beta.1"
|
version = "3.0.0-beta.1"
|
||||||
authors = ["Luke Street <luke@street.dev>"]
|
authors = ["Luke Street <luke@street.dev>"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
repository = "https://github.com/encounter/objdiff"
|
repository = "https://github.com/encounter/objdiff"
|
||||||
rust-version = "1.82"
|
rust-version = "1.85"
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
//! For now, this only adds a --version/-V option which causes early-exit.
|
//! For now, this only adds a --version/-V option which causes early-exit.
|
||||||
use std::ffi::OsStr;
|
use std::ffi::OsStr;
|
||||||
|
|
||||||
use argp::{parser::ParseGlobalOptions, EarlyExit, FromArgs, TopLevelCommand};
|
use argp::{EarlyExit, FromArgs, TopLevelCommand, parser::ParseGlobalOptions};
|
||||||
|
|
||||||
struct ArgsOrVersion<T>(T)
|
struct ArgsOrVersion<T>(T)
|
||||||
where T: FromArgs;
|
where T: FromArgs;
|
||||||
|
@ -3,40 +3,39 @@ use std::{
|
|||||||
mem,
|
mem,
|
||||||
str::FromStr,
|
str::FromStr,
|
||||||
sync::{
|
sync::{
|
||||||
atomic::{AtomicBool, Ordering},
|
|
||||||
Arc,
|
Arc,
|
||||||
|
atomic::{AtomicBool, Ordering},
|
||||||
},
|
},
|
||||||
task::{Wake, Waker},
|
task::{Wake, Waker},
|
||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
|
|
||||||
use anyhow::{anyhow, bail, Context, Result};
|
use anyhow::{Context, Result, anyhow, bail};
|
||||||
use argp::FromArgs;
|
use argp::FromArgs;
|
||||||
use crossterm::{
|
use crossterm::{
|
||||||
event,
|
event,
|
||||||
event::{DisableMouseCapture, EnableMouseCapture},
|
event::{DisableMouseCapture, EnableMouseCapture},
|
||||||
terminal::{
|
terminal::{
|
||||||
disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen, SetTitle,
|
EnterAlternateScreen, LeaveAlternateScreen, SetTitle, disable_raw_mode, enable_raw_mode,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use objdiff_core::{
|
use objdiff_core::{
|
||||||
bindings::diff::DiffResult,
|
bindings::diff::DiffResult,
|
||||||
build::{
|
build::{
|
||||||
watcher::{create_watcher, Watcher},
|
|
||||||
BuildConfig,
|
BuildConfig,
|
||||||
|
watcher::{Watcher, create_watcher},
|
||||||
},
|
},
|
||||||
config::{
|
config::{
|
||||||
build_globset,
|
ProjectConfig, ProjectObject, ProjectObjectMetadata, build_globset,
|
||||||
path::{check_path_buf, platform_path, platform_path_serde_option},
|
path::{check_path_buf, platform_path, platform_path_serde_option},
|
||||||
ProjectConfig, ProjectObject, ProjectObjectMetadata,
|
|
||||||
},
|
},
|
||||||
diff::{
|
diff::{
|
||||||
self, ConfigEnum, ConfigPropertyId, ConfigPropertyKind, DiffObjConfig, MappingConfig,
|
self, ConfigEnum, ConfigPropertyId, ConfigPropertyKind, DiffObjConfig, MappingConfig,
|
||||||
ObjectDiff,
|
ObjectDiff,
|
||||||
},
|
},
|
||||||
jobs::{
|
jobs::{
|
||||||
objdiff::{start_build, ObjDiffConfig},
|
|
||||||
Job, JobQueue, JobResult,
|
Job, JobQueue, JobResult,
|
||||||
|
objdiff::{ObjDiffConfig, start_build},
|
||||||
},
|
},
|
||||||
obj::{self, Object},
|
obj::{self, Object},
|
||||||
};
|
};
|
||||||
@ -45,10 +44,10 @@ use typed_path::{Utf8PlatformPath, Utf8PlatformPathBuf};
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
util::{
|
util::{
|
||||||
output::{write_output, OutputFormat},
|
output::{OutputFormat, write_output},
|
||||||
term::crossterm_panic_handler,
|
term::crossterm_panic_handler,
|
||||||
},
|
},
|
||||||
views::{function_diff::FunctionDiffUi, EventControlFlow, EventResult, UiView},
|
views::{EventControlFlow, EventResult, UiView, function_diff::FunctionDiffUi},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(FromArgs, PartialEq, Debug)]
|
#[derive(FromArgs, PartialEq, Debug)]
|
||||||
@ -426,15 +425,17 @@ fn run_interactive(
|
|||||||
let mut result = EventResult { redraw: true, ..Default::default() };
|
let mut result = EventResult { redraw: true, ..Default::default() };
|
||||||
'outer: loop {
|
'outer: loop {
|
||||||
if result.redraw {
|
if result.redraw {
|
||||||
terminal.draw(|f| loop {
|
terminal.draw(|f| {
|
||||||
result.redraw = false;
|
loop {
|
||||||
view.draw(&state, f, &mut result);
|
result.redraw = false;
|
||||||
result.click_xy = None;
|
view.draw(&state, f, &mut result);
|
||||||
if !result.redraw {
|
result.click_xy = None;
|
||||||
break;
|
if !result.redraw {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// Clear buffer on redraw
|
||||||
|
f.buffer_mut().reset();
|
||||||
}
|
}
|
||||||
// Clear buffer on redraw
|
|
||||||
f.buffer_mut().reset();
|
|
||||||
})?;
|
})?;
|
||||||
}
|
}
|
||||||
loop {
|
loop {
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
use std::{collections::HashSet, fs::File, io::Read, time::Instant};
|
use std::{collections::HashSet, fs::File, io::Read, time::Instant};
|
||||||
|
|
||||||
use anyhow::{bail, Context, Result};
|
use anyhow::{Context, Result, bail};
|
||||||
use argp::FromArgs;
|
use argp::FromArgs;
|
||||||
use objdiff_core::{
|
use objdiff_core::{
|
||||||
bindings::report::{
|
bindings::report::{
|
||||||
ChangeItem, ChangeItemInfo, ChangeUnit, Changes, ChangesInput, Measures, Report,
|
ChangeItem, ChangeItemInfo, ChangeUnit, Changes, ChangesInput, Measures, REPORT_VERSION,
|
||||||
ReportCategory, ReportItem, ReportItemMetadata, ReportUnit, ReportUnitMetadata,
|
Report, ReportCategory, ReportItem, ReportItemMetadata, ReportUnit, ReportUnitMetadata,
|
||||||
REPORT_VERSION,
|
|
||||||
},
|
},
|
||||||
config::path::platform_path,
|
config::path::platform_path,
|
||||||
diff, obj,
|
diff, obj,
|
||||||
@ -19,7 +18,7 @@ use typed_path::{Utf8PlatformPath, Utf8PlatformPathBuf};
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
cmd::diff::ObjectConfig,
|
cmd::diff::ObjectConfig,
|
||||||
util::output::{write_output, OutputFormat},
|
util::output::{OutputFormat, write_output},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(FromArgs, PartialEq, Debug)]
|
#[derive(FromArgs, PartialEq, Debug)]
|
||||||
@ -206,11 +205,7 @@ fn report_object(
|
|||||||
let section_match_percent = section_diff.match_percent.unwrap_or_else(|| {
|
let section_match_percent = section_diff.match_percent.unwrap_or_else(|| {
|
||||||
// Support cases where we don't have a target object,
|
// Support cases where we don't have a target object,
|
||||||
// assume complete means 100% match
|
// assume complete means 100% match
|
||||||
if object.complete.unwrap_or(false) {
|
if object.complete.unwrap_or(false) { 100.0 } else { 0.0 }
|
||||||
100.0
|
|
||||||
} else {
|
|
||||||
0.0
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
sections.push(ReportItem {
|
sections.push(ReportItem {
|
||||||
name: section.name.clone(),
|
name: section.name.clone(),
|
||||||
@ -251,11 +246,7 @@ fn report_object(
|
|||||||
let match_percent = symbol_diff.match_percent.unwrap_or_else(|| {
|
let match_percent = symbol_diff.match_percent.unwrap_or_else(|| {
|
||||||
// Support cases where we don't have a target object,
|
// Support cases where we don't have a target object,
|
||||||
// assume complete means 100% match
|
// assume complete means 100% match
|
||||||
if object.complete.unwrap_or(false) {
|
if object.complete.unwrap_or(false) { 100.0 } else { 0.0 }
|
||||||
100.0
|
|
||||||
} else {
|
|
||||||
0.0
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
measures.fuzzy_match_percent += match_percent * symbol.size as f32;
|
measures.fuzzy_match_percent += match_percent * symbol.size as f32;
|
||||||
measures.total_code += symbol.size;
|
measures.total_code += symbol.size;
|
||||||
|
@ -17,7 +17,7 @@ use anyhow::{Error, Result};
|
|||||||
use argp::{FromArgValue, FromArgs};
|
use argp::{FromArgValue, FromArgs};
|
||||||
use enable_ansi_support::enable_ansi_support;
|
use enable_ansi_support::enable_ansi_support;
|
||||||
use supports_color::Stream;
|
use supports_color::Stream;
|
||||||
use tracing_subscriber::{filter::LevelFilter, EnvFilter};
|
use tracing_subscriber::{EnvFilter, filter::LevelFilter};
|
||||||
|
|
||||||
#[derive(Debug, Eq, PartialEq, Copy, Clone)]
|
#[derive(Debug, Eq, PartialEq, Copy, Clone)]
|
||||||
enum LogLevel {
|
enum LogLevel {
|
||||||
|
@ -5,7 +5,7 @@ use std::{
|
|||||||
path::Path,
|
path::Path,
|
||||||
};
|
};
|
||||||
|
|
||||||
use anyhow::{bail, Context, Result};
|
use anyhow::{Context, Result, bail};
|
||||||
use tracing::info;
|
use tracing::info;
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Default)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Default)]
|
||||||
|
@ -3,7 +3,7 @@ use std::{io::stdout, panic};
|
|||||||
use crossterm::{
|
use crossterm::{
|
||||||
cursor::Show,
|
cursor::Show,
|
||||||
event::DisableMouseCapture,
|
event::DisableMouseCapture,
|
||||||
terminal::{disable_raw_mode, LeaveAlternateScreen},
|
terminal::{LeaveAlternateScreen, disable_raw_mode},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn crossterm_panic_handler() {
|
pub fn crossterm_panic_handler() {
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
use core::cmp::Ordering;
|
use core::cmp::Ordering;
|
||||||
|
|
||||||
use anyhow::{bail, Result};
|
use anyhow::{Result, bail};
|
||||||
use crossterm::event::{Event, KeyCode, KeyEventKind, KeyModifiers, MouseButton, MouseEventKind};
|
use crossterm::event::{Event, KeyCode, KeyEventKind, KeyModifiers, MouseButton, MouseEventKind};
|
||||||
use objdiff_core::{
|
use objdiff_core::{
|
||||||
diff::{
|
diff::{
|
||||||
display::{display_row, DiffText, DiffTextColor, HighlightKind},
|
|
||||||
DiffObjConfig, FunctionRelocDiffs, InstructionDiffKind, ObjectDiff, SymbolDiff,
|
DiffObjConfig, FunctionRelocDiffs, InstructionDiffKind, ObjectDiff, SymbolDiff,
|
||||||
|
display::{DiffText, DiffTextColor, HighlightKind, display_row},
|
||||||
},
|
},
|
||||||
obj::Object,
|
obj::Object,
|
||||||
};
|
};
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
|
Frame,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
widgets::{Block, Borders, Clear, Paragraph, Scrollbar, ScrollbarOrientation, ScrollbarState},
|
widgets::{Block, Borders, Clear, Paragraph, Scrollbar, ScrollbarOrientation, ScrollbarState},
|
||||||
Frame,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{EventControlFlow, EventResult, UiView};
|
use super::{EventControlFlow, EventResult, UiView};
|
||||||
|
@ -5,14 +5,14 @@ use alloc::{
|
|||||||
vec::Vec,
|
vec::Vec,
|
||||||
};
|
};
|
||||||
|
|
||||||
use anyhow::{bail, Result};
|
use anyhow::{Result, bail};
|
||||||
use arm_attr::{enums::CpuArch, tag::Tag, BuildAttrs};
|
use arm_attr::{BuildAttrs, enums::CpuArch, tag::Tag};
|
||||||
use object::{elf, Endian as _, Object as _, ObjectSection as _, ObjectSymbol as _};
|
use object::{Endian as _, Object as _, ObjectSection as _, ObjectSymbol as _, elf};
|
||||||
use unarm::{args, arm, thumb};
|
use unarm::{args, arm, thumb};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
arch::Arch,
|
arch::Arch,
|
||||||
diff::{display::InstructionPart, ArmArchVersion, ArmR9Usage, DiffObjConfig},
|
diff::{ArmArchVersion, ArmR9Usage, DiffObjConfig, display::InstructionPart},
|
||||||
obj::{
|
obj::{
|
||||||
InstructionRef, RelocationFlags, ResolvedInstructionRef, ResolvedRelocation,
|
InstructionRef, RelocationFlags, ResolvedInstructionRef, ResolvedRelocation,
|
||||||
ScannedInstruction, SymbolFlag, SymbolFlagSet, SymbolKind,
|
ScannedInstruction, SymbolFlag, SymbolFlagSet, SymbolKind,
|
||||||
@ -58,11 +58,7 @@ impl ArchArm {
|
|||||||
}
|
}
|
||||||
// Only checking first CpuArch tag. Others may exist, but that's very unlikely.
|
// Only checking first CpuArch tag. Others may exist, but that's very unlikely.
|
||||||
let cpu_arch = subsection.into_public_tag_iter()?.find_map(|(_, tag)| {
|
let cpu_arch = subsection.into_public_tag_iter()?.find_map(|(_, tag)| {
|
||||||
if let Tag::CpuArch(cpu_arch) = tag {
|
if let Tag::CpuArch(cpu_arch) = tag { Some(cpu_arch) } else { None }
|
||||||
Some(cpu_arch)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
match cpu_arch {
|
match cpu_arch {
|
||||||
Some(CpuArch::V4T) => return Ok(Some(unarm::ArmVersion::V4T)),
|
Some(CpuArch::V4T) => return Ok(Some(unarm::ArmVersion::V4T)),
|
||||||
@ -358,11 +354,7 @@ impl Arch for ArchArm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn symbol_address(&self, address: u64, kind: SymbolKind) -> u64 {
|
fn symbol_address(&self, address: u64, kind: SymbolKind) -> u64 {
|
||||||
if kind == SymbolKind::Function {
|
if kind == SymbolKind::Function { address & !1 } else { address }
|
||||||
address & !1
|
|
||||||
} else {
|
|
||||||
address
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn extra_symbol_flags(&self, symbol: &object::Symbol) -> SymbolFlagSet {
|
fn extra_symbol_flags(&self, symbol: &object::Symbol) -> SymbolFlagSet {
|
||||||
|
@ -5,7 +5,7 @@ use alloc::{
|
|||||||
};
|
};
|
||||||
use core::cmp::Ordering;
|
use core::cmp::Ordering;
|
||||||
|
|
||||||
use anyhow::{bail, Result};
|
use anyhow::{Result, bail};
|
||||||
use object::elf;
|
use object::elf;
|
||||||
use yaxpeax_arch::{Arch as YaxpeaxArch, Decoder, Reader, U8Reader};
|
use yaxpeax_arch::{Arch as YaxpeaxArch, Decoder, Reader, U8Reader};
|
||||||
use yaxpeax_arm::armv8::a64::{
|
use yaxpeax_arm::armv8::a64::{
|
||||||
@ -15,7 +15,7 @@ use yaxpeax_arm::armv8::a64::{
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
arch::Arch,
|
arch::Arch,
|
||||||
diff::{display::InstructionPart, DiffObjConfig},
|
diff::{DiffObjConfig, display::InstructionPart},
|
||||||
obj::{
|
obj::{
|
||||||
InstructionRef, RelocationFlags, ResolvedInstructionRef, ResolvedRelocation,
|
InstructionRef, RelocationFlags, ResolvedInstructionRef, ResolvedRelocation,
|
||||||
ScannedInstruction,
|
ScannedInstruction,
|
||||||
@ -216,11 +216,7 @@ where Cb: FnMut(InstructionPart<'static>) {
|
|||||||
unreachable!("movn operand 1 is always ImmShift");
|
unreachable!("movn operand 1 is always ImmShift");
|
||||||
};
|
};
|
||||||
let imm = if let Operand::Register(size, _) = ins.operands[0] {
|
let imm = if let Operand::Register(size, _) = ins.operands[0] {
|
||||||
if size == SizeCode::W {
|
if size == SizeCode::W { imm as u32 as u64 } else { imm }
|
||||||
imm as u32 as u64
|
|
||||||
} else {
|
|
||||||
imm
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
unreachable!("movn operand 0 is always Register");
|
unreachable!("movn operand 0 is always Register");
|
||||||
};
|
};
|
||||||
@ -237,11 +233,7 @@ where Cb: FnMut(InstructionPart<'static>) {
|
|||||||
unreachable!("movz operand is always ImmShift");
|
unreachable!("movz operand is always ImmShift");
|
||||||
};
|
};
|
||||||
let imm = if let Operand::Register(size, _) = ins.operands[0] {
|
let imm = if let Operand::Register(size, _) = ins.operands[0] {
|
||||||
if size == SizeCode::W {
|
if size == SizeCode::W { imm as u32 as u64 } else { imm }
|
||||||
imm as u32 as u64
|
|
||||||
} else {
|
|
||||||
imm
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
unreachable!("movz operand 0 is always Register");
|
unreachable!("movz operand 0 is always Register");
|
||||||
};
|
};
|
||||||
@ -574,11 +566,7 @@ where Cb: FnMut(InstructionPart<'static>) {
|
|||||||
{
|
{
|
||||||
if immr < imms {
|
if immr < imms {
|
||||||
let size = if let Operand::Register(size, _) = ins.operands[0] {
|
let size = if let Operand::Register(size, _) = ins.operands[0] {
|
||||||
if size == SizeCode::W {
|
if size == SizeCode::W { 32 } else { 64 }
|
||||||
32
|
|
||||||
} else {
|
|
||||||
64
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
unreachable!("operand 0 is always a register");
|
unreachable!("operand 0 is always a register");
|
||||||
};
|
};
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
use alloc::{collections::BTreeMap, string::ToString, vec::Vec};
|
use alloc::{collections::BTreeMap, string::ToString, vec::Vec};
|
||||||
use core::ops::Range;
|
use core::ops::Range;
|
||||||
|
|
||||||
use anyhow::{bail, Result};
|
use anyhow::{Result, bail};
|
||||||
use object::{elf, Endian as _, Object as _, ObjectSection as _, ObjectSymbol as _};
|
use object::{Endian as _, Object as _, ObjectSection as _, ObjectSymbol as _, elf};
|
||||||
use rabbitizer::{
|
use rabbitizer::{
|
||||||
abi::Abi,
|
|
||||||
operands::{ValuedOperand, IU16},
|
|
||||||
registers_meta::Register,
|
|
||||||
IsaExtension, IsaVersion, Vram,
|
IsaExtension, IsaVersion, Vram,
|
||||||
|
abi::Abi,
|
||||||
|
operands::{IU16, ValuedOperand},
|
||||||
|
registers_meta::Register,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
arch::Arch,
|
arch::Arch,
|
||||||
diff::{display::InstructionPart, DiffObjConfig, MipsAbi, MipsInstrCategory},
|
diff::{DiffObjConfig, MipsAbi, MipsInstrCategory, display::InstructionPart},
|
||||||
obj::{
|
obj::{
|
||||||
InstructionArg, InstructionArgValue, InstructionRef, Relocation, RelocationFlags,
|
InstructionArg, InstructionArgValue, InstructionRef, Relocation, RelocationFlags,
|
||||||
ResolvedInstructionRef, ResolvedRelocation, ScannedInstruction,
|
ResolvedInstructionRef, ResolvedRelocation, ScannedInstruction,
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
use alloc::{borrow::Cow, boxed::Box, format, string::String, vec::Vec};
|
use alloc::{borrow::Cow, boxed::Box, format, string::String, vec::Vec};
|
||||||
use core::{ffi::CStr, fmt, fmt::Debug};
|
use core::{ffi::CStr, fmt, fmt::Debug};
|
||||||
|
|
||||||
use anyhow::{bail, Result};
|
use anyhow::{Result, bail};
|
||||||
use object::Endian as _;
|
use object::Endian as _;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
diff::{
|
diff::{
|
||||||
display::{ContextItem, HoverItem, InstructionPart},
|
|
||||||
DiffObjConfig,
|
DiffObjConfig,
|
||||||
|
display::{ContextItem, HoverItem, InstructionPart},
|
||||||
},
|
},
|
||||||
obj::{
|
obj::{
|
||||||
InstructionArg, Object, ParsedInstruction, Relocation, RelocationFlags,
|
InstructionArg, Object, ParsedInstruction, Relocation, RelocationFlags,
|
||||||
@ -66,7 +66,9 @@ impl DataType {
|
|||||||
pub fn display_literals(&self, endian: object::Endianness, bytes: &[u8]) -> Vec<String> {
|
pub fn display_literals(&self, endian: object::Endianness, bytes: &[u8]) -> Vec<String> {
|
||||||
let mut strs = Vec::new();
|
let mut strs = Vec::new();
|
||||||
if self.required_len().is_some_and(|l| bytes.len() < l) {
|
if self.required_len().is_some_and(|l| bytes.len() < l) {
|
||||||
log::warn!("Failed to display a symbol value for a symbol whose size is too small for instruction referencing it.");
|
log::warn!(
|
||||||
|
"Failed to display a symbol value for a symbol whose size is too small for instruction referencing it."
|
||||||
|
);
|
||||||
return strs;
|
return strs;
|
||||||
}
|
}
|
||||||
let mut bytes = bytes;
|
let mut bytes = bytes;
|
||||||
|
@ -5,17 +5,17 @@ use alloc::{
|
|||||||
vec::Vec,
|
vec::Vec,
|
||||||
};
|
};
|
||||||
|
|
||||||
use anyhow::{bail, ensure, Result};
|
use anyhow::{Result, bail, ensure};
|
||||||
use cwextab::{decode_extab, ExceptionTableData};
|
use cwextab::{ExceptionTableData, decode_extab};
|
||||||
use flagset::Flags;
|
use flagset::Flags;
|
||||||
use object::{elf, Object as _, ObjectSection as _, ObjectSymbol as _};
|
use object::{Object as _, ObjectSection as _, ObjectSymbol as _, elf};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
arch::{Arch, DataType},
|
arch::{Arch, DataType},
|
||||||
diff::{
|
diff::{
|
||||||
|
DiffObjConfig,
|
||||||
data::resolve_relocation,
|
data::resolve_relocation,
|
||||||
display::{ContextItem, HoverItem, HoverItemColor, InstructionPart, SymbolNavigationKind},
|
display::{ContextItem, HoverItem, HoverItemColor, InstructionPart, SymbolNavigationKind},
|
||||||
DiffObjConfig,
|
|
||||||
},
|
},
|
||||||
obj::{
|
obj::{
|
||||||
InstructionRef, Object, Relocation, RelocationFlags, ResolvedInstructionRef,
|
InstructionRef, Object, Relocation, RelocationFlags, ResolvedInstructionRef,
|
||||||
@ -826,8 +826,8 @@ fn generate_fake_pool_relocations_for_function(
|
|||||||
for unseen_addr in unseen_addrs {
|
for unseen_addr in unseen_addrs {
|
||||||
let prev_bctr_gpr_state = gpr_state_at_bctr
|
let prev_bctr_gpr_state = gpr_state_at_bctr
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|(&addr, _)| addr < unseen_addr)
|
.filter(|&(&addr, _)| addr < unseen_addr)
|
||||||
.min_by_key(|(&addr, _)| addr)
|
.min_by_key(|&(&addr, _)| addr)
|
||||||
.map(|(_, gpr_state)| gpr_state);
|
.map(|(_, gpr_state)| gpr_state);
|
||||||
if let Some(gpr_pool_relocs) = prev_bctr_gpr_state {
|
if let Some(gpr_pool_relocs) = prev_bctr_gpr_state {
|
||||||
let dest_offset_into_func = unseen_addr - func_address as u32;
|
let dest_offset_into_func = unseen_addr - func_address as u32;
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
use alloc::{boxed::Box, string::String, vec::Vec};
|
use alloc::{boxed::Box, string::String, vec::Vec};
|
||||||
|
|
||||||
use anyhow::{anyhow, bail, Result};
|
use anyhow::{Result, anyhow, bail};
|
||||||
use iced_x86::{
|
use iced_x86::{
|
||||||
Decoder, DecoderOptions, DecoratorKind, FormatterOutput, FormatterTextKind, GasFormatter,
|
Decoder, DecoderOptions, DecoratorKind, FormatterOutput, FormatterTextKind, GasFormatter,
|
||||||
Instruction, IntelFormatter, MasmFormatter, NasmFormatter, NumberKind, OpKind, Register,
|
Instruction, IntelFormatter, MasmFormatter, NasmFormatter, NumberKind, OpKind, Register,
|
||||||
};
|
};
|
||||||
use object::{pe, Endian as _, Object as _, ObjectSection as _};
|
use object::{Endian as _, Object as _, ObjectSection as _, pe};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
arch::Arch,
|
arch::Arch,
|
||||||
diff::{display::InstructionPart, DiffObjConfig, X86Formatter},
|
diff::{DiffObjConfig, X86Formatter, display::InstructionPart},
|
||||||
obj::{InstructionRef, RelocationFlags, ResolvedInstructionRef, ScannedInstruction},
|
obj::{InstructionRef, RelocationFlags, ResolvedInstructionRef, ScannedInstruction},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ impl Arch for ArchX86 {
|
|||||||
let mut reloc_replace = None;
|
let mut reloc_replace = None;
|
||||||
if let Some(reloc) = resolved.relocation {
|
if let Some(reloc) = resolved.relocation {
|
||||||
const PLACEHOLDER: u64 = 0x7BDE3E7D; // chosen by fair dice roll.
|
const PLACEHOLDER: u64 = 0x7BDE3E7D; // chosen by fair dice roll.
|
||||||
// guaranteed to be random.
|
// guaranteed to be random.
|
||||||
let reloc_offset = reloc.relocation.address - resolved.ins_ref.address;
|
let reloc_offset = reloc.relocation.address - resolved.ins_ref.address;
|
||||||
let reloc_size = reloc_size(reloc.relocation.flags).unwrap_or(usize::MAX);
|
let reloc_size = reloc_size(reloc.relocation.flags).unwrap_or(usize::MAX);
|
||||||
let offsets = decoder.get_constant_offsets(&instruction);
|
let offsets = decoder.get_constant_offsets(&instruction);
|
||||||
|
@ -7,7 +7,7 @@ use alloc::{
|
|||||||
};
|
};
|
||||||
use core::ops::AddAssign;
|
use core::ops::AddAssign;
|
||||||
|
|
||||||
use anyhow::{bail, Result};
|
use anyhow::{Result, bail};
|
||||||
use prost::Message;
|
use prost::Message;
|
||||||
|
|
||||||
// Protobuf report types
|
// Protobuf report types
|
||||||
@ -441,11 +441,7 @@ impl From<LegacyReportItem> for ReportItem {
|
|||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
fn serialize_hex<S>(x: &Option<u64>, s: S) -> Result<S::Ok, S::Error>
|
fn serialize_hex<S>(x: &Option<u64>, s: S) -> Result<S::Ok, S::Error>
|
||||||
where S: serde::Serializer {
|
where S: serde::Serializer {
|
||||||
if let Some(x) = x {
|
if let Some(x) = x { s.serialize_str(&format!("{:#x}", x)) } else { s.serialize_none() }
|
||||||
s.serialize_str(&format!("{:#x}", x))
|
|
||||||
} else {
|
|
||||||
s.serialize_none()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
|
@ -2,8 +2,8 @@ use std::{
|
|||||||
fs,
|
fs,
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
sync::{
|
sync::{
|
||||||
atomic::{AtomicBool, Ordering},
|
|
||||||
Arc,
|
Arc,
|
||||||
|
atomic::{AtomicBool, Ordering},
|
||||||
},
|
},
|
||||||
task::Waker,
|
task::Waker,
|
||||||
time::Duration,
|
time::Duration,
|
||||||
@ -11,7 +11,7 @@ use std::{
|
|||||||
|
|
||||||
use globset::GlobSet;
|
use globset::GlobSet;
|
||||||
use notify::RecursiveMode;
|
use notify::RecursiveMode;
|
||||||
use notify_debouncer_full::{new_debouncer_opt, DebounceEventResult};
|
use notify_debouncer_full::{DebounceEventResult, new_debouncer_opt};
|
||||||
|
|
||||||
pub type Watcher = notify_debouncer_full::Debouncer<
|
pub type Watcher = notify_debouncer_full::Debouncer<
|
||||||
notify::RecommendedWatcher,
|
notify::RecommendedWatcher,
|
||||||
|
@ -6,7 +6,7 @@ use alloc::{
|
|||||||
vec::Vec,
|
vec::Vec,
|
||||||
};
|
};
|
||||||
|
|
||||||
use anyhow::{anyhow, Context, Result};
|
use anyhow::{Context, Result, anyhow};
|
||||||
use globset::{Glob, GlobSet, GlobSetBuilder};
|
use globset::{Glob, GlobSet, GlobSetBuilder};
|
||||||
use path::unix_path_serde_option;
|
use path::unix_path_serde_option;
|
||||||
use typed_path::Utf8UnixPathBuf;
|
use typed_path::Utf8UnixPathBuf;
|
||||||
|
@ -31,11 +31,7 @@ pub mod unix_path_serde_option {
|
|||||||
|
|
||||||
pub fn serialize<S>(path: &Option<Utf8UnixPathBuf>, s: S) -> Result<S::Ok, S::Error>
|
pub fn serialize<S>(path: &Option<Utf8UnixPathBuf>, s: S) -> Result<S::Ok, S::Error>
|
||||||
where S: Serializer {
|
where S: Serializer {
|
||||||
if let Some(path) = path {
|
if let Some(path) = path { s.serialize_some(path.as_str()) } else { s.serialize_none() }
|
||||||
s.serialize_some(path.as_str())
|
|
||||||
} else {
|
|
||||||
s.serialize_none()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn deserialize<'de, D>(deserializer: D) -> Result<Option<Utf8UnixPathBuf>, D::Error>
|
pub fn deserialize<'de, D>(deserializer: D) -> Result<Option<Utf8UnixPathBuf>, D::Error>
|
||||||
@ -51,11 +47,7 @@ pub mod platform_path_serde_option {
|
|||||||
|
|
||||||
pub fn serialize<S>(path: &Option<Utf8PlatformPathBuf>, s: S) -> Result<S::Ok, S::Error>
|
pub fn serialize<S>(path: &Option<Utf8PlatformPathBuf>, s: S) -> Result<S::Ok, S::Error>
|
||||||
where S: Serializer {
|
where S: Serializer {
|
||||||
if let Some(path) = path {
|
if let Some(path) = path { s.serialize_some(path.as_str()) } else { s.serialize_none() }
|
||||||
s.serialize_some(path.as_str())
|
|
||||||
} else {
|
|
||||||
s.serialize_none()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn deserialize<'de, D>(deserializer: D) -> Result<Option<Utf8PlatformPathBuf>, D::Error>
|
pub fn deserialize<'de, D>(deserializer: D) -> Result<Option<Utf8PlatformPathBuf>, D::Error>
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
use alloc::{
|
use alloc::{
|
||||||
collections::{btree_map, BTreeMap},
|
collections::{BTreeMap, btree_map},
|
||||||
string::{String, ToString},
|
string::{String, ToString},
|
||||||
vec,
|
vec,
|
||||||
vec::Vec,
|
vec::Vec,
|
||||||
};
|
};
|
||||||
|
|
||||||
use anyhow::{anyhow, ensure, Context, Result};
|
use anyhow::{Context, Result, anyhow, ensure};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
display::display_ins_data_literals, DiffObjConfig, FunctionRelocDiffs, InstructionArgDiffIndex,
|
DiffObjConfig, FunctionRelocDiffs, InstructionArgDiffIndex, InstructionBranchFrom,
|
||||||
InstructionBranchFrom, InstructionBranchTo, InstructionDiffKind, InstructionDiffRow,
|
InstructionBranchTo, InstructionDiffKind, InstructionDiffRow, SymbolDiff,
|
||||||
SymbolDiff,
|
display::display_ins_data_literals,
|
||||||
};
|
};
|
||||||
use crate::obj::{
|
use crate::obj::{
|
||||||
InstructionArg, InstructionArgValue, InstructionRef, Object, ResolvedInstructionRef,
|
InstructionArg, InstructionArgValue, InstructionRef, Object, ResolvedInstructionRef,
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
use alloc::{vec, vec::Vec};
|
use alloc::{vec, vec::Vec};
|
||||||
use core::{cmp::Ordering, ops::Range};
|
use core::{cmp::Ordering, ops::Range};
|
||||||
|
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{Result, anyhow};
|
||||||
use similar::{capture_diff_slices, get_diff_ratio, Algorithm};
|
use similar::{Algorithm, capture_diff_slices, get_diff_ratio};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
code::{address_eq, section_name_eq},
|
|
||||||
DataDiff, DataDiffKind, DataRelocationDiff, ObjectDiff, SectionDiff, SymbolDiff,
|
DataDiff, DataDiffKind, DataRelocationDiff, ObjectDiff, SectionDiff, SymbolDiff,
|
||||||
|
code::{address_eq, section_name_eq},
|
||||||
};
|
};
|
||||||
use crate::obj::{Object, Relocation, ResolvedRelocation, Symbol, SymbolFlag, SymbolKind};
|
use crate::obj::{Object, Relocation, ResolvedRelocation, Symbol, SymbolFlag, SymbolKind};
|
||||||
|
|
||||||
@ -431,11 +431,7 @@ pub fn diff_generic_section(
|
|||||||
.fold((0.0, 0.0), |(matched, total), (s, d)| {
|
.fold((0.0, 0.0), |(matched, total), (s, d)| {
|
||||||
(matched + d.match_percent.unwrap_or(0.0) * s.size as f32, total + s.size as f32)
|
(matched + d.match_percent.unwrap_or(0.0) * s.size as f32, total + s.size as f32)
|
||||||
});
|
});
|
||||||
if total == 0.0 {
|
if total == 0.0 { 100.0 } else { matched / total }
|
||||||
100.0
|
|
||||||
} else {
|
|
||||||
matched / total
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
Ok((
|
Ok((
|
||||||
SectionDiff { match_percent: Some(match_percent), data_diff: vec![], reloc_diff: vec![] },
|
SectionDiff { match_percent: Some(match_percent), data_diff: vec![], reloc_diff: vec![] },
|
||||||
|
@ -26,13 +26,7 @@ pub mod display;
|
|||||||
include!(concat!(env!("OUT_DIR"), "/config.gen.rs"));
|
include!(concat!(env!("OUT_DIR"), "/config.gen.rs"));
|
||||||
|
|
||||||
impl DiffObjConfig {
|
impl DiffObjConfig {
|
||||||
pub fn separator(&self) -> &'static str {
|
pub fn separator(&self) -> &'static str { if self.space_between_args { ", " } else { "," } }
|
||||||
if self.space_between_args {
|
|
||||||
", "
|
|
||||||
} else {
|
|
||||||
","
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
@ -6,7 +6,7 @@ use self_update::{
|
|||||||
update::{Release, ReleaseUpdate},
|
update::{Release, ReleaseUpdate},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::jobs::{start_job, update_status, Job, JobContext, JobResult, JobState};
|
use crate::jobs::{Job, JobContext, JobResult, JobState, start_job, update_status};
|
||||||
|
|
||||||
pub struct CheckUpdateConfig {
|
pub struct CheckUpdateConfig {
|
||||||
pub build_updater: fn() -> Result<Box<dyn ReleaseUpdate>>,
|
pub build_updater: fn() -> Result<Box<dyn ReleaseUpdate>>,
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
use std::{fs, sync::mpsc::Receiver, task::Waker};
|
use std::{fs, sync::mpsc::Receiver, task::Waker};
|
||||||
|
|
||||||
use anyhow::{anyhow, bail, Context, Result};
|
use anyhow::{Context, Result, anyhow, bail};
|
||||||
use typed_path::{Utf8PlatformPathBuf, Utf8UnixPathBuf};
|
use typed_path::{Utf8PlatformPathBuf, Utf8UnixPathBuf};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
build::{run_make, BuildConfig, BuildStatus},
|
build::{BuildConfig, BuildStatus, run_make},
|
||||||
jobs::{start_job, update_status, Job, JobContext, JobResult, JobState},
|
jobs::{Job, JobContext, JobResult, JobState, start_job, update_status},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use std::{
|
use std::{
|
||||||
sync::{
|
sync::{
|
||||||
|
Arc, RwLock,
|
||||||
atomic::{AtomicUsize, Ordering},
|
atomic::{AtomicUsize, Ordering},
|
||||||
mpsc::{Receiver, Sender, TryRecvError},
|
mpsc::{Receiver, Sender, TryRecvError},
|
||||||
Arc, RwLock,
|
|
||||||
},
|
},
|
||||||
task::Waker,
|
task::Waker,
|
||||||
thread::JoinHandle,
|
thread::JoinHandle,
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
use std::{sync::mpsc::Receiver, task::Waker};
|
use std::{sync::mpsc::Receiver, task::Waker};
|
||||||
|
|
||||||
use anyhow::{bail, Error, Result};
|
use anyhow::{Error, Result, bail};
|
||||||
use time::OffsetDateTime;
|
use time::OffsetDateTime;
|
||||||
use typed_path::Utf8PlatformPathBuf;
|
use typed_path::Utf8PlatformPathBuf;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
build::{run_make, BuildConfig, BuildStatus},
|
build::{BuildConfig, BuildStatus, run_make},
|
||||||
diff::{diff_objs, DiffObjConfig, MappingConfig, ObjectDiff},
|
diff::{DiffObjConfig, MappingConfig, ObjectDiff, diff_objs},
|
||||||
jobs::{start_job, update_status, Job, JobContext, JobResult, JobState},
|
jobs::{Job, JobContext, JobResult, JobState, start_job, update_status},
|
||||||
obj::{read, Object},
|
obj::{Object, read},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct ObjDiffConfig {
|
pub struct ObjDiffConfig {
|
||||||
|
@ -10,7 +10,7 @@ use anyhow::{Context, Result};
|
|||||||
pub use self_update; // Re-export self_update crate
|
pub use self_update; // Re-export self_update crate
|
||||||
use self_update::update::ReleaseUpdate;
|
use self_update::update::ReleaseUpdate;
|
||||||
|
|
||||||
use crate::jobs::{start_job, update_status, Job, JobContext, JobResult, JobState};
|
use crate::jobs::{Job, JobContext, JobResult, JobState, start_job, update_status};
|
||||||
|
|
||||||
pub struct UpdateConfig {
|
pub struct UpdateConfig {
|
||||||
pub build_updater: fn() -> Result<Box<dyn ReleaseUpdate>>,
|
pub build_updater: fn() -> Result<Box<dyn ReleaseUpdate>>,
|
||||||
|
@ -11,7 +11,7 @@ use alloc::{
|
|||||||
};
|
};
|
||||||
use core::{fmt, num::NonZeroU32};
|
use core::{fmt, num::NonZeroU32};
|
||||||
|
|
||||||
use flagset::{flags, FlagSet};
|
use flagset::{FlagSet, flags};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
arch::{Arch, ArchDummy},
|
arch::{Arch, ArchDummy},
|
||||||
|
@ -6,16 +6,16 @@ use alloc::{
|
|||||||
};
|
};
|
||||||
use core::cmp::Ordering;
|
use core::cmp::Ordering;
|
||||||
|
|
||||||
use anyhow::{anyhow, bail, ensure, Context, Result};
|
use anyhow::{Context, Result, anyhow, bail, ensure};
|
||||||
use object::{Object as _, ObjectSection as _, ObjectSymbol as _};
|
use object::{Object as _, ObjectSection as _, ObjectSymbol as _};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
arch::{new_arch, Arch},
|
arch::{Arch, new_arch},
|
||||||
diff::DiffObjConfig,
|
diff::DiffObjConfig,
|
||||||
obj::{
|
obj::{
|
||||||
split_meta::{SplitMeta, SPLITMETA_SECTION},
|
|
||||||
Object, Relocation, RelocationFlags, Section, SectionData, SectionFlag, SectionKind,
|
Object, Relocation, RelocationFlags, Section, SectionData, SectionFlag, SectionKind,
|
||||||
Symbol, SymbolFlag, SymbolKind,
|
Symbol, SymbolFlag, SymbolKind,
|
||||||
|
split_meta::{SPLITMETA_SECTION, SplitMeta},
|
||||||
},
|
},
|
||||||
util::{read_u16, read_u32},
|
util::{read_u16, read_u32},
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use alloc::{string::String, vec, vec::Vec};
|
use alloc::{string::String, vec, vec::Vec};
|
||||||
|
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{Result, anyhow};
|
||||||
use object::{elf::SHT_NOTE, Endian, ObjectSection};
|
use object::{Endian, ObjectSection, elf::SHT_NOTE};
|
||||||
|
|
||||||
pub const SPLITMETA_SECTION: &str = ".note.split";
|
pub const SPLITMETA_SECTION: &str = ".note.split";
|
||||||
pub const SHT_SPLITMETA: u32 = SHT_NOTE;
|
pub const SHT_SPLITMETA: u32 = SHT_NOTE;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use alloc::format;
|
use alloc::format;
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
|
|
||||||
use anyhow::{ensure, Result};
|
use anyhow::{Result, ensure};
|
||||||
use num_traits::PrimInt;
|
use num_traits::PrimInt;
|
||||||
use object::{Endian, Object};
|
use object::{Endian, Object};
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use objdiff_core::{
|
use objdiff_core::{
|
||||||
diff::{display::DiffTextSegment, DiffObjConfig, SymbolDiff},
|
diff::{DiffObjConfig, SymbolDiff, display::DiffTextSegment},
|
||||||
obj::Object,
|
obj::Object,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@ use std::{
|
|||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
rc::Rc,
|
rc::Rc,
|
||||||
sync::{
|
sync::{
|
||||||
atomic::{AtomicBool, Ordering},
|
|
||||||
Arc, Mutex, RwLock,
|
Arc, Mutex, RwLock,
|
||||||
|
atomic::{AtomicBool, Ordering},
|
||||||
},
|
},
|
||||||
time::Instant,
|
time::Instant,
|
||||||
};
|
};
|
||||||
@ -14,11 +14,11 @@ use std::{
|
|||||||
use filetime::FileTime;
|
use filetime::FileTime;
|
||||||
use globset::Glob;
|
use globset::Glob;
|
||||||
use objdiff_core::{
|
use objdiff_core::{
|
||||||
build::watcher::{create_watcher, Watcher},
|
build::watcher::{Watcher, create_watcher},
|
||||||
config::{
|
config::{
|
||||||
|
DEFAULT_WATCH_PATTERNS, ProjectConfig, ProjectConfigInfo, ProjectObject, ScratchConfig,
|
||||||
build_globset, default_watch_patterns, path::platform_path_serde_option,
|
build_globset, default_watch_patterns, path::platform_path_serde_option,
|
||||||
save_project_config, ProjectConfig, ProjectConfigInfo, ProjectObject, ScratchConfig,
|
save_project_config,
|
||||||
DEFAULT_WATCH_PATTERNS,
|
|
||||||
},
|
},
|
||||||
diff::DiffObjConfig,
|
diff::DiffObjConfig,
|
||||||
jobs::{Job, JobQueue, JobResult},
|
jobs::{Job, JobQueue, JobResult},
|
||||||
@ -27,22 +27,22 @@ use time::UtcOffset;
|
|||||||
use typed_path::{Utf8PlatformPath, Utf8PlatformPathBuf};
|
use typed_path::{Utf8PlatformPath, Utf8PlatformPathBuf};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
app_config::{deserialize_config, AppConfigVersion},
|
app_config::{AppConfigVersion, deserialize_config},
|
||||||
config::{load_project_config, ProjectObjectNode},
|
config::{ProjectObjectNode, load_project_config},
|
||||||
jobs::{create_objdiff_config, egui_waker, start_build},
|
jobs::{create_objdiff_config, egui_waker, start_build},
|
||||||
views::{
|
views::{
|
||||||
appearance::{appearance_window, Appearance},
|
appearance::{Appearance, appearance_window},
|
||||||
config::{
|
config::{
|
||||||
arch_config_window, config_ui, general_config_ui, project_window, ConfigViewState,
|
CONFIG_DISABLED_TEXT, ConfigViewState, arch_config_window, config_ui,
|
||||||
CONFIG_DISABLED_TEXT,
|
general_config_ui, project_window,
|
||||||
},
|
},
|
||||||
debug::debug_window,
|
debug::debug_window,
|
||||||
demangle::{demangle_window, DemangleViewState},
|
demangle::{DemangleViewState, demangle_window},
|
||||||
diff::diff_view_ui,
|
diff::diff_view_ui,
|
||||||
frame_history::FrameHistory,
|
frame_history::FrameHistory,
|
||||||
graphics::{graphics_window, GraphicsConfig, GraphicsViewState},
|
graphics::{GraphicsConfig, GraphicsViewState, graphics_window},
|
||||||
jobs::{jobs_menu_ui, jobs_window},
|
jobs::{jobs_menu_ui, jobs_window},
|
||||||
rlwinm::{rlwinm_decode_window, RlwinmDecodeViewState},
|
rlwinm::{RlwinmDecodeViewState, rlwinm_decode_window},
|
||||||
symbol_diff::{DiffViewAction, DiffViewState, ResolvedNavigation, View},
|
symbol_diff::{DiffViewAction, DiffViewState, ResolvedNavigation, View},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -11,7 +11,7 @@ use objdiff_core::{
|
|||||||
};
|
};
|
||||||
use typed_path::{Utf8PlatformPathBuf, Utf8UnixPathBuf};
|
use typed_path::{Utf8PlatformPathBuf, Utf8UnixPathBuf};
|
||||||
|
|
||||||
use crate::app::{AppConfig, ObjectConfig, CONFIG_KEY};
|
use crate::app::{AppConfig, CONFIG_KEY, ObjectConfig};
|
||||||
|
|
||||||
#[derive(Clone, serde::Deserialize, serde::Serialize)]
|
#[derive(Clone, serde::Deserialize, serde::Serialize)]
|
||||||
pub struct AppConfigVersion {
|
pub struct AppConfigVersion {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use globset::Glob;
|
use globset::Glob;
|
||||||
use objdiff_core::config::{try_project_config, DEFAULT_WATCH_PATTERNS};
|
use objdiff_core::config::{DEFAULT_WATCH_PATTERNS, try_project_config};
|
||||||
use typed_path::{Utf8UnixComponent, Utf8UnixPath};
|
use typed_path::{Utf8UnixComponent, Utf8UnixPath};
|
||||||
|
|
||||||
use crate::app::{AppState, ObjectConfig};
|
use crate::app::{AppState, ObjectConfig};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use egui::{
|
use egui::{
|
||||||
style::ScrollAnimation, vec2, Context, Key, KeyboardShortcut, Modifiers, PointerButton,
|
Context, Key, KeyboardShortcut, Modifiers, PointerButton, style::ScrollAnimation, vec2,
|
||||||
};
|
};
|
||||||
|
|
||||||
fn any_widget_focused(ctx: &Context) -> bool { ctx.memory(|mem| mem.focused().is_some()) }
|
fn any_widget_focused(ctx: &Context) -> bool { ctx.memory(|mem| mem.focused().is_some()) }
|
||||||
|
@ -3,18 +3,18 @@ use std::{
|
|||||||
task::{Wake, Waker},
|
task::{Wake, Waker},
|
||||||
};
|
};
|
||||||
|
|
||||||
use anyhow::{bail, Result};
|
use anyhow::{Result, bail};
|
||||||
use jobs::create_scratch;
|
use jobs::create_scratch;
|
||||||
use objdiff_core::{
|
use objdiff_core::{
|
||||||
build::BuildConfig,
|
build::BuildConfig,
|
||||||
diff::MappingConfig,
|
diff::MappingConfig,
|
||||||
jobs,
|
jobs,
|
||||||
jobs::{check_update::CheckUpdateConfig, objdiff, update::UpdateConfig, Job, JobQueue},
|
jobs::{Job, JobQueue, check_update::CheckUpdateConfig, objdiff, update::UpdateConfig},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
app::{AppConfig, AppState},
|
app::{AppConfig, AppState},
|
||||||
update::{build_updater, BIN_NAME_NEW, BIN_NAME_OLD},
|
update::{BIN_NAME_NEW, BIN_NAME_OLD, build_updater},
|
||||||
};
|
};
|
||||||
|
|
||||||
struct EguiWaker(egui::Context);
|
struct EguiWaker(egui::Context);
|
||||||
|
@ -17,12 +17,12 @@ use std::{
|
|||||||
sync::{Arc, Mutex},
|
sync::{Arc, Mutex},
|
||||||
};
|
};
|
||||||
|
|
||||||
use anyhow::{ensure, Result};
|
use anyhow::{Result, ensure};
|
||||||
use cfg_if::cfg_if;
|
use cfg_if::cfg_if;
|
||||||
use time::UtcOffset;
|
use time::UtcOffset;
|
||||||
use tracing_subscriber::EnvFilter;
|
use tracing_subscriber::EnvFilter;
|
||||||
|
|
||||||
use crate::views::graphics::{load_graphics_config, GraphicsBackend, GraphicsConfig};
|
use crate::views::graphics::{GraphicsBackend, GraphicsConfig, load_graphics_config};
|
||||||
|
|
||||||
fn load_icon() -> Result<egui::IconData> {
|
fn load_icon() -> Result<egui::IconData> {
|
||||||
let decoder = png::Decoder::new(include_bytes!("../assets/icon_64.png").as_ref());
|
let decoder = png::Decoder::new(include_bytes!("../assets/icon_64.png").as_ref());
|
||||||
@ -86,7 +86,7 @@ fn main() -> ExitCode {
|
|||||||
}
|
}
|
||||||
#[cfg(feature = "wgpu")]
|
#[cfg(feature = "wgpu")]
|
||||||
{
|
{
|
||||||
use eframe::egui_wgpu::{wgpu, WgpuSetup};
|
use eframe::egui_wgpu::{WgpuSetup, wgpu};
|
||||||
if graphics_config.desired_backend.is_supported() {
|
if graphics_config.desired_backend.is_supported() {
|
||||||
native_options.wgpu_options.wgpu_setup = match native_options.wgpu_options.wgpu_setup {
|
native_options.wgpu_options.wgpu_setup = match native_options.wgpu_options.wgpu_setup {
|
||||||
WgpuSetup::CreateNew(mut setup) => {
|
WgpuSetup::CreateNew(mut setup) => {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use egui::{text::LayoutJob, Color32, FontFamily, FontId, TextFormat, TextStyle, Widget};
|
use egui::{Color32, FontFamily, FontId, TextFormat, TextStyle, Widget, text::LayoutJob};
|
||||||
use time::UtcOffset;
|
use time::UtcOffset;
|
||||||
|
|
||||||
use crate::fonts::load_font_if_needed;
|
use crate::fonts::load_font_if_needed;
|
||||||
|
@ -5,17 +5,17 @@ use std::{mem::take, path::MAIN_SEPARATOR};
|
|||||||
#[cfg(all(windows, feature = "wsl"))]
|
#[cfg(all(windows, feature = "wsl"))]
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
use egui::{
|
use egui::{
|
||||||
output::OpenUrl, text::LayoutJob, CollapsingHeader, FontFamily, FontId, RichText,
|
CollapsingHeader, FontFamily, FontId, RichText, SelectableLabel, TextFormat, Widget,
|
||||||
SelectableLabel, TextFormat, Widget,
|
output::OpenUrl, text::LayoutJob,
|
||||||
};
|
};
|
||||||
use globset::Glob;
|
use globset::Glob;
|
||||||
use objdiff_core::{
|
use objdiff_core::{
|
||||||
config::{path::check_path_buf, DEFAULT_WATCH_PATTERNS},
|
config::{DEFAULT_WATCH_PATTERNS, path::check_path_buf},
|
||||||
diff::{
|
diff::{
|
||||||
ConfigEnum, ConfigEnumVariantInfo, ConfigPropertyId, ConfigPropertyKind,
|
CONFIG_GROUPS, ConfigEnum, ConfigEnumVariantInfo, ConfigPropertyId, ConfigPropertyKind,
|
||||||
ConfigPropertyValue, CONFIG_GROUPS,
|
ConfigPropertyValue,
|
||||||
},
|
},
|
||||||
jobs::{check_update::CheckUpdateResult, Job, JobQueue, JobResult},
|
jobs::{Job, JobQueue, JobResult, check_update::CheckUpdateResult},
|
||||||
};
|
};
|
||||||
use typed_path::Utf8PlatformPathBuf;
|
use typed_path::Utf8PlatformPathBuf;
|
||||||
|
|
||||||
@ -347,11 +347,7 @@ fn display_unit(
|
|||||||
let color = if selected {
|
let color = if selected {
|
||||||
appearance.emphasized_text_color
|
appearance.emphasized_text_color
|
||||||
} else if let Some(complete) = object.complete {
|
} else if let Some(complete) = object.complete {
|
||||||
if complete {
|
if complete { appearance.insert_color } else { appearance.delete_color }
|
||||||
appearance.insert_color
|
|
||||||
} else {
|
|
||||||
appearance.delete_color
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
appearance.text_color
|
appearance.text_color
|
||||||
};
|
};
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
use std::{cmp::min, default::Default, mem::take};
|
use std::{cmp::min, default::Default, mem::take};
|
||||||
|
|
||||||
use egui::{text::LayoutJob, Label, Sense, Widget};
|
use egui::{Label, Sense, Widget, text::LayoutJob};
|
||||||
use objdiff_core::{
|
use objdiff_core::{
|
||||||
diff::{
|
diff::{
|
||||||
data::resolve_relocation,
|
|
||||||
display::{relocation_context, relocation_hover, ContextItem, HoverItem},
|
|
||||||
DataDiff, DataDiffKind, DataRelocationDiff,
|
DataDiff, DataDiffKind, DataRelocationDiff,
|
||||||
|
data::resolve_relocation,
|
||||||
|
display::{ContextItem, HoverItem, relocation_context, relocation_hover},
|
||||||
},
|
},
|
||||||
obj::Object,
|
obj::Object,
|
||||||
};
|
};
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
use egui::{text::LayoutJob, Id, Layout, RichText, ScrollArea, TextEdit, Ui, Widget};
|
use egui::{Id, Layout, RichText, ScrollArea, TextEdit, Ui, Widget, text::LayoutJob};
|
||||||
use objdiff_core::{
|
use objdiff_core::{
|
||||||
build::BuildStatus,
|
build::BuildStatus,
|
||||||
diff::{
|
diff::{
|
||||||
display::{ContextItem, HoverItem, HoverItemColor, SymbolFilter, SymbolNavigationKind},
|
|
||||||
DiffObjConfig, ObjectDiff, SectionDiff, SymbolDiff,
|
DiffObjConfig, ObjectDiff, SectionDiff, SymbolDiff,
|
||||||
|
display::{ContextItem, HoverItem, HoverItemColor, SymbolFilter, SymbolNavigationKind},
|
||||||
},
|
},
|
||||||
obj::{Object, Section, Symbol},
|
obj::{Object, Section, Symbol},
|
||||||
};
|
};
|
||||||
@ -14,13 +14,12 @@ use crate::{
|
|||||||
views::{
|
views::{
|
||||||
appearance::Appearance,
|
appearance::Appearance,
|
||||||
column_layout::{render_header, render_strips, render_table},
|
column_layout::{render_header, render_strips, render_table},
|
||||||
data_diff::{data_row_ui, split_diffs, BYTES_PER_ROW},
|
data_diff::{BYTES_PER_ROW, data_row_ui, split_diffs},
|
||||||
extab_diff::extab_ui,
|
extab_diff::extab_ui,
|
||||||
function_diff::{asm_col_ui, FunctionDiffContext},
|
function_diff::{FunctionDiffContext, asm_col_ui},
|
||||||
symbol_diff::{
|
symbol_diff::{
|
||||||
match_color_for_symbol, symbol_context_menu_ui, symbol_hover_ui, symbol_list_ui,
|
|
||||||
DiffViewAction, DiffViewNavigation, DiffViewState, SymbolDiffContext, SymbolRefByName,
|
DiffViewAction, DiffViewNavigation, DiffViewState, SymbolDiffContext, SymbolRefByName,
|
||||||
View,
|
View, match_color_for_symbol, symbol_context_menu_ui, symbol_hover_ui, symbol_list_ui,
|
||||||
},
|
},
|
||||||
write_text,
|
write_text,
|
||||||
},
|
},
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
use std::{cmp::Ordering, default::Default};
|
use std::{cmp::Ordering, default::Default};
|
||||||
|
|
||||||
use egui::{text::LayoutJob, Label, Response, Sense, Widget};
|
use egui::{Label, Response, Sense, Widget, text::LayoutJob};
|
||||||
use egui_extras::TableRow;
|
use egui_extras::TableRow;
|
||||||
use objdiff_core::{
|
use objdiff_core::{
|
||||||
diff::{
|
diff::{
|
||||||
display::{
|
|
||||||
display_row, instruction_context, instruction_hover, DiffText, DiffTextColor,
|
|
||||||
DiffTextSegment, HighlightKind,
|
|
||||||
},
|
|
||||||
DiffObjConfig, InstructionDiffKind, InstructionDiffRow, ObjectDiff,
|
DiffObjConfig, InstructionDiffKind, InstructionDiffRow, ObjectDiff,
|
||||||
|
display::{
|
||||||
|
DiffText, DiffTextColor, DiffTextSegment, HighlightKind, display_row,
|
||||||
|
instruction_context, instruction_hover,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
obj::{InstructionArgValue, InstructionRef, Object},
|
obj::{InstructionArgValue, InstructionRef, Object},
|
||||||
util::ReallySigned,
|
util::ReallySigned,
|
||||||
|
@ -5,7 +5,7 @@ use std::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use egui::{text::LayoutJob, Context, FontId, RichText, TextFormat, TextStyle, Window};
|
use egui::{Context, FontId, RichText, TextFormat, TextStyle, Window, text::LayoutJob};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::views::{appearance::Appearance, frame_history::FrameHistory};
|
use crate::views::{appearance::Appearance, frame_history::FrameHistory};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use egui::{text::LayoutJob, Color32, FontId, TextFormat};
|
use egui::{Color32, FontId, TextFormat, text::LayoutJob};
|
||||||
|
|
||||||
pub(crate) mod appearance;
|
pub(crate) mod appearance;
|
||||||
pub(crate) mod column_layout;
|
pub(crate) mod column_layout;
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
use std::mem::take;
|
use std::mem::take;
|
||||||
|
|
||||||
use egui::{
|
use egui::{
|
||||||
style::ScrollAnimation, text::LayoutJob, CollapsingHeader, Color32, Id, OpenUrl, ScrollArea,
|
CollapsingHeader, Color32, Id, OpenUrl, ScrollArea, SelectableLabel, Ui, Widget,
|
||||||
SelectableLabel, Ui, Widget,
|
style::ScrollAnimation, text::LayoutJob,
|
||||||
};
|
};
|
||||||
use objdiff_core::{
|
use objdiff_core::{
|
||||||
diff::{
|
diff::{
|
||||||
display::{
|
|
||||||
display_sections, symbol_context, symbol_hover, HighlightKind, SectionDisplay,
|
|
||||||
SymbolFilter, SymbolNavigationKind,
|
|
||||||
},
|
|
||||||
ObjectDiff, SymbolDiff,
|
ObjectDiff, SymbolDiff,
|
||||||
|
display::{
|
||||||
|
HighlightKind, SectionDisplay, SymbolFilter, SymbolNavigationKind, display_sections,
|
||||||
|
symbol_context, symbol_hover,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
jobs::{create_scratch::CreateScratchResult, objdiff::ObjDiffResult, Job, JobQueue, JobResult},
|
jobs::{Job, JobQueue, JobResult, create_scratch::CreateScratchResult, objdiff::ObjDiffResult},
|
||||||
obj::{Object, Section, SectionKind, Symbol, SymbolFlag},
|
obj::{Object, Section, SectionKind, Symbol, SymbolFlag},
|
||||||
};
|
};
|
||||||
use regex::{Regex, RegexBuilder};
|
use regex::{Regex, RegexBuilder};
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
//! this is defined as a "weak" symbol. This means that other definitions are
|
//! this is defined as a "weak" symbol. This means that other definitions are
|
||||||
//! allowed to overwrite it if they are present in a compilation.
|
//! allowed to overwrite it if they are present in a compilation.
|
||||||
|
|
||||||
use alloc::{alloc, Layout};
|
use alloc::{Layout, alloc};
|
||||||
use core::ptr;
|
use core::ptr;
|
||||||
|
|
||||||
#[used]
|
#[used]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user