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);
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";
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<size_t> (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<size_t> (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);
Event *event_sp,
bool &got_error);
-extern "C" uint32_t
+extern "C" size_t
LLDBSwigPython_CalculateNumChildren (void *implementor);
extern "C" void *
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);
@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()
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
@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()