Update all dependencies & use ppc750cl InsIter

This commit is contained in:
Luke Street 2024-04-30 20:06:04 -06:00
parent 106652ae7d
commit 2c46286aff
12 changed files with 729 additions and 629 deletions

1243
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -82,8 +82,6 @@ allow = [
"0BSD",
"OFL-1.1",
"LicenseRef-UFL-1.0",
"OpenSSL",
"GPL-3.0",
]
# List of explictly disallowed licenses
# See https://spdx.org/licenses/ for list of possible licenses

View File

@ -14,16 +14,16 @@ publish = false
build = "build.rs"
[dependencies]
anyhow = "1.0.81"
anyhow = "1.0.82"
argp = "0.3.0"
crossterm = "0.27.0"
enable-ansi-support = "0.2.1"
objdiff-core = { path = "../objdiff-core", features = ["all"] }
ratatui = "0.26.1"
rayon = "1.9.0"
ratatui = "0.26.2"
rayon = "1.10.0"
serde = { version = "1", features = ["derive"] }
serde_json = "1.0.114"
serde_json = "1.0.116"
supports-color = "3.0.0"
time = { version = "0.3.34", features = ["formatting", "local-offset"] }
time = { version = "0.3.36", features = ["formatting", "local-offset"] }
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }

View File

