Created
May 4, 2022 14:57
-
-
Save h1romas4/c851be9afa16ff2ebb3a967548ed92ad to your computer and use it in GitHub Desktop.
Ubuntu 20.04 LTS 版の openmsx-debugger の Qt 修正 + z88dk の -m 形式の .map symbol を読ませる hack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/DebuggerForm.cpp b/src/DebuggerForm.cpp | |
index 7e03c9e..b1df51a 100644 | |
--- a/src/DebuggerForm.cpp | |
+++ b/src/DebuggerForm.cpp | |
@@ -632,7 +632,7 @@ void DebuggerForm::createForm() | |
// add widgets | |
for (int i = 0; i < list.size(); ++i) { | |
- QStringList s = list.at(i).split(" ", Qt::SplitBehaviorFlags::SkipEmptyParts); | |
+ QStringList s = list.at(i).split(" ", QString::SplitBehavior::SkipEmptyParts); | |
// get widget | |
if ((dw = dockMan.findDockableWidget(s.at(0)))) { | |
if (s.at(1) == "D") { | |
@@ -1451,7 +1451,7 @@ void DebuggerForm::setDebuggables(const QString& list) | |
debuggables.clear(); | |
// process result string | |
- QStringList l = list.split(" ", Qt::SplitBehaviorFlags::SkipEmptyParts); | |
+ QStringList l = list.split(" ", QString::SplitBehavior::SkipEmptyParts); | |
for (int i = 0; i < l.size(); ++i) { | |
QString d = l[i]; | |
// combine multiple words | |
diff --git a/src/SymbolManager.cpp b/src/SymbolManager.cpp | |
index c82191d..88a186a 100644 | |
--- a/src/SymbolManager.cpp | |
+++ b/src/SymbolManager.cpp | |
@@ -128,6 +128,7 @@ void SymbolManager::addFile() | |
<< "asMSX 0.x symbol files (*.sym)" | |
<< "HiTech C symbol files (*.sym)" | |
<< "HiTech C link map files (*.map)" | |
+ << "Z88DK map files (*.map)" | |
<< "pasmo symbol files (*.symbol *.publics *.sys)"; | |
d->setNameFilters(types); | |
d->setAcceptMode(QFileDialog::AcceptOpen); | |
@@ -150,6 +151,8 @@ void SymbolManager::addFile() | |
read = symTable.readFile(n, SymbolTable::HTC_FILE); | |
} else if (f.startsWith("HiTech C link")) { | |
read = symTable.readFile(n, SymbolTable::LINKMAP_FILE); | |
+ } else if (f.startsWith("Z88DK map")) { | |
+ read = symTable.readFile(n, SymbolTable::Z88DK_FILE); | |
} else if (f.startsWith("pasmo")) { | |
read = symTable.readFile(n, SymbolTable::PASMO_FILE); | |
} else { | |
diff --git a/src/SymbolTable.cpp b/src/SymbolTable.cpp | |
index 2551c05..4f5b9f1 100644 | |
--- a/src/SymbolTable.cpp | |
+++ b/src/SymbolTable.cpp | |
@@ -184,7 +184,9 @@ bool SymbolTable::readFile(const QString& filename, FileType type) | |
if (type == DETECT_FILE) { | |
if (filename.toLower().endsWith(".map")) { | |
// HiTech link map file | |
- type = LINKMAP_FILE; | |
+ // TODO: Z88DK Hack | |
+ // type = LINKMAP_FILE; | |
+ type = Z88DK_FILE; | |
} else if (filename.toLower().endsWith(".sym")) { | |
// auto detect which sym file | |
QFile file(filename); | |
@@ -229,6 +231,8 @@ bool SymbolTable::readFile(const QString& filename, FileType type) | |
return readASMSXFile(filename); | |
case HTC_FILE: | |
return readHTCFile(filename); | |
+ case Z88DK_FILE: | |
+ return readZ88DKFile(filename); | |
case LINKMAP_FILE: | |
return readLinkMapFile(filename); | |
case PASMO_FILE: | |
@@ -281,7 +285,7 @@ bool SymbolTable::readSymbolFile( | |
QTextStream in(&file); | |
while (!in.atEnd()) { | |
QString line = in.readLine(); | |
- QStringList l = line.split(equ, Qt::SplitBehaviorFlags::KeepEmptyParts, Qt::CaseInsensitive); | |
+ QStringList l = line.split(equ, QString::SplitBehavior::KeepEmptyParts, Qt::CaseInsensitive); | |
if (l.size() != 2) continue; | |
int value; | |
if (!parseValue(l.at(1), value)) continue; | |
@@ -392,6 +396,32 @@ bool SymbolTable::readHTCFile(const QString& filename) | |
return true; | |
} | |
+bool SymbolTable::readZ88DKFile(const QString& filename) | |
+{ | |
+ QFile file(filename); | |
+ if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { | |
+ return false; | |
+ } | |
+ | |
+ appendFile(filename, Z88DK_FILE); | |
+ QTextStream in(&file); | |
+ while (!in.atEnd()) { | |
+ QString line = in.readLine(); | |
+ QStringList l = line.split(QRegExp("(\t+)|( +)")); | |
+ if (l.size() < 3) continue; | |
+ int value; | |
+ // ex. $0001 | |
+ // printf("@@@ %s", l.at(2).mid(1,4).toStdString().c.str()); | |
+ if (!parseValue("0x" + l.at(2).mid(1,4), value)) continue; | |
+ // hack ex. $FFFFFFFFFFFF03B6 | |
+ if (value == 0xffff) continue; | |
+ auto* sym = new Symbol(l.at(0), value); | |
+ sym->setSource(&symbolFiles.back().fileName); | |
+ add(sym); | |
+ } | |
+ return true; | |
+} | |
+ | |
bool SymbolTable::readLinkMapFile(const QString& filename) | |
{ | |
const QString magic("Machine type"); | |
diff --git a/src/SymbolTable.h b/src/SymbolTable.h | |
index 1b7e761..b2d2e1e 100644 | |
--- a/src/SymbolTable.h | |
+++ b/src/SymbolTable.h | |
@@ -81,6 +81,7 @@ public: | |
ASMSX_FILE, | |
LINKMAP_FILE, | |
HTC_FILE, | |
+ Z88DK_FILE, | |
PASMO_FILE | |
}; | |
@@ -127,6 +128,7 @@ private: | |
bool readASMSXFile(const QString& filename); | |
bool readSJASMFile(const QString& filename); | |
bool readHTCFile(const QString& filename); | |
+ bool readZ88DKFile(const QString& filename); | |
bool readLinkMapFile(const QString& filename); | |
bool readPASMOFile(const QString& filename); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment