Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/DebugSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void DebugSession::clear()
modified = false;
}

void DebugSession::open(const QString& file)
void DebugSession::open(const QString& file, unsigned symConf)
{
QFile f(file);
if (!f.open(QFile::ReadOnly | QFile::Text)) {
Expand All @@ -73,7 +73,7 @@ void DebugSession::open(const QString& file)
// begin tag
if (ses.isStartElement()) {
if (ses.name() == "Symbols") {
symTable.loadSymbols(ses);
symTable.loadSymbols(ses, symConf);
} else if (ses.name() == "Breakpoints") {
breaks.loadBreakpoints(ses);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/DebugSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class DebugSession : public QObject

// session
void clear();
void open(const QString& file);
void open(const QString& file, unsigned symConf);
bool save();
bool saveAs(const QString& file);
bool existsAsFile() const;
Expand Down
25 changes: 24 additions & 1 deletion src/DebuggerForm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ int DebuggerForm::counter = 0;
DebuggerForm::DebuggerForm(QWidget* parent)
: QMainWindow(parent)
, comm(CommClient::instance())
, isReloadSymbolFilesPerSession(false) // false: past version behavior
, isIgnoreSymbolsOfPrevSession(false) // false: past version behavior
{
VDPRegView = nullptr;
VDPStatusRegView = nullptr;
Expand All @@ -163,6 +165,23 @@ DebuggerForm::DebuggerForm(QWidget* parent)

recentFiles = Settings::get().value("MainWindow/RecentFiles").toStringList();
updateRecentFiles();
// configure symbols reloading
struct {
bool *val;
const char *key;
} mapping[] = {
{ &isReloadSymbolFilesPerSession, "Session/ReloadSymbolFilesPerSession" },
{ &isIgnoreSymbolsOfPrevSession, "Session/IgnoreSymbolsOfPrevSession" },
{ NULL, NULL }
}, *p = mapping;
QSettings &cfg = Settings::get();
for (; p->val; ++p) {
if (cfg.contains(p->key)) {
*p->val = cfg.value(p->key).toBool();
} else if (cfg.isWritable()) {
cfg.setValue(p->key, *p->val);
}
}

connect(&session.symbolTable(), &SymbolTable::symbolFileChanged, this, &DebuggerForm::symbolFileChanged);
}
Expand Down Expand Up @@ -1044,10 +1063,14 @@ void DebuggerForm::fileOpenSession()
void DebuggerForm::openSession(const QString& file)
{
fileNewSession();
session.open(file);
unsigned symConf = 0;
symConf |= (isReloadSymbolFilesPerSession) ? SymbolTable::LoadSymbolFiles : 0;
symConf |= ( isIgnoreSymbolsOfPrevSession) ? SymbolTable::IgnoreSymbolTag : 0;
session.open(file, symConf);
if (systemDisconnectAction->isEnabled()) {
// active connection, merge loaded breakpoints
reloadBreakpoints(true);
emit symbolsChanged();
}
// update recent
if (session.existsAsFile()) {
Expand Down
2 changes: 2 additions & 0 deletions src/DebuggerForm.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ class DebuggerForm : public QMainWindow
static int counter;
enum {RESET = 0, SLOTS_CHECKED, PC_CHANGED, SLOTS_CHANGED} disasmStatus = RESET;
uint16_t disasmAddress;
bool isReloadSymbolFilesPerSession;
bool isIgnoreSymbolsOfPrevSession;

QList<CommandRef> commands;
void updateCustomActions();
Expand Down
20 changes: 14 additions & 6 deletions src/SymbolTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@ bool SymbolTable::readOMDSFile(const QString& filename)

QXmlStreamReader ses;
ses.setDevice(&file);
loadSymbols(ses);
unsigned flags = 0; // same as past behavior
loadSymbols(ses, flags);
return true;
}
bool SymbolTable::readTNIASM0File(const QString& filename)
Expand Down Expand Up @@ -704,9 +705,10 @@ void SymbolTable::saveSymbols(QXmlStreamWriter& xml)
}
}

void SymbolTable::loadSymbols(QXmlStreamReader& xml)
void SymbolTable::loadSymbols(QXmlStreamReader& xml, unsigned flags)
{
Symbol* sym = nullptr;
Symbol dummy("", 0); // for ignoring
Symbol* sym = (LoadSymbolFiles & flags) ? &dummy : nullptr;
while (!xml.atEnd()) {
xml.readNext();
// exit if closing of main tag
Expand All @@ -728,12 +730,18 @@ void SymbolTable::loadSymbols(QXmlStreamReader& xml)
} else if (ftype == "linkmap") {
type = LINKMAP_FILE;
}
// append file
appendFile(fname, type);
if (LoadSymbolFiles & flags) {
// (append file +) read file
bool ok = readFile(fname, type);
if (!ok) continue; // file cannot open, invalid format, ...
} else {
// append file
appendFile(fname, type);
}
// change time
symbolFiles.back().refreshTime.setTime_t(rtime.toUInt());

} else if (xml.name() == "Symbol") {
} else if (xml.name() == "Symbol" && !(IgnoreSymbolTag & flags)) {
// add empty symbol
sym = add(std::make_unique<Symbol>("", 0));
// get status attribute
Expand Down
6 changes: 5 additions & 1 deletion src/SymbolTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ class SymbolTable : public QObject
PASMO_FILE,
VASM_FILE
};
enum {
LoadSymbolFiles = 1,
IgnoreSymbolTag = 2,
};

SymbolTable();

Expand All @@ -103,7 +107,7 @@ class SymbolTable : public QObject

// xml session file functions
void saveSymbols(QXmlStreamWriter& xml);
void loadSymbols(QXmlStreamReader& xml);
void loadSymbols(QXmlStreamReader& xml, unsigned flags);

// Symbol access functions
[[nodiscard]] Symbol* findFirstAddressSymbol(int addr, MemoryLayout* ml = nullptr);
Expand Down