Handle various CDB output windows.

Add modules, threads and register view. Refactor register format code.
This commit is contained in:
Friedemann Kleint
2009-04-09 16:51:13 +02:00
parent e6843ff5bc
commit 6d4d19dfa8
16 changed files with 572 additions and 141 deletions

View File

@@ -25,7 +25,9 @@ HEADERS += \
$$PWD/cdbdebugoutput.h \ $$PWD/cdbdebugoutput.h \
$$PWD/cdbsymbolgroupcontext.h \ $$PWD/cdbsymbolgroupcontext.h \
$$PWD/cdbstacktracecontext.h \ $$PWD/cdbstacktracecontext.h \
$$PWD/cdbbreakpoint.h $$PWD/cdbbreakpoint.h \
$$PWD/cdbmodules.h \
$$PWD/cdbassembler.h
SOURCES += \ SOURCES += \
$$PWD/cdbdebugengine.cpp \ $$PWD/cdbdebugengine.cpp \
@@ -33,7 +35,9 @@ SOURCES += \
$$PWD/cdbdebugoutput.cpp \ $$PWD/cdbdebugoutput.cpp \
$$PWD/cdbsymbolgroupcontext.cpp \ $$PWD/cdbsymbolgroupcontext.cpp \
$$PWD/cdbstacktracecontext.cpp \ $$PWD/cdbstacktracecontext.cpp \
$$PWD/cdbbreakpoint.cpp $$PWD/cdbbreakpoint.cpp \
$$PWD/cdbmodules.cpp \
$$PWD/cdbassembler.cpp
} else { } else {
message("Debugging Tools for Windows could not be found in $$CDB_PATH") message("Debugging Tools for Windows could not be found in $$CDB_PATH")

View File

@@ -0,0 +1,83 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#include "cdbassembler.h"
#include "registerhandler.h"
#include "cdbdebugengine_p.h"
#include "cdbsymbolgroupcontext.h"
#include <QtCore/QVector>
namespace Debugger {
namespace Internal {
bool getRegisters(IDebugControl4 *ctl,
IDebugRegisters2 *ireg,
QList<Register> *registers,
QString *errorMessage, int base)
{
registers->clear();
ULONG count;
HRESULT hr = ireg->GetNumberRegisters(&count);
if (FAILED(hr)) {
*errorMessage= msgComFailed("GetNumberRegisters", hr);
return false;
}
if (!count)
return true;
// Retrieve names
WCHAR wszBuf[MAX_PATH];
for (ULONG r = 0; r < count; r++) {
hr = ireg->GetDescriptionWide(r, wszBuf, MAX_PATH - 1, 0, 0);
if (FAILED(hr)) {
*errorMessage= msgComFailed("GetDescriptionWide", hr);
return false;
}
Register reg;
reg.name = QString::fromUtf16(wszBuf);
registers->push_back(reg);
}
// get values
QVector<DEBUG_VALUE> values(count);
DEBUG_VALUE *valuesPtr = &(*values.begin());
memset(valuesPtr, 0, count * sizeof(DEBUG_VALUE));
hr = ireg->GetValues(count, 0, 0, valuesPtr);
if (FAILED(hr)) {
*errorMessage= msgComFailed("GetValues", hr);
return false;
}
if (base < 2)
base = 10;
for (ULONG r = 0; r < count; r++)
(*registers)[r].value = CdbSymbolGroupContext::debugValueToString(values.at(r), ctl, 0, base);
return true;
}
}
}

View File

@@ -0,0 +1,54 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#ifndef CDBASSEMBLER_H
#define CDBASSEMBLER_H
#include <QtCore/QList>
#include <QtCore/QString>
#include <windows.h>
#include <inc/dbgeng.h>
namespace Debugger {
namespace Internal {
// Utilities related to assembler code.
class Register;
bool getRegisters(IDebugControl4 *ctl,
IDebugRegisters2 *ireg,
QList<Register> *registers,
QString *errorMessage,
int base = 10 /* 16 for hex, etc */);
}
}
#endif // CDBASSEMBLER_H

View File

@@ -32,11 +32,16 @@
#include "cdbsymbolgroupcontext.h" #include "cdbsymbolgroupcontext.h"
#include "cdbstacktracecontext.h" #include "cdbstacktracecontext.h"
#include "cdbbreakpoint.h" #include "cdbbreakpoint.h"
#include "cdbmodules.h"
#include "cdbassembler.h"
#include "debuggeractions.h"
#include "debuggermanager.h" #include "debuggermanager.h"
#include "breakhandler.h" #include "breakhandler.h"
#include "stackhandler.h" #include "stackhandler.h"
#include "watchhandler.h" #include "watchhandler.h"
#include "registerhandler.h"
#include "moduleshandler.h"
#include "watchutils.h" #include "watchutils.h"
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -308,6 +313,10 @@ CdbDebugEngine::CdbDebugEngine(DebuggerManager *parent) :
connect(&m_d->m_consoleStubProc, SIGNAL(processError(QString)), this, SLOT(slotConsoleStubError(QString))); connect(&m_d->m_consoleStubProc, SIGNAL(processError(QString)), this, SLOT(slotConsoleStubError(QString)));
connect(&m_d->m_consoleStubProc, SIGNAL(processStarted()), this, SLOT(slotConsoleStubStarted())); connect(&m_d->m_consoleStubProc, SIGNAL(processStarted()), this, SLOT(slotConsoleStubStarted()));
connect(&m_d->m_consoleStubProc, SIGNAL(wrapperStopped()), this, SLOT(slotConsoleStubTerminated())); connect(&m_d->m_consoleStubProc, SIGNAL(wrapperStopped()), this, SLOT(slotConsoleStubTerminated()));
connect(&m_d->m_debugOutputCallBack, SIGNAL(debuggerOutput(QString,QString)),
m_d->m_debuggerManager, SLOT(showDebuggerOutput(QString,QString)));
connect(&m_d->m_debugOutputCallBack, SIGNAL(debuggerInputPrompt(QString,QString)),
m_d->m_debuggerManager, SLOT(showDebuggerInput(QString,QString)));
} }
CdbDebugEngine::~CdbDebugEngine() CdbDebugEngine::~CdbDebugEngine()
@@ -344,8 +353,16 @@ void CdbDebugEngine::setToolTipExpression(const QPoint & /*pos*/, const QString
{ {
} }
void CdbDebugEnginePrivate::clearDisplay()
{
m_debuggerManagerAccess->threadsHandler()->removeAll();
m_debuggerManagerAccess->modulesHandler()->removeAll();
m_debuggerManagerAccess->registerHandler()->removeAll();
}
bool CdbDebugEngine::startDebugger() bool CdbDebugEngine::startDebugger()
{ {
m_d->clearDisplay();
m_d->m_debuggerManager->showStatusMessage("Starting Debugger", -1); m_d->m_debuggerManager->showStatusMessage("Starting Debugger", -1);
QString errorMessage; QString errorMessage;
bool rc = false; bool rc = false;
@@ -1042,8 +1059,35 @@ void CdbDebugEngine::loadAllSymbols()
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
} }
static inline int registerFormatBase()
{
switch(checkedRegisterFormatAction()) {
case FormatHexadecimal:
return 16;
case FormatDecimal:
return 10;
case FormatOctal:
return 8;
case FormatBinary:
return 2;
break;
case FormatRaw:
case FormatNatural:
break;
}
return 10;
}
void CdbDebugEngine::reloadRegisters() void CdbDebugEngine::reloadRegisters()
{ {
const int intBase = registerFormatBase();
if (debugCDB)
qDebug() << Q_FUNC_INFO << intBase;
QList<Register> registers;
QString errorMessage;
if (!getRegisters(m_d->m_pDebugControl, m_d->m_pDebugRegisters, &registers, &errorMessage, intBase))
qWarning("reloadRegisters() failed: %s\n", qPrintable(errorMessage));
m_d->m_debuggerManagerAccess->registerHandler()->setRegisters(registers);
} }
void CdbDebugEngine::timerEvent(QTimerEvent* te) void CdbDebugEngine::timerEvent(QTimerEvent* te)
@@ -1142,14 +1186,23 @@ void CdbDebugEnginePrivate::updateThreadList()
ThreadsHandler* th = m_debuggerManagerAccess->threadsHandler(); ThreadsHandler* th = m_debuggerManagerAccess->threadsHandler();
QList<ThreadData> threads; QList<ThreadData> threads;
bool success = false;
HRESULT hr; QString errorMessage;
do {
ULONG numberOfThreads; ULONG numberOfThreads;
hr = m_pDebugSystemObjects->GetNumberThreads(&numberOfThreads); HRESULT hr= m_pDebugSystemObjects->GetNumberThreads(&numberOfThreads);
if (FAILED(hr)) {
errorMessage= msgComFailed("GetNumberThreads", hr);
break;
}
const ULONG maxThreadIds = 256; const ULONG maxThreadIds = 256;
ULONG threadIds[maxThreadIds]; ULONG threadIds[maxThreadIds];
ULONG biggestThreadId = qMin(maxThreadIds, numberOfThreads - 1); ULONG biggestThreadId = qMin(maxThreadIds, numberOfThreads - 1);
hr = m_pDebugSystemObjects->GetThreadIdsByIndex(0, biggestThreadId, threadIds, 0); hr = m_pDebugSystemObjects->GetThreadIdsByIndex(0, biggestThreadId, threadIds, 0);
if (FAILED(hr)) {
errorMessage= msgComFailed("GetThreadIdsByIndex", hr);
break;
}
for (ULONG threadId = 0; threadId <= biggestThreadId; ++threadId) { for (ULONG threadId = 0; threadId <= biggestThreadId; ++threadId) {
ThreadData thread; ThreadData thread;
thread.id = threadId; thread.id = threadId;
@@ -1157,6 +1210,10 @@ void CdbDebugEnginePrivate::updateThreadList()
} }
th->setThreads(threads); th->setThreads(threads);
success = true;
} while (false);
if (!success)
qWarning("updateThreadList() failed: %s\n", qPrintable(errorMessage));
} }
void CdbDebugEnginePrivate::updateStackTrace() void CdbDebugEnginePrivate::updateStackTrace()
@@ -1166,6 +1223,7 @@ void CdbDebugEnginePrivate::updateStackTrace()
// Create a new context // Create a new context
clearForRun(); clearForRun();
QString errorMessage; QString errorMessage;
m_engine->reloadRegisters();
m_currentStackTrace = m_currentStackTrace =
CdbStackTraceContext::create(m_pDebugControl, m_pDebugSystemObjects, CdbStackTraceContext::create(m_pDebugControl, m_pDebugSystemObjects,
m_pDebugSymbols, m_currentThreadId, &errorMessage); m_pDebugSymbols, m_currentThreadId, &errorMessage);
@@ -1191,11 +1249,14 @@ void CdbDebugEnginePrivate::updateStackTrace()
} }
} }
void CdbDebugEnginePrivate::handleDebugOutput(const char *szOutputString)
void CdbDebugEnginePrivate::updateModules()
{ {
if (debugCDB && strstr(szOutputString, "ModLoad:") == 0) QList<Module> modules;
qDebug() << Q_FUNC_INFO << szOutputString; QString errorMessage;
m_debuggerManagerAccess->showApplicationOutput(QString::fromLocal8Bit(szOutputString)); if (!getModuleList(m_pDebugSymbols, &modules, &errorMessage))
qWarning("updateModules() failed: %s\n", qPrintable(errorMessage));
m_debuggerManagerAccess->modulesHandler()->setModules(modules);
} }
void CdbDebugEnginePrivate::handleBreakpointEvent(PDEBUG_BREAKPOINT pBP) void CdbDebugEnginePrivate::handleBreakpointEvent(PDEBUG_BREAKPOINT pBP)

