- enhancement: By default, use monospaced font to display register values in the CPU Info dialog.

- fix: Negative values in register like AH/AL are wrongs displayed as 32/64-bit number.
This commit is contained in:
Roy Qu 2024-03-31 09:36:37 +08:00
parent 8584380587
commit f834a6dfbf
4 changed files with 24 additions and 10 deletions

View File

@ -105,6 +105,8 @@ Red Panda C++ Version 2.27
- fix: Compile info for project doesn't have name of the project executable.
- enhancement: Highlight words in the string/comments.
- fix: If there are only 1 line in the editor, shift+down can't select it.
- enhancement: By default, use monospaced font to display register values in the CPU Info dialog.
- fix: Negative values in register like AH/AL are wrongs displayed as 32/64-bit number.
Red Panda C++ Version 2.26
- enhancement: Code suggestion for embedded std::vectors.

View File

@ -34,6 +34,7 @@
#include <QJsonArray>
#include <QJsonObject>
#include "widgets/signalmessagedialog.h"
#include <QApplication>
Debugger::Debugger(QObject *parent) : QObject(parent),
mForceUTF8(false),
@ -2219,6 +2220,8 @@ QVariant RegisterModel::data(const QModelIndex &index, int role) const
,"");
}
break;
case Qt::FontRole:
return QFont{pSettings->debugger().fontName(),pSettings->debugger().fontSize()};
case Qt::ToolTipRole:
switch (index.column()) {
case 0:
@ -2265,7 +2268,9 @@ void RegisterModel::updateNames(const QStringList &regNames)
void RegisterModel::updateValues(const QHash<int, QString> registerValues)
{
mRegisterValues= registerValues;
foreach(int row, registerValues.keys()){
mRegisterValues[row] = registerValues[row];
}
emit dataChanged(createIndex(0,1),
createIndex(mRegisterNames.count()-1,1));
}

View File

@ -471,20 +471,26 @@ void GDBMIDebuggerClient::handleRegisterNames(const QList<GDBMIResultParser::Par
emit registerNamesUpdated(nameList);
}
void GDBMIDebuggerClient::handleRegisterValue(const QList<GDBMIResultParser::ParseValue> &values)
void GDBMIDebuggerClient::handleRegisterValue(const QList<GDBMIResultParser::ParseValue> &values, bool hexValue)
{
QHash<int,QString> result;
foreach (const GDBMIResultParser::ParseValue& val, values) {
GDBMIResultParser::ParseObject obj = val.object();
int number = obj["number"].intValue();
QString value = obj["value"].value();
bool ok;
long long intVal;
intVal = value.toLongLong(&ok,10);
if (ok) {
value = QString("0x%1").arg(intVal,0,16);
if (hexValue) {
bool ok;
long long intVal;
intVal = value.toLongLong(&ok,16);
if (ok)
result.insert(number,value);
} else {
bool ok;
long long intVal;
intVal = value.toLongLong(&ok,10);
if (!ok)
result.insert(number,value);
}
result.insert(number,value);
}
emit registerValuesUpdated(result);
}
@ -712,7 +718,7 @@ void GDBMIDebuggerClient::processResult(const QByteArray &result)
handleRegisterNames(multiValues["register-names"].array());
break;
case GDBMIResultType::RegisterValues:
handleRegisterValue(multiValues["register-values"].array());
handleRegisterValue(multiValues["register-values"].array(), mCurrentCmd->params=="x");
break;
case GDBMIResultType::CreateVar:
handleCreateVar(multiValues);
@ -1207,6 +1213,7 @@ void GDBMIDebuggerClient::refreshFrame()
void GDBMIDebuggerClient::refreshRegisters()
{
postCommand("-data-list-register-names","");
postCommand("-data-list-register-values", "x");
postCommand("-data-list-register-values", "N");
}

View File

@ -105,7 +105,7 @@ private:
void handleMemory(const QList<GDBMIResultParser::ParseValue> & rows);
void handleMemoryBytes(const QList<GDBMIResultParser::ParseValue> & rows);
void handleRegisterNames(const QList<GDBMIResultParser::ParseValue> & names);
void handleRegisterValue(const QList<GDBMIResultParser::ParseValue> & values);
void handleRegisterValue(const QList<GDBMIResultParser::ParseValue> & values, bool hexValue);
void handleListVarChildren(const GDBMIResultParser::ParseObject& multiVars);
void handleUpdateVarValue(const QList<GDBMIResultParser::ParseValue> &changes);
void handleDisassembly(const QList<GDBMIResultParser::ParseValue> &instructions);