diff --git a/libcxx/test/pretty_printers/gdb_pretty_printer_test.py b/libcxx/test/pretty_printers/gdb_pretty_printer_test.py --- a/libcxx/test/pretty_printers/gdb_pretty_printer_test.py +++ b/libcxx/test/pretty_printers/gdb_pretty_printer_test.py @@ -50,8 +50,7 @@ check_literal = expectation_val.string() test_fails = not re.match(check_literal, value) else: - check_literal_string = expectation_val.string(encoding="utf-8") - check_literal = check_literal_string.encode("utf-8") + check_literal = expectation_val.string(encoding="utf-8") test_fails = value != check_literal if test_fails: diff --git a/libcxx/utils/gdb/libcxx/printers.py b/libcxx/utils/gdb/libcxx/printers.py --- a/libcxx/utils/gdb/libcxx/printers.py +++ b/libcxx/utils/gdb/libcxx/printers.py @@ -15,6 +15,12 @@ import re import gdb +import sys + +if sys.version_info >= (3, 0): + py3k = True +else: + py3k = False # One under-documented feature of the gdb pretty-printer API # is that clients can call any other member of the API @@ -131,18 +137,23 @@ def __init__(self, val): self.val = val self.child_iter = iter(self.val["__base_"].type.fields()) + if not py3k: + self.child_iter.next == self.child_iter.__next__ self.count = 0 def __iter__(self): return self - def next(self): + def __next__(self): # child_iter raises StopIteration when appropriate. - field_name = self.child_iter.next() + field_name = self.child_iter.__next__() child = self.val["__base_"][field_name]["__value_"] self.count += 1 return ("[%d]" % self.count, child) + if not py3k: + next = __next__ + def __init__(self, val): self.val = val @@ -315,7 +326,7 @@ def __iter__(self): return self - def next(self): + def __next__(self): """Retrieve the next element.""" self.count += 1 @@ -332,6 +343,9 @@ self.offset = 0 return ("[%d]" % self.count, outbit) + if not py3k: + next = __next__ + class _VectorIterator(object): """Class to iterate over the non-bool vector's children.""" @@ -343,7 +357,7 @@ def __iter__(self): return self - def next(self): + def __next__(self): self.count += 1 if self.item == self.end: raise StopIteration @@ -351,6 +365,9 @@ self.item += 1 return ("[%d]" % self.count, entry) + if not py3k: + next = __next__ + def __init__(self, val): """Set val, length, capacity, and iterator for bool and normal vectors.""" self.val = val @@ -404,7 +421,7 @@ while value: index += 1 will_yield = value % 2 - value /= 2 + value //= 2 if will_yield: yield index diff --git a/libcxxabi/cmake/config-ix.cmake b/libcxxabi/cmake/config-ix.cmake --- a/libcxxabi/cmake/config-ix.cmake +++ b/libcxxabi/cmake/config-ix.cmake @@ -7,6 +7,7 @@ check_library_exists(c fopen "" LIBCXXABI_HAS_C_LIB) if (NOT LIBCXXABI_USE_COMPILER_RT) check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXXABI_HAS_GCC_S_LIB) + check_library_exists(gcc __aeabi_uldivmod "" LIBCXXABI_HAS_GCC_LIB) endif () # libc++abi is built with -nodefaultlibs, so we want all our checks to also @@ -26,8 +27,13 @@ list(APPEND CMAKE_REQUIRED_FLAGS -rtlib=compiler-rt) find_compiler_rt_library(builtins LIBCXXABI_BUILTINS_LIBRARY) list(APPEND CMAKE_REQUIRED_LIBRARIES "${LIBCXXABI_BUILTINS_LIBRARY}") - elseif (LIBCXXABI_HAS_GCC_S_LIB) - list(APPEND CMAKE_REQUIRED_LIBRARIES gcc_s) + else () + if (LIBCXXABI_HAS_GCC_S_LIB) + list(APPEND CMAKE_REQUIRED_LIBRARIES gcc_s) + endif () + if (LIBCXXABI_HAS_GCC_LIB) + list(APPEND CMAKE_REQUIRED_LIBRARIES gcc) + endif () endif () if (MINGW) # Mingw64 requires quite a few "C" runtime libraries in order for basic diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt --- a/libcxxabi/src/CMakeLists.txt +++ b/libcxxabi/src/CMakeLists.txt @@ -91,6 +91,10 @@ list(APPEND LIBCXXABI_LIBRARIES ${MINGW_LIBRARIES}) endif() +if (NOT LIBCXXABI_USE_COMPILER_RT) + add_library_flags_if(LIBCXXABI_HAS_GCC_LIB gcc) +endif () + # Setup flags. add_link_flags_if_supported(-nodefaultlibs)