View File

@@ -82,11 +82,13 @@ struct CdbDebugEnginePrivate
void updateThreadList(); void updateThreadList();
void updateStackTrace(); void updateStackTrace();
bool updateLocals(int frameIndex, WatchHandler *wh, QString *errorMessage); bool updateLocals(int frameIndex, WatchHandler *wh, QString *errorMessage);
void handleDebugOutput(const char* szOutputString); void updateModules();
void handleBreakpointEvent(PDEBUG_BREAKPOINT pBP); void handleBreakpointEvent(PDEBUG_BREAKPOINT pBP);
void cleanStackTrace(); void cleanStackTrace();
void clearForRun(); void clearForRun();
CdbSymbolGroupContext *getStackFrameSymbolGroupContext(int frameIndex, QString *errorMessage) const; CdbSymbolGroupContext *getStackFrameSymbolGroupContext(int frameIndex, QString *errorMessage) const;
void clearDisplay();
bool interruptInterferiorProcess(QString *errorMessage); bool interruptInterferiorProcess(QString *errorMessage);

View File

@@ -77,7 +77,8 @@ STDMETHODIMP_(ULONG) CdbDebugEventCallback::Release(THIS)
STDMETHODIMP CdbDebugEventCallback::GetInterestMask(THIS_ __out PULONG mask) STDMETHODIMP CdbDebugEventCallback::GetInterestMask(THIS_ __out PULONG mask)
{ {
*mask = DEBUG_EVENT_CREATE_PROCESS | DEBUG_EVENT_EXIT_PROCESS *mask = DEBUG_EVENT_CREATE_PROCESS | DEBUG_EVENT_EXIT_PROCESS
//| DEBUG_EVENT_CREATE_THREAD | DEBUG_EVENT_EXIT_THREAD | DEBUG_EVENT_LOAD_MODULE | DEBUG_EVENT_UNLOAD_MODULE
| DEBUG_EVENT_CREATE_THREAD | DEBUG_EVENT_EXIT_THREAD
| DEBUG_EVENT_BREAKPOINT | DEBUG_EVENT_BREAKPOINT
| DEBUG_EVENT_EXCEPTION | DEBUG_EVENT_EXCEPTION
; ;
@@ -125,13 +126,9 @@ STDMETHODIMP CdbDebugEventCallback::CreateThread(
Q_UNUSED(Handle) Q_UNUSED(Handle)
Q_UNUSED(DataOffset) Q_UNUSED(DataOffset)
Q_UNUSED(StartOffset) Q_UNUSED(StartOffset)
if (debugCDB) if (debugCDB)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
//Debugger::ThreadInfo ti; m_pEngine->m_d->updateThreadList();
//ti.handle = Handle;
//ti.dataOffset = DataOffset;
//ti.startOffset = StartOffset;
return S_OK; return S_OK;
} }
@@ -142,7 +139,8 @@ STDMETHODIMP CdbDebugEventCallback::ExitThread(
{ {
if (debugCDB) if (debugCDB)
qDebug() << Q_FUNC_INFO << ExitCode; qDebug() << Q_FUNC_INFO << ExitCode;
// @TODO: It seems the terminated thread is still in the list...
m_pEngine->m_d->updateThreadList();
return S_OK; return S_OK;
} }
@@ -211,14 +209,14 @@ STDMETHODIMP CdbDebugEventCallback::LoadModule(
{ {
Q_UNUSED(ImageFileHandle) Q_UNUSED(ImageFileHandle)
Q_UNUSED(BaseOffset) Q_UNUSED(BaseOffset)
Q_UNUSED(ModuleSize)
Q_UNUSED(ModuleName) Q_UNUSED(ModuleName)
Q_UNUSED(ModuleSize)
Q_UNUSED(ImageName) Q_UNUSED(ImageName)
Q_UNUSED(CheckSum) Q_UNUSED(CheckSum)
Q_UNUSED(TimeDateStamp) Q_UNUSED(TimeDateStamp)
if (debugCDB) if (debugCDB > 1)
qDebug() << Q_FUNC_INFO << ModuleName; qDebug() << Q_FUNC_INFO << ModuleName;
m_pEngine->m_d->updateModules();
return S_OK; return S_OK;
} }
@@ -230,9 +228,9 @@ STDMETHODIMP CdbDebugEventCallback::UnloadModule(
{ {
Q_UNUSED(ImageBaseName) Q_UNUSED(ImageBaseName)
Q_UNUSED(BaseOffset) Q_UNUSED(BaseOffset)
if (debugCDB) if (debugCDB > 1)
qDebug() << Q_FUNC_INFO << ImageBaseName; qDebug() << Q_FUNC_INFO << ImageBaseName;
m_pEngine->m_d->updateModules();
return S_OK; return S_OK;
} }

View File

@@ -76,14 +76,49 @@ STDMETHODIMP_(ULONG) CdbDebugOutput::Release(THIS)
return 0; return 0;
} }
// Return a prefix for debugger messages
static QString prefix(ULONG mask)
{
if (mask & (DEBUG_OUTPUT_DEBUGGEE|DEBUG_OUTPUT_DEBUGGEE_PROMPT|DEBUG_OUTPUT_DEBUGGEE_PROMPT)) {
static const QString p = QLatin1String("target:");
return p;
}
if (mask & (DEBUG_OUTPUT_PROMPT_REGISTERS)) {
static const QString p = QLatin1String("registers:");
return p;
}
if (mask & (DEBUG_OUTPUT_EXTENSION_WARNING|DEBUG_OUTPUT_WARNING)) {
static const QString p = QLatin1String("warning:");
return p;
}
if (mask & (DEBUG_OUTPUT_ERROR)) {
static const QString p = QLatin1String("error:");
return p;
}
if (mask & DEBUG_OUTPUT_SYMBOLS) {
static const QString p = QLatin1String("symbols:");
return p;
}
static const QString commonPrefix = QLatin1String("cdb:");
return commonPrefix;
}
STDMETHODIMP CdbDebugOutput::Output( STDMETHODIMP CdbDebugOutput::Output(
THIS_ THIS_
IN ULONG mask, IN ULONG mask,
IN PCSTR text IN PCSTR text
) )
{ {
UNREFERENCED_PARAMETER(mask); const QString msg = QString::fromLocal8Bit(text);
m_pEngine->m_d->handleDebugOutput(text);
if (debugCDB > 1)
qDebug() << Q_FUNC_INFO << "\n " << msg;
if (mask & (DEBUG_OUTPUT_PROMPT|DEBUG_OUTPUT_DEBUGGEE_PROMPT)) {
emit debuggerInputPrompt(prefix(mask), msg);
} else {
emit debuggerOutput(prefix(mask), msg);
}
return S_OK; return S_OK;
} }

View File

@@ -33,13 +33,16 @@
#include <windows.h> #include <windows.h>
#include <inc/dbgeng.h> #include <inc/dbgeng.h>
#include <QtCore/QObject>
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
class CdbDebugEngine; class CdbDebugEngine;
class CdbDebugOutput : public IDebugOutputCallbacks class CdbDebugOutput : public QObject, public IDebugOutputCallbacks
{ {
Q_OBJECT
public: public:
explicit CdbDebugOutput(CdbDebugEngine* engine); explicit CdbDebugOutput(CdbDebugEngine* engine);
@@ -63,6 +66,10 @@ public:
IN PCSTR text IN PCSTR text
); );
signals:
void debuggerOutput(const QString &prefix, const QString &message);
void debuggerInputPrompt(const QString &prefix, const QString &message);
private: private:
CdbDebugEngine* m_pEngine; CdbDebugEngine* m_pEngine;
}; };

View File

@@ -0,0 +1,81 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#include "cdbmodules.h"
#include "moduleshandler.h"
#include "cdbdebugengine_p.h"
namespace Debugger {
namespace Internal {
bool getModuleList(IDebugSymbols3 *syms, QList<Module> *modules, QString *errorMessage)
{
modules->clear();
ULONG loadedCount, unloadedCount;
HRESULT hr = syms->GetNumberModules(&loadedCount, &unloadedCount);
if (FAILED(hr)) {
*errorMessage= msgComFailed("GetNumberModules", hr);
return false;
}
// retrieve array of parameters
const ULONG count = loadedCount + unloadedCount;
QVector<DEBUG_MODULE_PARAMETERS> parameters(count);
DEBUG_MODULE_PARAMETERS *parmPtr = &(*parameters.begin());
memset(parmPtr, 0, sizeof(DEBUG_MODULE_PARAMETERS) * count);
hr = syms->GetModuleParameters(count, 0, 0u, parmPtr);
// E_INVALIDARG indicates 'Partial results' according to docu
if (FAILED(hr) && hr != E_INVALIDARG) {
*errorMessage= msgComFailed("GetModuleParameters", hr);
return false;
}
// fill array
const QString hexPrefix = QLatin1String("0x");
WCHAR wszBuf[MAX_PATH];
for (ULONG m = 0; m < count; m++) {
const DEBUG_MODULE_PARAMETERS &p = parameters.at(m);
if (p.Base != DEBUG_INVALID_OFFSET) { // Partial results?
Module module;
module.symbolsRead = (p.Flags & DEBUG_MODULE_USER_MODE)
&& (p.SymbolType != DEBUG_SYMTYPE_NONE);
module.startAddress = hexPrefix + QString::number(p.Base, 16);
module.endAddress = hexPrefix + QString::number((p.Base + p.Size), 16);
hr = syms ->GetModuleNameStringWide(DEBUG_MODNAME_IMAGE, m, 0, wszBuf, MAX_PATH - 1, 0);
if (FAILED(hr) && hr != E_INVALIDARG) {
*errorMessage= msgComFailed("GetModuleNameStringWide", hr);
return false;
}
module.moduleName = QString::fromUtf16(wszBuf);
modules->push_back(module);
}
}
return true;
}
}
}

