diff --git a/src/plugins/debugger/cdb/cdbbreakpoint.cpp b/src/plugins/debugger/cdb/cdbbreakpoint.cpp index 184c40c366c122635fcbdf1cde2f4fa6f11ab0d1..52536c69f95cb466e33e98d5c034d4170ed96d78 100644 --- a/src/plugins/debugger/cdb/cdbbreakpoint.cpp +++ b/src/plugins/debugger/cdb/cdbbreakpoint.cpp @@ -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; diff --git a/src/plugins/debugger/cdb/cdbmodules.cpp b/src/plugins/debugger/cdb/cdbmodules.cpp index a90dcc884a038071194ab122a2a0f5a1ef11a141..6ffe521207bf27abd3bb28190bf28b514b9838ea 100644 --- a/src/plugins/debugger/cdb/cdbmodules.cpp +++ b/src/plugins/debugger/cdb/cdbmodules.cpp @@ -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 diff --git a/src/plugins/debugger/cdb/cdbmodules.h b/src/plugins/debugger/cdb/cdbmodules.h index c8fa65dad9722c1e1da578be05578cf394d89bdb..792ba526fac8c8a91ab830f5ae8858e99b0dec85 100644 --- a/src/plugins/debugger/cdb/cdbmodules.h +++ b/src/plugins/debugger/cdb/cdbmodules.h @@ -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 diff --git a/src/plugins/debugger/shared/dbgwinutils.cpp b/src/plugins/debugger/shared/dbgwinutils.cpp index 6a256dff3ecd16326f02db9346b6737d496aab85..f441117bf944da71cc76fe3e2296e6f7ffa72ecf 100644 --- a/src/plugins/debugger/shared/dbgwinutils.cpp +++ b/src/plugins/debugger/shared/dbgwinutils.cpp @@ -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 diff --git a/src/plugins/debugger/shared/dbgwinutils.h b/src/plugins/debugger/shared/dbgwinutils.h index 5849ba7717624f2272e861418f4a993f1ef3b39f..3e03ee46620f05c6983f3d1b3f56bb27a8d9ca40 100644 --- a/src/plugins/debugger/shared/dbgwinutils.h +++ b/src/plugins/debugger/shared/dbgwinutils.h @@ -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