From 1477165e1c99057b7d9db3889ff140362affe997 Mon Sep 17 00:00:00 2001
From: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Date: Wed, 1 Dec 2010 16:37:34 +0100
Subject: [PATCH] Debugger: Fix StackFrame.usable for CDB

---
 src/plugins/debugger/cdb/cdbstacktracecontext.cpp | 5 +++--
 src/plugins/debugger/cdb2/cdbengine2.cpp          | 1 +
 src/plugins/debugger/cdb2/cdbparsehelpers.cpp     | 1 -
 src/plugins/debugger/cdb2/cdbparsehelpers.h       | 1 -
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/plugins/debugger/cdb/cdbstacktracecontext.cpp b/src/plugins/debugger/cdb/cdbstacktracecontext.cpp
index bb130141cbf..abf35ddf28b 100644
--- a/src/plugins/debugger/cdb/cdbstacktracecontext.cpp
+++ b/src/plugins/debugger/cdb/cdbstacktracecontext.cpp
@@ -40,6 +40,7 @@
 #include <utils/savedaction.h>
 
 #include <QtCore/QDebug>
+#include <QtCore/QFileInfo>
 
 enum { debug = 0 };
 
@@ -100,14 +101,14 @@ QList<StackFrame> CdbStackTraceContext::stackFrames() const
     // Convert from Core data structures
     QList<StackFrame> rc;
     const int count = frameCount();
-    const QString hexPrefix = QLatin1String("0x");
     for(int i = 0; i < count; i++) {
         const CdbCore::StackFrame &coreFrame = stackFrameAt(i);
         StackFrame frame;
         frame.level = i;
         frame.file = coreFrame.fileName;
+        frame.usable = !frame.file.isEmpty() && QFileInfo(frame.file).isFile();
         frame.line = coreFrame.line;
-        frame.function =coreFrame.function;
+        frame.function = coreFrame.function;
         frame.from = coreFrame.module;
         frame.address = coreFrame.address;
         rc.push_back(frame);
diff --git a/src/plugins/debugger/cdb2/cdbengine2.cpp b/src/plugins/debugger/cdb2/cdbengine2.cpp
index 3fa03310148..6f034a681cc 100644
--- a/src/plugins/debugger/cdb2/cdbengine2.cpp
+++ b/src/plugins/debugger/cdb2/cdbengine2.cpp
@@ -1801,6 +1801,7 @@ static StackFrames parseFrames(const QByteArray &data)
         if (fullName.isValid()) {
             frame.file = QFile::decodeName(fullName.data());
             frame.line = frameMi.findChild("line").data().toInt();
+            frame.usable = QFileInfo(frame.file).isFile();
         }
         frame.function = QLatin1String(frameMi.findChild("func").data());
         frame.from = QLatin1String(frameMi.findChild("from").data());
diff --git a/src/plugins/debugger/cdb2/cdbparsehelpers.cpp b/src/plugins/debugger/cdb2/cdbparsehelpers.cpp
index d13926dcf1c..82444570fdd 100644
--- a/src/plugins/debugger/cdb2/cdbparsehelpers.cpp
+++ b/src/plugins/debugger/cdb2/cdbparsehelpers.cpp
@@ -29,7 +29,6 @@
 
 #include "cdbparsehelpers.h"
 #include "breakpoint.h"
-#include "stackframe.h"
 #include "threadshandler.h"
 #include "registerhandler.h"
 #include "bytearrayinputstream.h"
diff --git a/src/plugins/debugger/cdb2/cdbparsehelpers.h b/src/plugins/debugger/cdb2/cdbparsehelpers.h
index 4d85df14f71..87ae6491f69 100644
--- a/src/plugins/debugger/cdb2/cdbparsehelpers.h
+++ b/src/plugins/debugger/cdb2/cdbparsehelpers.h
@@ -44,7 +44,6 @@ namespace Debugger {
 namespace Internal {
 class BreakpointData;
 class BreakpointParameters;
-class StackFrame;
 struct ThreadData;
 class Register;
 class GdbMi;
-- 
GitLab