Compare commits

...

10 Commits

Author SHA1 Message Date
Luke Street 2ab519d361 Update rabbitizer, deny.toml 2023-01-21 01:36:32 -05:00
Nick Condron 3406c76973
Simplify Affix::find (#24)
* Rewrite Affix::find to be much simpler

* Rename Affix::find parameters to not be string

* Remove unused `LevMatchingBlock` struct

* Make `Affix` type simpler
2023-01-21 01:28:33 -05:00
Nick Condron 6afc535fad
Replace panic! with Option (#25) 2023-01-21 01:27:37 -05:00
Anghelo Carvajal ec062bf5ca
User rabbitizer crate (#22)
* Start using rabbitizer crate

* Fix reference problem

* bump rabbitizer version
2023-01-21 01:27:09 -05:00
Luke Street 500965aacb Clippy fix 2023-01-21 01:14:16 -05:00
Luke Street a8c2514377 Changes for egui/object upgrades 2023-01-21 01:13:20 -05:00
Luke Street 4b58f69461 Upgrade all dependencies 2023-01-21 00:54:54 -05:00
Luke Street cd01b6254c Use rustls on Linux 2023-01-21 00:06:22 -05:00
Luke Street bea0a0007d Initial support for line number info 2023-01-21 00:03:56 -05:00
Luke Street ba74d63a99 Fix data diffing 2023-01-17 19:33:31 -05:00
13 changed files with 1036 additions and 847 deletions

1037
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
[package] [package]
name = "objdiff" name = "objdiff"
version = "0.2.3" version = "0.3.0"
edition = "2021" edition = "2021"
rust-version = "1.65" rust-version = "1.65"
authors = ["Luke Street <luke@street.dev>"] authors = ["Luke Street <luke@street.dev>"]
@ -17,31 +17,40 @@ lto = "thin"
strip = "debuginfo" strip = "debuginfo"
[dependencies] [dependencies]
anyhow = "1.0.66" anyhow = "1.0.68"
bytes = "1.3.0" bytes = "1.3.0"
cfg-if = "1.0.0" cfg-if = "1.0.0"
const_format = "0.2.30" const_format = "0.2.30"
cwdemangle = { git = "https://github.com/encounter/cwdemangle", rev = "286f3d1d29ee2457db89043782725631845c3e4c" } cwdemangle = "0.1.4"
eframe = { version = "0.19.0", features = ["persistence"] } # , "wgpu" eframe = { version = "0.20.1", features = ["persistence"] } # , "wgpu"
egui = "0.19.0" egui = "0.20.1"
egui_extras = "0.19.0" egui_extras = "0.20.0"
flagset = "0.4.3" flagset = "0.4.3"
log = "0.4.17" log = "0.4.17"
memmap2 = "0.5.8" memmap2 = "0.5.8"
notify = "5.0.0" notify = "5.0.0"
object = { version = "0.30.0", features = ["read_core", "std", "elf"], default-features = false } object = { version = "0.30.2", features = ["read_core", "std", "elf"], default-features = false }
png = "0.17.7" png = "0.17.7"
ppc750cl = { git = "https://github.com/encounter/ppc750cl", rev = "aa631a33de7882c679afca89350898b87cb3ba3f" } ppc750cl = { git = "https://github.com/terorie/ppc750cl", rev = "9ae36eef34aa6d74e00972c7671f547a2acfd0aa" }
rabbitizer = { git = "https://github.com/encounter/rabbitizer-rs", rev = "10c279b2ef251c62885b1dcdcfe740b0db8e9956" } rabbitizer = "1.5.8"
reqwest = "0.11.13" rfd = { version = "0.10.0" } #, default-features = false, features = ['xdg-portal']
rfd = { version = "0.10.0" } # , default-features = false, features = ['xdg-portal']
self_update = "0.32.0"
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
tempfile = "3.3.0" tempfile = "3.3.0"
thiserror = "1.0.37" thiserror = "1.0.38"
time = { version = "0.3.17", features = ["formatting", "local-offset"] } time = { version = "0.3.17", features = ["formatting", "local-offset"] }
toml = "0.5.9" toml = "0.5.11"
twox-hash = "1.6.3" twox-hash = "1.6.3"
byteorder = "1.4.3"
# For Linux static binaries, use rustls
[target.'cfg(target_os = "linux")'.dependencies]
reqwest = { version = "0.11.14", default-features = false, features = ["blocking", "json", "rustls"] }
self_update = { version = "0.34.0", default-features = false, features = ["rustls"] }
# For all other platforms, use native TLS
[target.'cfg(not(target_os = "linux"))'.dependencies]
reqwest = "0.11.14"
self_update = "0.34.0"
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
path-slash = "0.2.1" path-slash = "0.2.1"
@ -63,5 +72,5 @@ console_error_panic_hook = "0.1.7"
tracing-wasm = "0.2" tracing-wasm = "0.2"
[build-dependencies] [build-dependencies]
anyhow = "1.0.66" anyhow = "1.0.68"
vergen = { version = "7.4.3", features = ["build", "cargo", "git"], default-features = false } vergen = { version = "7.5.0", features = ["build", "cargo", "git"], default-features = false }

View File

@ -48,7 +48,9 @@ notice = "warn"
# A list of advisory IDs to ignore. Note that ignored advisories will still # A list of advisory IDs to ignore. Note that ignored advisories will still
# output a note when they are encountered. # output a note when they are encountered.
ignore = [ ignore = [
#"RUSTSEC-0000-0000", # git2 (build dependency)
"RUSTSEC-2023-0002",
"RUSTSEC-2023-0003",
] ]
# Threshold for security vulnerabilities, any vulnerability with a CVSS score # Threshold for security vulnerabilities, any vulnerability with a CVSS score
# lower than the range specified will be ignored. Note that ignored advisories # lower than the range specified will be ignored. Note that ignored advisories
@ -81,6 +83,9 @@ allow = [
"Unicode-DFS-2016", "Unicode-DFS-2016",
"Zlib", "Zlib",
"0BSD", "0BSD",
"OFL-1.1",
"LicenseRef-UFL-1.0",
"OpenSSL",
] ]
# List of explictly disallowed licenses # List of explictly disallowed licenses
# See https://spdx.org/licenses/ for list of possible licenses # See https://spdx.org/licenses/ for list of possible licenses
@ -118,22 +123,22 @@ exceptions = [
# Some crates don't have (easily) machine readable licensing information, # Some crates don't have (easily) machine readable licensing information,
# adding a clarification entry for it allows you to manually specify the # adding a clarification entry for it allows you to manually specify the
# licensing information # licensing information
#[[licenses.clarify]] [[licenses.clarify]]
# The name of the crate the clarification applies to # The name of the crate the clarification applies to
#name = "ring" name = "ring"
# The optional version constraint for the crate # The optional version constraint for the crate
#version = "*" version = "*"
# The SPDX expression for the license requirements of the crate # The SPDX expression for the license requirements of the crate
#expression = "MIT AND ISC AND OpenSSL" expression = "MIT AND ISC AND OpenSSL"
# One or more files in the crate's source used as the "source of truth" for # One or more files in the crate's source used as the "source of truth" for
# the license expression. If the contents match, the clarification will be used # the license expression. If the contents match, the clarification will be used
# when running the license check, otherwise the clarification will be ignored # when running the license check, otherwise the clarification will be ignored
# and the crate will be checked normally, which may produce warnings or errors # and the crate will be checked normally, which may produce warnings or errors
# depending on the rest of your configuration # depending on the rest of your configuration
#license-files = [ license-files = [
# Each entry is a crate relative path, and the (opaque) hash of its contents # Each entry is a crate relative path, and the (opaque) hash of its contents
#{ path = "LICENSE", hash = 0xbd0eed23 } { path = "LICENSE", hash = 0xbd0eed23 }
#] ]
[licenses.private] [licenses.private]
# If true, ignores workspace crates that aren't published, or are only # If true, ignores workspace crates that aren't published, or are only

View File

@ -17,14 +17,19 @@ fn no_diff_code(
data: &[u8], data: &[u8],
symbol: &mut ObjSymbol, symbol: &mut ObjSymbol,
relocs: &[ObjReloc], relocs: &[ObjReloc],
line_info: &Option<BTreeMap<u32, u32>>,
) -> Result<()> { ) -> Result<()> {
let code = let code =
&data[symbol.section_address as usize..(symbol.section_address + symbol.size) as usize]; &data[symbol.section_address as usize..(symbol.section_address + symbol.size) as usize];
let (_, ins) = match arch { let (_, ins) = match arch {
ObjArchitecture::PowerPc => ppc::process_code(code, symbol.address, relocs)?, ObjArchitecture::PowerPc => ppc::process_code(code, symbol.address, relocs, line_info)?,
ObjArchitecture::Mips => { ObjArchitecture::Mips => mips::process_code(
mips::process_code(code, symbol.address, symbol.address + symbol.size, relocs)? code,
} symbol.address,
symbol.address + symbol.size,
relocs,
line_info,
)?,
}; };
let mut diff = Vec::<ObjInsDiff>::new(); let mut diff = Vec::<ObjInsDiff>::new();
@ -36,6 +41,7 @@ fn no_diff_code(
Ok(()) Ok(())
} }
#[allow(clippy::too_many_arguments)]
pub fn diff_code( pub fn diff_code(
arch: ObjArchitecture, arch: ObjArchitecture,
left_data: &[u8], left_data: &[u8],
@ -44,6 +50,8 @@ pub fn diff_code(
right_symbol: &mut ObjSymbol, right_symbol: &mut ObjSymbol,
left_relocs: &[ObjReloc], left_relocs: &[ObjReloc],
right_relocs: &[ObjReloc], right_relocs: &[ObjReloc],
left_line_info: &Option<BTreeMap<u32, u32>>,
right_line_info: &Option<BTreeMap<u32, u32>>,
) -> Result<()> { ) -> Result<()> {
let left_code = &left_data[left_symbol.section_address as usize let left_code = &left_data[left_symbol.section_address as usize
..(left_symbol.section_address + left_symbol.size) as usize]; ..(left_symbol.section_address + left_symbol.size) as usize];
@ -51,8 +59,8 @@ pub fn diff_code(
..(right_symbol.section_address + right_symbol.size) as usize]; ..(right_symbol.section_address + right_symbol.size) as usize];
let ((left_ops, left_insts), (right_ops, right_insts)) = match arch { let ((left_ops, left_insts), (right_ops, right_insts)) = match arch {
ObjArchitecture::PowerPc => ( ObjArchitecture::PowerPc => (
ppc::process_code(left_code, left_symbol.address, left_relocs)?, ppc::process_code(left_code, left_symbol.address, left_relocs, left_line_info)?,
ppc::process_code(right_code, right_symbol.address, right_relocs)?, ppc::process_code(right_code, right_symbol.address, right_relocs, right_line_info)?,
), ),
ObjArchitecture::Mips => ( ObjArchitecture::Mips => (
mips::process_code( mips::process_code(
@ -60,12 +68,14 @@ pub fn diff_code(
left_symbol.address, left_symbol.address,
left_symbol.address + left_symbol.size, left_symbol.address + left_symbol.size,
left_relocs, left_relocs,
left_line_info,
)?, )?,
mips::process_code( mips::process_code(
right_code, right_code,
right_symbol.address, right_symbol.address,
left_symbol.address + left_symbol.size, left_symbol.address + left_symbol.size,
right_relocs, right_relocs,
right_line_info,
)?, )?,
), ),
}; };
@ -353,17 +363,13 @@ fn compare_ins(
Ok(result) Ok(result)
} }
fn find_section<'a>(obj: &'a mut ObjInfo, name: &str) -> Option<&'a mut ObjSection> {
obj.sections.iter_mut().find(|s| s.name == name)
}
fn find_symbol<'a>(symbols: &'a mut [ObjSymbol], name: &str) -> Option<&'a mut ObjSymbol> { fn find_symbol<'a>(symbols: &'a mut [ObjSymbol], name: &str) -> Option<&'a mut ObjSymbol> {
symbols.iter_mut().find(|s| s.name == name) symbols.iter_mut().find(|s| s.name == name)
} }
pub fn diff_objs(left: &mut ObjInfo, right: &mut ObjInfo, _diff_config: &DiffConfig) -> Result<()> { pub fn diff_objs(left: &mut ObjInfo, right: &mut ObjInfo, _diff_config: &DiffConfig) -> Result<()> {
for left_section in &mut left.sections { for left_section in &mut left.sections {
let Some(right_section) = find_section(right, &left_section.name) else { let Some(right_section) = right.sections.iter_mut().find(|s| s.name == left_section.name) else {
continue; continue;
}; };
if left_section.kind == ObjSectionKind::Code { if left_section.kind == ObjSectionKind::Code {
@ -381,6 +387,8 @@ pub fn diff_objs(left: &mut ObjInfo, right: &mut ObjInfo, _diff_config: &DiffCon
right_symbol, right_symbol,
&left_section.relocations, &left_section.relocations,
&right_section.relocations, &right_section.relocations,
&left.line_info,
&right.line_info,
)?; )?;
} else { } else {
no_diff_code( no_diff_code(
@ -388,6 +396,7 @@ pub fn diff_objs(left: &mut ObjInfo, right: &mut ObjInfo, _diff_config: &DiffCon
&left_section.data, &left_section.data,
left_symbol, left_symbol,
&left_section.relocations, &left_section.relocations,
&left.line_info,
)?; )?;
} }
} }
@ -398,6 +407,7 @@ pub fn diff_objs(left: &mut ObjInfo, right: &mut ObjInfo, _diff_config: &DiffCon
&right_section.data, &right_section.data,
right_symbol, right_symbol,
&right_section.relocations, &right_section.relocations,
&left.line_info,
)?; )?;
} }
} }

