1
- #include " windows/editor/editordock.h"
2
- #include " windows/editor/editortab.h"
3
-
4
- #include < QProcessEnvironment>
5
- #include < QtWidgets>
6
- #include < qactiongroup.h>
7
- #include < qwidget.h>
1
+ #include " mainwindow.h"
8
2
9
3
#include " assembler/fixmatheval.h"
10
4
#include " assembler/simpleasm.h"
5
+ #include " common/logging.h"
11
6
#include " dialogs/about/aboutdialog.h"
12
7
#include " dialogs/gotosymbol/gotosymboldialog.h"
13
8
#include " dialogs/savechanged/savechangeddialog.h"
14
9
#include " extprocess.h"
15
10
#include " helper/async_modal.h"
16
- #include " mainwindow.h"
17
11
#include " os_emulation/ossyscall.h"
18
12
#include " textsignalaction.h"
19
- #include " common/logging.h"
13
+ #include " windows/editor/editordock.h"
14
+ #include " windows/editor/editortab.h"
20
15
21
16
#include < QFileInfo>
22
17
#include < QMessageBox>
23
18
#include < QMetaObject>
19
+ #include < QProcessEnvironment>
24
20
#include < QTextDocument>
21
+ #include < QtWidgets>
22
+ #include < qactiongroup.h>
23
+ #include < qwidget.h>
25
24
26
25
LOG_CATEGORY (" gui.mainwindow" );
27
26
@@ -266,8 +265,9 @@ void MainWindow::create_core(
266
265
267
266
set_speed (); // Update machine speed to current settings
268
267
269
- const static machine::ExceptionCause ecall_variats[] = {machine::EXCAUSE_ECALL_ANY,
270
- machine::EXCAUSE_ECALL_M, machine::EXCAUSE_ECALL_S, machine::EXCAUSE_ECALL_U};
268
+ const static machine::ExceptionCause ecall_variats[]
269
+ = { machine::EXCAUSE_ECALL_ANY, machine::EXCAUSE_ECALL_M, machine::EXCAUSE_ECALL_S,
270
+ machine::EXCAUSE_ECALL_U };
271
271
272
272
if (config.osemu_enable ()) {
273
273
auto *osemu_handler = new osemu::OsSyscallExceptionHandler (
@@ -300,6 +300,8 @@ 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::mySignal, this , &MainWindow::hightlightByAddress);
303
305
// Connect signal from break to machine pause
304
306
connect (
305
307
machine->core (), &machine::Core::stop_on_exception_reached, machine.data (),
@@ -334,6 +336,14 @@ void MainWindow::new_machine() {
334
336
ndialog->show ();
335
337
}
336
338
339
+ void MainWindow::hightlightByAddress (machine::Address addr) {
340
+ auto lineNum = lineToAddress.value (addr);
341
+ printf (
342
+ " ))))))))))))))))))))))))))))))))))c))))))))))))))))))))))))addr: %x, block: %d\n " , addr,
343
+ lineNum);
344
+ editor_tabs->get_current_editor ()->highlightBlock (lineNum);
345
+ }
346
+
337
347
void MainWindow::machine_reload (bool force_memory_reset, bool force_elf_load) {
338
348
if (machine == nullptr ) { return new_machine (); }
339
349
bool load_executable = force_elf_load || machine->executable_loaded ();
@@ -408,13 +418,13 @@ void MainWindow::print_action() {
408
418
void MainWindow::show_##NAME() { \
409
419
show_dockwidget (&*NAME, DEFAULT_AREA, true , false ); \
410
420
} \
411
- void MainWindow::reset_state_##NAME() { \
412
- show_dockwidget (&*NAME, DEFAULT_AREA, DEFAULT_VISIBLE, true ); \
413
- }
421
+ void MainWindow::reset_state_##NAME() { \
422
+ show_dockwidget (&*NAME, DEFAULT_AREA, DEFAULT_VISIBLE, true ); \
423
+ }
414
424
415
425
SHOW_HANDLER (registers, Qt::TopDockWidgetArea, true )
416
426
SHOW_HANDLER(program, Qt::LeftDockWidgetArea, true )
417
- SHOW_HANDLER(memory, Qt::RightDockWidgetArea, true )
427
+ SHOW_HANDLER(memory, Qt::RightDockWidgetArea, true )
418
428
SHOW_HANDLER(cache_program, Qt::RightDockWidgetArea, false )
419
429
SHOW_HANDLER(cache_data, Qt::RightDockWidgetArea, false )
420
430
SHOW_HANDLER(cache_level2, Qt::RightDockWidgetArea, false )
@@ -524,8 +534,11 @@ void MainWindow::closeEvent(QCloseEvent *event) {
524
534
}
525
535
}
526
536
527
- void MainWindow::show_dockwidget (QDockWidget *dw, Qt::DockWidgetArea area,
528
- bool defaultVisible, bool resetState) {
537
+ void MainWindow::show_dockwidget (
538
+ QDockWidget *dw,
539
+ Qt::DockWidgetArea area,
540
+ bool defaultVisible,
541
+ bool resetState) {
529
542
if (dw == nullptr ) { return ; }
530
543
if (resetState) {
531
544
if (dw->isFloating ()) {
@@ -617,8 +630,7 @@ void MainWindow::message_selected(
617
630
central_widget_tabs->setCurrentWidget (editor_tabs.data ());
618
631
if (!editor_tabs->set_cursor_to (file, line, column)) {
619
632
editor_tabs->open_file_if_not_open (file, false );
620
- if (!editor_tabs->set_cursor_to (file, line, column))
621
- return ;
633
+ if (!editor_tabs->set_cursor_to (file, line, column)) return ;
622
634
}
623
635
624
636
// Highlight the line
@@ -632,7 +644,7 @@ void MainWindow::message_selected(
632
644
}
633
645
634
646
bool SimpleAsmWithEditorCheck::process_file (const QString &filename, QString *error_ptr) {
635
- EditorTab* tab = mainwindow->editor_tabs ->find_tab_by_filename (filename);
647
+ EditorTab * tab = mainwindow->editor_tabs ->find_tab_by_filename (filename);
636
648
if (tab == nullptr ) { return Super::process_file (filename, error_ptr); }
637
649
SrcEditor *editor = tab->get_editor ();
638
650
QTextDocument *doc = editor->document ();
@@ -759,6 +771,10 @@ void MainWindow::compile_source() {
759
771
}
760
772
if (!sasm.finish ()) { error_occured = true ; }
761
773
774
+ lineToAddress = sasm.lintToAddress ;
775
+ // TODO
776
+ // save lintToAddress in MainWindow?
777
+
762
778
if (error_occured) { show_messages (); }
763
779
}
764
780
0 commit comments