Commit 0240302b authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer
Browse files

Integrate merge-request #568 into branch '1.2'

axasia (1):
      Fix compile error on MSVC2008 Express Edition with Debugging Tools
         for Windows(CDB).

Request-url: http://gitorious.org/qt-creator/qt-creator/merge_requests/568

Reviewed-by: default avatarThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>
parents 9f4aaaee 8d53cb0f
......@@ -61,11 +61,9 @@ static const WCHAR *debuggerRegistryDefaultValueNameC = L"Debugger.Default";
static const char *linkC = "http://msdn.microsoft.com/en-us/library/cc266343.aspx";
static inline QString wCharToQString(const WCHAR *w) { return QString::fromUtf16(reinterpret_cast<const ushort *>(w)); }
#ifdef __GNUC__
static inline QString wCharToQString(const WCHAR *w) { return QString::fromUtf16(reinterpret_cast<const ushort*>(w)); }
#define RRF_RT_ANY 0x0000ffff // no type restriction
#else
static inline QString wCharToQString(const WCHAR *w) { return QString::fromUtf16(w); }
#endif
......
......@@ -65,7 +65,7 @@ bool getRegisters(CIDebugControl *ctl,
return false;
}
Register reg;
reg.name = QString::fromUtf16(wszBuf);
reg.name = QString::fromUtf16(reinterpret_cast<const ushort *>(wszBuf));
registers->push_back(reg);
}
// get values
......
......@@ -156,7 +156,7 @@ bool CDBBreakPoint::apply(CIDebugBreakpoint *ibp, QString *errorMessage) const
const QString expr = expression();
if (debugCDB)
qDebug() << Q_FUNC_INFO << *this << expr;
const HRESULT hr = ibp->SetOffsetExpressionWide(expr.utf16());
const HRESULT hr = ibp->SetOffsetExpressionWide(reinterpret_cast<PCWSTR>(expr.utf16()));
if (FAILED(hr)) {
*errorMessage = QString::fromLatin1("Unable to set breakpoint '%1' : %2").
arg(expr, msgComFailed("SetOffsetExpressionWide", hr));
......@@ -238,7 +238,7 @@ bool CDBBreakPoint::retrieve(CIDebugBreakpoint *ibp, QString *errorMessage)
ibp->GetFlags(&flags);
oneShot = (flags & DEBUG_BREAKPOINT_ONE_SHOT);
enabled = (flags & DEBUG_BREAKPOINT_ENABLED);
const QString expr = QString::fromUtf16(wszBuf);
const QString expr = QString::fromUtf16(reinterpret_cast<const ushort *>(wszBuf));
if (!parseExpression(expr)) {
*errorMessage = QString::fromLatin1("Parsing of '%1' failed.").arg(expr);
return false;
......
......@@ -618,7 +618,7 @@ bool CdbDebugEngine::startDebuggerWithExecutable(DebuggerStartMode sm, QString *
qDebug() << Q_FUNC_INFO <<filename;
const QFileInfo fi(filename);
m_d->m_cif.debugSymbols->AppendImagePathWide(QDir::toNativeSeparators(fi.absolutePath()).utf16());
m_d->m_cif.debugSymbols->AppendImagePathWide(reinterpret_cast<PCWSTR>(QDir::toNativeSeparators(fi.absolutePath()).utf16()));
//m_cif.debugSymbols->SetSymbolOptions(SYMOPT_CASE_INSENSITIVE | SYMOPT_UNDNAME | SYMOPT_DEBUG | SYMOPT_LOAD_LINES | SYMOPT_OMAP_FIND_NEAREST | SYMOPT_AUTO_PUBLICS);
m_d->m_cif.debugSymbols->SetSymbolOptions(SYMOPT_CASE_INSENSITIVE | SYMOPT_UNDNAME | SYMOPT_LOAD_LINES | SYMOPT_OMAP_FIND_NEAREST | SYMOPT_AUTO_PUBLICS);
//m_cif.debugSymbols->AddSymbolOptions(SYMOPT_CASE_INSENSITIVE | SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS | SYMOPT_DEBUG | SYMOPT_LOAD_LINES | SYMOPT_OMAP_FIND_NEAREST | SYMOPT_AUTO_PUBLICS | SYMOPT_NO_IMAGE_SEARCH);
......@@ -634,10 +634,10 @@ bool CdbDebugEngine::startDebuggerWithExecutable(DebuggerStartMode sm, QString *
env = reinterpret_cast<PCWSTR>(envData.data());
}
const HRESULT hr = m_d->m_cif.debugClient->CreateProcess2Wide(NULL,
const_cast<PWSTR>(cmd.utf16()),
reinterpret_cast<PWSTR>(const_cast<ushort *>(cmd.utf16())),
&dbgopts,
sizeof(dbgopts),
sp->workingDir.utf16(),
reinterpret_cast<PCWSTR>(sp->workingDir.utf16()),
env);
if (FAILED(hr)) {
*errorMessage = tr("Unable to create a process '%1': %2").arg(cmd, msgDebugEngineComResult(hr));
......@@ -1149,7 +1149,7 @@ void CdbDebugEngine::executeDebuggerCommand(const QString &command)
bool CdbDebugEnginePrivate::executeDebuggerCommand(CIDebugControl *ctrl, const QString &command, QString *errorMessage)
{
// output to all clients, else we do not see anything
const HRESULT hr = ctrl->ExecuteWide(DEBUG_OUTCTL_ALL_CLIENTS, command.utf16(), 0);
const HRESULT hr = ctrl->ExecuteWide(DEBUG_OUTCTL_ALL_CLIENTS, reinterpret_cast<PCWSTR>(command.utf16()), 0);
if (debugCDB)
qDebug() << "executeDebuggerCommand" << command << SUCCEEDED(hr);
if (FAILED(hr)) {
......@@ -1184,7 +1184,7 @@ bool CdbDebugEnginePrivate::evaluateExpression(CIDebugControl *ctrl,
// Original syntax must be restored, else setting breakpoints will fail.
SyntaxSetter syntaxSetter(ctrl, DEBUG_EXPR_CPLUSPLUS);
ULONG errorPosition = 0;
const HRESULT hr = ctrl->EvaluateWide(expression.utf16(),
const HRESULT hr = ctrl->EvaluateWide(reinterpret_cast<PCWSTR>(expression.utf16()),
DEBUG_VALUE_INVALID, debugValue,
&errorPosition);
if (FAILED(hr)) {
......@@ -1616,7 +1616,7 @@ QStringList CdbDebugEnginePrivate::sourcePaths() const
{
WCHAR wszBuf[MAX_PATH];
if (SUCCEEDED(m_cif.debugSymbols->GetSourcePathWide(wszBuf, MAX_PATH, 0)))
return QString::fromUtf16(wszBuf).split(QLatin1Char(';'));
return QString::fromUtf16(reinterpret_cast<const ushort *>(wszBuf)).split(QLatin1Char(';'));
return QStringList();
}
......@@ -1637,7 +1637,7 @@ static inline QString pathString(const QStringList &s)
bool CdbDebugEnginePrivate::setSourcePaths(const QStringList &s, QString *errorMessage)
{
const HRESULT hr = m_cif.debugSymbols->SetSourcePathWide(pathString(s).utf16());
const HRESULT hr = m_cif.debugSymbols->SetSourcePathWide(reinterpret_cast<PCWSTR>(pathString(s).utf16()));
if (FAILED(hr)) {
if (errorMessage)
*errorMessage = msgComFailed("SetSourcePathWide", hr);
......@@ -1650,13 +1650,13 @@ QStringList CdbDebugEnginePrivate::symbolPaths() const
{
WCHAR wszBuf[MAX_PATH];
if (SUCCEEDED(m_cif.debugSymbols->GetSymbolPathWide(wszBuf, MAX_PATH, 0)))
return QString::fromUtf16(wszBuf).split(QLatin1Char(';'));
return QString::fromUtf16(reinterpret_cast<const ushort *>(wszBuf)).split(QLatin1Char(';'));
return QStringList();
}
bool CdbDebugEnginePrivate::setSymbolPaths(const QStringList &s, QString *errorMessage)
{
const HRESULT hr = m_cif.debugSymbols->SetSymbolPathWide(pathString(s).utf16());
const HRESULT hr = m_cif.debugSymbols->SetSymbolPathWide(reinterpret_cast<PCWSTR>(pathString(s).utf16()));
if (FAILED(hr)) {
if (errorMessage)
*errorMessage = msgComFailed("SetSymbolPathWide", hr);
......
......@@ -342,7 +342,7 @@ STDMETHODIMP CdbDebugEventCallback::LoadModule(
Q_UNUSED(TimeDateStamp)
if (debugCDB > 1)
qDebug() << Q_FUNC_INFO << ModuleName;
m_pEngine->m_d->handleModuleLoad(QString::fromUtf16(ModuleName));
m_pEngine->m_d->handleModuleLoad(QString::fromUtf16(reinterpret_cast<const ushort *>(ModuleName)));
return S_OK;
}
......
......@@ -80,7 +80,7 @@ STDMETHODIMP CdbDebugOutputBase::Output(
IN PCWSTR text
)
{
const QString msg = QString::fromUtf16(text);
const QString msg = QString::fromUtf16(reinterpret_cast<const ushort *>(text));
output(mask, msg.trimmed());
return S_OK;
}
......
......@@ -384,7 +384,7 @@ static inline bool getSymbolAddress(CIDebugSymbols *sg,
QString *errorMessage)
{
// Get address
HRESULT hr = sg->GetOffsetByNameWide(name.utf16(), address);
HRESULT hr = sg->GetOffsetByNameWide(reinterpret_cast<PCWSTR>(name.utf16()), address);
if (FAILED(hr)) {
*errorMessage = msgComFailed("GetOffsetByNameWide", hr);
return false;
......
......@@ -59,7 +59,7 @@ bool getModuleNameList(CIDebugSymbols *syms, QStringList *modules, QString *erro
WCHAR wszBuf[MAX_PATH];
for (ULONG m = 0; m < count; m++)
if (SUCCEEDED(syms->GetModuleNameStringWide(DEBUG_MODNAME_IMAGE, m, 0, wszBuf, MAX_PATH - 1, 0)))
modules->push_back(QString::fromUtf16(wszBuf));
modules->push_back(QString::fromUtf16(reinterpret_cast<const ushort *>(wszBuf)));
return true;
}
......@@ -94,7 +94,7 @@ bool getModuleList(CIDebugSymbols *syms, QList<Module> *modules, QString *errorM
*errorMessage= msgComFailed("GetModuleNameStringWide", hr);
return false;
}
module.moduleName = QString::fromUtf16(wszBuf);
module.moduleName = QString::fromUtf16(reinterpret_cast<const ushort *>(wszBuf));
modules->push_back(module);
}
}
......@@ -109,7 +109,7 @@ bool searchSymbols(CIDebugSymbols *syms, const QString &pattern,
ULONG64 handle = 0;
// E_NOINTERFACE means "no match". Apparently, it does not always
// set handle.
HRESULT hr = syms->StartSymbolMatchWide(pattern.utf16(), &handle);
HRESULT hr = syms->StartSymbolMatchWide(reinterpret_cast<PCWSTR>(pattern.utf16()), &handle);
if (hr == E_NOINTERFACE) {
if (handle)
syms->EndSymbolMatch(handle);
......@@ -125,7 +125,7 @@ bool searchSymbols(CIDebugSymbols *syms, const QString &pattern,
if (hr == E_NOINTERFACE)
break;
if (hr == S_OK)
matches->push_back(QString::fromUtf16(wszBuf));
matches->push_back(QString::fromUtf16(reinterpret_cast<const ushort *>(wszBuf)));
}
syms->EndSymbolMatch(handle);
if (matches->empty())
......@@ -217,7 +217,7 @@ bool getModuleSymbols(CIDebugSymbols *syms, const QString &moduleName,
Symbol symbol;
symbol.name = name;
ULONG64 offset = 0;
if (SUCCEEDED(syms->GetOffsetByNameWide(name.utf16(), &offset)))
if (SUCCEEDED(syms->GetOffsetByNameWide(reinterpret_cast<PCWSTR>(name.utf16()), &offset)))
symbol.address = hexPrefix + QString::number(offset, 16);
symbols->push_back(symbol);
}
......
......@@ -102,7 +102,7 @@ bool CdbStackTraceContext::init(unsigned long frameCount, QString * /*errorMessa
frame.address = QString::fromLatin1("0x%1").arg(instructionOffset, 0, 16);
m_cif->debugSymbols->GetNameByOffsetWide(instructionOffset, wszBuf, MAX_PATH, 0, 0);
frame.function = QString::fromUtf16(wszBuf);
frame.function = QString::fromUtf16(reinterpret_cast<const ushort *>(wszBuf));
ULONG ulLine;
ULONG64 ul64Displacement;
......@@ -111,7 +111,7 @@ bool CdbStackTraceContext::init(unsigned long frameCount, QString * /*errorMessa
frame.line = ulLine;
// Vitally important to use canonical file that matches editormanager,
// else the marker will not show.
frame.file = CDBBreakPoint::canonicalSourceFile(QString::fromUtf16(wszBuf));
frame.file = CDBBreakPoint::canonicalSourceFile(QString::fromUtf16(reinterpret_cast<const ushort *>(wszBuf)));
}
m_frames.push_back(frame);
}
......
......@@ -91,7 +91,7 @@ static inline QString getSymbolString(IDebugSymbolGroup2 *sg,
const HRESULT hr = (sg->*wsf)(index, nameBuffer, MAX_PATH, &nameLength);
if (SUCCEEDED(hr)) {
nameBuffer[nameLength] = 0;
return QString::fromUtf16(nameBuffer);
return QString::fromUtf16(reinterpret_cast<const ushort *>(nameBuffer));
}
return QString();
}
......@@ -411,7 +411,7 @@ bool CdbSymbolGroupContext::assignValue(const QString &iname, const QString &val
return false;
}
const unsigned long index = it.value();
const HRESULT hr = m_symbolGroup->WriteSymbolWide(index, value.utf16());
const HRESULT hr = m_symbolGroup->WriteSymbolWide(index, reinterpret_cast<PCWSTR>(value.utf16()));
if (FAILED(hr)) {
*errorMessage = QString::fromLatin1("Unable to assign '%1' to '%2': %3").
arg(value, iname, msgComFailed("WriteSymbolWide", hr));
......
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