mirror of
https://github.com/encounter/objdiff.git
synced 2025-08-23 04:02:05 +00:00
Restore extab diff view
This commit is contained in:
parent
bd95faa9c3
commit
247d6da94b
@ -6,6 +6,7 @@ use alloc::{
|
|||||||
vec::Vec,
|
vec::Vec,
|
||||||
};
|
};
|
||||||
use core::{
|
use core::{
|
||||||
|
any::Any,
|
||||||
ffi::CStr,
|
ffi::CStr,
|
||||||
fmt::{self, Debug},
|
fmt::{self, Debug},
|
||||||
};
|
};
|
||||||
@ -305,7 +306,7 @@ impl dyn Arch {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Arch: Send + Sync + Debug {
|
pub trait Arch: Any + Debug + Send + Sync {
|
||||||
/// Finishes arch-specific initialization that must be done after sections have been combined.
|
/// Finishes arch-specific initialization that must be done after sections have been combined.
|
||||||
fn post_init(&mut self, _sections: &[Section], _symbols: &[Symbol]) {}
|
fn post_init(&mut self, _sections: &[Section], _symbols: &[Symbol]) {}
|
||||||
|
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
|
use core::any::Any;
|
||||||
|
|
||||||
use egui::ScrollArea;
|
use egui::ScrollArea;
|
||||||
use objdiff_core::{
|
use objdiff_core::{arch::ppc::ExceptionInfo, obj::Object};
|
||||||
arch::ppc::ExceptionInfo,
|
|
||||||
obj::{Object, Symbol},
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::views::{appearance::Appearance, function_diff::FunctionDiffContext};
|
use crate::views::{appearance::Appearance, function_diff::FunctionDiffContext};
|
||||||
|
|
||||||
@ -26,19 +25,19 @@ fn decode_extab(extab: &ExceptionInfo) -> String {
|
|||||||
text
|
text
|
||||||
}
|
}
|
||||||
|
|
||||||
fn find_extab_entry<'a>(_obj: &'a Object, _symbol: &Symbol) -> Option<&'a ExceptionInfo> {
|
fn find_extab_entry(obj: &Object, symbol_index: usize) -> Option<&ExceptionInfo> {
|
||||||
// TODO
|
(obj.arch.as_ref() as &dyn Any)
|
||||||
// obj.arch.ppc().and_then(|ppc| ppc.extab_for_symbol(symbol))
|
.downcast_ref::<objdiff_core::arch::ppc::ArchPpc>()
|
||||||
None
|
.and_then(|ppc| ppc.extab_for_symbol(symbol_index))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn extab_text_ui(
|
fn extab_text_ui(
|
||||||
ui: &mut egui::Ui,
|
ui: &mut egui::Ui,
|
||||||
ctx: FunctionDiffContext<'_>,
|
ctx: FunctionDiffContext<'_>,
|
||||||
symbol: &Symbol,
|
symbol_index: usize,
|
||||||
appearance: &Appearance,
|
appearance: &Appearance,
|
||||||
) -> Option<()> {
|
) -> Option<()> {
|
||||||
if let Some(extab_entry) = find_extab_entry(ctx.obj, symbol) {
|
if let Some(extab_entry) = find_extab_entry(ctx.obj, symbol_index) {
|
||||||
let text = decode_extab(extab_entry);
|
let text = decode_extab(extab_entry);
|
||||||
ui.colored_label(appearance.replace_color, &text);
|
ui.colored_label(appearance.replace_color, &text);
|
||||||
return Some(());
|
return Some(());
|
||||||
@ -58,10 +57,8 @@ pub(crate) fn extab_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_mode = Some(egui::TextWrapMode::Extend);
|
ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Extend);
|
||||||
|
|
||||||
if let Some(symbol) =
|
if let Some(symbol_index) = ctx.symbol_ref {
|
||||||
ctx.symbol_ref.and_then(|symbol_ref| ctx.obj.symbols.get(symbol_ref))
|
extab_text_ui(ui, ctx, symbol_index, appearance);
|
||||||
{
|
|
||||||
extab_text_ui(ui, ctx, symbol, appearance);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user