View File

@@ -0,0 +1,49 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#ifndef CDBMODULES_H
#define CDBMODULES_H
#include <QtCore/QList>
#include <QtCore/QString>
#include <windows.h>
#include <inc/dbgeng.h>
namespace Debugger {
namespace Internal {
class Module;
bool getModuleList(IDebugSymbols3 *syms, QList<Module> *modules, QString *errorMessage);
}
}
#endif // CDBMODULES_H

View File

@@ -403,45 +403,67 @@ bool CdbSymbolGroupContext::assignValue(const QString &iname, const QString &val
// format an array of integers as "0x323, 0x2322, ..." // format an array of integers as "0x323, 0x2322, ..."
template <class Integer> template <class Integer>
static QString hexFormatArrayHelper(const Integer *array, int size) static QString formatArrayHelper(const Integer *array, int size, int base = 10)
{ {
QString rc; QString rc;
const QString hexPrefix = QLatin1String("0x"); const QString hexPrefix = QLatin1String("0x");
const QString separator= QLatin1String(", "); const QString separator= QLatin1String(", ");
const bool hex = base == 16;
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
if (i) if (i)
rc += separator; rc += separator;
if (hex)
rc += hexPrefix; rc += hexPrefix;
rc += QString::number(array[i], 16); rc += QString::number(array[i], base);
} }
return rc; return rc;
} }
QString CdbSymbolGroupContext::hexFormatArray(const unsigned short *array, int size) QString CdbSymbolGroupContext::hexFormatArray(const unsigned short *array, int size)
{ {
return hexFormatArrayHelper(array, size); return formatArrayHelper(array, size, 16);
} }
QString CdbSymbolGroupContext::debugValueToString(const DEBUG_VALUE &dv, IDebugControl4 *ctl, QString *type) // Helper to format an integer with
// a hex prefix in case base = 16
template <class Integer>
inline QString formatInteger(Integer value, int base)
{
QString rc;
if (base == 16)
rc = QLatin1String("0x");
rc += QString::number(value, base);
return rc;
}
QString CdbSymbolGroupContext::debugValueToString(const DEBUG_VALUE &dv, IDebugControl4 *ctl,
QString *qType,
int integerBase)
{ {
switch (dv.Type) { switch (dv.Type) {
case DEBUG_VALUE_INT8: case DEBUG_VALUE_INT8:
*type = QLatin1String("char"); if (qType)
return QString::number(dv.I8); *qType = QLatin1String("char");
return formatInteger(dv.I8, integerBase);
case DEBUG_VALUE_INT16: case DEBUG_VALUE_INT16:
*type = QLatin1String("short"); if (qType)
return QString::number(static_cast<short>(dv.I16)); *qType = QLatin1String("short");
return formatInteger(static_cast<short>(dv.I16), integerBase);
case DEBUG_VALUE_INT32: case DEBUG_VALUE_INT32:
*type = QLatin1String("long"); if (qType)
return QString::number(static_cast<long>(dv.I32)); *qType = QLatin1String("long");
return formatInteger(static_cast<long>(dv.I32), integerBase);
case DEBUG_VALUE_INT64: case DEBUG_VALUE_INT64:
*type = QLatin1String("long long"); if (qType)
return QString::number(static_cast<long long>(dv.I64)); *qType = QLatin1String("long long");
return formatInteger(static_cast<long long>(dv.I64), integerBase);
case DEBUG_VALUE_FLOAT32: case DEBUG_VALUE_FLOAT32:
*type = QLatin1String("float"); if (qType)
*qType = QLatin1String("float");
return QString::number(dv.F32); return QString::number(dv.F32);
case DEBUG_VALUE_FLOAT64: case DEBUG_VALUE_FLOAT64:
*type = QLatin1String("double"); if (qType)
*qType = QLatin1String("double");
return QString::number(dv.F64); return QString::number(dv.F64);
case DEBUG_VALUE_FLOAT80: case DEBUG_VALUE_FLOAT80:
case DEBUG_VALUE_FLOAT128: { // Convert to double case DEBUG_VALUE_FLOAT128: { // Convert to double
@@ -449,28 +471,32 @@ QString CdbSymbolGroupContext::debugValueToString(const DEBUG_VALUE &dv, IDebugC
double d = 0.0; double d = 0.0;
if (SUCCEEDED(ctl->CoerceValue(const_cast<DEBUG_VALUE*>(&dv), DEBUG_VALUE_FLOAT64, &doubleValue))) if (SUCCEEDED(ctl->CoerceValue(const_cast<DEBUG_VALUE*>(&dv), DEBUG_VALUE_FLOAT64, &doubleValue)))
d = dv.F64; d = dv.F64;
*type = dv.Type == DEBUG_VALUE_FLOAT80 ? QLatin1String("80bit-float") : QLatin1String("128bit-float"); if (qType)
*qType = QLatin1String(dv.Type == DEBUG_VALUE_FLOAT80 ? "80bit-float" : "128bit-float");
return QString::number(d); return QString::number(d);
} }
case DEBUG_VALUE_VECTOR64: { case DEBUG_VALUE_VECTOR64: {
*type = QLatin1String("64bit-vector"); if (qType)
*qType = QLatin1String("64bit-vector");
QString rc = QLatin1String("bytes: "); QString rc = QLatin1String("bytes: ");
rc += hexFormatArrayHelper(dv.VI8, 8); rc += formatArrayHelper(dv.VI8, 8, integerBase);
rc += QLatin1String(" long: "); rc += QLatin1String(" long: ");
rc += hexFormatArrayHelper(dv.VI32, 2); rc += formatArrayHelper(dv.VI32, 2, integerBase);
return rc; return rc;
} }
case DEBUG_VALUE_VECTOR128: { case DEBUG_VALUE_VECTOR128: {
*type = QLatin1String("128bit-vector"); if (qType)
*qType = QLatin1String("128bit-vector");
QString rc = QLatin1String("bytes: "); QString rc = QLatin1String("bytes: ");
rc += hexFormatArrayHelper(dv.VI8, 16); rc += formatArrayHelper(dv.VI8, 16, integerBase);
rc += QLatin1String(" long long: "); rc += QLatin1String(" long long: ");
rc += hexFormatArrayHelper(dv.VI64, 2); rc += formatArrayHelper(dv.VI64, 2, integerBase);
return rc; return rc;
} }
} }
*type = QString::fromLatin1("Unknown type #%1:").arg(dv.Type); if (qType)
return hexFormatArrayHelper(dv.RawBytes, 24); *qType = QString::fromLatin1("Unknown type #%1:").arg(dv.Type);
return formatArrayHelper(dv.RawBytes, 24, integerBase);
} }
// - Watch model functions // - Watch model functions

