Compare commits

...

2 Commits

Author SHA1 Message Date
Luke Street e2fde3dbce Actually increment the version number 2022-12-12 01:17:03 -05:00
Luke Street 613e84ecf2 Version 0.2.3
- Fix regression when diffing symbols
  across mismatched section indexes
2022-12-10 20:28:01 -05:00
6 changed files with 23 additions and 16 deletions
Generated
+1 -1
View File
@@ -1926,7 +1926,7 @@ dependencies = [
[[package]]
name = "objdiff"
version = "0.2.2"
version = "0.2.3"
dependencies = [
"anyhow",
"bytes",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "objdiff"
version = "0.2.2"
version = "0.2.3"
edition = "2021"
rust-version = "1.62"
authors = ["Luke Street <luke@street.dev>"]
+1 -1
View File
@@ -81,7 +81,7 @@ impl Default for ViewConfig {
pub struct SymbolReference {
pub symbol_name: String,
pub section_index: usize,
pub section_name: String,
}
#[derive(serde::Deserialize, serde::Serialize)]
+3 -1
View File
@@ -14,7 +14,9 @@ use crate::{
const BYTES_PER_ROW: usize = 16;
fn find_section<'a>(obj: &'a ObjInfo, selected_symbol: &SymbolReference) -> Option<&'a ObjSection> {
obj.sections.get(selected_symbol.section_index)
obj.sections.iter().find(|section| {
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) {
+3 -2
View File
@@ -241,8 +241,9 @@ fn ins_context_menu(ui: &mut egui::Ui, ins: &ObjIns) {
}
fn find_symbol<'a>(obj: &'a ObjInfo, selected_symbol: &SymbolReference) -> Option<&'a ObjSymbol> {
let section = obj.sections.get(selected_symbol.section_index)?;
section.symbols.iter().find(|s| s.name == selected_symbol.symbol_name)
obj.sections.iter().find_map(|section| {
section.symbols.iter().find(|symbol| symbol.name == selected_symbol.symbol_name)
})
}
fn asm_row_ui(ui: &mut egui::Ui, ins_diff: &ObjInsDiff, symbol: &ObjSymbol, config: &ViewConfig) {
+14 -10
View File
@@ -56,7 +56,7 @@ fn symbol_hover_ui(ui: &mut Ui, symbol: &ObjSymbol) {
fn symbol_ui(
ui: &mut Ui,
symbol: &ObjSymbol,
section: Option<(usize, &ObjSection)>,
section: Option<&ObjSection>,
highlighted_symbol: &mut Option<String>,
selected_symbol: &mut Option<SymbolReference>,
current_view: &mut View,
@@ -97,14 +97,18 @@ fn symbol_ui(
.context_menu(|ui| symbol_context_menu_ui(ui, symbol))
.on_hover_ui_at_pointer(|ui| symbol_hover_ui(ui, symbol));
if response.clicked() {
if let Some((section_index, section)) = section {
if let Some(section) = section {
if section.kind == ObjSectionKind::Code {
*selected_symbol =
Some(SymbolReference { symbol_name: symbol.name.clone(), section_index });
*selected_symbol = Some(SymbolReference {
symbol_name: symbol.name.clone(),
section_name: section.name.clone(),
});
*current_view = View::FunctionDiff;
} else if section.kind == ObjSectionKind::Data {
*selected_symbol =
Some(SymbolReference { symbol_name: section.name.clone(), section_index });
*selected_symbol = Some(SymbolReference {
symbol_name: section.name.clone(),
section_name: section.name.clone(),
});
*current_view = View::DataDiff;
}
}
@@ -158,11 +162,11 @@ fn symbol_list_ui(
});
}
for (section_index, section) in obj.sections.iter().enumerate() {
for section in &obj.sections {
CollapsingHeader::new(format!("{} ({:x})", section.name, section.size))
.default_open(true)
.show(ui, |ui| {
if section.name == ".text" && reverse_function_order {
if section.kind == ObjSectionKind::Code && reverse_function_order {
for symbol in section.symbols.iter().rev() {
if !symbol_matches_search(symbol, &lower_search) {
continue;
@@ -170,7 +174,7 @@ fn symbol_list_ui(
symbol_ui(
ui,
symbol,
Some((section_index, section)),
Some(section),
highlighted_symbol,
selected_symbol,
current_view,
@@ -185,7 +189,7 @@ fn symbol_list_ui(
symbol_ui(
ui,
symbol,
Some((section_index, section)),
Some(section),
highlighted_symbol,
selected_symbol,
current_view,