<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Reverting was definitely the right thing to do as I was out on vacation throughout last week.</div><div>I am not sure why the change that defines SBCommandReturnObject::SetError() also had to be reverted, but I assume it just died its fiery death along with the rest of the patch</div><div><br></div><div>Since a lot of this code is SWIG boilerplate, I will see what can be done to fix the scoping issue - hopefully it can be done</div><div><br></div><div>
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div style=" orphans: 2; widows: 2; border-collapse: separate; border-spacing: 0px;"><span style="font-size: 12px; orphans: auto; widows: auto;">Enrico Granata</span><br style="font-size: 12px; orphans: auto; widows: auto;"><span style="font-size: 12px; orphans: auto; widows: auto;">📩 egranata@</span><font color="#ff2600" style="font-size: 12px; orphans: auto; widows: auto;"></font><span style="font-size: 12px; orphans: auto; widows: auto;">.com</span><br style="font-size: 12px; orphans: auto; widows: auto;"><span style="font-size: 12px; orphans: auto; widows: auto;">☎️ 27683</span></div></div></div>
</div>
<br><div><div>On Jul 3, 2013, at 10:58 AM, Daniel Malea <<a href="mailto:daniel.malea@intel.com">daniel.malea@intel.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Author: dmalea<br>Date: Wed Jul  3 12:58:31 2013<br>New Revision: 185560<br><br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=185560&view=rev">http://llvm.org/viewvc/llvm-project?rev=185560&view=rev</a><br>Log:<br>Revert commits that cause broken builds on GCC buildbots<br>- build fails due to PyCallable template definition inside an extern "C" scope<br><br>This commit reverts 185240, 184893 and 184608.<br><br><br>Modified:<br>   lldb/trunk/include/lldb/API/SBCommandReturnObject.h<br>   lldb/trunk/include/lldb/API/SBError.h<br>   lldb/trunk/include/lldb/Interpreter/CommandReturnObject.h<br>   lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h<br>   lldb/trunk/lldb.xcodeproj/project.pbxproj<br>   lldb/trunk/scripts/Python/interface/SBCommandReturnObject.i<br>   lldb/trunk/scripts/Python/python-swigsafecast.swig<br>   lldb/trunk/scripts/Python/python-wrapper.swig<br>   lldb/trunk/source/API/SBCommandReturnObject.cpp<br>   lldb/trunk/source/Commands/CommandObjectCommands.cpp<br>   lldb/trunk/source/Interpreter/CommandReturnObject.cpp<br>   lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp<br>   lldb/trunk/test/functionalities/command_script/welcome.py<br>   lldb/trunk/test/help/TestHelp.py<br><br>Modified: lldb/trunk/include/lldb/API/SBCommandReturnObject.h<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBCommandReturnObject.h?rev=185560&r1=185559&r2=185560&view=diff">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBCommandReturnObject.h?rev=185560&r1=185559&r2=185560&view=diff</a><br>==============================================================================<br>--- lldb/trunk/include/lldb/API/SBCommandReturnObject.h (original)<br>+++ lldb/trunk/include/lldb/API/SBCommandReturnObject.h Wed Jul  3 12:58:31 2013<br>@@ -98,13 +98,6 @@ public:<br>    const char *<br>    GetError (bool only_if_no_immediate);<br><br>-    void<br>-    SetError (lldb::SBError &error,<br>-              const char *fallback_error_cstr = NULL);<br>-    <br>-    void<br>-    SetError (const char* error_cstr);<br>-    <br>protected:<br>    friend class SBCommandInterpreter;<br>    friend class SBOptions;<br><br>Modified: lldb/trunk/include/lldb/API/SBError.h<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBError.h?rev=185560&r1=185559&r2=185560&view=diff">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBError.h?rev=185560&r1=185559&r2=185560&view=diff</a><br>==============================================================================<br>--- lldb/trunk/include/lldb/API/SBError.h (original)<br>+++ lldb/trunk/include/lldb/API/SBError.h Wed Jul  3 12:58:31 2013<br>@@ -66,7 +66,6 @@ public:<br><br>protected:<br><br>-    friend class SBCommandReturnObject;<br>    friend class SBData;<br>    friend class SBDebugger;<br>    friend class SBCommunication;<br><br>Modified: lldb/trunk/include/lldb/Interpreter/CommandReturnObject.h<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandReturnObject.h?rev=185560&r1=185559&r2=185560&view=diff">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandReturnObject.h?rev=185560&r1=185559&r2=185560&view=diff</a><br>==============================================================================<br>--- lldb/trunk/include/lldb/Interpreter/CommandReturnObject.h (original)<br>+++ lldb/trunk/include/lldb/Interpreter/CommandReturnObject.h Wed Jul  3 12:58:31 2013<br>@@ -143,11 +143,8 @@ public:<br><br>    void<br>    SetError (const Error &error,<span class="Apple-converted-space"> </span><br>-              const char *fallback_error_cstr = NULL);<br>+              const char *fallback_error_cstr);<br><br>-    void<br>-    SetError (const char *error_cstr);<br>-    <br>    lldb::ReturnStatus<br>    GetStatus();<br><br><br>Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h?rev=185560&r1=185559&r2=185560&view=diff">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h?rev=185560&r1=185559&r2=185560&view=diff</a><br>==============================================================================<br>--- lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h (original)<br>+++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h Wed Jul  3 12:58:31 2013<br>@@ -120,6 +120,7 @@ public:<br>                                                                     const char *session_dictionary_name,<br>                                                                     lldb::DebuggerSP& debugger,<br>                                                                     const char* args,<br>+                                                                     std::string& err_msg,<br>                                                                     lldb_private::CommandReturnObject& cmd_retobj);<br><br>    typedef bool           (*SWIGPythonCallModuleInit)              (const char *python_module_name,<br><br>Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=185560&r1=185559&r2=185560&view=diff">http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=185560&r1=185559&r2=185560&view=diff</a><br>==============================================================================<br>--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)<br>+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Jul  3 12:58:31 2013<br>@@ -1545,7 +1545,7 @@<br><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;">  </span>69A01E1E1236C5D400C660B5 /* Mutex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Mutex.cpp; sourceTree = "<group>"; };<br><span class="Apple-tab-span" style="white-space: pre;">      </span><span class="Apple-tab-span" style="white-space: pre;">  </span>69A01E1F1236C5D400C660B5 /* Symbols.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Symbols.cpp; sourceTree = "<group>"; };<br><span class="Apple-tab-span" style="white-space: pre;">  </span><span class="Apple-tab-span" style="white-space: pre;">  </span>69A01E201236C5D400C660B5 /* TimeValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TimeValue.cpp; sourceTree = "<group>"; };<br>-<span class="Apple-tab-span" style="white-space: pre;">     </span><span class="Apple-tab-span" style="white-space: pre;">  </span>94005E0313F438DF001EF42D /* python-wrapper.swig */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; path = "python-wrapper.swig"; sourceTree = "<group>"; };<br>+<span class="Apple-tab-span" style="white-space: pre;">        </span><span class="Apple-tab-span" style="white-space: pre;">  </span>94005E0313F438DF001EF42D /* python-wrapper.swig */ = {isa = PBXFileReference; lastKnownFileType = text; path = "python-wrapper.swig"; sourceTree = "<group>"; };<br><span class="Apple-tab-span" style="white-space: pre;">      </span><span class="Apple-tab-span" style="white-space: pre;">  </span>94005E0513F45A1B001EF42D /* embedded_interpreter.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; name = embedded_interpreter.py; path = source/Interpreter/embedded_interpreter.py; sourceTree = "<group>"; };<br><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;">  </span>94031A9B13CF484600DCFF3C /* InputReaderEZ.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = InputReaderEZ.h; path = include/lldb/Core/InputReaderEZ.h; sourceTree = "<group>"; };<br><span class="Apple-tab-span" style="white-space: pre;">      </span><span class="Apple-tab-span" style="white-space: pre;">  </span>94031A9D13CF486600DCFF3C /* InputReaderEZ.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = InputReaderEZ.cpp; path = source/Core/InputReaderEZ.cpp; sourceTree = "<group>"; };<br>@@ -1557,7 +1557,7 @@<br><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;">  </span>944372DB171F6B4300E57C32 /* RegisterContextDummy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegisterContextDummy.h; path = Utility/RegisterContextDummy.h; sourceTree = "<group>"; };<br><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;">  </span>9443B120140C18A90013457C /* SBData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SBData.h; path = include/lldb/API/SBData.h; sourceTree = "<group>"; };<br><span class="Apple-tab-span" style="white-space: pre;">    </span><span class="Apple-tab-span" style="white-space: pre;">  </span>9443B121140C18C10013457C /* SBData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBData.cpp; path = source/API/SBData.cpp; sourceTree = "<group>"; };<br>-<span class="Apple-tab-span" style="white-space: pre;">     </span><span class="Apple-tab-span" style="white-space: pre;">  </span>944DC3481774C99000D7D884 /* python-swigsafecast.swig */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; path = "python-swigsafecast.swig"; sourceTree = "<group>"; };<br>+<span class="Apple-tab-span" style="white-space: pre;">      </span><span class="Apple-tab-span" style="white-space: pre;">  </span>944DC3481774C99000D7D884 /* python-swigsafecast.swig */ = {isa = PBXFileReference; lastKnownFileType = text; path = "python-swigsafecast.swig"; sourceTree = "<group>"; };<br><span class="Apple-tab-span" style="white-space: pre;">    </span><span class="Apple-tab-span" style="white-space: pre;">  </span>9452573616262CD000325455 /* SBDeclaration.i */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c.preprocessed; path = SBDeclaration.i; sourceTree = "<group>"; };<br><span class="Apple-tab-span" style="white-space: pre;">   </span><span class="Apple-tab-span" style="white-space: pre;">  </span>9452573816262CEF00325455 /* SBDeclaration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SBDeclaration.h; path = include/lldb/API/SBDeclaration.h; sourceTree = "<group>"; };<br><span class="Apple-tab-span" style="white-space: pre;">       </span><span class="Apple-tab-span" style="white-space: pre;">  </span>9452573916262D0200325455 /* SBDeclaration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBDeclaration.cpp; path = source/API/SBDeclaration.cpp; sourceTree = "<group>"; };<br>@@ -1628,7 +1628,7 @@<br><span class="Apple-tab-span" style="white-space: pre;">  </span><span class="Apple-tab-span" style="white-space: pre;">  </span>94D6A0A816CEB55F00833B6E /* NSDictionary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NSDictionary.cpp; path = source/DataFormatters/NSDictionary.cpp; sourceTree = "<group>"; };<br><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;">  </span>94D6A0A916CEB55F00833B6E /* NSSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NSSet.cpp; path = source/DataFormatters/NSSet.cpp; sourceTree = "<group>"; };<br><span class="Apple-tab-span" style="white-space: pre;">      </span><span class="Apple-tab-span" style="white-space: pre;">  </span>94E367CC140C4EC4001C7A5A /* modify-python-lldb.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = "modify-python-lldb.py"; sourceTree = "<group>"; };<br>-<span class="Apple-tab-span" style="white-space: pre;">   </span><span class="Apple-tab-span" style="white-space: pre;">  </span>94E367CE140C4EEA001C7A5A /* python-typemaps.swig */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; path = "python-typemaps.swig"; sourceTree = "<group>"; };<br>+<span class="Apple-tab-span" style="white-space: pre;">      </span><span class="Apple-tab-span" style="white-space: pre;">  </span>94E367CE140C4EEA001C7A5A /* python-typemaps.swig */ = {isa = PBXFileReference; lastKnownFileType = text; path = "python-typemaps.swig"; sourceTree = "<group>"; };<br><span class="Apple-tab-span" style="white-space: pre;">    </span><span class="Apple-tab-span" style="white-space: pre;">  </span>94EA1D5A15E6C99B00D4171A /* PythonDataObjects.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PythonDataObjects.h; path = include/lldb/Interpreter/PythonDataObjects.h; sourceTree = "<group>"; };<br><span class="Apple-tab-span" style="white-space: pre;">   </span><span class="Apple-tab-span" style="white-space: pre;">  </span>94EA1D5B15E6C9B400D4171A /* PythonDataObjects.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PythonDataObjects.cpp; path = source/Interpreter/PythonDataObjects.cpp; sourceTree = "<group>"; };<br><span class="Apple-tab-span" style="white-space: pre;">     </span><span class="Apple-tab-span" style="white-space: pre;">  </span>94EBAC8313D9EE26009BA64E /* PythonPointer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PythonPointer.h; path = include/lldb/Utility/PythonPointer.h; sourceTree = "<group>"; };<br>@@ -1658,7 +1658,7 @@<br><span class="Apple-tab-span" style="white-space: pre;">    </span><span class="Apple-tab-span" style="white-space: pre;">  </span>9A42976211861AA600FE05CD /* CommandObjectBreakpointCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectBreakpointCommand.cpp; path = source/Commands/CommandObjectBreakpointCommand.cpp; sourceTree = "<group>"; };<br><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;">  </span>9A4633DA11F65D8600955CE1 /* UserSettingsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UserSettingsController.h; path = include/lldb/Core/UserSettingsController.h; sourceTree = "<group>"; };<br><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;">  </span>9A4633DC11F65D9A00955CE1 /* UserSettingsController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UserSettingsController.cpp; path = source/Core/UserSettingsController.cpp; sourceTree = "<group>"; };<br>-<span class="Apple-tab-span" style="white-space: pre;">    </span><span class="Apple-tab-span" style="white-space: pre;">  </span>9A48A3A7124AAA5A00922451 /* python-extensions.swig */ = {isa = PBXFileReference; explicitFileType = text.script.python; fileEncoding = 4; path = "python-extensions.swig"; sourceTree = "<group>"; };<br>+<span class="Apple-tab-span" style="white-space: pre;">        </span><span class="Apple-tab-span" style="white-space: pre;">  </span>9A48A3A7124AAA5A00922451 /* python-extensions.swig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "python-extensions.swig"; sourceTree = "<group>"; };<br><span class="Apple-tab-span" style="white-space: pre;">      </span><span class="Apple-tab-span" style="white-space: pre;">  </span>9A4F350F1368A51A00823F52 /* StreamAsynchronousIO.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StreamAsynchronousIO.cpp; path = source/Core/StreamAsynchronousIO.cpp; sourceTree = "<group>"; };<br><span class="Apple-tab-span" style="white-space: pre;">   </span><span class="Apple-tab-span" style="white-space: pre;">  </span>9A4F35111368A54100823F52 /* StreamAsynchronousIO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StreamAsynchronousIO.h; path = include/lldb/Core/StreamAsynchronousIO.h; sourceTree = "<group>"; };<br><span class="Apple-tab-span" style="white-space: pre;">       </span><span class="Apple-tab-span" style="white-space: pre;">  </span>9A633FE7112DCE3C001A7E43 /* SBFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBFrame.cpp; path = source/API/SBFrame.cpp; sourceTree = "<group>"; };<br><br>Modified: lldb/trunk/scripts/Python/interface/SBCommandReturnObject.i<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBCommandReturnObject.i?rev=185560&r1=185559&r2=185560&view=diff">http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBCommandReturnObject.i?rev=185560&r1=185559&r2=185560&view=diff</a><br>==============================================================================<br>--- lldb/trunk/scripts/Python/interface/SBCommandReturnObject.i (original)<br>+++ lldb/trunk/scripts/Python/interface/SBCommandReturnObject.i Wed Jul  3 12:58:31 2013<br>@@ -58,14 +58,7 @@ public:<br><br>    void<br>    SetStatus (lldb::ReturnStatus status);<br>-    <br>-    void<br>-    SetError (lldb::SBError &error,<br>-              const char *fallback_error_cstr = NULL);<br><br>-    void<br>-    SetError (const char *error_cstr);<br>-    <br>    lldb::ReturnStatus<br>    GetStatus();<br><br><br>Modified: lldb/trunk/scripts/Python/python-swigsafecast.swig<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-swigsafecast.swig?rev=185560&r1=185559&r2=185560&view=diff">http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-swigsafecast.swig?rev=185560&r1=185559&r2=185560&view=diff</a><br>==============================================================================<br>--- lldb/trunk/scripts/Python/python-swigsafecast.swig (original)<br>+++ lldb/trunk/scripts/Python/python-swigsafecast.swig Wed Jul  3 12:58:31 2013<br>@@ -1,3 +1,7 @@<br>+#ifndef __cplusplus<br>+#error needs C++ to build these<br>+#endif<br>+<br>// leaving this undefined ensures we will get a linker error if we try to use SBTypeToSWIGWrapper()<br>// for a type for which we did not specialze this function<br>template <typename SBClass><br>@@ -11,38 +15,6 @@ SBTypeToSWIGWrapper (SBClass& sb_object)<br>    return SBTypeToSWIGWrapper(&sb_object);<br>}<br><br>-template <typename SBClass><br>-PyObject*<br>-SBTypeToSWIGWrapper (const SBClass& sb_object)<br>-{<br>-    return SBTypeToSWIGWrapper(&sb_object);<br>-}<br>-<br>-template <><br>-PyObject*<br>-SBTypeToSWIGWrapper (PyObject* py_object)<br>-{<br>-    return py_object;<br>-}<br>-<br>-template <><br>-PyObject*<br>-SBTypeToSWIGWrapper (const char* c_str)<br>-{<br>-    if (c_str)<br>-        return PyString_FromString(c_str);<br>-    return NULL;<br>-}<br>-<br>-template <><br>-PyObject*<br>-SBTypeToSWIGWrapper (unsigned int* c_int)<br>-{<br>-    if (!c_int)<br>-        return NULL;<br>-    return PyInt_FromLong(*c_int);<br>-}<br>-<br>template <><br>PyObject*<br>SBTypeToSWIGWrapper (lldb::SBProcess* process_sb)<br><br>Modified: lldb/trunk/scripts/Python/python-wrapper.swig<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-wrapper.swig?rev=185560&r1=185559&r2=185560&view=diff">http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-wrapper.swig?rev=185560&r1=185559&r2=185560&view=diff</a><br>==============================================================================<br>--- lldb/trunk/scripts/Python/python-wrapper.swig (original)<br>+++ lldb/trunk/scripts/Python/python-wrapper.swig Wed Jul  3 12:58:31 2013<br>@@ -103,97 +103,6 @@ FindSessionDictionary(const char *sessio<br>    return ResolvePythonName(session_dictionary_name, NULL);<br>}<br><br>-class PyCallable<br>-{<br>-public:<br>-<br>-    operator<br>-    bool ()<br>-    {<br>-        return m_callable != NULL;<br>-    }<br>-<br>-    template<typename ...Args><br>-    PyObject*<br>-    operator () (Args... args)<br>-    {<br>-        return (*this)({SBTypeToSWIGWrapper(args)...});<br>-    }<br>-    <br>-    PyObject*<br>-    operator () (std::initializer_list<PyObject*> args)<br>-    {<br>-        PyObject* retval = NULL;<br>-        PyObject* pargs = PyTuple_New (args.size());<br>-        if (pargs == NULL)<br>-        {<br>-            if (PyErr_Occurred())<br>-                PyErr_Clear();<br>-            return retval;<br>-        }<br>-        size_t idx = 0;<br>-        for (auto arg : args)<br>-        {<br>-            if (!arg)<br>-                return retval;<br>-            PyTuple_SetItem(pargs,idx,arg);<br>-            idx++;<br>-        }<br>-        retval = PyObject_CallObject (m_callable, pargs);<br>-        Py_XDECREF (pargs);<br>-        return retval;<br>-    }<br>-    <br>-    static PyCallable<br>-    FindWithPythonObject (PyObject* pfunc)<br>-    {<br>-        return PyCallable(pfunc);<br>-    }<br>-    <br>-    static PyCallable<br>-    FindWithFunctionName (const char *python_function_name,<br>-                          const char *session_dictionary_name)<br>-    {<br>-        if (!python_function_name || !session_dictionary_name)<br>-            return PyCallable();<br>-        if ( (python_function_name[0] == 0) || (session_dictionary_name[0] == 0) )<br>-            return PyCallable();<br>-        return FindWithFunctionName(python_function_name,FindSessionDictionary (session_dictionary_name));<br>-    }<br>-    <br>-    static PyCallable<br>-    FindWithFunctionName (const char *python_function_name,<br>-                          PyObject *session_dict)<br>-    {<br>-        if (!python_function_name || !session_dict)<br>-            return PyCallable();<br>-        if ( (python_function_name[0] == 0))<br>-            return PyCallable();<br>-        return PyCallable(ResolvePythonName (python_function_name, session_dict));<br>-    }<br>-<br>-    static PyCallable<br>-    FindWithMemberFunction (PyObject *self,<br>-                            const char *python_function_name)<br>-    {<br>-        if (self == NULL || self == Py_None)<br>-            return PyCallable();<br>-        if (!python_function_name || (python_function_name[0] == 0))<br>-            return PyCallable();<br>-        return PyCallable(PyObject_GetAttrString(self, python_function_name));<br>-    }<br>-<br>-private:<br>-    PyObject* m_callable;<br>-    <br>-    PyCallable (PyObject *callable = NULL) :<br>-    m_callable(callable)<br>-    {<br>-        if (m_callable && PyCallable_Check(m_callable) == false)<br>-            m_callable = NULL;<br>-    }<br>-};<br>-<br>// This function is called by lldb_private::ScriptInterpreterPython::BreakpointCallbackFunction(...)<br>// and is used when a script command is attached to a breakpoint for execution.<br><br>@@ -210,27 +119,70 @@ LLDBSwigPythonBreakpointCallbackFunction<br>    lldb::SBBreakpointLocation sb_bp_loc(bp_loc_sp);<br><br>    bool stop_at_breakpoint = true;<br>-<br>-    {<br>-        PyErr_Cleaner py_err_cleaner(true);<br>-        <br>-        PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);<br>-        <br>-        if (!pfunc)<br>-            return stop_at_breakpoint;<br>-        <br>-        PyObject* session_dict = NULL;<br>-        PyObject* pvalue = NULL;<br>-        pvalue = pfunc(sb_frame, sb_bp_loc, session_dict = FindSessionDictionary(session_dictionary_name));<br>-        <br>-        Py_XINCREF (session_dict);<br>+    PyObject *Frame_PyObj = SBTypeToSWIGWrapper(sb_frame);<br>+    PyObject *Bp_Loc_PyObj = SBTypeToSWIGWrapper(sb_bp_loc);<br>+    <br>+    if (Frame_PyObj == NULL || Bp_Loc_PyObj == NULL)<br>+        return stop_at_breakpoint;<br><br>-        if (pvalue == Py_False)<br>-            stop_at_breakpoint = false;<br>+    if (!python_function_name || !session_dictionary_name)<br>+        return stop_at_breakpoint;<br><br>-        Py_XDECREF (pvalue);<br>-    }<br>+    PyObject *session_dict, *pfunc;<br>+    PyObject *pargs, *pvalue;<br><br>+    session_dict = FindSessionDictionary (session_dictionary_name);<br>+    if (session_dict != NULL)<br>+    {<br>+        pfunc = ResolvePythonName (python_function_name, session_dict);<br>+        if (pfunc != NULL)<br>+        {<br>+            // Set up the arguments and call the function.<br>+                <br>+            if (PyCallable_Check (pfunc))<br>+            {<br>+                pargs = PyTuple_New (3);<br>+                if (pargs == NULL)<br>+                {<br>+                    if (PyErr_Occurred())<br>+                        PyErr_Clear();<br>+                    return stop_at_breakpoint;<br>+                }<br>+                <br>+                PyTuple_SetItem (pargs, 0, Frame_PyObj);  // This "steals" a reference to Frame_PyObj<br>+                PyTuple_SetItem (pargs, 1, Bp_Loc_PyObj); // This "steals" a reference to Bp_Loc_PyObj<br>+                PyTuple_SetItem (pargs, 2, session_dict); // This "steals" a reference to session_dict<br>+                pvalue = PyObject_CallObject (pfunc, pargs);<br>+                Py_XDECREF (pargs);<br>+                <br>+                if (pvalue != NULL)<br>+                {<br>+                    // be very conservative here and only refuse to stop if the user<br>+                    // actually returned False - anything else, just stop<br>+                    if (pvalue == Py_False)<br>+                        stop_at_breakpoint = false;<br>+                    Py_XDECREF (pvalue);<br>+                }<br>+                else if (PyErr_Occurred ())<br>+                {<br>+                    PyErr_Clear();<br>+                }<br>+                Py_INCREF (session_dict);<br>+            }<br>+            else if (PyErr_Occurred())<br>+            {<br>+                PyErr_Clear();<br>+            }<br>+        }<br>+        else if (PyErr_Occurred())<br>+        {<br>+            PyErr_Clear();<br>+        }<br>+    }<br>+    else if (PyErr_Occurred ())<br>+    {<br>+        PyErr_Clear ();<br>+    }<br>    return stop_at_breakpoint;<br>}<br><br>@@ -250,55 +202,67 @@ LLDBSwigPythonWatchpointCallbackFunction<br>    lldb::SBWatchpoint sb_wp(wp_sp);<br><br>    bool stop_at_watchpoint = true;<br>+    PyObject *Frame_PyObj = SBTypeToSWIGWrapper(sb_frame);<br>+    PyObject *Wp_PyObj = SBTypeToSWIGWrapper(sb_wp);<br><br>-    {<br>-        PyErr_Cleaner py_err_cleaner(true);<br>-        <br>-        PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);<br>-        <br>-        if (!pfunc)<br>-            return stop_at_watchpoint;<br>+    if (Frame_PyObj == NULL || Wp_PyObj == NULL)<br>+        return stop_at_watchpoint;<br><br>-        PyObject* session_dict = NULL;<br>-        PyObject* pvalue = NULL;<br>-        pvalue = pfunc(sb_frame, sb_wp, session_dict = FindSessionDictionary(session_dictionary_name));<br>-        <br>-        Py_XINCREF (session_dict);<br>-        <br>-        if (pvalue == Py_False)<br>-            stop_at_watchpoint = false;<br>-        <br>-        Py_XDECREF (pvalue);<br>-    }<br>-    <br>-    return stop_at_watchpoint;<br>-}<br>+    if (!python_function_name || !session_dictionary_name)<br>+        return stop_at_watchpoint;<br><br>-bool<br>-PyObjectToString (PyObject* object,<br>-                  std::string& retval)<br>-{<br>-    retval.clear();<br>-    bool was_ok = false;<br>-    if (object != NULL && object != Py_None)<br>+    PyObject *session_dict, *pfunc;<br>+    PyObject *pargs, *pvalue;<br>+    <br>+    session_dict = FindSessionDictionary (session_dictionary_name);<br>+    if (session_dict != NULL)<br>    {<br>-        if (PyString_Check(object))<br>-        {<br>-            retval.assign(PyString_AsString(object));<br>-            was_ok = true;<br>-        }<br>-        else<br>+        pfunc = ResolvePythonName (python_function_name, session_dict);<br>+        if (pfunc != NULL)<br>        {<br>-            PyObject* value_as_string = PyObject_Str(object);<br>-            if (value_as_string && value_as_string != Py_None && PyString_Check(value_as_string))<br>+            // Set up the arguments and call the function.<br>+                <br>+            if (PyCallable_Check (pfunc))<br>+            {<br>+                pargs = PyTuple_New (3);<br>+                if (pargs == NULL)<br>+                {<br>+                    if (PyErr_Occurred())<br>+                        PyErr_Clear();<br>+                    return stop_at_watchpoint;<br>+                }<br>+                <br>+                PyTuple_SetItem (pargs, 0, Frame_PyObj);  // This "steals" a reference to Frame_PyObj<br>+                PyTuple_SetItem (pargs, 1, Wp_PyObj);     // This "steals" a reference to Wp_PyObj<br>+                PyTuple_SetItem (pargs, 2, session_dict); // This "steals" a reference to session_dict<br>+                pvalue = PyObject_CallObject (pfunc, pargs);<br>+                Py_XDECREF (pargs);<br>+                <br>+                if (pvalue != NULL)<br>+                {<br>+                    Py_XDECREF (pvalue);<br>+                }<br>+                else if (PyErr_Occurred ())<br>+                {<br>+                    PyErr_Clear();<br>+                }<br>+                Py_INCREF (session_dict);<br>+            }<br>+            else if (PyErr_Occurred())<br>            {<br>-                retval.assign(PyString_AsString(value_as_string));<br>-                was_ok = true;<br>+                PyErr_Clear();<br>            }<br>-            Py_XDECREF(value_as_string);<br>        }<br>+        else if (PyErr_Occurred())<br>+        {<br>+            PyErr_Clear();<br>+        }<br>+    }<br>+    else if (PyErr_Occurred ())<br>+    {<br>+        PyErr_Clear ();<br>    }<br>-    return was_ok;<br>+    return stop_at_watchpoint;<br>}<br><br>SWIGEXPORT bool<br>@@ -315,18 +279,23 @@ LLDBSwigPythonCallTypeScript<br><br>    retval.clear();<br><br>+    PyObject *ValObj_PyObj = SBTypeToSWIGWrapper(sb_value);<br>+    <br>+    if (ValObj_PyObj == NULL)<br>+        return false;<br>+        <br>    if (!python_function_name || !session_dictionary)<br>        return false;<br><br>-    PyObject *session_dict = (PyObject*)session_dictionary, *pfunc_impl = NULL, *pvalue = NULL;<br>+    PyObject *session_dict = (PyObject*)session_dictionary, *pfunc = NULL, *pargs = NULL, *pvalue = NULL;<br><br>    if (pyfunct_wrapper && *pyfunct_wrapper && PyFunction_Check (*pyfunct_wrapper))<br>    {<br>-        pfunc_impl = (PyObject*)(*pyfunct_wrapper);<br>-        if (pfunc_impl->ob_refcnt == 1)<br>+        pfunc = (PyObject*)(*pyfunct_wrapper);<br>+        if (pfunc->ob_refcnt == 1)<br>        {<br>-            Py_XDECREF(pfunc_impl);<br>-            pfunc_impl = NULL;<br>+            Py_XDECREF(pfunc);<br>+            pfunc = NULL;<br>        }<br>    }<br><br>@@ -334,32 +303,41 @@ LLDBSwigPythonCallTypeScript<br>    {<br>        PyErr_Cleaner pyerr_cleanup(true);  // show Python errors<br><br>-        if (!pfunc_impl)<br>+        if (!pfunc)<br>        {<br>-            pfunc_impl = ResolvePythonName (python_function_name, session_dict);<br>-            if (!pfunc_impl || !PyCallable_Check (pfunc_impl))<br>+            pfunc = ResolvePythonName (python_function_name, session_dict);<br>+            if (!pfunc || !PyFunction_Check (pfunc))<br>                return false;<br>            else<br>            {<br>                if (pyfunct_wrapper)<br>-                    *pyfunct_wrapper = pfunc_impl;<br>+                    *pyfunct_wrapper = pfunc;<br>            }<br>        }<br>        /*else<br>            printf("caching works!!!!\n");*/<br><br>-        PyCallable pfunc = PyCallable::FindWithPythonObject(pfunc_impl);<br>-        <br>-        if (!pfunc)<br>+        pargs = PyTuple_Pack(2, ValObj_PyObj, session_dict);<br>+        if (pargs == NULL)<br>            return false;<br><br>-        pvalue = pfunc(sb_value,session_dict);<br>-<br>-        Py_INCREF (session_dict);<br>-        <br>-        PyObjectToString(pvalue,retval);<br>+        pvalue = PyObject_CallObject (pfunc, pargs);<br>+        Py_XDECREF (pargs);<br><br>+        if (pvalue != NULL && pvalue != Py_None)<br>+        {<br>+            if (PyString_Check(pvalue))<br>+                retval.assign(PyString_AsString(pvalue));<br>+            else<br>+            {<br>+                PyObject* value_as_string = PyObject_Str(pvalue);<br>+                if (value_as_string && value_as_string != Py_None && PyString_Check(value_as_string))<br>+                    retval.assign(PyString_AsString(value_as_string));<br>+                Py_XDECREF(value_as_string);<br>+            }<br>+        }<br>        Py_XDECREF (pvalue);<br>+        Py_INCREF (session_dict);<br>    }<br>    return true;<br>}<br>@@ -381,29 +359,81 @@ LLDBSwigPythonCreateSyntheticProvider<br>    // has ownership of it and will manage memory for this object by itself<br>    lldb::SBValue *sb_value = new lldb::SBValue(valobj_sp);<br>    sb_value->SetPreferSyntheticValue(false);<br>+<br>    PyObject *ValObj_PyObj = SBTypeToSWIGWrapper(sb_value);<br><br>    if (ValObj_PyObj == NULL)<br>        Py_RETURN_NONE;<br>+<br>+    const char* python_function_name = python_class_name;<br>+<br>+    PyObject *session_dict, *pfunc;<br>+    PyObject *pvalue;<br><br>+    session_dict = FindSessionDictionary (session_dictionary_name);<br>+    if (session_dict != NULL)<br>    {<br>-        PyErr_Cleaner py_err_cleaner(true);<br>-        <br>-        PyCallable pfunc = PyCallable::FindWithFunctionName(python_class_name,session_dictionary_name);<br>-        <br>-        if (!pfunc)<br>-            return retval;<br>-        <br>-        Py_INCREF(ValObj_PyObj);<br>-        <br>-        PyObject* session_dict = NULL;<br>-        retval = pfunc(ValObj_PyObj, session_dict = FindSessionDictionary(session_dictionary_name));<br>-        <br>-        Py_XINCREF (session_dict);<br>-        <br>-        Py_XINCREF(retval);<br>+        pfunc = ResolvePythonName (python_function_name, session_dict);<br>+        if (pfunc != NULL)<br>+        {<br>+            // Set up the arguments and call the function.<br>+                <br>+            if (PyCallable_Check (pfunc))<br>+            {<br>+                PyObject *argList = Py_BuildValue("SS", ValObj_PyObj, session_dict);<br>+<br>+                if (PyErr_Occurred ())<br>+                {<br>+                    PyErr_Print();<br>+                    PyErr_Clear();<br>+                    return retval;<br>+                }<br>+<br>+                if (argList == NULL)<br>+                {<br>+                    return retval;<br>+                }<br>+<br>+                Py_INCREF(ValObj_PyObj);<br>+<br>+                pvalue = PyObject_CallObject(pfunc, argList);<br>+<br>+                Py_XDECREF(argList);<br>+<br>+                if (pvalue != NULL)<br>+                {<br>+                    if (pvalue != Py_None)<br>+                        retval = pvalue;<br>+                    else<br>+                    {<br>+                        retval = Py_None;<br>+                        Py_INCREF(retval);<br>+                    }<br>+                }<br>+                else if (PyErr_Occurred ())<br>+                {<br>+                    PyErr_Print();<br>+                    PyErr_Clear();<br>+                }<br>+                Py_INCREF (session_dict);<br>+            }<br>+            else if (PyErr_Occurred())<br>+            {<br>+                PyErr_Print();<br>+                PyErr_Clear();<br>+            }<br>+        }<br>+        else if (PyErr_Occurred())<br>+        {<br>+            PyErr_Print();<br>+            PyErr_Clear();<br>+        }<br>+    }<br>+    else if (PyErr_Occurred ())<br>+    {<br>+        PyErr_Print();<br>+        PyErr_Clear ();<br>    }<br>-    <br>    if (retval)<br>        return retval;<br>    else<br>@@ -420,22 +450,64 @@ LLDBSwigPython_CallOptionalMember<br>    bool* was_found = NULL<br>)<br>{<br>-    PyErr_Cleaner py_err_cleaner(false);<br>-    <br>-    PyCallable pfunc = PyCallable::FindWithMemberFunction(self,callee_name);<br>-    <br>-    if (!pfunc)<br>+    if (self == NULL || self == Py_None)<br>    {<br>        if (was_found)<br>            *was_found = false;<br>        Py_XINCREF(ret_if_not_found);<br>        return ret_if_not_found;<br>    }<br>-    <br>+<br>+    PyObject* pmeth  = PyObject_GetAttrString(self, callee_name);<br>+<br>+    if (PyErr_Occurred())<br>+    {<br>+        PyErr_Clear();<br>+    }<br>+<br>+    if (pmeth == NULL || pmeth == Py_None)<br>+    {<br>+        if (was_found)<br>+            *was_found = false;<br>+        Py_XDECREF(pmeth);<br>+        Py_XINCREF(ret_if_not_found);<br>+        return ret_if_not_found;<br>+    }<br>+<br>+    if (PyCallable_Check(pmeth) == 0)<br>+    {<br>+        if (PyErr_Occurred())<br>+        {<br>+            PyErr_Clear();<br>+        }<br>+<br>+        Py_XDECREF(pmeth);<br>+        if (was_found)<br>+            *was_found = false;<br>+        Py_XINCREF(ret_if_not_found);<br>+        return ret_if_not_found;<br>+    }<br>+<br>    if (was_found)<br>        *was_found = true;<br>+<br>+    if (PyErr_Occurred())<br>+    {<br>+        PyErr_Clear();<br>+    }<br>+<br>+    Py_XDECREF(pmeth);<br>+<br>+    // right now we know this function exists and is callable..<br>+    PyObject* py_return = PyObject_CallMethod(self, callee_name, NULL);<br>+    <br>+    // if it fails, print the error but otherwise go on<br>+    if (PyErr_Occurred())<br>+    {<br>+        PyErr_Print();<br>+        PyErr_Clear();<br>+    }<br><br>-    PyObject* py_return = pfunc();<br>    return py_return;<br>}<br><br>@@ -475,15 +547,18 @@ LLDBSwigPython_GetChildAtIndex<br>    uint32_t idx<br>)<br>{<br>-    PyErr_Cleaner py_err_cleaner(true);<br>-    <br>-    PyCallable pfunc = PyCallable::FindWithMemberFunction(implementor,"get_child_at_index");<br>-    <br>-    if (!pfunc)<br>+<br>+    static char callee_name[] = "get_child_at_index";<br>+    static char param_format[] = "i";<br>+<br>+    if (implementor == NULL || implementor == Py_None)<br>        return NULL;<br>-    <br>-    PyObject *py_return = NULL;<br>-    py_return = pfunc(idx);<br>+    PyObject* py_return = PyObject_CallMethod(implementor, callee_name, param_format, idx);<br>+    if (PyErr_Occurred())<br>+    {<br>+        PyErr_Print();<br>+        PyErr_Clear();<br>+    }<br><br>    if (py_return == NULL || py_return == Py_None)<br>    {<br>@@ -492,7 +567,7 @@ LLDBSwigPython_GetChildAtIndex<br>    }<br><br>    lldb::SBValue* sbvalue_ptr = NULL;<br>-    <br>+<br>    if (SWIG_ConvertPtr(py_return, (void**)&sbvalue_ptr, SWIGTYPE_p_lldb__SBValue, 0) == -1)<br>    {<br>        Py_XDECREF(py_return);<br>@@ -501,8 +576,8 @@ LLDBSwigPython_GetChildAtIndex<br><br>    if (sbvalue_ptr == NULL)<br>        return NULL;<br>-    <br>-    return py_return;    <br>+<br>+    return py_return;<br>}<br><br>SWIGEXPORT int<br>@@ -512,29 +587,33 @@ LLDBSwigPython_GetIndexOfChildWithName<br>    const char* child_name<br>)<br>{<br>-    PyErr_Cleaner py_err_cleaner(true);<br>-    <br>-    PyCallable pfunc = PyCallable::FindWithMemberFunction(implementor,"get_child_index");<br>-    <br>-    if (!pfunc)<br>-        return UINT32_MAX;<br>-    <br>-    PyObject *py_return = NULL;<br>-    py_return = pfunc(child_name);<br>+    static char callee_name[] = "get_child_index";<br>+    static char param_format[] = "s";<br>+<br>+    if (implementor == NULL || implementor == Py_None)<br>+        return 0;<br>+    PyObject* py_return = PyObject_CallMethod(implementor, callee_name, param_format, child_name);<br>+    if (PyErr_Occurred())<br>+    {<br>+        PyErr_Print();<br>+        PyErr_Clear();<br>+    }<br><br>    if (py_return == NULL || py_return == Py_None)<br>    {<br>        Py_XDECREF(py_return);<br>        return UINT32_MAX;<br>    }<br>-    <br>    long retval = PyInt_AsLong(py_return);<br>    Py_XDECREF(py_return);<br>-<br>    if (retval >= 0)<br>        return (uint32_t)retval;<br>-    <br>-    return UINT32_MAX;<br>+    if (PyErr_Occurred())<br>+    {<br>+        PyErr_Print();<br>+        PyErr_Clear();<br>+    }<br>+    return 0;<br>}<br><br>SWIGEXPORT bool<br>@@ -624,6 +703,7 @@ LLDBSwigPythonCallCommand<br>    const char *session_dictionary_name,<br>    lldb::DebuggerSP& debugger,<br>    const char* args,<br>+    std::string& err_msg,<br>    lldb_private::CommandReturnObject& cmd_retobj<br>)<br>{<br>@@ -634,25 +714,86 @@ LLDBSwigPythonCallCommand<br><br>    bool retval = false;<br><br>-    {<br>-        PyErr_Cleaner py_err_cleaner(true);<br>-        PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);<br>-        <br>-        if (!pfunc)<br>-            return retval;<br>+    PyObject *DebuggerObj_PyObj = SBTypeToSWIGWrapper(debugger_sb);<br>+    PyObject *CmdRetObj_PyObj = SBTypeToSWIGWrapper(cmd_retobj_sb);<br><br>-        PyObject* session_dict = NULL;<br>-        // pass the pointer-to cmd_retobj_sb or watch the underlying object disappear from under you<br>-        // see comment above for SBCommandReturnObjectReleaser for further details<br>-        PyObject* pvalue = NULL;<br>-        pvalue = pfunc(debugger_sb, args, &cmd_retobj_sb, session_dict = FindSessionDictionary(session_dictionary_name));<br>-        <br>-        Py_XINCREF (session_dict);<br>-        Py_XDECREF (pvalue);<br>+    if (DebuggerObj_PyObj == NULL)<br>+        return retval;<br><br>-        retval = true;<br>-    }<br>+    if (CmdRetObj_PyObj == NULL)<br>+        return retval;<br>+<br>+    if (!python_function_name || !session_dictionary_name)<br>+        return retval;<br>+<br>+    PyObject *session_dict, *pfunc;<br>+    PyObject *pargs, *pvalue;<br><br>+    session_dict = FindSessionDictionary (session_dictionary_name);<br>+    if (session_dict != NULL)<br>+    {<br>+        pfunc = ResolvePythonName (python_function_name, session_dict);<br>+        if (pfunc != NULL)<br>+        {<br>+            // Set up the arguments and call the function.<br>+                <br>+            if (PyCallable_Check (pfunc))<br>+            {<br>+                pargs = PyTuple_New (4);<br>+                if (pargs == NULL)<br>+                {<br>+                    if (PyErr_Occurred())<br>+                        PyErr_Clear();<br>+                    return retval;<br>+                }<br>+                <br>+                PyTuple_SetItem (pargs, 0, DebuggerObj_PyObj);  // This "steals" a reference to DebuggerObj_PyObj<br>+                PyTuple_SetItem (pargs, 1, PyString_FromString(args));<br>+                PyTuple_SetItem (pargs, 2, CmdRetObj_PyObj);  // This "steals" a reference to CmdRetObj_PyObj<br>+                PyTuple_SetItem (pargs, 3, session_dict); // This "steals" a reference to session_dict<br>+                pvalue = PyObject_CallObject (pfunc, pargs);<br>+                Py_XDECREF (pargs);<br>+                <br>+                if (pvalue != NULL)<br>+                {<br>+                    if (pvalue == Py_None) // no error<br>+                    {<br>+                        err_msg.clear();<br>+                        retval = true;<br>+                    }<br>+                    else<br>+                    {<br>+                        // return value is an error string<br>+                        if (PyString_CheckExact(pvalue))<br>+                            err_msg.assign(PyString_AsString(pvalue));<br>+                        retval = false;<br>+                    }<br>+                    Py_XDECREF (pvalue);<br>+                }<br>+                else if (PyErr_Occurred ())<br>+                {<br>+                    PyErr_Print();<br>+                    PyErr_Clear();<br>+                }<br>+                Py_INCREF (session_dict);<br>+            }<br>+            else if (PyErr_Occurred())<br>+            {<br>+                PyErr_Print();<br>+                PyErr_Clear();<br>+            }<br>+        }<br>+        else if (PyErr_Occurred())<br>+        {<br>+            PyErr_Print();<br>+            PyErr_Clear();<br>+        }<br>+    }<br>+    else if (PyErr_Occurred ())<br>+    {<br>+        PyErr_Print();<br>+        PyErr_Clear ();<br>+    }<br>    return retval;<br>}<br><br>@@ -678,25 +819,75 @@ LLDBSWIGPythonCreateOSPlugin<br>    if (SBProc_PyObj == NULL)<br>        Py_RETURN_NONE;<br><br>+    const char* python_function_name = python_class_name;<br>+<br>+    PyObject *session_dict, *pfunc;<br>+    PyObject *pvalue;<br>+    <br>+    session_dict = FindSessionDictionary (session_dictionary_name);<br>+    if (session_dict != NULL)<br>    {<br>-        PyErr_Cleaner py_err_cleaner(true);<br>-        <br>-        PyCallable pfunc = PyCallable::FindWithFunctionName(python_class_name,session_dictionary_name);<br>-        <br>-        if (!pfunc)<br>-            return retval;<br>-        <br>-        Py_INCREF(SBProc_PyObj);<br>-        <br>-        PyObject* session_dict = NULL;<br>-        session_dict = session_dict = FindSessionDictionary(session_dictionary_name);<br>-        retval = pfunc(SBProc_PyObj);<br>-        <br>-        Py_XINCREF (session_dict);<br>-        <br>-        Py_XINCREF(retval);<br>+        pfunc = ResolvePythonName (python_function_name, session_dict);<br>+        if (pfunc != NULL)<br>+        {<br>+            // Set up the arguments and call the function.<br>+                <br>+            if (PyCallable_Check (pfunc))<br>+            {<br>+                PyObject *argList = Py_BuildValue("(O)", SBProc_PyObj);<br>+<br>+                if (PyErr_Occurred ())<br>+                {<br>+                    PyErr_Print();<br>+                    PyErr_Clear();<br>+                    return retval;<br>+                }<br>+<br>+                if (argList == NULL)<br>+                {<br>+                    return retval;<br>+                }<br>+<br>+                Py_INCREF(SBProc_PyObj);<br>+<br>+                pvalue = PyObject_CallObject(pfunc, argList);<br>+<br>+                Py_XDECREF(argList);<br>+<br>+                if (pvalue != NULL)<br>+                {<br>+                    if (pvalue != Py_None)<br>+                        retval = pvalue;<br>+                    else<br>+                    {<br>+                        retval = Py_None;<br>+                        Py_INCREF(retval);<br>+                    }<br>+                }<br>+                else if (PyErr_Occurred ())<br>+                {<br>+                    PyErr_Print();<br>+                    PyErr_Clear();<br>+                }<br>+                Py_INCREF (session_dict);<br>+            }<br>+            else if (PyErr_Occurred())<br>+            {<br>+                PyErr_Print();<br>+                PyErr_Clear();<br>+            }<br>+        }<br>+        else if (PyErr_Occurred())<br>+        {<br>+            PyErr_Print();<br>+            PyErr_Clear();<br>+        }<br>+    }<br>+    else if (PyErr_Occurred ())<br>+    {<br>+        PyErr_Print();<br>+        PyErr_Clear ();<br>    }<br>-    <br>    if (retval)<br>        return retval;<br>    else<br>@@ -717,27 +908,75 @@ std::string& output)<br>        return retval;<br><br>    lldb::SBProcess process_sb(process);<br>+    PyObject *ProcessObj_PyObj = SBTypeToSWIGWrapper(process_sb);<br><br>-    {<br>-        PyErr_Cleaner py_err_cleaner(true);<br>-        <br>-        PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);<br>-        <br>-        if (!pfunc)<br>-            return retval;<br>-        <br>-        PyObject* session_dict = NULL;<br>-        PyObject* pvalue = NULL;<br>-        pvalue = pfunc(process_sb, session_dict = FindSessionDictionary(session_dictionary_name));<br>+    if (ProcessObj_PyObj == NULL)<br>+        return retval;<br><br>-        Py_XINCREF (session_dict);<br>+    PyObject *session_dict, *pfunc;<br>+    PyObject *pargs, *pvalue;<br>+    <br>+    session_dict = FindSessionDictionary (session_dictionary_name);<br><br>-        if (PyObjectToString(pvalue,output))<br>-            retval = true;<br>+    if (session_dict != NULL)<br>+    {<br>+        pfunc = ResolvePythonName (python_function_name, session_dict);<br><br>-        Py_XDECREF(pvalue);<br>+        if (PyErr_Occurred()) // this might not exist.. let's make sure we handle that<br>+        {<br>+            PyErr_Clear();<br>+            return true;<br>+        }<br>+<br>+        if (pfunc == NULL)<br>+            return true;<br>+        else<br>+        {<br>+            // Set up the arguments and call the function.<br>+                <br>+            if (PyCallable_Check (pfunc))<br>+            {<br>+                pargs = PyTuple_New (2);<br>+                if (pargs == NULL)<br>+                {<br>+                    if (PyErr_Occurred())<br>+                        PyErr_Clear();<br>+                    return retval;<br>+                }<br>+                <br>+                PyTuple_SetItem (pargs, 0, ProcessObj_PyObj);  // This "steals" a reference to ProcessObj_PyObj<br>+                PyTuple_SetItem (pargs, 1, session_dict); // This "steals" a reference to session_dict<br>+                pvalue = PyObject_CallObject (pfunc, pargs);<br>+                Py_XDECREF (pargs);<br>+                <br>+                if (PyErr_Occurred ())<br>+                {<br>+                    PyErr_Print();<br>+                    PyErr_Clear();<br>+                }<br>+                else<br>+                {<br>+                    if (PyString_Check(pvalue))<br>+                    {<br>+                        output.assign(PyString_AsString(pvalue));<br>+                        retval = true;<br>+                    }<br>+                    else<br>+                    {<br>+                        output.clear();<br>+                        retval = false;<br>+                    }<br>+                    Py_XDECREF (pvalue);<br>+                }<br>+                Py_INCREF (session_dict);<br>+            }<br>+            else if (PyErr_Occurred())<br>+            {<br>+                PyErr_Print();<br>+                PyErr_Clear();<br>+            }<br>+        }<br>    }<br>-    <br>    return retval;<br>}<br><br>@@ -755,27 +994,75 @@ std::string& output)<br>        return retval;<br><br>    lldb::SBThread thread_sb(thread);<br>-    <br>-    {<br>-        PyErr_Cleaner py_err_cleaner(true);<br>-        <br>-        PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);<br>-        <br>-        if (!pfunc)<br>-            return retval;<br>-        <br>-        PyObject* session_dict = NULL;<br>-        PyObject* pvalue = NULL;<br>-        pvalue = pfunc(thread_sb, session_dict = FindSessionDictionary(session_dictionary_name));<br>+    PyObject *ThreadObj_PyObj = SBTypeToSWIGWrapper(thread_sb);<br>+<br>+    if (ThreadObj_PyObj == NULL)<br>+        return retval;<br><br>-        Py_XINCREF (session_dict);<br>+    PyObject *session_dict, *pfunc;<br>+    PyObject *pargs, *pvalue;<br>+    <br>+    session_dict = FindSessionDictionary (session_dictionary_name);<br><br>-        if (PyObjectToString(pvalue,output))<br>-            retval = true;<br>+    if (session_dict != NULL)<br>+    {<br>+        pfunc = ResolvePythonName (python_function_name, session_dict);<br><br>-        Py_XDECREF(pvalue);<br>+        if (PyErr_Occurred()) // this might not exist.. let's make sure we handle that<br>+        {<br>+            PyErr_Clear();<br>+            return true;<br>+        }<br>+<br>+        if (pfunc == NULL)<br>+            return true;<br>+        else<br>+        {<br>+            // Set up the arguments and call the function.<br>+                <br>+            if (PyCallable_Check (pfunc))<br>+            {<br>+                pargs = PyTuple_New (2);<br>+                if (pargs == NULL)<br>+                {<br>+                    if (PyErr_Occurred())<br>+                        PyErr_Clear();<br>+                    return retval;<br>+                }<br>+                <br>+                PyTuple_SetItem (pargs, 0, ThreadObj_PyObj);  // This "steals" a reference to ThreadObj_PyObj<br>+                PyTuple_SetItem (pargs, 1, session_dict); // This "steals" a reference to session_dict<br>+                pvalue = PyObject_CallObject (pfunc, pargs);<br>+                Py_XDECREF (pargs);<br>+                <br>+                if (PyErr_Occurred ())<br>+                {<br>+                    PyErr_Print();<br>+                    PyErr_Clear();<br>+                }<br>+                else<br>+                {<br>+                    if (PyString_Check(pvalue))<br>+                    {<br>+                        output.assign(PyString_AsString(pvalue));<br>+                        retval = true;<br>+                    }<br>+                    else<br>+                    {<br>+                        output.clear();<br>+                        retval = false;<br>+                    }<br>+                    Py_XDECREF (pvalue);<br>+                }<br>+                Py_INCREF (session_dict);<br>+            }<br>+            else if (PyErr_Occurred())<br>+            {<br>+                PyErr_Print();<br>+                PyErr_Clear();<br>+            }<br>+        }<br>    }<br>-    <br>    return retval;<br>}<br><br>@@ -793,27 +1080,75 @@ std::string& output)<br>        return retval;<br><br>    lldb::SBTarget target_sb(target);<br>-    <br>-    {<br>-        PyErr_Cleaner py_err_cleaner(true);<br>-        <br>-        PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);<br>-        <br>-        if (!pfunc)<br>-            return retval;<br>-        <br>-        PyObject* session_dict = NULL;<br>-        PyObject* pvalue = NULL;<br>-        pvalue = pfunc(target_sb, session_dict = FindSessionDictionary(session_dictionary_name));<br>+    PyObject *TargetObj_PyObj = SBTypeToSWIGWrapper(target_sb);<br>+<br>+    if (TargetObj_PyObj == NULL)<br>+        return retval;<br><br>-        Py_XINCREF (session_dict);<br>+    PyObject *session_dict, *pfunc;<br>+    PyObject *pargs, *pvalue;<br>+    <br>+    session_dict = FindSessionDictionary (session_dictionary_name);<br><br>-        if (PyObjectToString(pvalue,output))<br>-            retval = true;<br>+    if (session_dict != NULL)<br>+    {<br>+        pfunc = ResolvePythonName (python_function_name, session_dict);<br><br>-        Py_XDECREF(pvalue);<br>+        if (PyErr_Occurred()) // this might not exist.. let's make sure we handle that<br>+        {<br>+            PyErr_Clear();<br>+            return true;<br>+        }<br>+<br>+        if (pfunc == NULL)<br>+            return true;<br>+        else<br>+        {<br>+            // Set up the arguments and call the function.<br>+                <br>+            if (PyCallable_Check (pfunc))<br>+            {<br>+                pargs = PyTuple_New (2);<br>+                if (pargs == NULL)<br>+                {<br>+                    if (PyErr_Occurred())<br>+                        PyErr_Clear();<br>+                    return retval;<br>+                }<br>+                <br>+                PyTuple_SetItem (pargs, 0, TargetObj_PyObj);  // This "steals" a reference to TargetObj_PyObj<br>+                PyTuple_SetItem (pargs, 1, session_dict); // This "steals" a reference to session_dict<br>+                pvalue = PyObject_CallObject (pfunc, pargs);<br>+                Py_XDECREF (pargs);<br>+                <br>+                if (PyErr_Occurred ())<br>+                {<br>+                    PyErr_Print();<br>+                    PyErr_Clear();<br>+                }<br>+                else<br>+                {<br>+                    if (PyString_Check(pvalue))<br>+                    {<br>+                        output.assign(PyString_AsString(pvalue));<br>+                        retval = true;<br>+                    }<br>+                    else<br>+                    {<br>+                        output.clear();<br>+                        retval = false;<br>+                    }<br>+                    Py_XDECREF (pvalue);<br>+                }<br>+                Py_INCREF (session_dict);<br>+            }<br>+            else if (PyErr_Occurred())<br>+            {<br>+                PyErr_Print();<br>+                PyErr_Clear();<br>+            }<br>+        }<br>    }<br>-    <br>    return retval;<br>}<br><br>@@ -831,27 +1166,75 @@ std::string& output)<br>        return retval;<br><br>    lldb::SBFrame frame_sb(frame);<br>-    <br>-    {<br>-        PyErr_Cleaner py_err_cleaner(true);<br>-        <br>-        PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);<br>-        <br>-        if (!pfunc)<br>-            return retval;<br>-        <br>-        PyObject* session_dict = NULL;<br>-        PyObject* pvalue = NULL;<br>-        pvalue = pfunc(frame_sb, session_dict = FindSessionDictionary(session_dictionary_name));<br>+    PyObject *FrameObj_PyObj = SBTypeToSWIGWrapper(frame_sb);<br>+<br>+    if (FrameObj_PyObj == NULL)<br>+        return retval;<br><br>-        Py_XINCREF (session_dict);<br>+    PyObject *session_dict, *pfunc;<br>+    PyObject *pargs, *pvalue;<br>+    <br>+    session_dict = FindSessionDictionary (session_dictionary_name);<br><br>-        if (PyObjectToString(pvalue,output))<br>-            retval = true;<br>+    if (session_dict != NULL)<br>+    {<br>+        pfunc = ResolvePythonName (python_function_name, session_dict);<br><br>-        Py_XDECREF(pvalue);<br>+        if (PyErr_Occurred()) // this might not exist.. let's make sure we handle that<br>+        {<br>+            PyErr_Clear();<br>+            return true;<br>+        }<br>+<br>+        if (pfunc == NULL)<br>+            return true;<br>+        else<br>+        {<br>+            // Set up the arguments and call the function.<br>+                <br>+            if (PyCallable_Check (pfunc))<br>+            {<br>+                pargs = PyTuple_New (2);<br>+                if (pargs == NULL)<br>+                {<br>+                    if (PyErr_Occurred())<br>+                        PyErr_Clear();<br>+                    return retval;<br>+                }<br>+                <br>+                PyTuple_SetItem (pargs, 0, FrameObj_PyObj);  // This "steals" a reference to FrameObj_PyObj<br>+                PyTuple_SetItem (pargs, 1, session_dict); // This "steals" a reference to session_dict<br>+                pvalue = PyObject_CallObject (pfunc, pargs);<br>+                Py_XDECREF (pargs);<br>+                <br>+                if (PyErr_Occurred ())<br>+                {<br>+                    PyErr_Print();<br>+                    PyErr_Clear();<br>+                }<br>+                else<br>+                {<br>+                    if (PyString_Check(pvalue))<br>+                    {<br>+                        output.assign(PyString_AsString(pvalue));<br>+                        retval = true;<br>+                    }<br>+                    else<br>+                    {<br>+                        output.clear();<br>+                        retval = false;<br>+                    }<br>+                    Py_XDECREF (pvalue);<br>+                }<br>+                Py_INCREF (session_dict);<br>+            }<br>+            else if (PyErr_Occurred())<br>+            {<br>+                PyErr_Print();<br>+                PyErr_Clear();<br>+            }<br>+        }<br>    }<br>-    <br>    return retval;<br>}<br><br>@@ -863,33 +1246,78 @@ LLDBSwigPythonCallModuleInit<br>    lldb::DebuggerSP& debugger<br>)<br>{<br>-    bool retval = false;<br><br>    lldb::SBDebugger debugger_sb(debugger);<br><br>+    bool retval = false;<br>+<br>+    PyObject *DebuggerObj_PyObj = SBTypeToSWIGWrapper(debugger_sb);<br>+<br>+    if (DebuggerObj_PyObj == NULL)<br>+        return retval;<br>+        <br>+    if (python_module_name == NULL || python_module_name[0] == '\0' || !session_dictionary_name)<br>+        return retval;<br>+<br>+    PyObject *session_dict, *pfunc;<br>+    PyObject *pargs, *pvalue;<br>+    <br>+    session_dict = FindSessionDictionary (session_dictionary_name);<br>+    <br>    std::string python_function_name_string = python_module_name;<br>    python_function_name_string += ".__lldb_init_module";<br>    const char* python_function_name = python_function_name_string.c_str();<br><br>+    if (session_dict != NULL)<br>    {<br>-        PyErr_Cleaner py_err_cleaner(true);<br>-        <br>-        PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);<br>+        pfunc = ResolvePythonName (python_function_name, session_dict);<br><br>-        if (!pfunc)<br>+        if (PyErr_Occurred()) // this might not exist.. let's make sure we handle that<br>+        {<br>+            PyErr_Clear();<br>            return true;<br>-        <br>-        PyObject* session_dict = NULL;<br>-        PyObject* pvalue = NULL;<br>-        pvalue = pfunc(debugger_sb, session_dict = FindSessionDictionary(session_dictionary_name));<br>-        <br>-        Py_XINCREF (session_dict);<br>-        <br>-        retval = true;<br>-        <br>-        Py_XDECREF(pvalue);<br>+        }<br>+<br>+        if (pfunc == NULL)<br>+            return true;<br>+        else<br>+        {<br>+            // Set up the arguments and call the function.<br>+                <br>+            if (PyCallable_Check (pfunc))<br>+            {<br>+                pargs = PyTuple_New (2);<br>+                if (pargs == NULL)<br>+                {<br>+                    if (PyErr_Occurred())<br>+                        PyErr_Clear();<br>+                    return retval;<br>+                }<br>+                <br>+                PyTuple_SetItem (pargs, 0, DebuggerObj_PyObj);  // This "steals" a reference to DebuggerObj_PyObj<br>+                PyTuple_SetItem (pargs, 1, session_dict); // This "steals" a reference to session_dict<br>+                pvalue = PyObject_CallObject (pfunc, pargs);<br>+                Py_XDECREF (pargs);<br>+                <br>+                if (PyErr_Occurred ())<br>+                {<br>+                    PyErr_Print();<br>+                    PyErr_Clear();<br>+                }<br>+                else<br>+                {<br>+                    retval = true;<br>+                    Py_XDECREF (pvalue);<br>+                }<br>+                Py_INCREF (session_dict);<br>+            }<br>+            else if (PyErr_Occurred())<br>+            {<br>+                PyErr_Print();<br>+                PyErr_Clear();<br>+            }<br>+        }<br>    }<br>-    <br>    return retval;<br>}<br>%}<br><br>Modified: lldb/trunk/source/API/SBCommandReturnObject.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandReturnObject.cpp?rev=185560&r1=185559&r2=185560&view=diff">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandReturnObject.cpp?rev=185560&r1=185559&r2=185560&view=diff</a><br>==============================================================================<br>--- lldb/trunk/source/API/SBCommandReturnObject.cpp (original)<br>+++ lldb/trunk/source/API/SBCommandReturnObject.cpp Wed Jul  3 12:58:31 2013<br>@@ -8,10 +8,8 @@<br>//===----------------------------------------------------------------------===//<br><br>#include "lldb/API/SBCommandReturnObject.h"<br>-#include "lldb/API/SBError.h"<br>#include "lldb/API/SBStream.h"<br><br>-#include "lldb/Core/Error.h"<br>#include "lldb/Core/Log.h"<br>#include "lldb/Interpreter/CommandReturnObject.h"<br><br>@@ -331,21 +329,3 @@ SBCommandReturnObject::Printf(const char<br>    return 0;<br>}<br><br>-void<br>-SBCommandReturnObject::SetError (lldb::SBError &error, const char *fallback_error_cstr)<br>-{<br>-    if (m_opaque_ap.get())<br>-    {<br>-        if (error.IsValid())<br>-            m_opaque_ap->SetError(error.ref(), fallback_error_cstr);<br>-        else if (fallback_error_cstr)<br>-            m_opaque_ap->SetError(Error(), fallback_error_cstr);<br>-    }<br>-}<br>-<br>-void<br>-SBCommandReturnObject::SetError (const char *error_cstr)<br>-{<br>-    if (m_opaque_ap.get() && error_cstr)<br>-        m_opaque_ap->SetError(error_cstr);<br>-}<br><br>Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=185560&r1=185559&r2=185560&view=diff">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=185560&r1=185559&r2=185560&view=diff</a><br>==============================================================================<br>--- lldb/trunk/source/Commands/CommandObjectCommands.cpp (original)<br>+++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Wed Jul  3 12:58:31 2013<br>@@ -1328,9 +1328,7 @@ protected:<br>            // Don't change the status if the command already set it...<br>            if (result.GetStatus() == eReturnStatusInvalid)<br>            {<br>-                if (result.GetErrorData() && result.GetErrorData()[0])<br>-                    result.SetStatus(eReturnStatusFailed);<br>-                else if (result.GetOutputData() == NULL || result.GetOutputData()[0] == '\0')<br>+                if (result.GetOutputData() == NULL || result.GetOutputData()[0] == '\0')<br>                    result.SetStatus(eReturnStatusSuccessFinishNoResult);<br>                else<br>                    result.SetStatus(eReturnStatusSuccessFinishResult);<br><br>Modified: lldb/trunk/source/Interpreter/CommandReturnObject.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandReturnObject.cpp?rev=185560&r1=185559&r2=185560&view=diff">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandReturnObject.cpp?rev=185560&r1=185559&r2=185560&view=diff</a><br>==============================================================================<br>--- lldb/trunk/source/Interpreter/CommandReturnObject.cpp (original)<br>+++ lldb/trunk/source/Interpreter/CommandReturnObject.cpp Wed Jul  3 12:58:31 2013<br>@@ -143,19 +143,9 @@ CommandReturnObject::SetError (const Err<br>    const char *error_cstr = error.AsCString();<br>    if (error_cstr == NULL)<br>        error_cstr = fallback_error_cstr;<br>-    SetError(error_cstr);<br>+    AppendError (error_cstr);<br>+    SetStatus (eReturnStatusFailed);<br>}<br>-<br>-void<br>-CommandReturnObject::SetError (const char *error_cstr)<br>-{<br>-    if (error_cstr)<br>-    {<br>-        AppendError (error_cstr);<br>-        SetStatus (eReturnStatusFailed);<br>-    }<br>-}<br>-<br>// Similar to AppendError, but do not prepend 'Error: ' to message, and<br>// don't append "\n" to the end of it.<br><br><br>Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=185560&r1=185559&r2=185560&view=diff">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=185560&r1=185559&r2=185560&view=diff</a><br>==============================================================================<br>--- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original)<br>+++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Wed Jul  3 12:58:31 2013<br>@@ -115,6 +115,7 @@ LLDBSwigPythonCallCommand (const char *p<br>                           const char *session_dictionary_name,<br>                           lldb::DebuggerSP& debugger,<br>                           const char* args,<br>+                           std::string& err_msg,<br>                           lldb_private::CommandReturnObject& cmd_retobj);<br><br>extern "C" bool<br>@@ -2969,7 +2970,7 @@ ScriptInterpreterPython::RunScriptBasedC<br>        return false;<br>    }<br><br>-    bool ret_val = false;<br>+    bool ret_val;<br><br>    std::string err_msg;<br><br>@@ -2994,11 +2995,12 @@ ScriptInterpreterPython::RunScriptBasedC<br>                                             m_dictionary_name.c_str(),<br>                                             debugger_sp,<br>                                             args,<br>+                                             err_msg,<br>                                             cmd_retobj);<br>    }<br><br>    if (!ret_val)<br>-        error.SetErrorString("unable to execute script function");<br>+        error.SetErrorString(err_msg.c_str());<br>    else<br>        error.Clear();<br><br><br>Modified: lldb/trunk/test/functionalities/command_script/welcome.py<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/command_script/welcome.py?rev=185560&r1=185559&r2=185560&view=diff">http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/command_script/welcome.py?rev=185560&r1=185559&r2=185560&view=diff</a><br>==============================================================================<br>--- lldb/trunk/test/functionalities/command_script/welcome.py (original)<br>+++ lldb/trunk/test/functionalities/command_script/welcome.py Wed Jul  3 12:58:31 2013<br>@@ -13,7 +13,9 @@ def target_name_impl(debugger, args, res<br>    file = target.GetExecutable()<br>    print >>result,  ('Current target ' + file.GetFilename())<br>    if args == 'fail':<br>-        result.SetError('a test for error in command')<br>+        return 'a test for error in command'<br>+    else:<br>+        return None<br><br>def print_wait_impl(debugger, args, result, dict):<br>    result.SetImmediateOutputFile(sys.stdout)<br>@@ -23,10 +25,11 @@ def print_wait_impl(debugger, args, resu<br>    print >>result,  ('Still doing long task..')<br>    time.sleep(1)<br>    print >>result,  ('Done; if you saw the delays I am doing OK')<br>+    return None<br><br>def check_for_synchro(debugger, args, result, dict):<br>    if debugger.GetAsync() == True:<br>        print >>result,  ('I am running async')<br>    if debugger.GetAsync() == False:<br>        print >>result,  ('I am running sync')<br>-<br>+    return None<br><br>Modified: lldb/trunk/test/help/TestHelp.py<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/test/help/TestHelp.py?rev=185560&r1=185559&r2=185560&view=diff">http://llvm.org/viewvc/llvm-project/lldb/trunk/test/help/TestHelp.py?rev=185560&r1=185559&r2=185560&view=diff</a><br>==============================================================================<br>--- lldb/trunk/test/help/TestHelp.py (original)<br>+++ lldb/trunk/test/help/TestHelp.py Wed Jul  3 12:58:31 2013<br>@@ -124,7 +124,7 @@ class HelpCommandTestCase(TestBase):<br>        """Command 'help image du line' is not ambiguous and should work."""<br>        # 'image' is an alias for 'target modules'.<br>        self.expect("help image du line",<br>-            substrs = ['Dump the line table for one or more compilation units'])<br>+            substrs = ['Dump the debug symbol file for one or more target modules'])<br><br>    def test_help_target_variable_syntax(self):<br>        """Command 'help target variable' should display <variable-name> ..."""<br><br><br>_______________________________________________<br>lldb-commits mailing list<br><a href="mailto:lldb-commits@cs.uiuc.edu">lldb-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits</a></div></blockquote></div><br></body></html>