Skip to content
Snippets Groups Projects
Commit 203c7a2f authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Debugger/MSVC: Move MSVC-specific code around.

for new CDB engine.
parent 2d4e7510
No related branches found
No related tags found
No related merge requests found
......@@ -32,6 +32,7 @@
#include "corebreakpoint.h"
#include "cdbmodules.h"
#include "breakhandler.h"
#include "shared/dbgwinutils.h"
#include <QtCore/QDebug>
#include <QtCore/QDir>
......@@ -69,33 +70,13 @@ static inline QString msgCannotSetBreakAtFunction(const QString &func, const QSt
return QString::fromLatin1("Cannot set a breakpoint at '%1': %2").arg(func, why);
}
static inline BreakpointParameters transformBreakpoint(const BreakpointParameters &p)
{
if (p.type == BreakpointAtThrow) {
BreakpointParameters rc(BreakpointByFunction);
rc.functionName = QLatin1String(cdbThrowFunction);
return rc;
}
if (p.type == BreakpointAtCatch) {
BreakpointParameters rc(BreakpointByFunction);
rc.functionName = QLatin1String(cdbCatchFunction);
return rc;
}
if (p.type == BreakpointAtMain) {
BreakpointParameters rc(BreakpointByFunction);
rc.functionName = QLatin1String("main");
return rc;
}
return p;
}
bool addCdbBreakpoint(CIDebugControl* debugControl,
CIDebugSymbols *syms,
const BreakpointParameters &bpIn,
BreakpointResponse *response,
QString *errorMessage)
{
const BreakpointParameters bp = transformBreakpoint(bpIn);
const BreakpointParameters bp = fixWinMSVCBreakpoint(bpIn);
errorMessage->clear();
// Function breakpoints: Are the module names specified?
QString resolvedFunction;
......
......@@ -31,6 +31,7 @@
#include "moduleshandler.h"
#include "cdbengine_p.h"
#include "breakpoint.h"
#include "shared/dbgwinutils.h"
#include <QtCore/QFileInfo>
#include <QtCore/QRegExp>
......@@ -173,9 +174,6 @@ bool searchSymbols(CIDebugSymbols *syms, const QString &pattern,
return true;
}
const char *cdbThrowFunction = "CxxThrowException";
const char *cdbCatchFunction = "__CxxCallCatchBlock";
// Helper for the resolveSymbol overloads.
static ResolveSymbolResult resolveSymbol(CIDebugSymbols *syms, QString *symbol,
QStringList *matches,
......@@ -185,8 +183,8 @@ static ResolveSymbolResult resolveSymbol(CIDebugSymbols *syms, QString *symbol,
// Is it an incomplete symbol?
if (symbol->contains(QLatin1Char('!')))
return ResolveSymbolOk;
const bool withinMSVCRunTime = *symbol == QLatin1String(cdbThrowFunction)
|| *symbol == QLatin1String(cdbCatchFunction);
const bool withinMSVCRunTime = *symbol == QLatin1String(winMSVCThrowFunction)
|| *symbol == QLatin1String(winMSVCCatchFunction);
if (*symbol == QLatin1String("qMain")) // 'main' is a #define for gdb, but not for VS
*symbol = QLatin1String("main");
// resolve
......
......@@ -64,9 +64,6 @@ ResolveSymbolResult resolveSymbol(CIDebugSymbols *syms, const QString &pattern,
bool getModuleSymbols(CIDebugSymbols *syms, const QString &moduleName,
QList<Symbol> *symbols, QString *errorMessage);
extern const char *cdbThrowFunction;
extern const char *cdbCatchFunction;
} // namespace Internal
} // namespace Debugger
......
......@@ -30,6 +30,7 @@
#include "winutils.h"
#include "dbgwinutils.h"
#include "debuggerdialogs.h"
#include "breakpoint.h"
#include <QtCore/QDebug>
#include <QtCore/QString>
......@@ -381,5 +382,29 @@ bool isFatalWinException(long code)
return true;
}
// Special function names in MSVC runtime
const char *winMSVCThrowFunction = "CxxThrowException";
const char *winMSVCCatchFunction = "__CxxCallCatchBlock";
BreakpointParameters fixWinMSVCBreakpoint(const BreakpointParameters &p)
{
if (p.type == BreakpointAtThrow) {
BreakpointParameters rc(BreakpointByFunction);
rc.functionName = QLatin1String(winMSVCThrowFunction);
return rc;
}
if (p.type == BreakpointAtCatch) {
BreakpointParameters rc(BreakpointByFunction);
rc.functionName = QLatin1String(winMSVCCatchFunction);
return rc;
}
if (p.type == BreakpointAtMain) {
BreakpointParameters rc(BreakpointByFunction);
rc.functionName = QLatin1String("main");
return rc;
}
return p;
}
} // namespace Internal
} // namespace Debugger
......@@ -38,6 +38,8 @@ QT_FORWARD_DECLARE_CLASS(QTextStream)
namespace Debugger {
namespace Internal {
class BreakpointParameters;
struct ProcData; // debuggerdialogs, used by the process listing dialogs
QList<ProcData> winProcessList();
......@@ -82,6 +84,12 @@ bool isFatalWinException(long code);
// Check for EXCEPTION_BREAKPOINT, EXCEPTION_SINGLE_STEP
bool isDebuggerWinException(long code);
// fix up breakpoints (catch/throw, etc).
BreakpointParameters fixWinMSVCBreakpoint(const BreakpointParameters &p);
// Special function names in MSVC runtime
extern const char *winMSVCThrowFunction;
extern const char *winMSVCCatchFunction;
} // namespace Internal
} // namespace Debugger
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment