OSDN Git Service

Debugger/MSVC: Move MSVC-specific code around.
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>
Thu, 18 Nov 2010 10:53:45 +0000 (11:53 +0100)
committerFriedemann Kleint <Friedemann.Kleint@nokia.com>
Thu, 18 Nov 2010 10:53:45 +0000 (11:53 +0100)
for new CDB engine.

src/plugins/debugger/cdb/cdbbreakpoint.cpp
src/plugins/debugger/cdb/cdbmodules.cpp
src/plugins/debugger/cdb/cdbmodules.h
src/plugins/debugger/shared/dbgwinutils.cpp
src/plugins/debugger/shared/dbgwinutils.h

index 184c40c..52536c6 100644 (file)
@@ -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;
index a90dcc8..6ffe521 100644 (file)
@@ -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
index c8fa65d..792ba52 100644 (file)
@@ -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
 
index 6a256df..f441117 100644 (file)
@@ -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
index 5849ba7..3e03ee4 100644 (file)
@@ -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