Commit 63ebdb36 authored by hjk's avatar hjk

debugger: cleanup

parent e7441dab
......@@ -329,6 +329,12 @@ void GdbEngine::readDebugeeOutput(const QByteArray &data)
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)
{
showMessage(QString::fromLocal8Bit(buff, buff.length()), LogOutput);
......
......@@ -45,13 +45,6 @@
namespace Debugger {
namespace Internal {
enum GuessChildrenResult
{
HasChildren,
HasNoChildren,
HasPossiblyChildren
};
static QString htmlEscape(const QString &plain)
{
QString rich;
......@@ -127,19 +120,6 @@ bool isIntOrFloatType(const QByteArray &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() :
id(0),
state(InitialState),
......@@ -234,6 +214,21 @@ void WatchData::setValueToolTip(const QString &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)
{
type = str.trimmed();
......
......@@ -496,18 +496,6 @@ QByteArray gdbQuoteTypes(const QByteArray &type)
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)
{
return type == "TInt" || type == "TBool";
......@@ -730,7 +718,7 @@ void setWatchDataValueEnabled(WatchData &data, const GdbMi &mi)
data.valueEnabled = false;
}
void setWatchDataValueEditable(WatchData &data, const GdbMi &mi)
static void setWatchDataValueEditable(WatchData &data, const GdbMi &mi)
{
if (mi.data() == "true")
data.valueEditable = true;
......@@ -738,24 +726,35 @@ void setWatchDataValueEditable(WatchData &data, const GdbMi &mi)
data.valueEditable = false;
}
void setWatchDataExpression(WatchData &data, const GdbMi &mi)
static void setWatchDataExpression(WatchData &data, const GdbMi &mi)
{
if (mi.isValid())
data.exp = mi.data();
}
static void setWatchDataAddressHelper(WatchData &data, const QByteArray &addr)
{
if (addr.startsWith("0x")) { // Item model dumpers pull tricks
data.setHexAddress(addr);
} else {
data.dumperFlags = addr;
}
if (data.exp.isEmpty() && !data.dumperFlags.startsWith('$'))
data.exp = "*(" + gdbQuoteTypes(data.type) + "*)" +data.hexAddress();
}
void setWatchDataAddress(WatchData &data, const GdbMi &mi)
{
if (mi.isValid())
setWatchDataAddressHelper(data, mi.data());
}
void setWatchDataOrigAddress(WatchData &data, const GdbMi &mi)
static void setWatchDataOrigAddress(WatchData &data, const GdbMi &mi)
{
data.origAddress = mi.data().toULongLong(0, 16);
}
void setWatchDataSize(WatchData &data, const GdbMi &mi)
static void setWatchDataSize(WatchData &data, const GdbMi &mi)
{
if (mi.isValid()) {
bool ok = false;
......@@ -765,17 +764,6 @@ void setWatchDataSize(WatchData &data, const GdbMi &mi)
}
}
void setWatchDataAddressHelper(WatchData &data, const QByteArray &addr)
{
if (addr.startsWith("0x")) { // Item model dumpers pull tricks
data.setHexAddress(addr);
} else {
data.dumperFlags = addr;
}
if (data.exp.isEmpty() && !data.dumperFlags.startsWith('$'))
data.exp = "*(" + gdbQuoteTypes(data.type) + "*)" +data.hexAddress();
}
// Find the "type" and "displayedtype" children of root and set up type.
void setWatchDataType(WatchData &data, const GdbMi &item)
{
......
......@@ -36,11 +36,6 @@
#include <QtCore/QSet>
#include <QtCore/QString>
#include <QtCore/QMap>
QT_BEGIN_NAMESPACE
class QDebug;
QT_END_NAMESPACE
namespace TextEditor {
class ITextEditor;
......@@ -84,12 +79,6 @@ QString currentTime();
bool isSkippableFunction(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 hasSideEffects(const QString &exp);
bool isKeyWord(const QString &exp);
......@@ -98,15 +87,11 @@ bool isCharPointerType(const QByteArray &type);
bool startsWithDigit(const QString &str);
QByteArray stripPointerType(QByteArray type);
QByteArray gdbQuoteTypes(const QByteArray &type);
QString extractTypeFromPTypeOutput(const QString &str);
bool isFloatType(const QByteArray &type);
bool isIntOrFloatType(const QByteArray &type);
bool isIntType(const QByteArray &type);
bool isSymbianIntType(const QByteArray &type);
enum GuessChildrenResult { HasChildren, HasNoChildren, HasPossiblyChildren };
GuessChildrenResult guessChildren(const QByteArray &type);
QString quoteUnprintableLatin1(const QByteArray &ba);
// Editor tooltip support
......@@ -124,9 +109,6 @@ bool getUninitializedVariables(const CPlusPlus::Snapshot &snapshot,
const QString &function, const QString &file, int line,
QStringList *uninitializedVariables);
// remove the default template argument in std:: containers
QString removeDefaultTemplateArguments(QString type);
//
// GdbMi interaction
......@@ -137,10 +119,7 @@ void setWatchDataValueToolTip(WatchData &data, const GdbMi &mi,
int encoding);
void setWatchDataChildCount(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 setWatchDataAddressHelper(WatchData &data, const QByteArray &addr);
void setWatchDataType(WatchData &data, const GdbMi &mi);
void setWatchDataDisplayedType(WatchData &data, const GdbMi &mi);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment