From ed2a84c822c4eb3cd46d405bf366de1c557f2fe2 Mon Sep 17 00:00:00 2001
From: hjk <hjk@theqtcompany.com>
Date: Wed, 28 Jan 2015 17:17:31 +0100
Subject: [PATCH] Debugger: Prevent LLDB choking on extra dumper paths

Change-Id: I230a05274e95430162c3f2d05de5d93bf4985b4e
Reviewed-by: hjk <hjk@theqtcompany.com>
---
 share/qtcreator/debugger/lldbbridge.py   |  7 +++++++
 src/plugins/debugger/lldb/lldbengine.cpp | 12 +++---------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/share/qtcreator/debugger/lldbbridge.py b/share/qtcreator/debugger/lldbbridge.py
index eb7e3252498..7d3e4dc180a 100644
--- a/share/qtcreator/debugger/lldbbridge.py
+++ b/share/qtcreator/debugger/lldbbridge.py
@@ -1579,6 +1579,13 @@ class Dumper(DumperBase):
         error = str(result.GetError())
         self.report('success="%d",output="%s",error="%s"' % (success, output, error))
 
+    def addExtraDumper(self, args):
+        path = args['path']
+        (head, tail) = os.path.split(path)
+        sys.path.insert(1, head)
+        #dumpermodules.append(os.path.splitext(tail)[0])
+        self.report('ok')
+
     def updateData(self, args):
         if 'expanded' in args:
             self.expandedINames = set(args['expanded'].split(','))
diff --git a/src/plugins/debugger/lldb/lldbengine.cpp b/src/plugins/debugger/lldb/lldbengine.cpp
index d5d1b6d5a12..f543122112a 100644
--- a/src/plugins/debugger/lldb/lldbengine.cpp
+++ b/src/plugins/debugger/lldb/lldbengine.cpp
@@ -273,15 +273,9 @@ void LldbEngine::setupInferior()
 
     const QString path = stringSetting(ExtraDumperFile);
     if (!path.isEmpty()) {
-        QFileInfo fi(path);
-
-        Command cmd1("executeDebuggerCommand");
-        cmd1.arg("command", "python sys.path.insert(1, '" + fi.absolutePath().toUtf8() + "')");
-        runCommand(cmd1);
-
-        Command cmd2("executeDebuggerCommand");
-        cmd2.arg("python from " + fi.baseName().toUtf8() + " import *");
-        runCommand(cmd2);
+        Command cmd("addExtraDumper");
+        cmd.arg("path", path.toUtf8());
+        runCommand(cmd);
     }
 
     const QString commands = stringSetting(ExtraDumperCommands);
-- 
GitLab