@@ -300,6 +300,9 @@ void MainWindow::create_core(
300
300
connect (machine.data (), &machine::Machine::status_change, this , &MainWindow::machine_status);
301
301
connect (machine.data (), &machine::Machine::program_exit, this , &MainWindow::machine_exit);
302
302
connect (machine.data (), &machine::Machine::program_trap, this , &MainWindow::machine_trap);
303
+ connect (
304
+ machine.data ()->core (), &machine::Core::highlight_editor, this ,
305
+ &MainWindow::hightlightByAddress);
303
306
// Connect signal from break to machine pause
304
307
connect (
305
308
machine->core (), &machine::Core::stop_on_exception_reached, machine.data (),
@@ -334,6 +337,12 @@ void MainWindow::new_machine() {
334
337
ndialog->show ();
335
338
}
336
339
340
+ void MainWindow::hightlightByAddress (machine::Address addr) {
341
+ auto lineNum = lineToAddress.value (addr);
342
+ printf (" hightlightByAddress addr: %x, block: %d\n " , addr, lineNum);
343
+ editor_tabs->get_current_editor ()->highlightBlock (lineNum);
344
+ }
345
+
337
346
void MainWindow::machine_reload (bool force_memory_reset, bool force_elf_load) {
338
347
if (machine == nullptr ) { return new_machine (); }
339
348
bool load_executable = force_elf_load || machine->executable_loaded ();
@@ -414,7 +423,7 @@ void MainWindow::reset_state_##NAME() {
414
423
415
424
SHOW_HANDLER (registers, Qt::TopDockWidgetArea, true )
416
425
SHOW_HANDLER(program, Qt::LeftDockWidgetArea, true )
417
- SHOW_HANDLER(memory, Qt::RightDockWidgetArea, true )
426
+ SHOW_HANDLER(memory, Qt::RightDockWidgetArea, true )
418
427
SHOW_HANDLER(cache_program, Qt::RightDockWidgetArea, false )
419
428
SHOW_HANDLER(cache_data, Qt::RightDockWidgetArea, false )
420
429
SHOW_HANDLER(cache_level2, Qt::RightDockWidgetArea, false )
@@ -632,7 +641,7 @@ void MainWindow::message_selected(
632
641
}
633
642
634
643
bool SimpleAsmWithEditorCheck::process_file (const QString &filename, QString *error_ptr) {
635
- EditorTab* tab = mainwindow->editor_tabs ->find_tab_by_filename (filename);
644
+ EditorTab * tab = mainwindow->editor_tabs ->find_tab_by_filename (filename);
636
645
if (tab == nullptr ) { return Super::process_file (filename, error_ptr); }
637
646
SrcEditor *editor = tab->get_editor ();
638
647
QTextDocument *doc = editor->document ();
@@ -759,6 +768,8 @@ void MainWindow::compile_source() {
759
768
}
760
769
if (!sasm.finish ()) { error_occured = true ; }
761
770
771
+ lineToAddress = sasm.addressToLine ;
772
+
762
773
if (error_occured) { show_messages (); }
763
774
}
764
775
0 commit comments