View File

@ -40,25 +40,18 @@ pub struct LevEditOp {
pub second_start: usize, /* destination position */ pub second_start: usize, /* destination position */
} }
#[derive(Debug, PartialEq, Eq)]
pub struct LevMatchingBlock {
pub first_start: usize,
pub second_start: usize,
pub len: usize,
}
pub fn editops_find<T>(query: &[T], choice: &[T]) -> Vec<LevEditOp> pub fn editops_find<T>(query: &[T], choice: &[T]) -> Vec<LevEditOp>
where T: PartialEq { where T: PartialEq {
let string_affix = Affix::find(query, choice); let Affix {
prefix_len,
suffix_len,
} = Affix::find(query, choice);
let first_string_len = string_affix.first_string_len; let first_string = &query[prefix_len..query.len() - suffix_len];
let second_string_len = string_affix.second_string_len; let second_string = &choice[prefix_len..choice.len() - suffix_len];
let prefix_len = string_affix.prefix_len;
let first_string = &query[prefix_len..prefix_len + first_string_len];
let second_string = &choice[prefix_len..prefix_len + second_string_len];
let matrix_columns = first_string_len + 1; let matrix_columns = first_string.len() + 1;
let matrix_rows = second_string_len + 1; let matrix_rows = second_string.len() + 1;
// TODO maybe use an actual matrix for readability // TODO maybe use an actual matrix for readability
let mut cache_matrix: Vec<usize> = vec![0; matrix_rows * matrix_columns]; let mut cache_matrix: Vec<usize> = vec![0; matrix_rows * matrix_columns];
@ -186,73 +179,25 @@ where
pub struct Affix { pub struct Affix {
pub prefix_len: usize, pub prefix_len: usize,
pub first_string_len: usize, pub suffix_len: usize,
pub second_string_len: usize,
} }
impl Affix { impl Affix {
pub fn find<T>(first_string: &[T], second_string: &[T]) -> Affix pub fn find<T>(s1: &[T], s2: &[T]) -> Affix
where T: PartialEq { where T: PartialEq {
// remove common prefix and suffix (linear vs square runtime for levensthein) let prefix_len = s1.iter()
let mut first_iter = first_string.iter(); .zip(s2.iter())
let mut second_iter = second_string.iter(); .take_while(|t| t.0 == t.1)
.count();
let suffix_len = s1[prefix_len..].iter()
.rev()
.zip(s2[prefix_len..].iter().rev())
.take_while(|t| t.0 == t.1)
.count();
let mut limit_start = 0; Affix {
prefix_len,
let mut first_iter_char = first_iter.next(); suffix_len,
let mut second_iter_char = second_iter.next();
while first_iter_char.is_some() && first_iter_char == second_iter_char {
first_iter_char = first_iter.next();
second_iter_char = second_iter.next();
limit_start += 1;
}
// save char since the iterator was already consumed
let first_iter_cache = first_iter_char;
let second_iter_cache = second_iter_char;
if second_iter_char.is_some() && first_iter_char.is_some() {
first_iter_char = first_iter.next_back();
second_iter_char = second_iter.next_back();
while first_iter_char.is_some() && first_iter_char == second_iter_char {
first_iter_char = first_iter.next_back();
second_iter_char = second_iter.next_back();
}
}
match (first_iter_char, second_iter_char) {
(None, None) => {
// characters might not match even though they were consumed
let remaining_char = (first_iter_cache != second_iter_cache) as usize;
Affix {
prefix_len: limit_start,
first_string_len: remaining_char,
second_string_len: remaining_char,
}
}
(None, _) => {
let remaining_char =
(first_iter_cache.is_some() && first_iter_cache != second_iter_char) as usize;
Affix {
prefix_len: limit_start,
first_string_len: remaining_char,
second_string_len: second_iter.count() + 1 + remaining_char,
}
}
(_, None) => {
let remaining_char =
(second_iter_cache.is_some() && second_iter_cache != first_iter_char) as usize;
Affix {
prefix_len: limit_start,
first_string_len: first_iter.count() + 1 + remaining_char,
second_string_len: remaining_char,
}
}
_ => Affix {
prefix_len: limit_start,
first_string_len: first_iter.count() + 2,
second_string_len: second_iter.count() + 2,
},
} }
} }
} }

View File

@ -1,6 +1,7 @@
use std::{fs, path::Path}; use std::{collections::BTreeMap, fs, io::Cursor, path::Path};
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use byteorder::{BigEndian, ReadBytesExt};
use cwdemangle::demangle; use cwdemangle::demangle;
use flagset::Flags; use flagset::Flags;
use object::{ use object::{
@ -17,12 +18,12 @@ use crate::obj::{
ObjSymbolFlagSet, ObjSymbolFlags, ObjSymbolFlagSet, ObjSymbolFlags,
}; };
fn to_obj_section_kind(kind: SectionKind) -> ObjSectionKind { fn to_obj_section_kind(kind: SectionKind) -> Option<ObjSectionKind> {
match kind { match kind {
SectionKind::Text => ObjSectionKind::Code, SectionKind::Text => Some(ObjSectionKind::Code),
SectionKind::Data | SectionKind::ReadOnlyData => ObjSectionKind::Data, SectionKind::Data | SectionKind::ReadOnlyData => Some(ObjSectionKind::Data),
SectionKind::UninitializedData => ObjSectionKind::Bss, SectionKind::UninitializedData => Some(ObjSectionKind::Bss),
_ => panic!("Unhandled section kind {kind:?}"), _ => None,
} }
} }
@ -73,18 +74,14 @@ fn filter_sections(obj_file: &File<'_>) -> Result<Vec<ObjSection>> {
if section.size() == 0 { if section.size() == 0 {
continue; continue;
} }
if section.kind() != SectionKind::Text let Some(kind) = to_obj_section_kind(section.kind()) else {
&& section.kind() != SectionKind::Data
&& section.kind() != SectionKind::ReadOnlyData
&& section.kind() != SectionKind::UninitializedData
{
continue; continue;
} };
let name = section.name().context("Failed to process section name")?; let name = section.name().context("Failed to process section name")?;
let data = section.uncompressed_data().context("Failed to read section data")?; let data = section.uncompressed_data().context("Failed to read section data")?;
result.push(ObjSection { result.push(ObjSection {
name: name.to_string(), name: name.to_string(),
kind: to_obj_section_kind(section.kind()), kind,
address: section.address(), address: section.address(),
size: section.size(), size: section.size(),
data: data.to_vec(), data: data.to_vec(),
@ -249,7 +246,7 @@ fn relocations_by_section(
}; };
// println!("Reloc: {:?}, symbol: {:?}", reloc, symbol); // println!("Reloc: {:?}, symbol: {:?}", reloc, symbol);
let target = match symbol.kind() { let target = match symbol.kind() {
SymbolKind::Text | SymbolKind::Data | SymbolKind::Unknown => { SymbolKind::Text | SymbolKind::Data | SymbolKind::Label | SymbolKind::Unknown => {
to_obj_symbol(obj_file, &symbol, reloc.addend()) to_obj_symbol(obj_file, &symbol, reloc.addend())
} }
SymbolKind::Section => { SymbolKind::Section => {
@ -284,6 +281,32 @@ fn relocations_by_section(
Ok(relocations) Ok(relocations)
} }
fn line_info(obj_file: &File<'_>) -> Result<Option<BTreeMap<u32, u32>>> {
if let Some(section) = obj_file.section_by_name(".line") {
if section.size() == 0 {
return Ok(None);
}
let data = section.uncompressed_data()?;
let mut reader = Cursor::new(data.as_ref());
let mut map = BTreeMap::new();
let size = reader.read_u32::<BigEndian>()?;
let base_address = reader.read_u32::<BigEndian>()?;
while reader.position() < size as u64 {
let line_number = reader.read_u32::<BigEndian>()?;
let statement_pos = reader.read_u16::<BigEndian>()?;
if statement_pos != 0xFFFF {
log::warn!("Unhandled statement pos {}", statement_pos);
}
let address_delta = reader.read_u32::<BigEndian>()?;
map.insert(base_address + address_delta, line_number);
}
println!("Line info: {map:#X?}");
return Ok(Some(map));
}
Ok(None)
}
pub fn read(obj_path: &Path) -> Result<ObjInfo> { pub fn read(obj_path: &Path) -> Result<ObjInfo> {
let data = { let data = {
let file = fs::File::open(obj_path)?; let file = fs::File::open(obj_path)?;
@ -305,6 +328,7 @@ pub fn read(obj_path: &Path) -> Result<ObjInfo> {
path: obj_path.to_owned(), path: obj_path.to_owned(),
sections: filter_sections(&obj_file)?, sections: filter_sections(&obj_file)?,
common: common_symbols(&obj_file)?, common: common_symbols(&obj_file)?,
line_info: line_info(&obj_file)?,
}; };
for section in &mut result.sections { for section in &mut result.sections {
section.symbols = symbols_by_section(&obj_file, section)?; section.symbols = symbols_by_section(&obj_file, section)?;

View File

@ -1,15 +1,24 @@
use std::collections::BTreeMap;
use anyhow::Result; use anyhow::Result;
use rabbitizer::{config_set_register_fpr_abi_names, Abi, Instruction, SimpleOperandType}; use rabbitizer::{config, Abi, Instruction, InstrCategory, OperandType};
use crate::obj::{ObjIns, ObjInsArg, ObjReloc}; use crate::obj::{ObjIns, ObjInsArg, ObjReloc};
fn configure_rabbitizer() {
unsafe {
config::RabbitizerConfig_Cfg.reg_names.fpr_abi_names = Abi::O32;
}
}
pub fn process_code( pub fn process_code(
data: &[u8], data: &[u8],
start_address: u64, start_address: u64,
end_address: u64, end_address: u64,
relocs: &[ObjReloc], relocs: &[ObjReloc],
line_info: &Option<BTreeMap<u32, u32>>,
) -> Result<(Vec<u8>, Vec<ObjIns>)> { ) -> Result<(Vec<u8>, Vec<ObjIns>)> {
config_set_register_fpr_abi_names(Abi::RABBITIZER_ABI_O32); configure_rabbitizer();
let ins_count = data.len() / 4; let ins_count = data.len() / 4;
let mut ops = Vec::<u8>::with_capacity(ins_count); let mut ops = Vec::<u8>::with_capacity(ins_count);
@ -18,21 +27,21 @@ pub fn process_code(
for chunk in data.chunks_exact(4) { for chunk in data.chunks_exact(4) {
let reloc = relocs.iter().find(|r| (r.address as u32 & !3) == cur_addr); let reloc = relocs.iter().find(|r| (r.address as u32 & !3) == cur_addr);
let code = u32::from_be_bytes(chunk.try_into()?); let code = u32::from_be_bytes(chunk.try_into()?);
let mut instruction = Instruction::new(code, cur_addr); let instruction = Instruction::new(code, cur_addr, InstrCategory::CPU);
let op = instruction.instr_id() as u8; let op = instruction.unique_id as u8;
ops.push(op); ops.push(op);
let mnemonic = instruction.instr_id().get_opcode_name().unwrap_or_default().to_string(); let mnemonic = instruction.opcode_name().to_string();
let is_branch = instruction.is_branch(); let is_branch = instruction.is_branch();
let branch_offset = instruction.branch_offset(); let branch_offset = instruction.branch_offset();
let branch_dest = let branch_dest =
if is_branch { Some((cur_addr as i32 + branch_offset) as u32) } else { None }; if is_branch { Some((cur_addr as i32 + branch_offset) as u32) } else { None };
let args = instruction let args = instruction
.simple_operands() .get_operands_slice()
.iter() .iter()
.map(|op| match op.kind { .map(|op| match op {
SimpleOperandType::Imm | SimpleOperandType::Label => { OperandType::cpu_immediate | OperandType::cpu_label | OperandType::cpu_branch_target_label => {
if is_branch { if is_branch {
ObjInsArg::BranchOffset(branch_offset) ObjInsArg::BranchOffset(branch_offset)
} else if let Some(reloc) = reloc { } else if let Some(reloc) = reloc {
@ -46,19 +55,21 @@ pub fn process_code(
ObjInsArg::Reloc ObjInsArg::Reloc
} }
} else { } else {
ObjInsArg::MipsArg(op.disassembled.clone()) ObjInsArg::MipsArg(op.disassemble(&instruction, None))
} }
} }
SimpleOperandType::ImmBase => { OperandType::cpu_immediate_base => {
if reloc.is_some() { if reloc.is_some() {
ObjInsArg::RelocWithBase ObjInsArg::RelocWithBase
} else { } else {
ObjInsArg::MipsArg(op.disassembled.clone()) ObjInsArg::MipsArg(op.disassemble(&instruction, None))
} }
} }
_ => ObjInsArg::MipsArg(op.disassembled.clone()), _ => ObjInsArg::MipsArg(op.disassemble(&instruction, None)),
}) })
.collect(); .collect();
let line =
line_info.as_ref().and_then(|map| map.range(..=cur_addr).last().map(|(_, &b)| b));
insts.push(ObjIns { insts.push(ObjIns {
address: cur_addr, address: cur_addr,
code, code,
@ -67,6 +78,7 @@ pub fn process_code(
args, args,
reloc: reloc.cloned(), reloc: reloc.cloned(),
branch_dest, branch_dest,
line,
}); });
cur_addr += 4; cur_addr += 4;
} }

View File

@ -2,7 +2,7 @@ pub mod elf;
pub mod mips; pub mod mips;
pub mod ppc; pub mod ppc;
use std::path::PathBuf; use std::{collections::BTreeMap, path::PathBuf};
use flagset::{flags, FlagSet}; use flagset::{flags, FlagSet};
@ -83,6 +83,8 @@ pub struct ObjIns {
pub args: Vec<ObjInsArg>, pub args: Vec<ObjInsArg>,
pub reloc: Option<ObjReloc>, pub reloc: Option<ObjReloc>,
pub branch_dest: Option<u32>, pub branch_dest: Option<u32>,
/// Line info
pub line: Option<u32>,
} }
#[derive(Debug, Clone, Default)] #[derive(Debug, Clone, Default)]
pub struct ObjInsDiff { pub struct ObjInsDiff {
@ -138,6 +140,7 @@ pub struct ObjInfo {
pub path: PathBuf, pub path: PathBuf,
pub sections: Vec<ObjSection>, pub sections: Vec<ObjSection>,
pub common: Vec<ObjSymbol>, pub common: Vec<ObjSymbol>,
pub line_info: Option<BTreeMap<u32, u32>>,
} }
#[derive(Debug, Eq, PartialEq, Copy, Clone)] #[derive(Debug, Eq, PartialEq, Copy, Clone)]
pub enum ObjRelocKind { pub enum ObjRelocKind {

View File

@ -1,3 +1,5 @@
use std::collections::BTreeMap;
use anyhow::Result; use anyhow::Result;
use ppc750cl::{disasm_iter, Argument}; use ppc750cl::{disasm_iter, Argument};
@ -19,6 +21,7 @@ pub fn process_code(
data: &[u8], data: &[u8],
address: u64, address: u64,
relocs: &[ObjReloc], relocs: &[ObjReloc],
line_info: &Option<BTreeMap<u32, u32>>,
) -> Result<(Vec<u8>, Vec<ObjIns>)> { ) -> Result<(Vec<u8>, Vec<ObjIns>)> {
let ins_count = data.len() / 4; let ins_count = data.len() / 4;
let mut ops = Vec::<u8>::with_capacity(ins_count); let mut ops = Vec::<u8>::with_capacity(ins_count);
@ -74,6 +77,9 @@ pub fn process_code(
} }
} }
ops.push(simplified.ins.op as u8); ops.push(simplified.ins.op as u8);
let line = line_info
.as_ref()
.and_then(|map| map.range(..=simplified.ins.addr).last().map(|(_, &b)| b));
insts.push(ObjIns { insts.push(ObjIns {
address: simplified.ins.addr, address: simplified.ins.addr,
code: simplified.ins.code, code: simplified.ins.code,
@ -82,6 +88,7 @@ pub fn process_code(
reloc: reloc.cloned(), reloc: reloc.cloned(),
op: 0, op: 0,
branch_dest: None, branch_dest: None,
line,
}); });
} }
Ok((ops, insts)) Ok((ops, insts))

View File

@ -1,7 +1,7 @@
use std::{cmp::min, default::Default, mem::take}; use std::{cmp::min, default::Default, mem::take};
use egui::{text::LayoutJob, Color32, Label, Sense}; use egui::{text::LayoutJob, Align, Color32, Label, Layout, Sense, Vec2};
use egui_extras::{Size, StripBuilder, TableBuilder}; use egui_extras::{Column, TableBuilder};
use time::format_description; use time::format_description;
use crate::{ use crate::{
@ -14,9 +14,7 @@ use crate::{
const BYTES_PER_ROW: usize = 16; const BYTES_PER_ROW: usize = 16;
fn find_section<'a>(obj: &'a ObjInfo, selected_symbol: &SymbolReference) -> Option<&'a ObjSection> { fn find_section<'a>(obj: &'a ObjInfo, selected_symbol: &SymbolReference) -> Option<&'a ObjSection> {
obj.sections.iter().find(|section| { obj.sections.iter().find(|section| section.name == selected_symbol.section_name)
section.symbols.iter().any(|symbol| symbol.name == selected_symbol.symbol_name)
})
} }
fn data_row_ui(ui: &mut egui::Ui, address: usize, diffs: &[ObjDataDiff], config: &ViewConfig) { fn data_row_ui(ui: &mut egui::Ui, address: usize, diffs: &[ObjDataDiff], config: &ViewConfig) {
@ -168,88 +166,89 @@ pub fn data_diff_ui(ui: &mut egui::Ui, view_state: &mut ViewState) -> bool {
let (Some(result), Some(selected_symbol)) = (&view_state.build, &view_state.selected_symbol) else { let (Some(result), Some(selected_symbol)) = (&view_state.build, &view_state.selected_symbol) else {
return rebuild; return rebuild;
}; };
StripBuilder::new(ui)
.size(Size::exact(20.0)) // Header
.size(Size::exact(40.0)) let available_width = ui.available_width();
.size(Size::remainder()) let column_width = available_width / 2.0;
.vertical(|mut strip| { ui.allocate_ui_with_layout(
strip.strip(|builder| { Vec2 { x: available_width, y: 100.0 },
builder.sizes(Size::remainder(), 2).horizontal(|mut strip| { Layout::left_to_right(Align::Min),
strip.cell(|ui| { |ui| {
ui.horizontal(|ui| { // Left column
if ui.button("Back").clicked() { ui.allocate_ui_with_layout(
view_state.current_view = View::SymbolDiff; Vec2 { x: column_width, y: 100.0 },
} Layout::top_down(Align::Min),
}); |ui| {
ui.set_width(column_width);
if ui.button("Back").clicked() {
view_state.current_view = View::SymbolDiff;
}
ui.scope(|ui| {
ui.style_mut().override_text_style = Some(egui::TextStyle::Monospace);
ui.style_mut().wrap = Some(false);
ui.colored_label(Color32::WHITE, &selected_symbol.symbol_name);
ui.label("Diff target:");
}); });
strip.cell(|ui| { },
ui.horizontal(|ui| { );
if ui.button("Build").clicked() {
rebuild = true; // Right column
} ui.allocate_ui_with_layout(
ui.scope(|ui| { Vec2 { x: column_width, y: 100.0 },
ui.style_mut().override_text_style = Layout::top_down(Align::Min),
Some(egui::TextStyle::Monospace); |ui| {
ui.style_mut().wrap = Some(false); ui.set_width(column_width);
if view_state.jobs.iter().any(|job| job.job_type == Job::ObjDiff) {
ui.label("Building..."); ui.horizontal(|ui| {
} else { if ui.button("Build").clicked() {
ui.label("Last built:"); rebuild = true;
let format = }
format_description::parse("[hour]:[minute]:[second]")
.unwrap();
ui.label(
result
.time
.to_offset(view_state.utc_offset)
.format(&format)
.unwrap(),
);
}
});
});
});
});
});
strip.strip(|builder| {
builder.sizes(Size::remainder(), 2).horizontal(|mut strip| {
strip.cell(|ui| {
ui.scope(|ui| { ui.scope(|ui| {
ui.style_mut().override_text_style = Some(egui::TextStyle::Monospace); ui.style_mut().override_text_style = Some(egui::TextStyle::Monospace);
ui.style_mut().wrap = Some(false); ui.style_mut().wrap = Some(false);
ui.colored_label(Color32::WHITE, &selected_symbol.symbol_name); if view_state.jobs.iter().any(|job| job.job_type == Job::ObjDiff) {
ui.label("Diff target:"); ui.label("Building...");
ui.separator(); } else {
ui.label("Last built:");
let format =
format_description::parse("[hour]:[minute]:[second]").unwrap();
ui.label(
result
.time
.to_offset(view_state.utc_offset)
.format(&format)
.unwrap(),
);
}
}); });
}); });
strip.cell(|ui| {
ui.scope(|ui| { ui.scope(|ui| {
ui.style_mut().override_text_style = Some(egui::TextStyle::Monospace); ui.style_mut().override_text_style = Some(egui::TextStyle::Monospace);
ui.style_mut().wrap = Some(false); ui.style_mut().wrap = Some(false);
ui.label(""); ui.label("");
ui.label("Diff base:"); ui.label("Diff base:");
ui.separator();
});
}); });
}); },
}); );
strip.cell(|ui| { },
if let (Some(left_obj), Some(right_obj)) = (&result.first_obj, &result.second_obj) { );
let table = TableBuilder::new(ui) ui.separator();
.striped(false)
.cell_layout(egui::Layout::left_to_right(egui::Align::Min)) // Table
.column(Size::relative(0.5)) if let (Some(left_obj), Some(right_obj)) = (&result.first_obj, &result.second_obj) {
.column(Size::relative(0.5)) let available_height = ui.available_height();
.resizable(false); let table = TableBuilder::new(ui)
data_table_ui( .striped(false)
table, .cell_layout(Layout::left_to_right(Align::Min))
left_obj, .columns(Column::exact(column_width).clip(true), 2)
right_obj, .resizable(false)
selected_symbol, .auto_shrink([false, false])
&view_state.view_config, .min_scrolled_height(available_height);
); data_table_ui(table, left_obj, right_obj, selected_symbol, &view_state.view_config);
} }
});
});
rebuild rebuild
} }

View File

@ -1,8 +1,9 @@
use std::default::Default; use std::default::Default;
use cwdemangle::demangle; use cwdemangle::demangle;
use egui::{text::LayoutJob, Color32, FontId, Label, Sense}; use eframe::emath::Align;
use egui_extras::{Size, StripBuilder, TableBuilder}; use egui::{text::LayoutJob, Color32, FontId, Label, Layout, Sense, Vec2};
use egui_extras::{Column, TableBuilder};
use ppc750cl::Argument; use ppc750cl::Argument;
use time::format_description; use time::format_description;
@ -264,8 +265,14 @@ fn asm_row_ui(ui: &mut egui::Ui, ins_diff: &ObjInsDiff, symbol: &ObjSymbol, conf
ObjInsDiffKind::Delete => COLOR_RED, ObjInsDiffKind::Delete => COLOR_RED,
ObjInsDiffKind::Insert => Color32::GREEN, ObjInsDiffKind::Insert => Color32::GREEN,
}; };
let mut pad = 6;
if let Some(line) = ins.line {
let line_str = format!("{line} ");
write_text(&line_str, Color32::DARK_GRAY, &mut job, config.code_font.clone());
pad = 12 - line_str.len();
}
write_text( write_text(
&format!("{:<6}", format!("{:x}:", ins.address - symbol.address as u32)), &format!("{:<1$}", format!("{:x}: ", ins.address - symbol.address as u32), pad),
base_color, base_color,
&mut job, &mut job,
config.code_font.clone(), config.code_font.clone(),
@ -326,102 +333,109 @@ pub fn function_diff_ui(ui: &mut egui::Ui, view_state: &mut ViewState) -> bool {
let (Some(result), Some(selected_symbol)) = (&view_state.build, &view_state.selected_symbol) else { let (Some(result), Some(selected_symbol)) = (&view_state.build, &view_state.selected_symbol) else {
return rebuild; return rebuild;
}; };
StripBuilder::new(ui)
.size(Size::exact(20.0)) // Header
.size(Size::exact(40.0)) let available_width = ui.available_width();
.size(Size::remainder()) let column_width = available_width / 2.0;
.vertical(|mut strip| { ui.allocate_ui_with_layout(
strip.strip(|builder| { Vec2 { x: available_width, y: 100.0 },
builder.sizes(Size::remainder(), 2).horizontal(|mut strip| { Layout::left_to_right(Align::Min),
strip.cell(|ui| { |ui| {
ui.horizontal(|ui| { // Left column
if ui.button("Back").clicked() { ui.allocate_ui_with_layout(
view_state.current_view = View::SymbolDiff; Vec2 { x: column_width, y: 100.0 },
} Layout::top_down(Align::Min),
}); |ui| {
}); ui.set_width(column_width);
strip.cell(|ui| {
ui.horizontal(|ui| { if ui.button("Back").clicked() {
if ui.button("Build").clicked() { view_state.current_view = View::SymbolDiff;
rebuild = true; }
}
ui.scope(|ui| {
ui.style_mut().override_text_style =
Some(egui::TextStyle::Monospace);
ui.style_mut().wrap = Some(false);
if view_state.jobs.iter().any(|job| job.job_type == Job::ObjDiff) {
ui.label("Building...");
} else {
ui.label("Last built:");
let format =
format_description::parse("[hour]:[minute]:[second]")
.unwrap();
ui.label(
result
.time
.to_offset(view_state.utc_offset)
.format(&format)
.unwrap(),
);
}
});
});
});
});
});
strip.strip(|builder| {
builder.sizes(Size::remainder(), 2).horizontal(|mut strip| {
let demangled = demangle(&selected_symbol.symbol_name, &Default::default()); let demangled = demangle(&selected_symbol.symbol_name, &Default::default());
strip.cell(|ui| { let name = demangled.as_deref().unwrap_or(&selected_symbol.symbol_name);
ui.scope(|ui| { let mut job = LayoutJob::simple(
ui.style_mut().override_text_style = Some(egui::TextStyle::Monospace); name.to_string(),
ui.style_mut().wrap = Some(false); view_state.view_config.code_font.clone(),
ui.colored_label( Color32::WHITE,
Color32::WHITE, column_width,
demangled.as_ref().unwrap_or(&selected_symbol.symbol_name), );
); job.wrap.break_anywhere = true;
ui.label("Diff target:"); job.wrap.max_rows = 1;
ui.separator(); ui.label(job);
});
ui.scope(|ui| {
ui.style_mut().override_text_style = Some(egui::TextStyle::Monospace);
ui.label("Diff target:");
}); });
strip.cell(|ui| { },
);
// Right column
ui.allocate_ui_with_layout(
Vec2 { x: column_width, y: 100.0 },
Layout::top_down(Align::Min),
|ui| {
ui.set_width(column_width);
ui.horizontal(|ui| {
if ui.button("Build").clicked() {
rebuild = true;
}
ui.scope(|ui| { ui.scope(|ui| {
ui.style_mut().override_text_style = Some(egui::TextStyle::Monospace); ui.style_mut().override_text_style = Some(egui::TextStyle::Monospace);
ui.style_mut().wrap = Some(false); ui.style_mut().wrap = Some(false);
if let Some(match_percent) = result if view_state.jobs.iter().any(|job| job.job_type == Job::ObjDiff) {
.second_obj ui.label("Building...");
.as_ref() } else {
.and_then(|obj| find_symbol(obj, selected_symbol)) ui.label("Last built:");
.and_then(|symbol| symbol.match_percent) let format =
{ format_description::parse("[hour]:[minute]:[second]").unwrap();
ui.colored_label( ui.label(
match_color_for_symbol(match_percent), result
&format!("{match_percent:.0}%"), .time
.to_offset(view_state.utc_offset)
.format(&format)
.unwrap(),
); );
} }
ui.label("Diff base:");
ui.separator();
}); });
}); });
});
}); ui.scope(|ui| {
strip.cell(|ui| { ui.style_mut().override_text_style = Some(egui::TextStyle::Monospace);
if let (Some(left_obj), Some(right_obj)) = (&result.first_obj, &result.second_obj) { if let Some(match_percent) = result
let table = TableBuilder::new(ui) .second_obj
.striped(false) .as_ref()
.cell_layout(egui::Layout::left_to_right(egui::Align::Min)) .and_then(|obj| find_symbol(obj, selected_symbol))
.column(Size::relative(0.5)) .and_then(|symbol| symbol.match_percent)
.column(Size::relative(0.5)) {
.resizable(false); ui.colored_label(
asm_table_ui( match_color_for_symbol(match_percent),
table, &format!("{match_percent:.0}%"),
left_obj, );
right_obj, } else {
selected_symbol, ui.label("");
&view_state.view_config, }
); ui.label("Diff base:");
} });
}); },
}); );
},
);
ui.separator();
// Table
if let (Some(left_obj), Some(right_obj)) = (&result.first_obj, &result.second_obj) {
let available_height = ui.available_height();
let table = TableBuilder::new(ui)
.striped(false)
.cell_layout(Layout::left_to_right(Align::Min))
.columns(Column::exact(column_width).clip(true), 2)
.resizable(false)
.auto_shrink([false, false])
.min_scrolled_height(available_height);
asm_table_ui(table, left_obj, right_obj, selected_symbol, &view_state.view_config);
}
rebuild rebuild
} }

View File

@ -9,5 +9,5 @@ pub(crate) mod symbol_diff;
const COLOR_RED: Color32 = Color32::from_rgb(200, 40, 41); const COLOR_RED: Color32 = Color32::from_rgb(200, 40, 41);
fn write_text(str: &str, color: Color32, job: &mut LayoutJob, font_id: FontId) { fn write_text(str: &str, color: Color32, job: &mut LayoutJob, font_id: FontId) {
job.append(str, 0.0, TextFormat { font_id, color, ..Default::default() }); job.append(str, 0.0, TextFormat::simple(font_id, color));
} }

View File

@ -1,5 +1,6 @@
use egui::{ use egui::{
text::LayoutJob, CollapsingHeader, Color32, Rgba, ScrollArea, SelectableLabel, Ui, Widget, text::LayoutJob, Align, CollapsingHeader, Color32, Layout, Rgba, ScrollArea, SelectableLabel,
TextEdit, Ui, Vec2, Widget,
}; };
use egui_extras::{Size, StripBuilder}; use egui_extras::{Size, StripBuilder};
@ -135,12 +136,9 @@ fn symbol_list_ui(
selected_symbol: &mut Option<SymbolReference>, selected_symbol: &mut Option<SymbolReference>,
current_view: &mut View, current_view: &mut View,
reverse_function_order: bool, reverse_function_order: bool,
search: &mut String, lower_search: &str,
config: &ViewConfig, config: &ViewConfig,
) { ) {
ui.text_edit_singleline(search);
let lower_search = search.to_ascii_lowercase();
ScrollArea::both().auto_shrink([false, false]).show(ui, |ui| { ScrollArea::both().auto_shrink([false, false]).show(ui, |ui| {
ui.scope(|ui| { ui.scope(|ui| {
ui.style_mut().override_text_style = Some(egui::TextStyle::Monospace); ui.style_mut().override_text_style = Some(egui::TextStyle::Monospace);
@ -168,7 +166,7 @@ fn symbol_list_ui(
.show(ui, |ui| { .show(ui, |ui| {
if section.kind == ObjSectionKind::Code && reverse_function_order { if section.kind == ObjSectionKind::Code && reverse_function_order {
for symbol in section.symbols.iter().rev() { for symbol in section.symbols.iter().rev() {
if !symbol_matches_search(symbol, &lower_search) { if !symbol_matches_search(symbol, lower_search) {
continue; continue;
} }
symbol_ui( symbol_ui(
@ -183,7 +181,7 @@ fn symbol_list_ui(
} }
} else { } else {
for symbol in &section.symbols { for symbol in &section.symbols {
if !symbol_matches_search(symbol, &lower_search) { if !symbol_matches_search(symbol, lower_search) {
continue; continue;
} }
symbol_ui( symbol_ui(
@ -215,94 +213,116 @@ fn build_log_ui(ui: &mut Ui, status: &BuildStatus) {
} }
pub fn symbol_diff_ui(ui: &mut Ui, view_state: &mut ViewState) { pub fn symbol_diff_ui(ui: &mut Ui, view_state: &mut ViewState) {
if let (Some(result), highlighted_symbol, selected_symbol, current_view, search) = ( let (Some(result), highlighted_symbol, selected_symbol, current_view, search) = (
&view_state.build, &view_state.build,
&mut view_state.highlighted_symbol, &mut view_state.highlighted_symbol,
&mut view_state.selected_symbol, &mut view_state.selected_symbol,
&mut view_state.current_view, &mut view_state.current_view,
&mut view_state.search, &mut view_state.search,
) { ) else {
StripBuilder::new(ui).size(Size::exact(40.0)).size(Size::remainder()).vertical( return;
|mut strip| { };
strip.strip(|builder| {
builder.sizes(Size::remainder(), 2).horizontal(|mut strip| {
strip.cell(|ui| {
ui.scope(|ui| {
ui.style_mut().override_text_style =
Some(egui::TextStyle::Monospace);
ui.style_mut().wrap = Some(false);
ui.label("Build target:"); // Header
if result.first_status.success { let available_width = ui.available_width();
ui.label("OK"); let column_width = available_width / 2.0;
} else { ui.allocate_ui_with_layout(
ui.colored_label(Rgba::from_rgb(1.0, 0.0, 0.0), "Fail"); Vec2 { x: available_width, y: 100.0 },
} Layout::left_to_right(Align::Min),
}); |ui| {
ui.separator(); // Left column
}); ui.allocate_ui_with_layout(
strip.cell(|ui| { Vec2 { x: column_width, y: 100.0 },
ui.scope(|ui| { Layout::top_down(Align::Min),
ui.style_mut().override_text_style = |ui| {
Some(egui::TextStyle::Monospace); ui.set_width(column_width);
ui.style_mut().wrap = Some(false);
ui.label("Build base:"); ui.scope(|ui| {
if result.second_status.success { ui.style_mut().override_text_style = Some(egui::TextStyle::Monospace);
ui.label("OK"); ui.style_mut().wrap = Some(false);
} else {
ui.colored_label(Rgba::from_rgb(1.0, 0.0, 0.0), "Fail"); ui.label("Build target:");
} if result.first_status.success {
ui.label("OK");
} else {
ui.colored_label(Rgba::from_rgb(1.0, 0.0, 0.0), "Fail");
}
});
TextEdit::singleline(search).hint_text("Filter symbols").ui(ui);
},
);
// Right column
ui.allocate_ui_with_layout(
Vec2 { x: column_width, y: 100.0 },
Layout::top_down(Align::Min),
|ui| {
ui.set_width(column_width);
ui.scope(|ui| {
ui.style_mut().override_text_style = Some(egui::TextStyle::Monospace);
ui.style_mut().wrap = Some(false);
ui.label("Build base:");
if result.second_status.success {
ui.label("OK");
} else {
ui.colored_label(Rgba::from_rgb(1.0, 0.0, 0.0), "Fail");
}
});
},
);
},
);
ui.separator();
// Table
let lower_search = search.to_ascii_lowercase();
StripBuilder::new(ui).size(Size::remainder()).vertical(|mut strip| {
strip.strip(|builder| {
builder.sizes(Size::remainder(), 2).horizontal(|mut strip| {
strip.cell(|ui| {
if result.first_status.success {
if let Some(obj) = &result.first_obj {
ui.push_id("left", |ui| {
symbol_list_ui(
ui,
obj,
highlighted_symbol,
selected_symbol,
current_view,
view_state.reverse_fn_order,
&lower_search,
&view_state.view_config,
);
}); });
ui.separator(); }
}); } else {
}); build_log_ui(ui, &result.first_status);
}
}); });
strip.strip(|builder| { strip.cell(|ui| {
builder.sizes(Size::remainder(), 2).horizontal(|mut strip| { if result.second_status.success {
strip.cell(|ui| { if let Some(obj) = &result.second_obj {
if result.first_status.success { ui.push_id("right", |ui| {
if let Some(obj) = &result.first_obj { symbol_list_ui(
ui.push_id("left", |ui| { ui,
symbol_list_ui( obj,
ui, highlighted_symbol,
obj, selected_symbol,
highlighted_symbol, current_view,
selected_symbol, view_state.reverse_fn_order,
current_view, &lower_search,
view_state.reverse_fn_order, &view_state.view_config,
search, );
&view_state.view_config, });
); }
}); } else {
} build_log_ui(ui, &result.second_status);
} else { }
build_log_ui(ui, &result.first_status);
}
});
strip.cell(|ui| {
if result.second_status.success {
if let Some(obj) = &result.second_obj {
ui.push_id("right", |ui| {
symbol_list_ui(
ui,
obj,
highlighted_symbol,
selected_symbol,
current_view,
view_state.reverse_fn_order,
search,
&view_state.view_config,
);
});
}
} else {
build_log_ui(ui, &result.second_status);
}
});
});
}); });
}, });
); });
} });
} }