Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions objdiff-core/config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,27 @@
"name": "Space between args",
"description": "Adds a space between arguments in the diff output."
},
{
"id": "showSymbolSizes",
"type": "choice",
"default": "off",
"name": "Show symbol sizes",
"description": "Shows symbol sizes in the symbol view.",
"items": [
{
"value": "off",
"name": "Off"
},
{
"value": "hex",
"name": "Hex"
},
{
"value": "decimal",
"name": "Decimal"
}
]
},
{
"id": "combineDataSections",
"type": "boolean",
Expand Down Expand Up @@ -296,6 +317,7 @@
"properties": [
"functionRelocDiffs",
"demangler",
"showSymbolSizes",
"spaceBetweenArgs",
"combineDataSections",
"combineTextSections"
Expand Down
5 changes: 4 additions & 1 deletion objdiff-gui/src/app_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use objdiff_core::{
config::ScratchConfig,
diff::{
ArmArchVersion, ArmR9Usage, DiffObjConfig, FunctionRelocDiffs, MipsAbi, MipsInstrCategory,
X86Formatter,
ShowSymbolSizes, X86Formatter,
},
};
use typed_path::{Utf8PlatformPathBuf, Utf8UnixPathBuf};
Expand Down Expand Up @@ -227,6 +227,7 @@ pub struct DiffObjConfigV1 {
pub relax_reloc_diffs: bool,
#[serde(default = "bool_true")]
pub space_between_args: bool,
pub show_symbol_sizes: ShowSymbolSizes,
pub combine_data_sections: bool,
// x86
pub x86_formatter: X86Formatter,
Expand All @@ -248,6 +249,7 @@ impl Default for DiffObjConfigV1 {
Self {
relax_reloc_diffs: false,
space_between_args: true,
show_symbol_sizes: Default::default(),
combine_data_sections: false,
x86_formatter: Default::default(),
mips_abi: Default::default(),
Expand All @@ -272,6 +274,7 @@ impl DiffObjConfigV1 {
FunctionRelocDiffs::default()
},
space_between_args: self.space_between_args,
show_symbol_sizes: self.show_symbol_sizes,
combine_data_sections: self.combine_data_sections,
x86_formatter: self.x86_formatter,
mips_abi: self.mips_abi,
Expand Down
2 changes: 2 additions & 0 deletions objdiff-gui/src/views/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@ fn diff_col_ui(
appearance,
column,
open_sections,
diff_config,
) {
match (column, action) {
(
Expand Down Expand Up @@ -703,6 +704,7 @@ fn diff_col_ui(
appearance,
column,
open_sections,
diff_config,
) {
ret = Some(result);
}
Expand Down
20 changes: 19 additions & 1 deletion objdiff-gui/src/views/symbol_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use egui::{
};
use objdiff_core::{
diff::{
ObjectDiff, SymbolDiff,
DiffObjConfig, ObjectDiff, ShowSymbolSizes, SymbolDiff,
display::{
HighlightKind, SectionDisplay, SymbolFilter, SymbolNavigationKind, display_sections,
symbol_context, symbol_hover,
Expand Down Expand Up @@ -525,6 +525,7 @@ fn symbol_ui(
state: &SymbolViewState,
appearance: &Appearance,
column: usize,
diff_config: &DiffObjConfig,
) -> Option<DiffViewAction> {
let mut ret = None;
let mut job = LayoutJob::default();
Expand Down Expand Up @@ -572,6 +573,21 @@ fn symbol_ui(
write_text(") ", appearance.text_color, &mut job, appearance.code_font.clone());
}
write_text(name, appearance.highlight_color, &mut job, appearance.code_font.clone());
if diff_config.show_symbol_sizes == ShowSymbolSizes::Decimal {
write_text(
&format!(" (size={})", symbol.size),
appearance.deemphasized_text_color,
&mut job,
appearance.code_font.clone(),
);
} else if diff_config.show_symbol_sizes == ShowSymbolSizes::Hex {
write_text(
&format!(" (size={:x})", symbol.size),
appearance.deemphasized_text_color,
&mut job,
appearance.code_font.clone(),
);
}
let response = egui::Button::selectable(selected, job)
.ui(ui)
.on_hover_ui_at_pointer(|ui| symbol_hover_ui(ui, ctx, symbol_idx, appearance));
Expand Down Expand Up @@ -646,6 +662,7 @@ pub fn symbol_list_ui(
appearance: &Appearance,
column: usize,
open_sections: Option<bool>,
diff_config: &DiffObjConfig,
) -> Option<DiffViewAction> {
let mut ret = None;
ScrollArea::both().auto_shrink([false, false]).show(ui, |ui| {
Expand Down Expand Up @@ -770,6 +787,7 @@ pub fn symbol_list_ui(
state,
appearance,
column,
diff_config,
) {
ret = Some(result);
}
Expand Down
Loading