This change fixes two issues that arise when compiling libunwind with GCC and specifying the flag "-D_GLIBCXX_DEBUG". The first issue is that there is no overloaded != operator for libunwind::EHABISectionIterator:
In file included from /usr/local/google/home/chadduffin/raspi_tools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/include/c++/4.8.3/debug/debug.h:127:0, from /usr/local/google/home/chadduffin/raspi_tools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/include/c++/4.8.3/bits/stl_iterator_base_funcs.h:65, from /usr/local/google/home/chadduffin/raspi_tools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/include/c++/4.8.3/bits/stl_algobase.h:66, from /usr/local/google/home/chadduffin/raspi_tools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/include/c++/4.8.3/algorithm:61, from ../../third_party/llvm-project/libunwind/src/libunwind.cpp:19: /usr/local/google/home/chadduffin/raspi_tools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/include/c++/4.8.3/debug/functions.h: In instantiation of ‘bool __gnu_debug::__check_partitioned_upper(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = libunwind::EHABISectionIterator<libunwind::LocalAddressSpace>; _Tp = unsigned int]’: /usr/local/google/home/chadduffin/raspi_tools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/include/c++/4.8.3/bits/stl_algo.h:2483:7: required from ‘_FIter std::upper_bound(_FIter, _FIter, const _Tp&) [with _FIter = libunwind::EHABISectionIterator<libunwind::LocalAddressSpace>; _Tp = unsigned int]’ ../../third_party/llvm-project/libunwind/src/UnwindCursor.hpp:806:69: required from ‘bool libunwind::UnwindCursor<A, R>::getInfoFromEHABISection(libunwind::UnwindCursor<A, R>::pint_t, const libunwind::UnwindInfoSections&) [with A = libunwind::LocalAddressSpace; R = libunwind::Registers_arm; libunwind::UnwindCursor<A, R>::pint_t = unsigned int]’ ../../third_party/llvm-project/libunwind/src/UnwindCursor.hpp:1320:32: required from ‘void libunwind::UnwindCursor<A, R>::setInfoBasedOnIPRegister(bool) [with A = libunwind::LocalAddressSpace; R = libunwind::Registers_arm]’ ../../third_party/llvm-project/libunwind/src/libunwind.cpp:420:1: required from here /usr/local/google/home/chadduffin/raspi_tools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/include/c++/4.8.3/debug/functions.h:372:22: error: no match for ‘operator!=’ (operand types are ‘libunwind::EHABISectionIterator<libunwind::LocalAddressSpace>’ and ‘libunwind::EHABISectionIterator<libunwind::LocalAddressSpace>’) while (__first != __last && !(__value < *__first))
The next issue was that the overloaded - operator was not a const member:
In file included from /usr/local/google/home/chadduffin/raspi_tools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/include/c++/4.8.3/debug/debug.h:127:0, from /usr/local/google/home/chadduffin/raspi_tools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/include/c++/4.8.3/bits/stl_iterator_base_funcs.h:65, from /usr/local/google/home/chadduffin/raspi_tools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/include/c++/4.8.3/bits/stl_algobase.h:66, from /usr/local/google/home/chadduffin/raspi_tools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/include/c++/4.8.3/algorithm:61, from ../../third_party/llvm-project/libunwind/src/libunwind.cpp:19: /usr/local/google/home/chadduffin/raspi_tools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/include/c++/4.8.3/debug/functions.h: In instantiation of ‘bool __gnu_debug::__valid_range_aux2(const _RandomAccessIterator&, const _RandomAccessIterator&, std::random_access_iterator_tag) [with _RandomAccessIterator = libunwind::EHABISectionIterator<libunwind::LocalAddressSpace>]’: /usr/local/google/home/chadduffin/raspi_tools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/include/c++/4.8.3/debug/functions.h:122:43: required from ‘bool __gnu_debug::__valid_range_aux(const _InputIterator&, const _InputIterator&, std::__false_type) [with _InputIterator = libunwind::EHABISectionIterator<libunwind::LocalAddressSpace>]’ /usr/local/google/home/chadduffin/raspi_tools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/include/c++/4.8.3/debug/functions.h:134:60: required from ‘bool __gnu_debug::__valid_range(const _InputIterator&, const _InputIterator&) [with _InputIterator = libunwind::EHABISectionIterator<libunwind::LocalAddressSpace>]’ /usr/local/google/home/chadduffin/raspi_tools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/include/c++/4.8.3/bits/stl_algo.h:2483:7: required from ‘_FIter std::upper_bound(_FIter, _FIter, const _Tp&) [with _FIter = libunwind::EHABISectionIterator<libunwind::LocalAddressSpace>; _Tp = unsigned int]’ ../../third_party/llvm-project/libunwind/src/UnwindCursor.hpp:813:69: required from ‘bool libunwind::UnwindCursor<A, R>::getInfoFromEHABISection(libunwind::UnwindCursor<A, R>::pint_t, const libunwind::UnwindInfoSections&) [with A = libunwind::LocalAddressSpace; R = libunwind::Registers_arm; libunwind::UnwindCursor<A, R>::pint_t = unsigned int]’ ../../third_party/llvm-project/libunwind/src/UnwindCursor.hpp:1327:32: required from ‘void libunwind::UnwindCursor<A, R>::setInfoBasedOnIPRegister(bool) [with A = libunwind::LocalAddressSpace; R = libunwind::Registers_arm]’ ../../third_party/llvm-project/libunwind/src/libunwind.cpp:420:1: required from here /usr/local/google/home/chadduffin/raspi_tools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/include/c++/4.8.3/debug/functions.h:93:21: error: passing ‘const libunwind::EHABISectionIterator<libunwind::LocalAddressSpace>’ as ‘this’ argument of ‘size_t libunwind::EHABISectionIterator<A>::operator-(const _Self&) [with A = libunwind::LocalAddressSpace; size_t = unsigned int; libunwind::EHABISectionIterator<A>::_Self = libunwind::EHABISectionIterator<libunwind::LocalAddressSpace>]’ discards qualifiers [-fpermissive] { return __last - __first >= 0; }
With both of these operators overloaded the issue is resolved.