Index: include/lldb/Interpreter/ScriptInterpreter.h =================================================================== --- include/lldb/Interpreter/ScriptInterpreter.h +++ include/lldb/Interpreter/ScriptInterpreter.h @@ -119,7 +119,7 @@ const char *session_dictionary_name, const lldb::ProcessSP& process_sp); - typedef uint32_t (*SWIGPythonCalculateNumChildren) (void *implementor); + typedef size_t (*SWIGPythonCalculateNumChildren) (void *implementor); typedef void* (*SWIGPythonGetChildAtIndex) (void *implementor, uint32_t idx); typedef int (*SWIGPythonGetIndexOfChildWithName) (void *implementor, const char* child_name); typedef void* (*SWIGPythonCastPyObjectToSBValue) (void* data); Index: scripts/Python/python-wrapper.swig =================================================================== --- scripts/Python/python-wrapper.swig +++ scripts/Python/python-wrapper.swig @@ -631,13 +631,14 @@ return py_return; } -SWIGEXPORT uint32_t +SWIGEXPORT size_t LLDBSwigPython_CalculateNumChildren ( PyObject *implementor ) { - uint32_t ret_val = UINT32_MAX; + size_t ret_val = UINT32_MAX; + bool int_match = false; static char callee_name[] = "num_children"; @@ -646,8 +647,27 @@ if (!py_return) return ret_val; - if (PyInt_Check(py_return)) - ret_val = PyInt_AsLong(py_return); + // PyInt_* are not available for Python 3 and above. +#if PY_MAJOR_VERSION < 3 + if (PyInt_Check (py_return)) + { + int_match = true; + ret_val = static_cast (PyInt_AsLong (py_return)); + } +#endif + + // We want to check for PyLong only if the return value did not + // match PyInt. This is because we do not want to call PyLong_Check if + // PyInt_Check returns true but PyInt_AsLong generates an error. + if (!int_match && PyLong_Check (py_return)) + { +#if PY_MAJOR_VERSION < 3 + ret_val = static_cast (PyLong_AsUnsignedLong (py_return)); +#else + // PyLong_AsSize_t is available only for Python 3 and above. + ret_val = PyLong_AsSize_t (py_return); +#endif + } Py_XDECREF(py_return); Index: source/API/SBCommandInterpreter.cpp =================================================================== --- source/API/SBCommandInterpreter.cpp +++ source/API/SBCommandInterpreter.cpp @@ -619,7 +619,7 @@ Event *event_sp, bool &got_error); -extern "C" uint32_t +extern "C" size_t LLDBSwigPython_CalculateNumChildren (void *implementor); extern "C" void * Index: source/Interpreter/ScriptInterpreterPython.cpp =================================================================== --- source/Interpreter/ScriptInterpreterPython.cpp +++ source/Interpreter/ScriptInterpreterPython.cpp @@ -2082,7 +2082,7 @@ if (!g_swig_calc_children) return 0; - uint32_t ret_val = 0; + size_t ret_val = 0; { Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN); Index: test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py =================================================================== --- test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py +++ test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py @@ -21,8 +21,6 @@ @dwarf_test @expectedFailureFreeBSD("llvm.org/pr20548") # fails to build on lab.llvm.org buildbot - @expectedFailureLinux('llvm.org/pr15301', ['icc']) # LLDB prints incorrect sizes of STL containers - @expectedFailureGcc # llvm.org/pr17499 The data formatter cannot parse STL containers def test_with_dwarf_and_run_command(self): """Test data formatter commands.""" self.buildDwarf() Index: test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/Makefile =================================================================== --- test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/Makefile +++ test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/Makefile @@ -5,4 +5,11 @@ CXXFLAGS := -O0 USE_LIBSTDCPP := 1 +# clang-3.5+ outputs FullDebugInfo by default for Darwin/FreeBSD +# # targets. Other targets do not, which causes this test to fail. +# # This flag enables FullDebugInfo for all targets. +ifneq (,$(findstring clang,$(CC))) + CFLAGS_EXTRAS += -fstandalone-debug +endif + include $(LEVEL)/Makefile.rules Index: test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py =================================================================== --- test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py +++ test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py @@ -21,16 +21,9 @@ @dwarf_test @skipIfFreeBSD - @expectedFailureLinux # non-core functionality, need to reenable and fix - # later (DES 2014.11.07). Most likely failing because - # of mis-match is version of libstdc++ supported by - # the data-formatters. @expectedFailureIcc # llvm.org/pr15301 LLDB prints incorrect sizes of STL containers - @expectedFailureGcc # llvm.org/pr17499 The data formatter cannot parse STL containers def test_with_dwarf_and_run_command(self): """Test data formatter commands.""" - if "gcc" in self.getCompiler() and "4.8" in self.getCompilerVersion(): - self.skipTest("llvm.org/pr15301 LLDB prints incorrect sizes of STL containers") self.buildDwarf() self.data_formatter_commands()