forked from qt-creator/qt-creator
Debugger[CDB]: Fix expanding arrays.
Strip '[', ']' off inames in coreengine so that the name lookup for them works. Handle 64bit-addresses in .dvalloc-output parsing for dumpers. Some debug formatting. Task-number: QTCREATORBUG-1216
This commit is contained in:
@@ -218,7 +218,7 @@ static inline void fixDumperResult(const WatchData &source,
|
|||||||
// classes (see note in its header documentation).
|
// classes (see note in its header documentation).
|
||||||
bool WatchHandleDumperInserter::expandPointerToDumpable(const WatchData &wd, QString *errorMessage)
|
bool WatchHandleDumperInserter::expandPointerToDumpable(const WatchData &wd, QString *errorMessage)
|
||||||
{
|
{
|
||||||
if (debugCDBWatchHandling)
|
if (debugCDBWatchHandling > 1)
|
||||||
qDebug() << ">expandPointerToDumpable" << wd.toString();
|
qDebug() << ">expandPointerToDumpable" << wd.toString();
|
||||||
|
|
||||||
bool handled = false;
|
bool handled = false;
|
||||||
@@ -252,7 +252,7 @@ bool WatchHandleDumperInserter::expandPointerToDumpable(const WatchData &wd, QSt
|
|||||||
m_wh->insertBulkData(m_dumperResult);
|
m_wh->insertBulkData(m_dumperResult);
|
||||||
handled = true;
|
handled = true;
|
||||||
} while (false);
|
} while (false);
|
||||||
if (debugCDBWatchHandling)
|
if (debugCDBWatchHandling > 1)
|
||||||
qDebug() << "<expandPointerToDumpable returns " << handled << *errorMessage;
|
qDebug() << "<expandPointerToDumpable returns " << handled << *errorMessage;
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
@@ -368,14 +368,6 @@ unsigned CdbSymbolGroupContext::watchDataAt(unsigned long index, WatchData *wd)
|
|||||||
const unsigned rc = dumpValue(index, &iname, &(wd->name), &address,
|
const unsigned rc = dumpValue(index, &iname, &(wd->name), &address,
|
||||||
&typeId, &type, &value);
|
&typeId, &type, &value);
|
||||||
wd->exp = wd->iname = iname.toLatin1();
|
wd->exp = wd->iname = iname.toLatin1();
|
||||||
// Trigger numeric sorting for arrays "local.[22]" -> "local.22"
|
|
||||||
if (wd->iname.endsWith(']')) {
|
|
||||||
const int openingBracketPos = wd->iname.lastIndexOf('[');
|
|
||||||
if (openingBracketPos != -1) {
|
|
||||||
wd->iname.truncate(wd->iname.size() - 1);
|
|
||||||
wd->iname.remove(openingBracketPos, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
wd->setAddress(("0x") + QByteArray::number(address, 16));
|
wd->setAddress(("0x") + QByteArray::number(address, 16));
|
||||||
wd->setType(type, false);
|
wd->setType(type, false);
|
||||||
if (rc & OutOfScope) {
|
if (rc & OutOfScope) {
|
||||||
@@ -396,8 +388,7 @@ unsigned CdbSymbolGroupContext::watchDataAt(unsigned long index, WatchData *wd)
|
|||||||
bool CdbSymbolGroupContext::populateModelInitially(WatchHandler *wh, QString *errorMessage)
|
bool CdbSymbolGroupContext::populateModelInitially(WatchHandler *wh, QString *errorMessage)
|
||||||
{
|
{
|
||||||
if (debugCDBWatchHandling)
|
if (debugCDBWatchHandling)
|
||||||
qDebug() << "populateModelInitially dumpers=" << m_useDumpers
|
qDebug() << ">populateModelInitially dumpers=" << m_useDumpers;
|
||||||
<< toString();
|
|
||||||
// Recurse down items that are initially expanded in the view, stop processing for
|
// Recurse down items that are initially expanded in the view, stop processing for
|
||||||
// dumper items.
|
// dumper items.
|
||||||
const CdbSymbolGroupRecursionContext rctx(this, OwnerSymbolGroupDumper);
|
const CdbSymbolGroupRecursionContext rctx(this, OwnerSymbolGroupDumper);
|
||||||
@@ -412,6 +403,8 @@ bool CdbSymbolGroupContext::populateModelInitially(WatchHandler *wh, QString *er
|
|||||||
WatchHandlerExpandedPredicate(wh),
|
WatchHandlerExpandedPredicate(wh),
|
||||||
falsePredicate,
|
falsePredicate,
|
||||||
errorMessage);
|
errorMessage);
|
||||||
|
if (debugCDBWatchHandling)
|
||||||
|
qDebug("<populateModelInitially\n%s\n", qPrintable(toString()));
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -420,7 +413,9 @@ bool CdbSymbolGroupContext::completeData(const WatchData &incompleteLocal,
|
|||||||
QString *errorMessage)
|
QString *errorMessage)
|
||||||
{
|
{
|
||||||
if (debugCDBWatchHandling)
|
if (debugCDBWatchHandling)
|
||||||
qDebug() << ">completeData src=" << incompleteLocal.source << incompleteLocal.toString();
|
qDebug(">completeData src=%d %s\n%s\n",
|
||||||
|
incompleteLocal.source, qPrintable(incompleteLocal.toString()),
|
||||||
|
qPrintable(toString()));
|
||||||
|
|
||||||
const CdbSymbolGroupRecursionContext rctx(this, OwnerSymbolGroupDumper);
|
const CdbSymbolGroupRecursionContext rctx(this, OwnerSymbolGroupDumper);
|
||||||
// Expand symbol group items, recurse one level from desired item
|
// Expand symbol group items, recurse one level from desired item
|
||||||
|
@@ -30,6 +30,7 @@
|
|||||||
#include "coreengine.h"
|
#include "coreengine.h"
|
||||||
#include "debugeventcallbackbase.h"
|
#include "debugeventcallbackbase.h"
|
||||||
#include "debugoutputbase.h"
|
#include "debugoutputbase.h"
|
||||||
|
#include "symbolgroupcontext.h"
|
||||||
|
|
||||||
#include <utils/winutils.h>
|
#include <utils/winutils.h>
|
||||||
#include <utils/abstractprocess.h>
|
#include <utils/abstractprocess.h>
|
||||||
@@ -725,9 +726,9 @@ bool CoreEngine::endSession(QString *appendableErrorMessage)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CoreEngine::allocDebuggeeMemory(int size, ULONG64 *address, QString *errorMessage)
|
bool CoreEngine::allocDebuggeeMemory(int size, ULONG64 *addressPtr, QString *errorMessage)
|
||||||
{
|
{
|
||||||
*address = 0;
|
*addressPtr = 0;
|
||||||
const QString allocCmd = QLatin1String(".dvalloc ") + QString::number(size);
|
const QString allocCmd = QLatin1String(".dvalloc ") + QString::number(size);
|
||||||
|
|
||||||
QSharedPointer<StringOutputHandler> outputHandler(new StringOutputHandler);
|
QSharedPointer<StringOutputHandler> outputHandler(new StringOutputHandler);
|
||||||
@@ -735,23 +736,21 @@ bool CoreEngine::allocDebuggeeMemory(int size, ULONG64 *address, QString *errorM
|
|||||||
Q_UNUSED(redir)
|
Q_UNUSED(redir)
|
||||||
if (!executeDebuggerCommand(allocCmd, errorMessage))
|
if (!executeDebuggerCommand(allocCmd, errorMessage))
|
||||||
return false;
|
return false;
|
||||||
// "Allocated 1000 bytes starting at 003a0000" .. hopefully never localized
|
// "Allocated 1000 bytes starting at 003a0000" or
|
||||||
bool ok = false;
|
// "Allocated 1000 bytes starting at 00000000'000023ab" (64bit) / hopefully never localized
|
||||||
const QString output = outputHandler->result();
|
const QString output = outputHandler->result().trimmed();
|
||||||
const int lastBlank = output.lastIndexOf(QLatin1Char(' '));
|
const int lastBlank = output.lastIndexOf(QLatin1Char(' '));
|
||||||
if (lastBlank != -1) {
|
if (lastBlank != -1) {
|
||||||
const qint64 addri = output.mid(lastBlank + 1).toLongLong(&ok, 16);
|
const QString hexNumberS = QLatin1String("0x") + output.mid(lastBlank + 1);
|
||||||
if (ok)
|
quint64 address;
|
||||||
*address = addri;
|
if (SymbolGroupContext::getUnsignedHexValue(hexNumberS, &address)) {
|
||||||
|
*addressPtr = address;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
if (debug > 1)
|
} // blank
|
||||||
qDebug() << Q_FUNC_INFO << '\n' << output << *address << ok;
|
|
||||||
if (!ok) {
|
|
||||||
*errorMessage = QString::fromLatin1("Failed to parse output '%1'").arg(output);
|
*errorMessage = QString::fromLatin1("Failed to parse output '%1'").arg(output);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Alloc an AscII string in debuggee
|
// Alloc an AscII string in debuggee
|
||||||
bool CoreEngine::createDebuggeeAscIIString(const QString &s,
|
bool CoreEngine::createDebuggeeAscIIString(const QString &s,
|
||||||
|
@@ -229,6 +229,12 @@ void SymbolGroupContext::populateINameIndexMap(const QString &prefix, unsigned l
|
|||||||
symbolName = QLatin1String("<unnamed");
|
symbolName = QLatin1String("<unnamed");
|
||||||
symbolName += QString::number(m_unnamedSymbolNumber++);
|
symbolName += QString::number(m_unnamedSymbolNumber++);
|
||||||
symbolName += QLatin1Char('>');
|
symbolName += QLatin1Char('>');
|
||||||
|
} else {
|
||||||
|
// Trigger numeric sorting for arrays "local.[22]" -> "local.22"
|
||||||
|
if (symbolName.startsWith(QLatin1Char('[')) && symbolName.endsWith(QLatin1Char(']'))) {
|
||||||
|
symbolName.truncate(symbolName.size() - 1);
|
||||||
|
symbolName.remove(0, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Find a unique name in case the variable is shadowed by
|
// Find a unique name in case the variable is shadowed by
|
||||||
// an existing one
|
// an existing one
|
||||||
|
Reference in New Issue
Block a user