forked from qt-creator/qt-creator
Debugger[CDB]: Add thread names.
This commit is contained in:
@@ -43,7 +43,7 @@
|
|||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QTextStream>
|
#include <QtCore/QTextStream>
|
||||||
#include <QtCore/QFileInfo>
|
#include <QtCore/QFileInfo>
|
||||||
|
#include <QtCore/QDir>
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@@ -239,7 +239,7 @@ QString BreakpointData::toToolTip() const
|
|||||||
QTextStream str(&rc);
|
QTextStream str(&rc);
|
||||||
str << "<html><body><table>"
|
str << "<html><body><table>"
|
||||||
<< "<tr><td>" << BreakHandler::tr("Marker File:")
|
<< "<tr><td>" << BreakHandler::tr("Marker File:")
|
||||||
<< "</td><td>" << m_markerFileName << "</td></tr>"
|
<< "</td><td>" << QDir::toNativeSeparators(m_markerFileName) << "</td></tr>"
|
||||||
<< "<tr><td>" << BreakHandler::tr("Marker Line:")
|
<< "<tr><td>" << BreakHandler::tr("Marker Line:")
|
||||||
<< "</td><td>" << m_markerLineNumber << "</td></tr>"
|
<< "</td><td>" << m_markerLineNumber << "</td></tr>"
|
||||||
<< "<tr><td>" << BreakHandler::tr("Breakpoint Number:")
|
<< "<tr><td>" << BreakHandler::tr("Breakpoint Number:")
|
||||||
@@ -257,7 +257,7 @@ QString BreakpointData::toToolTip() const
|
|||||||
<< "<tr><td>" << BreakHandler::tr("Internal Number:")
|
<< "<tr><td>" << BreakHandler::tr("Internal Number:")
|
||||||
<< "</td><td>—</td><td>" << bpNumber << "</td></tr>"
|
<< "</td><td>—</td><td>" << bpNumber << "</td></tr>"
|
||||||
<< "<tr><td>" << BreakHandler::tr("File Name:")
|
<< "<tr><td>" << BreakHandler::tr("File Name:")
|
||||||
<< "</td><td>" << fileName << "</td><td>" << bpFileName << "</td></tr>"
|
<< "</td><td>" << fileName << "</td><td>" << QDir::toNativeSeparators(bpFileName) << "</td></tr>"
|
||||||
<< "<tr><td>" << BreakHandler::tr("Function Name:")
|
<< "<tr><td>" << BreakHandler::tr("Function Name:")
|
||||||
<< "</td><td>" << funcName << "</td><td>" << bpFuncName << "</td></tr>"
|
<< "</td><td>" << funcName << "</td><td>" << bpFuncName << "</td></tr>"
|
||||||
<< "<tr><td>" << BreakHandler::tr("Line Number:")
|
<< "<tr><td>" << BreakHandler::tr("Line Number:")
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ typedef IDebugDataSpaces4 CIDebugDataSpaces;
|
|||||||
|
|
||||||
typedef IDebugSymbolGroup2 CIDebugSymbolGroup;
|
typedef IDebugSymbolGroup2 CIDebugSymbolGroup;
|
||||||
typedef IDebugBreakpoint2 CIDebugBreakpoint;
|
typedef IDebugBreakpoint2 CIDebugBreakpoint;
|
||||||
|
typedef IDebugAdvanced2 CIDebugAdvanced;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ bool CdbStackTraceContext::getThreads(const CdbCore::ComInterfaces &cif,
|
|||||||
const CdbCore::Thread &coreThread = coreThreads.at(i);
|
const CdbCore::Thread &coreThread = coreThreads.at(i);
|
||||||
ThreadData data(coreThread.id);
|
ThreadData data(coreThread.id);
|
||||||
data.targetId = QLatin1String("0x") + QString::number(coreThread.systemId);
|
data.targetId = QLatin1String("0x") + QString::number(coreThread.systemId);
|
||||||
|
data.name = coreThread.name;
|
||||||
if (stopped) {
|
if (stopped) {
|
||||||
const CdbCore::StackFrame &coreFrame = frames.at(i);
|
const CdbCore::StackFrame &coreFrame = frames.at(i);
|
||||||
data.address = coreFrame.address;
|
data.address = coreFrame.address;
|
||||||
|
|||||||
@@ -152,7 +152,8 @@ ComInterfaces::ComInterfaces() :
|
|||||||
debugSystemObjects(0),
|
debugSystemObjects(0),
|
||||||
debugSymbols(0),
|
debugSymbols(0),
|
||||||
debugRegisters(0),
|
debugRegisters(0),
|
||||||
debugDataSpaces(0)
|
debugDataSpaces(0),
|
||||||
|
debugAdvanced(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,6 +251,8 @@ CoreEngine::~CoreEngine()
|
|||||||
m_cif.debugRegisters->Release();
|
m_cif.debugRegisters->Release();
|
||||||
if (m_cif.debugDataSpaces)
|
if (m_cif.debugDataSpaces)
|
||||||
m_cif.debugDataSpaces->Release();
|
m_cif.debugDataSpaces->Release();
|
||||||
|
if (m_cif.debugAdvanced)
|
||||||
|
m_cif.debugAdvanced->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CoreEngine::init(const QString &dllEnginePath, QString *errorMessage)
|
bool CoreEngine::init(const QString &dllEnginePath, QString *errorMessage)
|
||||||
@@ -310,6 +313,12 @@ bool CoreEngine::init(const QString &dllEnginePath, QString *errorMessage)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hr = lib.debugCreate( __uuidof(IDebugAdvanced2), reinterpret_cast<void**>(&m_cif.debugAdvanced));
|
||||||
|
if (FAILED(hr)) {
|
||||||
|
*errorMessage = QString::fromLatin1("Creation of IDebugAdvanced2 failed: %1").arg(msgDebugEngineComResult(hr));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << QString::fromLatin1("CDB Initialization succeeded, interrupt time out %1s.").arg(getInterruptTimeOutSecs(m_cif.debugControl));
|
qDebug() << QString::fromLatin1("CDB Initialization succeeded, interrupt time out %1s.").arg(getInterruptTimeOutSecs(m_cif.debugControl));
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ struct ComInterfaces
|
|||||||
CIDebugSymbols* debugSymbols;
|
CIDebugSymbols* debugSymbols;
|
||||||
CIDebugRegisters* debugRegisters;
|
CIDebugRegisters* debugRegisters;
|
||||||
CIDebugDataSpaces* debugDataSpaces;
|
CIDebugDataSpaces* debugDataSpaces;
|
||||||
|
CIDebugAdvanced* debugAdvanced;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CoreEngine : public QObject
|
class CoreEngine : public QObject
|
||||||
|
|||||||
@@ -84,7 +84,8 @@ QString Thread::toString() const
|
|||||||
{
|
{
|
||||||
QString rc;
|
QString rc;
|
||||||
QTextStream str(&rc);
|
QTextStream str(&rc);
|
||||||
str << "Thread id " << id << " System id " << systemId << " Data at 0x";
|
str << "Thread id " << id << " System id " << systemId
|
||||||
|
<< " name='" << name <<"' Data at 0x";
|
||||||
str.setIntegerBase(16);
|
str.setIntegerBase(16);
|
||||||
str << dataOffset;
|
str << dataOffset;
|
||||||
return rc;
|
return rc;
|
||||||
@@ -401,13 +402,23 @@ bool StackTraceContext::getThreadList(const CdbCore::ComInterfaces &cif,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Create entries
|
// Create entries
|
||||||
|
static WCHAR name[256];
|
||||||
for (ULONG i= 0; i < threadCount ; i++) {
|
for (ULONG i= 0; i < threadCount ; i++) {
|
||||||
threads->push_back(Thread(ids[i], systemIds[i]));
|
const ULONG id = ids[i];
|
||||||
|
Thread thread(id, systemIds[i]);
|
||||||
if (ids[i] == *currentThreadId) { // More info for current
|
if (ids[i] == *currentThreadId) { // More info for current
|
||||||
ULONG64 offset;
|
ULONG64 offset;
|
||||||
if (SUCCEEDED(cif.debugSystemObjects->GetCurrentThreadDataOffset(&offset)))
|
if (SUCCEEDED(cif.debugSystemObjects->GetCurrentThreadDataOffset(&offset)))
|
||||||
threads->back().dataOffset = offset;
|
thread.dataOffset = offset;
|
||||||
}
|
}
|
||||||
|
// Name
|
||||||
|
ULONG bytesReceived = 0;
|
||||||
|
hr = cif.debugAdvanced->GetSystemObjectInformation(DEBUG_SYSOBJINFO_THREAD_NAME_WIDE,
|
||||||
|
0, id, name,
|
||||||
|
sizeof(name), &bytesReceived);
|
||||||
|
if (SUCCEEDED(hr) && bytesReceived)
|
||||||
|
thread.name = QString::fromWCharArray(name);
|
||||||
|
threads->push_back(thread);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ struct Thread {
|
|||||||
unsigned long id;
|
unsigned long id;
|
||||||
unsigned long systemId;
|
unsigned long systemId;
|
||||||
quint64 dataOffset; // Only for current.
|
quint64 dataOffset; // Only for current.
|
||||||
|
QString name;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool operator<(const Thread &t1, const Thread &t2) { return t1.id < t2.id; }
|
inline bool operator<(const Thread &t1, const Thread &t2) { return t1.id < t2.id; }
|
||||||
|
|||||||
@@ -73,6 +73,9 @@ static inline QString threadToolTip(const ThreadData &thread)
|
|||||||
if (!thread.targetId.isEmpty())
|
if (!thread.targetId.isEmpty())
|
||||||
str << tableRowStartC << ThreadsHandler::tr("Target id:")
|
str << tableRowStartC << ThreadsHandler::tr("Target id:")
|
||||||
<< tableRowSeparatorC << thread.targetId << tableRowEndC;
|
<< tableRowSeparatorC << thread.targetId << tableRowEndC;
|
||||||
|
if (!thread.name.isEmpty())
|
||||||
|
str << tableRowStartC << ThreadsHandler::tr("Name:")
|
||||||
|
<< tableRowSeparatorC << thread.name << tableRowEndC;
|
||||||
if (!thread.state.isEmpty())
|
if (!thread.state.isEmpty())
|
||||||
str << tableRowStartC << ThreadsHandler::tr("State:")
|
str << tableRowStartC << ThreadsHandler::tr("State:")
|
||||||
<< tableRowSeparatorC << thread.state << tableRowEndC;
|
<< tableRowSeparatorC << thread.state << tableRowEndC;
|
||||||
|
|||||||
Reference in New Issue
Block a user