View File

@@ -92,7 +92,7 @@ public:
inline bool isExpanded(const QString &prefix) const { return symbolState(prefix) == ExpandedSymbol; } inline bool isExpanded(const QString &prefix) const { return symbolState(prefix) == ExpandedSymbol; }
// Helper to convert a DEBUG_VALUE structure to a string representation // Helper to convert a DEBUG_VALUE structure to a string representation
static QString debugValueToString(const DEBUG_VALUE &dv, IDebugControl4 *ctl, QString *type); static QString debugValueToString(const DEBUG_VALUE &dv, IDebugControl4 *ctl, QString *type = 0, int integerBase = 10);
// format an array of unsigned longs as "0x323, 0x2322, ..." // format an array of unsigned longs as "0x323, 0x2322, ..."
static QString hexFormatArray(const unsigned short *array, int size); static QString hexFormatArray(const unsigned short *array, int size);

View File

@@ -54,7 +54,7 @@ namespace Internal {
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
DebuggerSettings::DebuggerSettings(QObject *parent) DebuggerSettings::DebuggerSettings(QObject *parent)
: QObject(parent) : QObject(parent), m_registerFormatGroup(0)
{} {}
DebuggerSettings::~DebuggerSettings() DebuggerSettings::~DebuggerSettings()
@@ -74,25 +74,25 @@ void DebuggerSettings::readSettings(QSettings *settings)
item->readSettings(settings); item->readSettings(settings);
} }
void DebuggerSettings::writeSettings(QSettings *settings) void DebuggerSettings::writeSettings(QSettings *settings) const
{ {
foreach (SavedAction *item, m_items) foreach (SavedAction *item, m_items)
item->writeSettings(settings); item->writeSettings(settings);
} }
SavedAction *DebuggerSettings::item(int code) SavedAction *DebuggerSettings::item(int code) const
{ {
QTC_ASSERT(m_items.value(code, 0), return 0); QTC_ASSERT(m_items.value(code, 0), return 0);
return m_items.value(code, 0); return m_items.value(code, 0);
} }
QString DebuggerSettings::dump() QString DebuggerSettings::dump() const
{ {
QString out; QString out;
QTextStream ts(&out); QTextStream ts(&out);
ts << "Debugger settings: "; ts << "Debugger settings: ";
foreach (SavedAction *item, m_items) foreach (SavedAction *item, m_items)
ts << "\n" << item->value().toString(); ts << '\n' << item->value().toString();
return out; return out;
} }
@@ -153,27 +153,27 @@ DebuggerSettings *DebuggerSettings::instance()
// //
// DebuggingHelper // DebuggingHelper
// const QString debugModeGroup = QLatin1String("DebugMode");
item = new SavedAction(instance); item = new SavedAction(instance);
instance->insertItem(UseDebuggingHelpers, item); instance->insertItem(UseDebuggingHelpers, item);
item->setDefaultValue(true); item->setDefaultValue(true);
item->setSettingsKey("DebugMode", "UseDebuggingHelper"); item->setSettingsKey(debugModeGroup, QLatin1String("UseDebuggingHelper"));
item->setText(tr("Use Debugging Helper")); item->setText(tr("Use Debugging Helper"));
item->setCheckable(true); item->setCheckable(true);
item->setDefaultValue(true); item->setDefaultValue(true);
item = new SavedAction(instance); item = new SavedAction(instance);
instance->insertItem(UseCustomDebuggingHelperLocation, item); instance->insertItem(UseCustomDebuggingHelperLocation, item);
item->setSettingsKey("DebugMode", "CustomDebuggingHelperLocation"); item->setSettingsKey(debugModeGroup, QLatin1String("CustomDebuggingHelperLocation"));
item->setCheckable(true); item->setCheckable(true);
item = new SavedAction(instance); item = new SavedAction(instance);
instance->insertItem(CustomDebuggingHelperLocation, item); instance->insertItem(CustomDebuggingHelperLocation, item);
item->setSettingsKey("DebugMode", "CustomDebuggingHelperLocation"); item->setSettingsKey(debugModeGroup, QLatin1String("CustomDebuggingHelperLocation"));
item = new SavedAction(instance); item = new SavedAction(instance);
instance->insertItem(DebugDebuggingHelpers, item); instance->insertItem(DebugDebuggingHelpers, item);
item->setSettingsKey("DebugMode", "DebugDebuggingHelpers"); item->setSettingsKey(debugModeGroup, QLatin1String("DebugDebuggingHelpers"));
item->setText(tr("Debug debugging helper")); item->setText(tr("Debug debugging helper"));
item->setCheckable(true); item->setCheckable(true);
@@ -193,115 +193,120 @@ DebuggerSettings *DebuggerSettings::instance()
// Registers // Registers
// //
QActionGroup *registerFormatGroup = new QActionGroup(instance); instance->m_registerFormatGroup = new QActionGroup(instance);
registerFormatGroup->setExclusive(true); instance->m_registerFormatGroup->setExclusive(true);
item = new SavedAction(instance); item = new SavedAction(instance);
item->setText(tr("Hexadecimal")); item->setText(tr("Hexadecimal"));
item->setCheckable(true); item->setCheckable(true);
item->setSettingsKey("DebugMode", "FormatHexadecimal"); item->setSettingsKey(debugModeGroup, QLatin1String("FormatHexadecimal"));
item->setChecked(true); item->setChecked(true);
item->setData(FormatHexadecimal);
instance->insertItem(FormatHexadecimal, item); instance->insertItem(FormatHexadecimal, item);
registerFormatGroup->addAction(item); instance->m_registerFormatGroup->addAction(item);
item = new SavedAction(instance); item = new SavedAction(instance);
item->setText(tr("Decimal")); item->setText(tr("Decimal"));
item->setCheckable(true); item->setCheckable(true);
item->setSettingsKey("DebugMode", "FormatDecimal"); item->setSettingsKey(debugModeGroup, QLatin1String("FormatDecimal"));
item->setData(FormatDecimal);
instance->insertItem(FormatDecimal, item); instance->insertItem(FormatDecimal, item);
registerFormatGroup->addAction(item); instance->m_registerFormatGroup->addAction(item);
item = new SavedAction(instance); item = new SavedAction(instance);
item->setText(tr("Octal")); item->setText(tr("Octal"));
item->setCheckable(true); item->setCheckable(true);
item->setSettingsKey("DebugMode", "FormatOctal"); item->setSettingsKey(debugModeGroup, QLatin1String("FormatOctal"));
item->setData(FormatOctal);
instance->insertItem(FormatOctal, item); instance->insertItem(FormatOctal, item);
registerFormatGroup->addAction(item); instance->m_registerFormatGroup->addAction(item);
item = new SavedAction(instance); item = new SavedAction(instance);
item->setText(tr("Binary")); item->setText(tr("Binary"));
item->setCheckable(true); item->setCheckable(true);
item->setSettingsKey("DebugMode", "FormatBinary"); item->setSettingsKey(debugModeGroup, QLatin1String("FormatBinary"));
item->setData(FormatBinary);
instance->insertItem(FormatBinary, item); instance->insertItem(FormatBinary, item);
registerFormatGroup->addAction(item); instance->m_registerFormatGroup->addAction(item);
item = new SavedAction(instance); item = new SavedAction(instance);
item->setText(tr("Raw")); item->setText(tr("Raw"));
item->setCheckable(true); item->setCheckable(true);
item->setSettingsKey("DebugMode", "FormatRaw"); item->setSettingsKey(debugModeGroup, QLatin1String("FormatRaw"));
instance->insertItem(FormatRaw, item); instance->insertItem(FormatRaw, item);
registerFormatGroup->addAction(item); item->setData(FormatRaw);
instance->m_registerFormatGroup->addAction(item);
item = new SavedAction(instance); item = new SavedAction(instance);
item->setText(tr("Natural")); item->setText(tr("Natural"));
item->setCheckable(true); item->setCheckable(true);
item->setSettingsKey("DebugMode", "FormatNatural"); item->setSettingsKey(debugModeGroup, QLatin1String("FormatNatural"));
item->setData(FormatNatural);
instance->insertItem(FormatNatural, item); instance->insertItem(FormatNatural, item);
registerFormatGroup->addAction(item); instance->m_registerFormatGroup->addAction(item);
// //
// Settings // Settings
// //
item = new SavedAction(instance); item = new SavedAction(instance);
item->setSettingsKey("DebugMode", "Location"); item->setSettingsKey(debugModeGroup, QLatin1String("Location"));
instance->insertItem(GdbLocation, item); instance->insertItem(GdbLocation, item);
item = new SavedAction(instance); item = new SavedAction(instance);
item->setSettingsKey("DebugMode", "Environment"); item->setSettingsKey(debugModeGroup, QLatin1String("Environment"));
instance->insertItem(GdbEnvironment, item); instance->insertItem(GdbEnvironment, item);
item = new SavedAction(instance); item = new SavedAction(instance);
item->setSettingsKey("DebugMode", "ScriptFile"); item->setSettingsKey(debugModeGroup, QLatin1String("ScriptFile"));
instance->insertItem(GdbScriptFile, item); instance->insertItem(GdbScriptFile, item);
item = new SavedAction(instance); item = new SavedAction(instance);
item->setSettingsKey("DebugMode", "AutoQuit"); item->setSettingsKey(debugModeGroup, QLatin1String("AutoQuit"));
item->setText(tr("Automatically quit debugger")); item->setText(tr("Automatically quit debugger"));
item->setCheckable(true); item->setCheckable(true);
instance->insertItem(AutoQuit, item); instance->insertItem(AutoQuit, item);
item = new SavedAction(instance); item = new SavedAction(instance);
item->setSettingsKey("DebugMode", "UseToolTips"); item->setSettingsKey(debugModeGroup, QLatin1String("UseToolTips"));
item->setText(tr("Use tooltips when debugging")); item->setText(tr("Use tooltips when debugging"));
item->setCheckable(true); item->setCheckable(true);
instance->insertItem(UseToolTips, item); instance->insertItem(UseToolTips, item);
item = new SavedAction(instance); item = new SavedAction(instance);
item->setDefaultValue("xterm"); item->setDefaultValue(QLatin1String("xterm"));
item->setSettingsKey("DebugMode", "Terminal"); item->setSettingsKey(debugModeGroup, QLatin1String("Terminal"));
instance->insertItem(TerminalApplication, item); instance->insertItem(TerminalApplication, item);
item = new SavedAction(instance); item = new SavedAction(instance);
item->setSettingsKey("DebugMode", "ListSourceFiles"); item->setSettingsKey(debugModeGroup, QLatin1String("ListSourceFiles"));
item->setText(tr("List source files")); item->setText(tr("List source files"));
item->setCheckable(true); item->setCheckable(true);
instance->insertItem(ListSourceFiles, item); instance->insertItem(ListSourceFiles, item);
item = new SavedAction(instance); item = new SavedAction(instance);
item->setSettingsKey("DebugMode", "SkipKnownFrames"); item->setSettingsKey(debugModeGroup, QLatin1String("SkipKnownFrames"));
item->setText(tr("Skip known frames")); item->setText(tr("Skip known frames"));
item->setCheckable(true); item->setCheckable(true);
instance->insertItem(SkipKnownFrames, item); instance->insertItem(SkipKnownFrames, item);
item = new SavedAction(instance); item = new SavedAction(instance);
item->setSettingsKey("DebugMode", "AllPluginBreakpoints"); item->setSettingsKey(debugModeGroup, QLatin1String("AllPluginBreakpoints"));
instance->insertItem(AllPluginBreakpoints, item); instance->insertItem(AllPluginBreakpoints, item);
item = new SavedAction(instance); item = new SavedAction(instance);
item->setSettingsKey("DebugMode", "SelectedPluginBreakpoints"); item->setSettingsKey(debugModeGroup, QLatin1String("SelectedPluginBreakpoints"));
instance->insertItem(SelectedPluginBreakpoints, item); instance->insertItem(SelectedPluginBreakpoints, item);
item = new SavedAction(instance); item = new SavedAction(instance);
item->setSettingsKey("DebugMode", "NoPluginBreakpoints"); item->setSettingsKey(debugModeGroup, QLatin1String("NoPluginBreakpoints"));
instance->insertItem(NoPluginBreakpoints, item); instance->insertItem(NoPluginBreakpoints, item);
item = new SavedAction(instance); item = new SavedAction(instance);
item->setSettingsKey("DebugMode", "SelectedPluginBreakpointsPattern"); item->setSettingsKey(debugModeGroup, QLatin1String("SelectedPluginBreakpointsPattern"));
instance->insertItem(SelectedPluginBreakpointsPattern, item); instance->insertItem(SelectedPluginBreakpointsPattern, item);
item = new SavedAction(instance); item = new SavedAction(instance);
item->setSettingsKey("DebugMode", "MaximalStackDepth"); item->setSettingsKey(debugModeGroup, QLatin1String("MaximalStackDepth"));
item->setDefaultValue(20); item->setDefaultValue(20);
instance->insertItem(MaximalStackDepth, item); instance->insertItem(MaximalStackDepth, item);
@@ -316,6 +321,11 @@ DebuggerSettings *DebuggerSettings::instance()
return instance; return instance;
} }
int DebuggerSettings::checkedRegisterFormatAction() const
{
return m_registerFormatGroup->checkedAction()->data().toInt();
}
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// //
// DebuggerActions // DebuggerActions
@@ -327,6 +337,11 @@ SavedAction *theDebuggerAction(int code)
return DebuggerSettings::instance()->item(code); return DebuggerSettings::instance()->item(code);
} }
int checkedRegisterFormatAction()
{
return DebuggerSettings::instance()->checkedRegisterFormatAction();
}
bool theDebuggerBoolSetting(int code) bool theDebuggerBoolSetting(int code)
{ {
return DebuggerSettings::instance()->item(code)->value().toBool(); return DebuggerSettings::instance()->item(code)->value().toBool();

View File

@@ -34,6 +34,9 @@
#include <utils/savedaction.h> #include <utils/savedaction.h>
QT_BEGIN_NAMESPACE
class QActionGroup;
QT_END_NAMESPACE
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
@@ -46,18 +49,22 @@ public:
~DebuggerSettings(); ~DebuggerSettings();
void insertItem(int code, Core::Utils::SavedAction *item); void insertItem(int code, Core::Utils::SavedAction *item);
Core::Utils::SavedAction *item(int code); Core::Utils::SavedAction *item(int code) const;
QString dump(); QString dump() const;
static DebuggerSettings *instance(); static DebuggerSettings *instance();
// Return one of FormatHexadecimal, FormatDecimal,...
int checkedRegisterFormatAction() const;
public slots: public slots:
void readSettings(QSettings *settings); void readSettings(QSettings *settings);
void writeSettings(QSettings *settings); void writeSettings(QSettings *settings) const;
private: private:
QHash<int, Core::Utils::SavedAction *> m_items; QHash<int, Core::Utils::SavedAction *> m_items;
QActionGroup *m_registerFormatGroup;
}; };
@@ -125,7 +132,10 @@ enum DebuggerActionCode
// singleton access // singleton access
Core::Utils::SavedAction *theDebuggerAction(int code); Core::Utils::SavedAction *theDebuggerAction(int code);
// convienience // Return one of FormatHexadecimal, FormatDecimal,...
int checkedRegisterFormatAction();
// convenience
bool theDebuggerBoolSetting(int code); bool theDebuggerBoolSetting(int code);
QString theDebuggerStringSetting(int code); QString theDebuggerStringSetting(int code);