@ -2,7 +2,7 @@ mod argp_version;
mod cmd;
mod util;
use std::{env, ffi::OsStr, path::PathBuf, str::FromStr};
use std::{env, ffi::OsStr, fmt::Display, path::PathBuf, str::FromStr};
use anyhow::{Error, Result};
use argp::{FromArgValue, FromArgs};
@ -34,16 +34,15 @@ impl FromStr for LogLevel {
}
}
impl ToString for LogLevel {
fn to_string(&self) -> String {
match self {
impl Display for LogLevel {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(match self {
LogLevel::Error => "error",
LogLevel::Warn => "warn",
LogLevel::Info => "info",
LogLevel::Debug => "debug",
LogLevel::Trace => "trace",
}
.to_string()
})
}
}

View File

@ -21,32 +21,32 @@ ppc = ["any-arch", "cwdemangle", "ppc750cl"]
x86 = ["any-arch", "cpp_demangle", "iced-x86", "msvc-demangler"]
[dependencies]
anyhow = "1.0.81"
anyhow = "1.0.82"
byteorder = "1.5.0"
filetime = "0.2.23"
flagset = "0.4.5"
log = "0.4.21"
memmap2 = "0.9.4"
num-traits = "0.2.18"
object = { version = "0.34.0", features = ["read_core", "std", "elf", "pe"], default-features = false }
object = { version = "0.35.0", features = ["read_core", "std", "elf", "pe"], default-features = false }
serde = { version = "1", features = ["derive"] }
similar = { version = "2.4.0", default-features = false }
similar = { version = "2.5.0", default-features = false }
# config
globset = { version = "0.4.14", features = ["serde1"], optional = true }
semver = { version = "1.0.22", optional = true }
serde_json = { version = "1.0.114", optional = true }
serde_yaml = { version = "0.9.32", optional = true }
serde_json = { version = "1.0.116", optional = true }
serde_yaml = { version = "0.9.34", optional = true }
# dwarf
gimli = { version = "0.28.1", default-features = false, features = ["read-all"], optional = true }
gimli = { version = "0.29.0", default-features = false, features = ["read-all"], optional = true }
# ppc
cwdemangle = { version = "1.0.0", optional = true }
ppc750cl = { git = "https://github.com/encounter/ppc750cl", rev = "d31bf75009e4efc102fc2b3b33fb7cd041859942", optional = true }
ppc750cl = { git = "https://github.com/encounter/ppc750cl", rev = "6cbd7d888c7082c2c860f66cbb9848d633f753ed", optional = true }
# mips
rabbitizer = { version = "1.9.2", optional = true }
rabbitizer = { version = "1.10.0", optional = true }
# x86
cpp_demangle = { version = "0.4.3", optional = true }

View File

@ -2,7 +2,7 @@ use std::borrow::Cow;
use anyhow::{bail, Result};
use object::{elf, File, Relocation, RelocationFlags};
use ppc750cl::{Argument, GPR};
use ppc750cl::{Argument, GPR, InsIter};
use crate::{
arch::{ObjArch, ProcessCodeResult},
@ -42,24 +42,21 @@ impl ObjArch for ObjArchPpc {
let ins_count = code.len() / 4;
let mut ops = Vec::<u16>::with_capacity(ins_count);
let mut insts = Vec::<ObjIns>::with_capacity(ins_count);
let mut cur_addr = symbol.address as u32;
for chunk in code.chunks_exact(4) {
let mut code = u32::from_be_bytes(chunk.try_into()?);
for (cur_addr, mut ins) in InsIter::new(code, symbol.address as u32) {
let reloc = section.relocations.iter().find(|r| (r.address as u32 & !3) == cur_addr);
if let Some(reloc) = reloc {
// Zero out relocations
code = match reloc.flags {
RelocationFlags::Elf { r_type: elf::R_PPC_EMB_SDA21 } => code & !0x1FFFFF,
RelocationFlags::Elf { r_type: elf::R_PPC_REL24 } => code & !0x3FFFFFC,
RelocationFlags::Elf { r_type: elf::R_PPC_REL14 } => code & !0xFFFC,
ins.code = match reloc.flags {
RelocationFlags::Elf { r_type: elf::R_PPC_EMB_SDA21 } => ins.code & !0x1FFFFF,
RelocationFlags::Elf { r_type: elf::R_PPC_REL24 } => ins.code & !0x3FFFFFC,
RelocationFlags::Elf { r_type: elf::R_PPC_REL14 } => ins.code & !0xFFFC,
RelocationFlags::Elf {
r_type: elf::R_PPC_ADDR16_HI | elf::R_PPC_ADDR16_HA | elf::R_PPC_ADDR16_LO,
} => code & !0xFFFF,
_ => code,
} => ins.code & !0xFFFF,
_ => ins.code,
};
}
let ins = ppc750cl::Ins::new(code);
let orig = ins.basic().to_string();
let simplified = ins.simplified();
@ -149,7 +146,6 @@ impl ObjArch for ObjArchPpc {
line,
orig: Some(orig),
});
cur_addr += 4;
}
Ok(ProcessCodeResult { ops, insts })
}

View File

@ -294,7 +294,7 @@ fn line_info(obj_file: &File<'_>) -> Result<Option<BTreeMap<u64, u64>>> {
// DWARF 2+
#[cfg(feature = "dwarf")]
{
let dwarf_cow = gimli::Dwarf::load(|id| {
let dwarf_cow = gimli::DwarfSections::load(|id| {
Ok::<_, gimli::Error>(
obj_file
.section_by_name(id.name())

View File

@ -23,41 +23,41 @@ wgpu = ["eframe/wgpu"]
wsl = []
[dependencies]
anyhow = "1.0.81"
bytes = "1.5.0"
anyhow = "1.0.82"
bytes = "1.6.0"
cfg-if = "1.0.0"
const_format = "0.2.32"
cwdemangle = "1.0.0"
dirs = "5.0.1"
eframe = { version = "0.26.2", features = ["persistence"] }
egui = "0.26.2"
egui_extras = "0.26.2"
eframe = { version = "0.27.2", features = ["persistence"] }
egui = "0.27.2"
egui_extras = "0.27.2"
filetime = "0.2.23"
float-ord = "0.3.2"
font-kit = "0.12.0"
font-kit = "0.13.0"
globset = { version = "0.4.14", features = ["serde1"] }
log = "0.4.21"
notify = "6.1.1"
objdiff-core = { path = "../objdiff-core", features = ["all"] }
png = "0.17.13"
pollster = "0.3.0"
rfd = { version = "0.14.0" } #, default-features = false, features = ['xdg-portal']
rfd = { version = "0.14.1" } #, default-features = false, features = ['xdg-portal']
ron = "0.8.1"
serde = { version = "1", features = ["derive"] }
serde_json = "1.0.114"
serde_json = "1.0.116"
shell-escape = "0.1.5"
tempfile = "3.10.1"
time = { version = "0.3.34", features = ["formatting", "local-offset"] }
time = { version = "0.3.36", features = ["formatting", "local-offset"] }
# For Linux static binaries, use rustls
[target.'cfg(target_os = "linux")'.dependencies]
reqwest = { version = "0.11.26", default-features = false, features = ["blocking", "json", "multipart", "rustls"] }
self_update = { version = "0.39.0", default-features = false, features = ["rustls"] }
reqwest = { version = "0.12.4", default-features = false, features = ["blocking", "json", "multipart", "rustls-tls"] }
self_update = { version = "0.40.0", default-features = false, features = ["rustls"] }
# For all other platforms, use native TLS
[target.'cfg(not(target_os = "linux"))'.dependencies]
reqwest = { version = "0.11.26", default-features = false, features = ["blocking", "json", "multipart", "default-tls"] }
self_update = "0.39.0"
reqwest = { version = "0.12.4", default-features = false, features = ["blocking", "json", "multipart", "default-tls"] }
self_update = "0.40.0"
[target.'cfg(windows)'.dependencies]
path-slash = "0.2.1"
@ -79,5 +79,5 @@ console_error_panic_hook = "0.1.7"
tracing-wasm = "0.2"
[build-dependencies]
anyhow = "1.0.81"
anyhow = "1.0.82"
vergen = { version = "8.3.1", features = ["build", "cargo", "git", "gitcl"] }

View File

@ -123,8 +123,6 @@ pub struct AppConfig {
#[serde(skip)]
pub queue_reload: bool,
#[serde(skip)]
pub queue_scratch: bool,
#[serde(skip)]
pub project_config_info: Option<ProjectConfigInfo>,
}
@ -152,7 +150,6 @@ impl Default for AppConfig {
obj_change: false,
queue_build: false,
queue_reload: false,
queue_scratch: false,
project_config_info: None,
}
}

View File

@ -10,12 +10,12 @@ pub struct LoadedFontFamily {
pub family_name: String,
pub fonts: Vec<font_kit::font::Font>,
pub handles: Vec<font_kit::handle::Handle>,
pub properties: Vec<font_kit::properties::Properties>,
// pub properties: Vec<font_kit::properties::Properties>,
pub default_index: usize,
}
pub struct LoadedFont {
pub font_name: String,
// pub font_name: String,
pub font_data: egui::FontData,
}
@ -48,13 +48,13 @@ pub fn load_font_family(
family_name: font_family_name,
fonts: loaded,
handles,
properties,
// properties,
default_index,
})
}
pub fn load_font(handle: &font_kit::handle::Handle) -> Result<LoadedFont> {
let loaded = font_kit::loaders::default::Font::from_handle(handle)?;
// let loaded = font_kit::loaders::default::Font::from_handle(handle)?;
let data = match handle {
font_kit::handle::Handle::Memory { bytes, font_index } => egui::FontData {
font: Cow::Owned(bytes.to_vec()),
@ -68,7 +68,10 @@ pub fn load_font(handle: &font_kit::handle::Handle) -> Result<LoadedFont> {
egui::FontData { font: Cow::Owned(vec), index: *font_index, tweak: Default::default() }
}
};
Ok(LoadedFont { font_name: loaded.full_name(), font_data: data })
Ok(LoadedFont {
// font_name: loaded.full_name(),
font_data: data,
})
}
pub fn load_font_if_needed(

View File

@ -114,12 +114,12 @@ fn ins_context_menu(ui: &mut egui::Ui, ins: &ObjIns) {
if let Some(reloc) = &ins.reloc {
if let Some(name) = &reloc.target.demangled_name {
if ui.button(format!("Copy \"{name}\"")).clicked() {
ui.output_mut(|output| output.copied_text = name.clone());
ui.output_mut(|output| output.copied_text.clone_from(name));
ui.close_menu();
}
}
if ui.button(format!("Copy \"{}\"", reloc.target.name)).clicked() {
ui.output_mut(|output| output.copied_text = reloc.target.name.clone());
ui.output_mut(|output| output.copied_text.clone_from(&reloc.target.name));
ui.close_menu();
}
}

View File

@ -138,12 +138,12 @@ fn symbol_context_menu_ui(ui: &mut Ui, symbol: &ObjSymbol) {
if let Some(name) = &symbol.demangled_name {
if ui.button(format!("Copy \"{name}\"")).clicked() {
ui.output_mut(|output| output.copied_text = name.clone());
ui.output_mut(|output| output.copied_text.clone_from(name));
ui.close_menu();
}
}
if ui.button(format!("Copy \"{}\"", symbol.name)).clicked() {
ui.output_mut(|output| output.copied_text = symbol.name.clone());
ui.output_mut(|output| output.copied_text.clone_from(&symbol.name));
ui.close_menu();
}
if let Some(address) = symbol.virtual_address {
@ -334,7 +334,7 @@ fn build_log_ui(ui: &mut Ui, status: &BuildStatus, appearance: &Appearance) {
ScrollArea::both().auto_shrink([false, false]).show(ui, |ui| {
ui.horizontal(|ui| {
if ui.button("Copy command").clicked() {
ui.output_mut(|output| output.copied_text = status.cmdline.clone());
ui.output_mut(|output| output.copied_text.clone_from(&status.cmdline));
}
if ui.button("Copy log").clicked() {
ui.output_mut(|output| {