Skip to content

Commit

Permalink
Merge pull request #92 from perlindgren/mips_ui_fix
Browse files Browse the repository at this point in the history
Mips UI fixes
  • Loading branch information
onsdagens authored Oct 14, 2024
2 parents 5b1d7e5 + adcb567 commit da35dbf
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ edition = "2021"
members = [ "mips-lib", "riscv"]

[dependencies]
MIPS_disassembly = "0.1.2"
MIPS_disassembly = "=0.1.3"
anyhow = "1.0.72"
clap = { version = "4.3.15", features = ["derive"] }
elf = "0.7.4"
Expand Down
4 changes: 2 additions & 2 deletions mips-lib/mips_single_cycle.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@
"type": "PhysicalMem",
"id": "phys_mem",
"pos": [
0.0,
0.0
425.0,
575.0
]
},
{
Expand Down
31 changes: 24 additions & 7 deletions mips-lib/src/gui_egui/mips_mem_view_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@ impl MemViewWindow {

// add submenu with a button for each symbol, which sets self.go_to_address
ui.menu_button("symbol", |ui| {
let because_lifetimes_sad = mem.get_symbol_table();
let mut sections = because_lifetimes_sad.iter().collect::<Vec<_>>();
sections.sort_by(|a, b| a.0.partial_cmp(b.0).unwrap());

ScrollArea::vertical().show(ui, |ui| {
let because_lifetimes_sad = mem.get_symbol_table();
let mut symbols = because_lifetimes_sad.iter().collect::<Vec<_>>();
Expand All @@ -253,13 +257,26 @@ impl MemViewWindow {
let mut sections = because_lifetimes_sad.iter().collect::<Vec<_>>();
sections.sort_by(|a, b| a.0.partial_cmp(b.0).unwrap());

for (key, v) in sections {
if ui.button(format!("{} {:#0x}", v, key)).clicked() {
self.go_to_address = set_address(&self.go_type, *key);
ui.close_menu();
close_menu = true;
// for (key, v) in sections {
// if ui.button(format!("{} {:#0x}", v, key)).clicked() {
// self.go_to_address = set_address(&self.go_type, *key);
// ui.close_menu();
// close_menu = true;
// }
// }
ScrollArea::vertical().show(ui, |ui| {
let because_lifetimes_sad = mem.get_section_table();
let mut section = because_lifetimes_sad.iter().collect::<Vec<_>>();
section.sort_by(|a, b| a.0.partial_cmp(b.0).unwrap());

for (key, v) in section {
if ui.button(format!("{} {:#0x}", v, key)).clicked() {
self.go_to_address = set_address(&self.go_type, *key);
ui.close_menu();
close_menu = true;
}
}
}
});
});

// Does any PC pointer exists, make them visible in this menu for quick access
Expand Down Expand Up @@ -484,7 +501,7 @@ impl MemViewWindow {
}
DataFormat::HexAndMips => {
format!(
"{:#010x} {:015}",
"{:#010x} {:015}",
data_u32,
MIPS_disassembly::get_disassembly_adv(
data_u32,
Expand Down

0 comments on commit da35dbf

Please sign in to comment.