View File

@@ -650,6 +650,19 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
connect(resetToSimpleAction, SIGNAL(triggered()), connect(resetToSimpleAction, SIGNAL(triggered()),
m_manager, SLOT(setSimpleDockWidgetArrangement())); m_manager, SLOT(setSimpleDockWidgetArrangement()));
connect(theDebuggerAction(FormatHexadecimal), SIGNAL(triggered()),
m_manager, SLOT(reloadRegisters()));
connect(theDebuggerAction(FormatDecimal), SIGNAL(triggered()),
m_manager, SLOT(reloadRegisters()));
connect(theDebuggerAction(FormatOctal), SIGNAL(triggered()),
m_manager, SLOT(reloadRegisters()));
connect(theDebuggerAction(FormatBinary), SIGNAL(triggered()),
m_manager, SLOT(reloadRegisters()));
connect(theDebuggerAction(FormatRaw), SIGNAL(triggered()),
m_manager, SLOT(reloadRegisters()));
connect(theDebuggerAction(FormatNatural), SIGNAL(triggered()),
m_manager, SLOT(reloadRegisters()));
// FIXME: // FIXME:
m_generalOptionPage = new GdbOptionPage; m_generalOptionPage = new GdbOptionPage;
addObject(m_generalOptionPage); addObject(m_generalOptionPage);

