mirror of
https://github.com/encounter/objdiff.git
synced 2025-06-07 15:13:47 +00:00
Data diff view: Show bytes with relocations as ??
instead of 00
(#204)
* Data diff view: Show bytes with relocations as `xx` * xx -> ??
This commit is contained in:
parent
f7c3501eae
commit
22052ea10b
@ -147,14 +147,20 @@ pub(crate) fn data_row_ui(
|
|||||||
cur_addr += diff.len;
|
cur_addr += diff.len;
|
||||||
} else {
|
} else {
|
||||||
for byte in &diff.data {
|
for byte in &diff.data {
|
||||||
|
let mut byte_text = format!("{byte:02x} ");
|
||||||
let mut byte_color = base_color;
|
let mut byte_color = base_color;
|
||||||
if let Some(reloc_diff) = reloc_diffs.iter().find(|reloc_diff| {
|
if let Some(reloc_diff) = reloc_diffs
|
||||||
reloc_diff.kind != DataDiffKind::None
|
.iter()
|
||||||
&& reloc_diff.range.contains(&cur_addr_actual)
|
.find(|reloc_diff| reloc_diff.range.contains(&cur_addr_actual))
|
||||||
}) {
|
{
|
||||||
byte_color = get_color_for_diff_kind(reloc_diff.kind, appearance);
|
if *byte == 0 {
|
||||||
|
// Display 00 data bytes with a relocation as ?? instead.
|
||||||
|
byte_text = "?? ".to_string();
|
||||||
|
}
|
||||||
|
if reloc_diff.kind != DataDiffKind::None {
|
||||||
|
byte_color = get_color_for_diff_kind(reloc_diff.kind, appearance);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let byte_text = format!("{byte:02x} ");
|
|
||||||
write_text(byte_text.as_str(), byte_color, &mut job, appearance.code_font.clone());
|
write_text(byte_text.as_str(), byte_color, &mut job, appearance.code_font.clone());
|
||||||
cur_addr += 1;
|
cur_addr += 1;
|
||||||
cur_addr_actual += 1;
|
cur_addr_actual += 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user