core: Fix libdwarf and Qt build failure
[clinton/Virtual-Jaguar-Rx.git] / src / debugger / debuggertab.cpp
... / ...
CommitLineData
1//\r
2// debuggertab.cpp: "Debugger" tab on the settings dialog\r
3//\r
4// by Jean-Paul Mari\r
5//\r
6// JPM = Jean-Paul Mari <djipi.mari@gmail.com>\r
7// RG = Richard Goedeken\r
8//\r
9// WHO WHEN WHAT\r
10// --- ---------- ------------------------------------------------------------\r
11// JPM Sept./2016 Created this file, and added Soft debugger support\r
12// JPM 10/09/2018 Added source file search paths\r
13// JPM 04/06/2019 Added ELF sections check\r
14// RG Jan./2021 Linux build fix\r
15//\r
16\r
17#include "debuggertab.h"\r
18#include "settings.h"\r
19\r
20\r
21// \r
22DebuggerTab::DebuggerTab(QWidget * parent/*= 0*/): QWidget(parent)\r
23{\r
24 // Number of disassembly lines\r
25 QLabel *label3 = new QLabel("Disassembly lines:");\r
26 QVBoxLayout *layout1 = new QVBoxLayout;\r
27 layout1->addWidget(label3);\r
28 QVBoxLayout *layout2 = new QVBoxLayout;\r
29 nbrdisasmlines = new QLineEdit("");\r
30 nbrdisasmlines->setPlaceholderText("Number of disassembly lines");\r
31 layout2->addWidget(nbrdisasmlines);\r
32\r
33 // Sources code paths\r
34 QLabel *label4 = new QLabel("Source file search paths:");\r
35 QVBoxLayout *layout5 = new QVBoxLayout;\r
36 layout5->addWidget(label4);\r
37 QVBoxLayout *layout6 = new QVBoxLayout;\r
38 sourcefilesearchpaths = new QLineEdit("");\r
39 sourcefilesearchpaths->setMaxLength(sizeof(vjs.sourcefilesearchPaths));\r
40 sourcefilesearchpaths->setPlaceholderText("Each path must be separate by a ';', search is recursive and based on each path");\r
41 layout6->addWidget(sourcefilesearchpaths);\r
42\r
43 QHBoxLayout *layout3 = new QHBoxLayout;\r
44 layout3->addLayout(layout1);\r
45 layout3->addLayout(layout2);\r
46 QHBoxLayout *layout7 = new QHBoxLayout;\r
47 layout7->addLayout(layout5);\r
48 layout7->addLayout(layout6);\r
49\r
50 QVBoxLayout *layout4 = new QVBoxLayout;\r
51 layout4->addLayout(layout3);\r
52 layout4->addLayout(layout7);\r
53\r
54 // Checkboxes\r
55 displayHWlabels = new QCheckBox(tr("Display HW labels"));\r
56 disasmopcodes = new QCheckBox(tr("Display M68000 opcodes"));\r
57 displayFullSourceFilename = new QCheckBox(tr("Display source filename"));\r
58 ELFSectionsCheck = new QCheckBox(tr("ELF sections check"));\r
59 disasmopcodes->setDisabled(false);\r
60 displayHWlabels->setDisabled(false);\r
61 displayFullSourceFilename->setDisabled(false);\r
62 ELFSectionsCheck->setDisabled(false);\r
63\r
64 layout4->addWidget(disasmopcodes);\r
65 layout4->addWidget(displayHWlabels);\r
66 layout4->addWidget(displayFullSourceFilename);\r
67 layout4->addWidget(ELFSectionsCheck);\r
68\r
69 setLayout(layout4);\r
70}\r
71\r
72\r
73// \r
74DebuggerTab::~DebuggerTab()\r
75{\r
76}\r
77\r
78\r
79// Save / Update the settings from the tabs dialog\r
80void DebuggerTab::SetSettings(void)\r
81{\r
82 bool ok;\r
83\r
84 strcpy(vjs.debuggerROMPath, vjs.alpineROMPath);\r
85 strcpy(vjs.sourcefilesearchPaths, CheckForTrailingSlash(sourcefilesearchpaths->text()).toUtf8().data());\r
86 vjs.nbrdisasmlines = nbrdisasmlines->text().toUInt(&ok, 10);\r
87 vjs.displayHWlabels = displayHWlabels->isChecked();\r
88 vjs.disasmopcodes = disasmopcodes->isChecked();\r
89 vjs.displayFullSourceFilename = displayFullSourceFilename->isChecked();\r
90 vjs.ELFSectionsCheck = ELFSectionsCheck->isChecked();\r
91}\r
92\r
93\r
94// Load / Update the tabs dialog from the settings\r
95void DebuggerTab::GetSettings(void)\r
96{\r
97 QVariant v((qulonglong) vjs.nbrdisasmlines);\r
98 nbrdisasmlines->setText(v.toString());\r
99 sourcefilesearchpaths->setText(vjs.sourcefilesearchPaths);\r
100 displayHWlabels->setChecked(vjs.displayHWlabels);\r
101 disasmopcodes->setChecked(vjs.disasmopcodes);\r
102 displayFullSourceFilename->setChecked(vjs.displayFullSourceFilename);\r
103 ELFSectionsCheck->setChecked(vjs.ELFSectionsCheck);\r
104}\r
105\r
106\r
107// Remove the last character if slash or backslash at the end of each string\r
108// Depend the platform transform slashes or backslashes\r
109QString DebuggerTab::CheckForTrailingSlash(QString s)\r
110{\r
111 if (s.endsWith('/') || s.endsWith('\\'))\r
112 {\r
113 s.remove(s.length() - 1, 1);\r
114 }\r
115#ifdef _WIN32\r
116 s.replace(QString("/"), QString("\\"));\r
117 s.replace(QString("\\;"), QString(";"));\r
118#else\r
119 s.replace(QString("\\"), QString("/"));\r
120 s.replace(QString("/;"), QString(";"));\r
121#endif\r
122 return s;\r
123}\r