View File

@@ -221,19 +221,6 @@ void GdbEngine::initializeConnections()
connect(theDebuggerAction(RecheckDebuggingHelpers), SIGNAL(triggered()), connect(theDebuggerAction(RecheckDebuggingHelpers), SIGNAL(triggered()),
this, SLOT(recheckDebuggingHelperAvailability())); this, SLOT(recheckDebuggingHelperAvailability()));
connect(theDebuggerAction(FormatHexadecimal), SIGNAL(triggered()),
this, SLOT(reloadRegisters()));
connect(theDebuggerAction(FormatDecimal), SIGNAL(triggered()),
this, SLOT(reloadRegisters()));
connect(theDebuggerAction(FormatOctal), SIGNAL(triggered()),
this, SLOT(reloadRegisters()));
connect(theDebuggerAction(FormatBinary), SIGNAL(triggered()),
this, SLOT(reloadRegisters()));
connect(theDebuggerAction(FormatRaw), SIGNAL(triggered()),
this, SLOT(reloadRegisters()));
connect(theDebuggerAction(FormatNatural), SIGNAL(triggered()),
this, SLOT(reloadRegisters()));
connect(theDebuggerAction(ExpandStack), SIGNAL(triggered()), connect(theDebuggerAction(ExpandStack), SIGNAL(triggered()),
this, SLOT(reloadFullStack())); this, SLOT(reloadFullStack()));
connect(theDebuggerAction(MaximalStackDepth), SIGNAL(triggered()), connect(theDebuggerAction(MaximalStackDepth), SIGNAL(triggered()),
@@ -2619,22 +2606,28 @@ void GdbEngine::handleStackListThreads(const GdbResultRecord &record, int id)
// //
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
static inline char registerFormatChar()
{
switch(checkedRegisterFormatAction()) {
case FormatHexadecimal:
return 'x';
case FormatDecimal:
return 'd';
case FormatOctal:
return 'o';
case FormatBinary:
return 't';
case FormatRaw:
return 'r';
default:
break;
}
return 'N';
}
void GdbEngine::reloadRegisters() void GdbEngine::reloadRegisters()
{ {
QString format; sendCommand(QLatin1String("-data-list-register-values ") + QLatin1Char(registerFormatChar()), RegisterListValues);
if (theDebuggerAction(FormatHexadecimal)->isChecked())
format = "x";
else if (theDebuggerAction(FormatDecimal)->isChecked())
format = "d";
else if (theDebuggerAction(FormatOctal)->isChecked())
format = "o";
else if (theDebuggerAction(FormatBinary)->isChecked())
format = "t";
else if (theDebuggerAction(FormatRaw)->isChecked())
format = "r";
else
format = "N";
sendCommand("-data-list-register-values " + format, RegisterListValues);
} }
void GdbEngine::handleRegisterListNames(const GdbResultRecord &record) void GdbEngine::handleRegisterListNames(const GdbResultRecord &record)