forked from qt-creator/qt-creator
debugger: cleanup
This commit is contained in:
@@ -329,6 +329,12 @@ void GdbEngine::readDebugeeOutput(const QByteArray &data)
|
|||||||
showMessage(msg, AppOutput);
|
showMessage(msg, AppOutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool isNameChar(char c)
|
||||||
|
{
|
||||||
|
// could be 'stopped' or 'shlibs-added'
|
||||||
|
return (c >= 'a' && c <= 'z') || c == '-';
|
||||||
|
}
|
||||||
|
|
||||||
void GdbEngine::handleResponse(const QByteArray &buff)
|
void GdbEngine::handleResponse(const QByteArray &buff)
|
||||||
{
|
{
|
||||||
showMessage(QString::fromLocal8Bit(buff, buff.length()), LogOutput);
|
showMessage(QString::fromLocal8Bit(buff, buff.length()), LogOutput);
|
||||||
|
@@ -45,13 +45,6 @@
|
|||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
enum GuessChildrenResult
|
|
||||||
{
|
|
||||||
HasChildren,
|
|
||||||
HasNoChildren,
|
|
||||||
HasPossiblyChildren
|
|
||||||
};
|
|
||||||
|
|
||||||
static QString htmlEscape(const QString &plain)
|
static QString htmlEscape(const QString &plain)
|
||||||
{
|
{
|
||||||
QString rich;
|
QString rich;
|
||||||
@@ -127,19 +120,6 @@ bool isIntOrFloatType(const QByteArray &type)
|
|||||||
return isIntType(type) || isFloatType(type);
|
return isIntType(type) || isFloatType(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
GuessChildrenResult guessChildren(const QByteArray &type)
|
|
||||||
{
|
|
||||||
if (isIntOrFloatType(type))
|
|
||||||
return HasNoChildren;
|
|
||||||
if (isCharPointerType(type))
|
|
||||||
return HasNoChildren;
|
|
||||||
if (isPointerType(type))
|
|
||||||
return HasChildren;
|
|
||||||
if (type.endsWith("QString"))
|
|
||||||
return HasNoChildren;
|
|
||||||
return HasPossiblyChildren;
|
|
||||||
}
|
|
||||||
|
|
||||||
WatchData::WatchData() :
|
WatchData::WatchData() :
|
||||||
id(0),
|
id(0),
|
||||||
state(InitialState),
|
state(InitialState),
|
||||||
@@ -234,6 +214,21 @@ void WatchData::setValueToolTip(const QString &tooltip)
|
|||||||
valuetooltip = tooltip;
|
valuetooltip = tooltip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum GuessChildrenResult { HasChildren, HasNoChildren, HasPossiblyChildren };
|
||||||
|
|
||||||
|
static GuessChildrenResult guessChildren(const QByteArray &type)
|
||||||
|
{
|
||||||
|
if (isIntOrFloatType(type))
|
||||||
|
return HasNoChildren;
|
||||||
|
if (isCharPointerType(type))
|
||||||
|
return HasNoChildren;
|
||||||
|
if (isPointerType(type))
|
||||||
|
return HasChildren;
|
||||||
|
if (type.endsWith("QString"))
|
||||||
|
return HasNoChildren;
|
||||||
|
return HasPossiblyChildren;
|
||||||
|
}
|
||||||
|
|
||||||
void WatchData::setType(const QByteArray &str, bool guessChildrenFromType)
|
void WatchData::setType(const QByteArray &str, bool guessChildrenFromType)
|
||||||
{
|
{
|
||||||
type = str.trimmed();
|
type = str.trimmed();
|
||||||
|
@@ -496,18 +496,6 @@ QByteArray gdbQuoteTypes(const QByteArray &type)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString extractTypeFromPTypeOutput(const QString &str)
|
|
||||||
{
|
|
||||||
int pos0 = str.indexOf(QLatin1Char('='));
|
|
||||||
int pos1 = str.indexOf(QLatin1Char('{'));
|
|
||||||
int pos2 = str.lastIndexOf(QLatin1Char('}'));
|
|
||||||
QString res = str;
|
|
||||||
if (pos0 != -1 && pos1 != -1 && pos2 != -1)
|
|
||||||
res = str.mid(pos0 + 2, pos1 - 1 - pos0)
|
|
||||||
+ QLatin1String(" ... ") + str.right(str.size() - pos2);
|
|
||||||
return res.simplified();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isSymbianIntType(const QByteArray &type)
|
bool isSymbianIntType(const QByteArray &type)
|
||||||
{
|
{
|
||||||
return type == "TInt" || type == "TBool";
|
return type == "TInt" || type == "TBool";
|
||||||
@@ -730,7 +718,7 @@ void setWatchDataValueEnabled(WatchData &data, const GdbMi &mi)
|
|||||||
data.valueEnabled = false;
|
data.valueEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setWatchDataValueEditable(WatchData &data, const GdbMi &mi)
|
static void setWatchDataValueEditable(WatchData &data, const GdbMi &mi)
|
||||||
{
|
{
|
||||||
if (mi.data() == "true")
|
if (mi.data() == "true")
|
||||||
data.valueEditable = true;
|
data.valueEditable = true;
|
||||||
@@ -738,34 +726,13 @@ void setWatchDataValueEditable(WatchData &data, const GdbMi &mi)
|
|||||||
data.valueEditable = false;
|
data.valueEditable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setWatchDataExpression(WatchData &data, const GdbMi &mi)
|
static void setWatchDataExpression(WatchData &data, const GdbMi &mi)
|
||||||
{
|
{
|
||||||
if (mi.isValid())
|
if (mi.isValid())
|
||||||
data.exp = mi.data();
|
data.exp = mi.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setWatchDataAddress(WatchData &data, const GdbMi &mi)
|
static void setWatchDataAddressHelper(WatchData &data, const QByteArray &addr)
|
||||||
{
|
|
||||||
if (mi.isValid())
|
|
||||||
setWatchDataAddressHelper(data, mi.data());
|
|
||||||
}
|
|
||||||
|
|
||||||
void setWatchDataOrigAddress(WatchData &data, const GdbMi &mi)
|
|
||||||
{
|
|
||||||
data.origAddress = mi.data().toULongLong(0, 16);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setWatchDataSize(WatchData &data, const GdbMi &mi)
|
|
||||||
{
|
|
||||||
if (mi.isValid()) {
|
|
||||||
bool ok = false;
|
|
||||||
const unsigned size = mi.data().toUInt(&ok);
|
|
||||||
if (ok)
|
|
||||||
data.size = size;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void setWatchDataAddressHelper(WatchData &data, const QByteArray &addr)
|
|
||||||
{
|
{
|
||||||
if (addr.startsWith("0x")) { // Item model dumpers pull tricks
|
if (addr.startsWith("0x")) { // Item model dumpers pull tricks
|
||||||
data.setHexAddress(addr);
|
data.setHexAddress(addr);
|
||||||
@@ -776,6 +743,27 @@ void setWatchDataAddressHelper(WatchData &data, const QByteArray &addr)
|
|||||||
data.exp = "*(" + gdbQuoteTypes(data.type) + "*)" +data.hexAddress();
|
data.exp = "*(" + gdbQuoteTypes(data.type) + "*)" +data.hexAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setWatchDataAddress(WatchData &data, const GdbMi &mi)
|
||||||
|
{
|
||||||
|
if (mi.isValid())
|
||||||
|
setWatchDataAddressHelper(data, mi.data());
|
||||||
|
}
|
||||||
|
|
||||||
|
static void setWatchDataOrigAddress(WatchData &data, const GdbMi &mi)
|
||||||
|
{
|
||||||
|
data.origAddress = mi.data().toULongLong(0, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void setWatchDataSize(WatchData &data, const GdbMi &mi)
|
||||||
|
{
|
||||||
|
if (mi.isValid()) {
|
||||||
|
bool ok = false;
|
||||||
|
const unsigned size = mi.data().toUInt(&ok);
|
||||||
|
if (ok)
|
||||||
|
data.size = size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Find the "type" and "displayedtype" children of root and set up type.
|
// Find the "type" and "displayedtype" children of root and set up type.
|
||||||
void setWatchDataType(WatchData &data, const GdbMi &item)
|
void setWatchDataType(WatchData &data, const GdbMi &item)
|
||||||
{
|
{
|
||||||
|
@@ -36,11 +36,6 @@
|
|||||||
|
|
||||||
#include <QtCore/QSet>
|
#include <QtCore/QSet>
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
#include <QtCore/QMap>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QDebug;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace TextEditor {
|
namespace TextEditor {
|
||||||
class ITextEditor;
|
class ITextEditor;
|
||||||
@@ -84,12 +79,6 @@ QString currentTime();
|
|||||||
bool isSkippableFunction(const QString &funcName, const QString &fileName);
|
bool isSkippableFunction(const QString &funcName, const QString &fileName);
|
||||||
bool isLeavableFunction(const QString &funcName, const QString &fileName);
|
bool isLeavableFunction(const QString &funcName, const QString &fileName);
|
||||||
|
|
||||||
inline bool isNameChar(char c)
|
|
||||||
{
|
|
||||||
// could be 'stopped' or 'shlibs-added'
|
|
||||||
return (c >= 'a' && c <= 'z') || c == '-';
|
|
||||||
}
|
|
||||||
|
|
||||||
bool hasLetterOrNumber(const QString &exp);
|
bool hasLetterOrNumber(const QString &exp);
|
||||||
bool hasSideEffects(const QString &exp);
|
bool hasSideEffects(const QString &exp);
|
||||||
bool isKeyWord(const QString &exp);
|
bool isKeyWord(const QString &exp);
|
||||||
@@ -98,15 +87,11 @@ bool isCharPointerType(const QByteArray &type);
|
|||||||
bool startsWithDigit(const QString &str);
|
bool startsWithDigit(const QString &str);
|
||||||
QByteArray stripPointerType(QByteArray type);
|
QByteArray stripPointerType(QByteArray type);
|
||||||
QByteArray gdbQuoteTypes(const QByteArray &type);
|
QByteArray gdbQuoteTypes(const QByteArray &type);
|
||||||
QString extractTypeFromPTypeOutput(const QString &str);
|
|
||||||
bool isFloatType(const QByteArray &type);
|
bool isFloatType(const QByteArray &type);
|
||||||
bool isIntOrFloatType(const QByteArray &type);
|
bool isIntOrFloatType(const QByteArray &type);
|
||||||
bool isIntType(const QByteArray &type);
|
bool isIntType(const QByteArray &type);
|
||||||
bool isSymbianIntType(const QByteArray &type);
|
bool isSymbianIntType(const QByteArray &type);
|
||||||
|
|
||||||
enum GuessChildrenResult { HasChildren, HasNoChildren, HasPossiblyChildren };
|
|
||||||
GuessChildrenResult guessChildren(const QByteArray &type);
|
|
||||||
|
|
||||||
QString quoteUnprintableLatin1(const QByteArray &ba);
|
QString quoteUnprintableLatin1(const QByteArray &ba);
|
||||||
|
|
||||||
// Editor tooltip support
|
// Editor tooltip support
|
||||||
@@ -124,9 +109,6 @@ bool getUninitializedVariables(const CPlusPlus::Snapshot &snapshot,
|
|||||||
const QString &function, const QString &file, int line,
|
const QString &function, const QString &file, int line,
|
||||||
QStringList *uninitializedVariables);
|
QStringList *uninitializedVariables);
|
||||||
|
|
||||||
// remove the default template argument in std:: containers
|
|
||||||
QString removeDefaultTemplateArguments(QString type);
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// GdbMi interaction
|
// GdbMi interaction
|
||||||
@@ -137,10 +119,7 @@ void setWatchDataValueToolTip(WatchData &data, const GdbMi &mi,
|
|||||||
int encoding);
|
int encoding);
|
||||||
void setWatchDataChildCount(WatchData &data, const GdbMi &mi);
|
void setWatchDataChildCount(WatchData &data, const GdbMi &mi);
|
||||||
void setWatchDataValueEnabled(WatchData &data, const GdbMi &mi);
|
void setWatchDataValueEnabled(WatchData &data, const GdbMi &mi);
|
||||||
void setWatchDataValueEditable(WatchData &data, const GdbMi &mi);
|
|
||||||
void setWatchDataExpression(WatchData &data, const GdbMi &mi);
|
|
||||||
void setWatchDataAddress(WatchData &data, const GdbMi &mi);
|
void setWatchDataAddress(WatchData &data, const GdbMi &mi);
|
||||||
void setWatchDataAddressHelper(WatchData &data, const QByteArray &addr);
|
|
||||||
void setWatchDataType(WatchData &data, const GdbMi &mi);
|
void setWatchDataType(WatchData &data, const GdbMi &mi);
|
||||||
void setWatchDataDisplayedType(WatchData &data, const GdbMi &mi);
|
void setWatchDataDisplayedType(WatchData &data, const GdbMi &mi);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user