Commit e3712f96 authored by hjk's avatar hjk

debugger: refactoring, use QByteArray instead of QString when appropriate

parent 84e2e893
......@@ -139,7 +139,7 @@ public:
}
}
}
m_data->lineNumber = QString::number(lineNumber);
m_data->lineNumber = QByteArray::number(lineNumber);
m_data->handler()->updateMarkers();
}
......@@ -386,13 +386,13 @@ void BreakHandler::loadBreakpoints()
data->fileName = v.toString();
v = map.value(QLatin1String("linenumber"));
if (v.isValid())
data->lineNumber = v.toString();
data->lineNumber = v.toString().toLatin1();
v = map.value(QLatin1String("condition"));
if (v.isValid())
data->condition = v.toString();
data->condition = v.toString().toLatin1();
v = map.value(QLatin1String("ignorecount"));
if (v.isValid())
data->ignoreCount = v.toInt();
data->ignoreCount = v.toString().toLatin1();
v = map.value(QLatin1String("funcname"));
if (v.isValid())
data->funcName = v.toString();
......@@ -561,7 +561,7 @@ bool BreakHandler::setData(const QModelIndex &mi, const QVariant &value, int rol
case 4: {
QString val = value.toString();
if (val != data->condition) {
data->condition = val;
data->condition = val.toLatin1();
dataChanged(mi, mi);
}
return true;
......@@ -569,7 +569,7 @@ bool BreakHandler::setData(const QModelIndex &mi, const QVariant &value, int rol
case 5: {
QString val = value.toString();
if (val != data->ignoreCount) {
data->ignoreCount = val;
data->ignoreCount = val.toLatin1();
dataChanged(mi, mi);
}
return true;
......@@ -660,7 +660,7 @@ void BreakHandler::setBreakpoint(const QString &fileName, int lineNumber)
BreakpointData *data = new BreakpointData(this);
data->fileName = fileName;
data->lineNumber = QString::number(lineNumber);
data->lineNumber = QByteArray::number(lineNumber);
data->pending = true;
data->markerFileName = fileName;
data->markerLineNumber = lineNumber;
......
......@@ -69,30 +69,30 @@ private:
BreakpointData(const BreakpointData &);
// Our owner
BreakHandler *m_handler; // not owned.
BreakHandler *m_handler; // not owned.
public:
bool enabled; // should we talk to the debugger engine?
bool pending; // does the debugger engine know about us already?
bool enabled; // should we talk to the debugger engine?
bool pending; // does the debugger engine know about us already?
// this "user requested information". will get stored in the session
QString fileName; // short name of source file
QString condition; // condition associated with breakpoint
QString ignoreCount; // ignore count associated with breakpoint
QString lineNumber; // line in source file
QString funcName; // name of containing function
bool useFullPath; // should we use the full path when setting the bp?
QString fileName; // short name of source file
QByteArray condition; // condition associated with breakpoint
QByteArray ignoreCount; // ignore count associated with breakpoint
QByteArray lineNumber; // line in source file
QString funcName; // name of containing function
bool useFullPath; // should we use the full path when setting the bp?
// this is what gdb produced in response
QString bpNumber; // breakpoint number assigned by the debugger engine
QString bpCondition; // condition acknowledged by the debugger engine
QString bpIgnoreCount; // ignore count acknowledged by the debugger engine
QString bpFileName; // file name acknowledged by the debugger engine
QString bpLineNumber; // line number acknowledged by the debugger engine
QString bpFuncName; // function name acknowledged by the debugger engine
QString bpAddress; // address acknowledged by the debugger engine
bool bpMultiple; // happens in constructors/gdb
bool bpEnabled; // enable/disable command sent
QByteArray bpNumber; // breakpoint number assigned by the debugger engine
QByteArray bpCondition; // condition acknowledged by the debugger engine
QByteArray bpIgnoreCount;// ignore count acknowledged by the debugger engine
QString bpFileName; // file name acknowledged by the debugger engine
QByteArray bpLineNumber; // line number acknowledged by the debugger engine
QString bpFuncName; // function name acknowledged by the debugger engine
QString bpAddress; // address acknowledged by the debugger engine
bool bpMultiple; // happens in constructors/gdb
bool bpEnabled; // enable/disable command sent
// taken from either user input or gdb responses
QString markerFileName; // used to locate the marker
......
......@@ -84,7 +84,7 @@ bool getRegisters(CIDebugControl *ctl,
return false;
}
Register reg;
reg.name = QString::fromUtf16(reinterpret_cast<const ushort *>(wszBuf));
reg.name = QString::fromUtf16(reinterpret_cast<const ushort *>(wszBuf)).toLatin1();
registers->push_back(reg);
}
// get values
......
......@@ -564,7 +564,7 @@ bool CDBBreakPoint::synchronizeBreakPoints(CIDebugControl* debugControl,
handler->takeInsertedBreakPoint(nbd);
updateMarkers = true;
nbd->pending = false;
nbd->bpNumber = QString::number(id);
nbd->bpNumber = QByteArray::number(uint(id));
nbd->bpAddress = QLatin1String("0x") + QString::number(address, 16);
// Take over rest as is
nbd->bpCondition = nbd->condition;
......
......@@ -985,7 +985,7 @@ void CdbDebugEngine::updateWatchData(const WatchData &incomplete)
qDebug() << Q_FUNC_INFO << "\n " << incomplete.toString();
WatchHandler *watchHandler = manager()->watchHandler();
if (incomplete.iname.startsWith(QLatin1String("watch."))) {
if (incomplete.iname.startsWith("watch.")) {
WatchData watchData = incomplete;
evaluateWatcher(&watchData);
watchHandler->insertData(watchData);
......@@ -1311,7 +1311,7 @@ void CdbDebugEngine::assignValueInDebugger(const QString &expr, const QString &v
break;
// Update view
WatchHandler *watchHandler = manager()->watchHandler();
if (WatchData *fwd = watchHandler->findItem(expr)) {
if (WatchData *fwd = watchHandler->findItem(expr.toLatin1())) {
fwd->setValue(newValue);
watchHandler->insertData(*fwd);
watchHandler->updateWatchers();
......
......@@ -230,7 +230,7 @@ bool WatchHandleDumperInserter::expandPointerToDumpable(const WatchData &wd, QSt
derefedWd.setType(type);
derefedWd.setAddress(hexAddrS);
derefedWd.name = QString(QLatin1Char('*'));
derefedWd.iname = wd.iname + QLatin1String(".*");
derefedWd.iname = wd.iname + ".*";
derefedWd.source = OwnerDumper | CdbStackFrameContext::ChildrenKnownBit;
const CdbDumperHelper::DumpResult dr = m_dumper->dumpType(derefedWd, true, &m_dumperResult, errorMessage);
if (dr != CdbDumperHelper::DumpOk)
......
......@@ -470,11 +470,11 @@ static inline QString fixValue(const QString &value, const QString &type)
WatchData CdbSymbolGroupContext::watchDataAt(unsigned long index) const
{
WatchData wd;
wd.iname = symbolINameAt(index);
wd.iname = symbolINameAt(index).toLatin1();
wd.exp = wd.iname;
// Determine name from iname and format shadowed variables correctly
// as "<shadowed X>, see populateINameIndexMap().
const int lastDelimiterPos = wd.iname.lastIndexOf(m_nameDelimiter);
const int lastDelimiterPos = wd.iname.lastIndexOf(m_nameDelimiter.toLatin1());
QString name = lastDelimiterPos == -1 ? wd.iname : wd.iname.mid(lastDelimiterPos + 1);
int shadowedNumber = 0;
const int shadowedPos = name.lastIndexOf(QLatin1Char(iNameShadowDelimiter));
......@@ -486,7 +486,7 @@ WatchData CdbSymbolGroupContext::watchDataAt(unsigned long index) const
// (std::map extends std::tree<>... Remove them for display only.
const QString fullShadowedName = WatchData::shadowedName(name, shadowedNumber);
wd.name = WatchData::shadowedName(removeInnerTemplateType(name), shadowedNumber);
wd.addr = hexSymbolOffset(m_symbolGroup, index);
wd.addr = hexSymbolOffset(m_symbolGroup, index).toLatin1();
const QString type = getSymbolString(m_symbolGroup, &IDebugSymbolGroup2::GetSymbolTypeNameWide, index);
wd.setType(type);
// Check for unitialized variables at level 0 only.
......
......@@ -137,7 +137,7 @@ bool insertSymbolRecursion(WatchData wd,
return false;
} else {
const QString msg = QString::fromLatin1("WARNING: Skipping invalid child symbol #%2 (type %3) of '%4'.").
arg(QLatin1String(Q_FUNC_INFO)).arg(c).arg(cwd.type, wd.iname);
arg(QLatin1String(Q_FUNC_INFO)).arg(c).arg(cwd.type, QString::fromLatin1(wd.iname));
qWarning("%s\n", qPrintable(msg));
}
}
......
......@@ -70,7 +70,7 @@ void AttachGdbAdapter::startInferior()
{
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
const qint64 pid = startParameters().attachPID;
m_engine->postCommand(_("attach %1").arg(pid), CB(handleAttach));
m_engine->postCommand("attach " + QByteArray::number(pid), CB(handleAttach));
// Task 254674 does not want to remove them
//qq->breakHandler()->removeAllBreakpoints();
}
......
......@@ -97,8 +97,9 @@ void CoreGdbAdapter::loadExeAndSyms()
{
// Do that first, otherwise no symbols are loaded.
QFileInfo fi(m_executable);
m_engine->postCommand(_("-file-exec-and-symbols \"%1\"")
.arg(fi.absoluteFilePath()), CB(handleFileExecAndSymbols));
QByteArray path = fi.absoluteFilePath().toLocal8Bit();
m_engine->postCommand("-file-exec-and-symbols \"" + path + '"',
CB(handleFileExecAndSymbols));
}
void CoreGdbAdapter::handleFileExecAndSymbols(const GdbResponse &response)
......@@ -118,8 +119,8 @@ void CoreGdbAdapter::loadCoreFile()
{
// Quoting core name below fails in gdb 6.8-debian.
QFileInfo fi(startParameters().coreFile);
QString coreName = fi.absoluteFilePath();
m_engine->postCommand(_("target core ") + coreName, CB(handleTargetCore));
QByteArray coreName = fi.absoluteFilePath().toLocal8Bit();
m_engine->postCommand("target core " + coreName, CB(handleTargetCore));
}
void CoreGdbAdapter::handleTargetCore(const GdbResponse &response)
......@@ -144,7 +145,7 @@ void CoreGdbAdapter::handleTargetCore(const GdbResponse &response)
if (QFile::exists(m_executable)) {
// Finish extra round ...
showStatusMessage(tr("Attached to core temporarily."));
m_engine->postCommand(_("detach"));
m_engine->postCommand("detach");
// ... and retry.
loadExeAndSyms();
return;
......
This diff is collapsed.
......@@ -201,7 +201,7 @@ private: ////////// Gdb Command Management //////////
GdbCommandCallback callback;
AdapterCallback adapterCallback;
const char *callbackName;
QString command;
QByteArray command;
QVariant cookie;
QTime postTime;
};
......@@ -211,20 +211,20 @@ private: ////////// Gdb Command Management //////////
// send and decrements on receipt, effectively preventing
// watch model updates before everything is finished.
void flushCommand(const GdbCommand &cmd);
void postCommand(const QString &command,
void postCommand(const QByteArray &command,
GdbCommandFlags flags,
GdbCommandCallback callback = 0,
const char *callbackName = 0,
const QVariant &cookie = QVariant());
void postCommand(const QString &command,
void postCommand(const QByteArray &command,
GdbCommandCallback callback = 0,
const char *callbackName = 0,
const QVariant &cookie = QVariant());
void postCommand(const QString &command,
void postCommand(const QByteArray &command,
AdapterCallback callback,
const char *callbackName,
const QVariant &cookie = QVariant());
void postCommand(const QString &command,
void postCommand(const QByteArray &command,
GdbCommandFlags flags,
AdapterCallback callback,
const char *callbackName,
......@@ -458,7 +458,7 @@ private: ////////// View & Data Stuff //////////
void setWatchDataType(WatchData &data, const GdbMi &mi);
void setWatchDataDisplayedType(WatchData &data, const GdbMi &mi);
QSet<QString> m_processedNames;
QSet<QByteArray> m_processedNames;
QMap<QString, QString> m_varToType;
private: ////////// Dumper Management //////////
......
......@@ -99,11 +99,13 @@ void PlainGdbAdapter::startAdapter()
void PlainGdbAdapter::startInferior()
{
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
if (!startParameters().processArgs.isEmpty())
m_engine->postCommand(_("-exec-arguments ")
+ startParameters().processArgs.join(_(" ")));
if (!startParameters().processArgs.isEmpty()) {
QString args = startParameters().processArgs.join(_(" "));
m_engine->postCommand("-exec-arguments " + args.toLocal8Bit());
}
QFileInfo fi(startParameters().executable);
m_engine->postCommand(_("-file-exec-and-symbols \"%1\"").arg(fi.absoluteFilePath()),
QByteArray path = fi.absoluteFilePath().toLocal8Bit();
m_engine->postCommand("-file-exec-and-symbols \"" + path + '"',
CB(handleFileExecAndSymbols));
}
......@@ -116,7 +118,7 @@ void PlainGdbAdapter::handleFileExecAndSymbols(const GdbResponse &response)
// Note that successfully preloading the debugging helpers will
// automatically load pthreads, so this will be unnecessary.
if (m_engine->m_gdbVersion < 70000)
m_engine->postCommand(_("info target"), CB(handleInfoTarget));
m_engine->postCommand("info target", CB(handleInfoTarget));
#endif
emit inferiorPrepared();
} else {
......@@ -138,7 +140,7 @@ void PlainGdbAdapter::handleInfoTarget(const GdbResponse &response)
if (needle.indexIn(msg) != -1) {
m_engine->m_entryPoint =
"0x" + needle.cap(1).toLatin1().rightJustified(sizeof(void *) * 2, '0');
m_engine->postCommand(_("tbreak *0x") + needle.cap(1));
m_engine->postCommand("tbreak *0x" + needle.cap(1).toAscii());
// Do nothing here - inferiorPrepared handles the sequencing.
} else {
emit inferiorStartFailed(_("Parsing start address failed"));
......@@ -152,7 +154,7 @@ void PlainGdbAdapter::handleInfoTarget(const GdbResponse &response)
void PlainGdbAdapter::startInferiorPhase2()
{
setState(InferiorRunningRequested);
m_engine->postCommand(_("-exec-run"), GdbEngine::RunRequest, CB(handleExecRun));
m_engine->postCommand("-exec-run", GdbEngine::RunRequest, CB(handleExecRun));
}
void PlainGdbAdapter::handleExecRun(const GdbResponse &response)
......
......@@ -155,21 +155,24 @@ void RemoteGdbAdapter::startInferior()
{
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
m_engine->postCommand(_("set architecture %1")
.arg(startParameters().remoteArchitecture));
m_engine->postCommand(_("set sysroot %1").arg(startParameters().sysRoot));
m_engine->postCommand(_("set solib-search-path %1").
arg(QFileInfo(startParameters().dumperLibrary).path()));
if (!startParameters().processArgs.isEmpty())
m_engine->postCommand(_("-exec-arguments ")
+ startParameters().processArgs.join(_(" ")));
m_engine->postCommand("set architecture "
+ startParameters().remoteArchitecture.toLatin1());
m_engine->postCommand("set sysroot "
+ startParameters().sysRoot.toLocal8Bit());
m_engine->postCommand("set solib-search-path "
+ QFileInfo(startParameters().dumperLibrary).path().toLocal8Bit());
if (!startParameters().processArgs.isEmpty()) {
QString args = startParameters().processArgs.join(_(" "));
m_engine->postCommand("-exec-arguments " + args.toLocal8Bit());
}
m_engine->postCommand(_("set target-async on"), CB(handleSetTargetAsync));
m_engine->postCommand("set target-async on", CB(handleSetTargetAsync));
QString x = startParameters().executable;
QFileInfo fi(startParameters().executable);
QString fileName = fi.absoluteFilePath();
m_engine->postCommand(_("-file-exec-and-symbols \"%1\"").arg(fileName),
m_engine->postCommand("-file-exec-and-symbols \""
+ fileName.toLocal8Bit() + '"',
CB(handleFileExecAndSymbols));
}
......@@ -191,7 +194,7 @@ void RemoteGdbAdapter::handleFileExecAndSymbols(const GdbResponse &response)
// (2) starts the remote application
// (3) stops the remote application (early, e.g. in the dynamic linker)
QString channel = startParameters().remoteChannel;
m_engine->postCommand(_("target remote %1").arg(channel),
m_engine->postCommand("target remote " + channel.toLatin1(),
CB(handleTargetRemote));
} else {
QString msg = tr("Starting remote executable failed:\n");
......@@ -224,7 +227,7 @@ void RemoteGdbAdapter::startInferiorPhase2()
void RemoteGdbAdapter::interruptInferior()
{
m_engine->postCommand(_("-exec-interrupt"));
m_engine->postCommand("-exec-interrupt");
}
void RemoteGdbAdapter::shutdown()
......
......@@ -129,7 +129,8 @@ void TermGdbAdapter::startInferior()
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
const qint64 attachedPID = m_stubProc.applicationPID();
m_engine->handleInferiorPidChanged(attachedPID);
m_engine->postCommand(_("attach %1").arg(attachedPID), CB(handleStubAttached));
m_engine->postCommand("attach " + QByteArray::number(attachedPID),
CB(handleStubAttached));
}
void TermGdbAdapter::handleStubAttached(const GdbResponse &response)
......@@ -140,7 +141,7 @@ void TermGdbAdapter::handleStubAttached(const GdbResponse &response)
debugMessage(_("INFERIOR ATTACHED"));
emit inferiorPrepared();
#ifdef Q_OS_LINUX
m_engine->postCommand(_("-stack-list-frames 0 0"), CB(handleEntryPoint));
m_engine->postCommand("-stack-list-frames 0 0", CB(handleEntryPoint));
#endif
} else if (response.resultClass == GdbResultError) {
QString msg = QString::fromLocal8Bit(response.data.findChild("msg").data());
......
......@@ -1685,15 +1685,15 @@ void TrkGdbAdapter::handleCreateProcess(const TrkResult &result)
logMessage(startMsg);
const QString fileName = m_symbolFile;
if (m_symbolFile.isEmpty()) {
const QByteArray symbolFile = m_symbolFile.toLocal8Bit();
if (symbolFile.isEmpty()) {
logMessage(_("WARNING: No symbol file available."));
} else {
m_engine->postCommand(_("add-symbol-file \"%1\" %2").arg(m_symbolFile)
.arg(m_session.codeseg));
m_engine->postCommand(_("symbol-file \"%1\"").arg(m_symbolFile));
m_engine->postCommand("add-symbol-file \"" + symbolFile + "\" "
+ QByteArray::number(m_session.codeseg));
m_engine->postCommand("symbol-file \"" + symbolFile + "\"");
}
m_engine->postCommand(_("target remote ") + gdbServerName(),
m_engine->postCommand("target remote " + gdbServerName().toLatin1(),
CB(handleTargetRemote));
}
......
......@@ -46,10 +46,10 @@ class Register
{
public:
Register() : changed(true) {}
Register(QString const &name_) : name(name_), changed(true) {}
Register(QByteArray const &name_) : name(name_), changed(true) {}
public:
QString name;
QByteArray name;
QString value;
bool changed;
};
......
......@@ -390,7 +390,7 @@ void ScriptEngine::attemptBreakpointSynchronization()
updateNeeded = true;
}
if (data->bpNumber.isEmpty()) {
data->bpNumber = QString::number(index + 1);
data->bpNumber = QByteArray::number(index + 1);
updateNeeded = true;
}
if (!data->fileName.isEmpty() && data->markerFileName.isEmpty()) {
......@@ -560,7 +560,7 @@ void ScriptEngine::maybeBreakNow(bool byFunction)
// we just run into a breakpoint
//SDEBUG("RESOLVING BREAKPOINT AT " << fileName << lineNumber);
BreakpointData *data = handler->at(index);
data->bpLineNumber = QString::number(lineNumber);
data->bpLineNumber = QByteArray::number(lineNumber);
data->bpFileName = fileName;
data->bpFuncName = functionName;
data->markerLineNumber = lineNumber;
......@@ -703,8 +703,8 @@ void ScriptEngine::updateSubItem(const WatchData &data0)
while (it.hasNext()) {
it.next();
WatchData data1;
data1.iname = data.iname + "." + it.name();
data1.exp = it.name();
data1.iname = data.iname + "." + it.name().toLatin1();
data1.exp = it.name().toLatin1();
data1.name = it.name();
data1.scriptValue = it.value();
if (manager()->watchHandler()->isExpandedIName(data1.iname))
......
......@@ -224,7 +224,7 @@ void WatchData::setType(const QString &str, bool guessChildrenFromType)
void WatchData::setAddress(const QString &str)
{
addr = str;
addr = str.toLatin1();
}
QString WatchData::toString() const
......@@ -349,15 +349,15 @@ WatchModel::WatchModel(WatchHandler *handler, WatchType type)
switch (m_type) {
case LocalsWatch:
m_root->iname = QLatin1String("local");
m_root->iname = "local";
m_root->name = WatchHandler::tr("Locals");
break;
case WatchersWatch:
m_root->iname = QLatin1String("watch");
m_root->iname = "watch";
m_root->name = WatchHandler::tr("Watchers");
break;
case TooltipsWatch:
m_root->iname = QLatin1String("tooltip");
m_root->iname = "tooltip";
m_root->name = WatchHandler::tr("Tooltip");
break;
}
......@@ -461,11 +461,11 @@ void WatchModel::destroyItem(WatchItem *item)
delete item;
}
static QString parentName(const QString &iname)
static QByteArray parentName(const QByteArray &iname)
{
int pos = iname.lastIndexOf(QLatin1Char('.'));
int pos = iname.lastIndexOf('.');
if (pos == -1)
return QString();
return QByteArray();
return iname.left(pos);
}
......@@ -931,9 +931,9 @@ QVariant WatchModel::headerData(int section, Qt::Orientation orientation, int ro
return QVariant();
}
struct IName : public QString
struct IName : public QByteArray
{
IName(const QString &iname) : QString(iname) {}
IName(const QByteArray &iname) : QByteArray(iname) {}
};
bool iNameLess(const QString &iname1, const QString &iname2)
......@@ -1028,7 +1028,7 @@ void WatchModel::insertBulkData(const QList<WatchData> &list)
//foreach (const WatchItem &data, list)
// qDebug() << "BULK: " << ++bulk << data.toString();
QTC_ASSERT(!list.isEmpty(), return);
QString parentIName = parentName(list.at(0).iname);
QByteArray parentIName = parentName(list.at(0).iname);
WatchItem *parent = findItem(parentIName, m_root);
if (!parent) {
WatchData parent;
......@@ -1117,7 +1117,7 @@ void WatchModel::insertBulkData(const QList<WatchData> &list)
dump();
}
WatchItem *WatchModel::findItem(const QString &iname, WatchItem *root) const
WatchItem *WatchModel::findItem(const QByteArray &iname, WatchItem *root) const
{
if (root->iname == iname)
return root;
......@@ -1248,7 +1248,7 @@ void WatchHandler::insertBulkData(const QList<WatchData> &list)
if (list.isEmpty())
return;
QMap<QString, QList<WatchData> > hash;
QMap<QByteArray, QList<WatchData> > hash;
foreach (const WatchData &data, list) {
// we insert everything, including incomplete stuff
......@@ -1259,7 +1259,7 @@ void WatchHandler::insertBulkData(const QList<WatchData> &list)
qWarning("%s:%d: Attempt to bulk-insert invalid watch item: %s", __FILE__, __LINE__, qPrintable(data.toString()));
}
}
foreach (const QString &parentIName, hash.keys()) {
foreach (const QByteArray &parentIName, hash.keys()) {
WatchModel *model = modelForIName(parentIName);
QTC_ASSERT(model, return);
model->insertBulkData(hash[parentIName]);
......@@ -1271,7 +1271,7 @@ void WatchHandler::insertBulkData(const QList<WatchData> &list)
}
}
void WatchHandler::removeData(const QString &iname)
void WatchHandler::removeData(const QByteArray &iname)
{
WatchModel *model = modelForIName(iname);
if (!model)
......@@ -1287,21 +1287,21 @@ void WatchHandler::watchExpression()
watchExpression(action->data().toString());
}
QString WatchHandler::watcherName(const QString &exp)
QByteArray WatchHandler::watcherName(const QByteArray &exp)
{
return QLatin1String("watch.") + QString::number(m_watcherNames[exp]);
return "watch." + QByteArray::number(m_watcherNames[exp]);
}
void WatchHandler::watchExpression(const QString &exp)
{
// FIXME: 'exp' can contain illegal characters
m_watcherNames[exp] = watcherCounter++;
WatchData data;
data.exp = exp;
data.exp = exp.toLatin1();
data.name = exp;
m_watcherNames[data.exp] = watcherCounter++;
if (exp.isEmpty() || exp == watcherEditPlaceHolder())
data.setAllUnneeded();
data.iname = watcherName(exp);
data.iname = watcherName(data.exp);
IDebuggerEngine *engine = m_manager->currentEngine();
if (engine && engine->isSynchroneous())
m_manager->updateWatchData(data);
......@@ -1392,8 +1392,9 @@ void WatchHandler::removeWatchExpression()
removeWatchExpression(action->data().toString());
}
void WatchHandler::removeWatchExpression(const QString &exp)
void WatchHandler::removeWatchExpression(const QString &exp0)
{
QByteArray exp = exp0.toLatin1();
MODEL_DEBUG("REMOVE WATCH: " << exp);
m_watcherNames.remove(exp);
foreach (WatchItem *item, m_watchers->rootItem()->children) {
......@@ -1409,7 +1410,7 @@ void WatchHandler::updateWatchers()
{
//qDebug() << "UPDATE WATCHERS";
// copy over all watchers and mark all watchers as incomplete
foreach (const QString &exp, m_watcherNames.keys()) {
foreach (const QByteArray &exp, m_watcherNames.keys()) {
WatchData data;
data.iname = watcherName(exp);
data.setAllNeeded();
......@@ -1423,7 +1424,7 @@ void WatchHandler::loadWatchers()
{
QVariant value = m_manager->sessionValue("Watchers");
foreach (const QString &exp, value.toStringList())
m_watcherNames[exp] = watcherCounter++;
m_watcherNames[exp.toLatin1()] = watcherCounter++;
//qDebug() << "LOAD WATCHERS: " << m_watchers;
//reinitializeWatchersHelper();
......@@ -1433,7 +1434,7 @@ QStringList WatchHandler::watchedExpressions() const
{
// Filter out invalid watchers.
QStringList watcherNames;
QHashIterator<QString, int> it(m_watcherNames);
QHashIterator<QByteArray, int> it(m_watcherNames);
while (it.hasNext()) {