Added the return address information in the call stack
[clinton/Virtual-Jaguar-Rx.git] / src / debugger / debuggertab.cpp
index c5b3a00..d6135e8 100644 (file)
@@ -7,32 +7,48 @@
 //\r
 // WHO  WHEN        WHAT\r
 // ---  ----------  ------------------------------------------------------------\r
-// JPM  06/19/2016  Created this file\r
-// JPM  06/19/2016  Soft debugger support\r
+// JPM  Sept./2016  Created this file, and added Soft debugger support\r
+// JPM  10/09/2018  Added source file search paths\r
+//\r
 \r
 #include "debuggertab.h"\r
 #include "settings.h"\r
 \r
 \r
+// \r
 DebuggerTab::DebuggerTab(QWidget * parent/*= 0*/): QWidget(parent)\r
 {\r
-       QLabel * label3 = new QLabel("Disassembly lines:");\r
-       edit3 = new QLineEdit("");\r
-       edit3->setPlaceholderText("Number of disassembly lines");\r
-       QVBoxLayout * layout1 = new QVBoxLayout;\r
+       // Number of disassembly lines\r
+       QLabel *label3 = new QLabel("Disassembly lines:");\r
+       QVBoxLayout *layout1 = new QVBoxLayout;\r
        layout1->addWidget(label3);\r
-\r
-       QVBoxLayout * layout2 = new QVBoxLayout;\r
-       layout2->addWidget(edit3);\r
-\r
-       QHBoxLayout * layout3 = new QHBoxLayout;\r
+       QVBoxLayout *layout2 = new QVBoxLayout;\r
+       nbrdisasmlines = new QLineEdit("");\r
+       nbrdisasmlines->setPlaceholderText("Number of disassembly lines");\r
+       layout2->addWidget(nbrdisasmlines);\r
+\r
+       // Sources code paths\r
+       QLabel *label4 = new QLabel("Source file search paths:");\r
+       QVBoxLayout *layout5 = new QVBoxLayout;\r
+       layout5->addWidget(label4);\r
+       QVBoxLayout *layout6 = new QVBoxLayout;\r
+       sourcefilesearchpaths = new QLineEdit("");\r
+       sourcefilesearchpaths->setMaxLength(sizeof(vjs.sourcefilesearchPaths));\r
+       sourcefilesearchpaths->setPlaceholderText("Each path must be separate by a ';', search is recursive and based on each path");\r
+       layout6->addWidget(sourcefilesearchpaths);\r
+\r
+       QHBoxLayout *layout3 = new QHBoxLayout;\r
        layout3->addLayout(layout1);\r
        layout3->addLayout(layout2);\r
+       QHBoxLayout *layout7 = new QHBoxLayout;\r
+       layout7->addLayout(layout5);\r
+       layout7->addLayout(layout6);\r
 \r
-       QVBoxLayout * layout4 = new QVBoxLayout;\r
+       QVBoxLayout *layout4 = new QVBoxLayout;\r
        layout4->addLayout(layout3);\r
+       layout4->addLayout(layout7);\r
 \r
-       // Checkboxes...\r
+       // Checkboxes\r
        displayHWlabels = new QCheckBox(tr("Display HW labels"));\r
        disasmopcodes   = new QCheckBox(tr("Display M68000 opcodes"));\r
        displayFullSourceFilename = new QCheckBox(tr("Display source filename"));\r
@@ -48,6 +64,7 @@ DebuggerTab::DebuggerTab(QWidget * parent/*= 0*/): QWidget(parent)
 }\r
 \r
 \r
+// \r
 DebuggerTab::~DebuggerTab()\r
 {\r
 }\r
@@ -58,11 +75,9 @@ void DebuggerTab::SetSettings(void)
 {\r
        bool ok;\r
 \r
-       //strcpy(vjs.debuggerROMPath, debuggerTab->edit1->text().toUtf8().data());\r
        strcpy(vjs.debuggerROMPath, vjs.alpineROMPath);\r
-       //strcpy(vjs.absROMPath, debuggerTab->edit2->text().toUtf8().data());\r
-       vjs.nbrdisasmlines = edit3->text().toUInt(&ok, 10);\r
-       //vjs.allowWritesToROM = debuggerTab->writeROM->isChecked();\r
+       strcpy(vjs.sourcefilesearchPaths, CheckForTrailingSlash(sourcefilesearchpaths->text()).toUtf8().data());\r
+       vjs.nbrdisasmlines = nbrdisasmlines->text().toUInt(&ok, 10);\r
        vjs.displayHWlabels = displayHWlabels->isChecked();\r
        vjs.disasmopcodes = disasmopcodes->isChecked();\r
        vjs.displayFullSourceFilename = displayFullSourceFilename->isChecked();\r
@@ -73,12 +88,28 @@ void DebuggerTab::SetSettings(void)
 void DebuggerTab::GetSettings(void)\r
 {\r
        QVariant v(vjs.nbrdisasmlines);\r
-       //debuggerTab->edit1->setText(vjs.debuggerROMPath);\r
-       //debuggerTab->edit2->setText(vjs.absROMPath);\r
-       edit3->setText(v.toString());\r
-       //debuggerTab->writeROM->setChecked(vjs.allowWritesToROM\r
+       nbrdisasmlines->setText(v.toString());\r
+       sourcefilesearchpaths->setText(vjs.sourcefilesearchPaths);\r
        displayHWlabels->setChecked(vjs.displayHWlabels);\r
        disasmopcodes->setChecked(vjs.disasmopcodes);\r
        displayFullSourceFilename->setChecked(vjs.displayFullSourceFilename);\r
 }\r
 \r
+\r
+// Remove the last character if slash or backslash at the end of each string\r
+// Depend the platform transform slashes or backslashes\r
+QString DebuggerTab::CheckForTrailingSlash(QString s)\r
+{\r
+       if (s.endsWith('/') || s.endsWith('\\'))\r
+       {\r
+               s.remove(s.length() - 1, 1);\r
+       }\r
+#ifdef _WIN32\r
+       s.replace(QString("/"), QString("\\"));\r
+       s.replace(QString("\\;"), QString(";"));\r
+#else\r
+       s.replace(QString("\\"), QString("/"));\r
+       s.replace(QString("/;"), QString(";"));\r
+#endif\r
+       return s;\r
+}\r