Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-38757

Using abseil hash maps for stdx::unordered_map breaks GDB pretty printing

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.1.7
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • Security 2019-01-28
    • 0

      The change to use the abseil hash map implementation for stdx::unordered_map in SERVER-38249 breaks pretty printing of hash maps in GDB when using the standard C++ pretty printer library. Trying to print a simple hash map in GDB now appears like this:

      myMap = {
        <absl::container_internal::raw_hash_map<absl::container_internal::NodeHashMapPolicy<int, int>, absl::hash_internal::Hash<int>, std::equal_to<int>, std::allocator<std::pair<int const, int> > >> = {
          <absl::container_internal::raw_hash_set<absl::container_internal::NodeHashMapPolicy<int, int>, absl::hash_internal::Hash<int>, std::equal_to<int>, std::allocator<std::pair<int const, int> > >> = {
            static kMaxLoadFactorNumerator = 14,
            static kMaxLoadFactorDenominator = 16,
            static kMaxLoadFactor = 0.875,
            ctrl_ = 0x7ffff0eabe20 "\200\200\200\006\200\200\200\200\200\200\200\200\200-\200\377\200\200\200\006\200\200\200\200\200\200\200\200\200-\200", '\253' <repeats 25 times>, "\340\371\352\360\377\177"
      ,
            slots_ = 0x7ffff0eabe40,
            size_ = 2,
            capacity_ = 15,
            settings_ = {
              <absl::container_internal::internal_compressed_tuple::CompressedTupleImpl<absl::container_internal::CompressedTuple<unsigned long, absl::hash_internal::Hash<int>, std::equal_to<int>, std::allocato
      r<std::pair<int const, int> > >, absl::integer_sequence<unsigned long, 0, 1, 2, 3> >> = {
                <absl::container_internal::internal_compressed_tuple::Storage<absl::container_internal::CompressedTuple<unsigned long, absl::hash_internal::Hash<int>, std::equal_to<int>, std::allocator<std::pai
      r<int const, int> > >, 0, false>> = {
                  value = 11
                },
                <absl::container_internal::internal_compressed_tuple::Storage<absl::container_internal::CompressedTuple<unsigned long, absl::hash_internal::Hash<int>, std::equal_to<int>, std::allocator<std::pai
      r<int const, int> > >, 1, true>> = {
                  <absl::hash_internal::Hash<int>> = {
                    <absl::hash_internal::HashImpl<int>> = {<No data fields>}, <No data fields>}, <No data fields>},
                <absl::container_internal::internal_compressed_tuple::Storage<absl::container_internal::CompressedTuple<unsigned long, absl::hash_internal::Hash<int>, std::equal_to<int>, std::allocator<std::pair<int const, int> > >, 2, true>> = {
                  <std::equal_to<int>> = {
                    <std::binary_function<int, int, bool>> = {<No data fields>}, <No data fields>}, <No data fields>},
                <absl::container_internal::internal_compressed_tuple::Storage<absl::container_internal::CompressedTuple<unsigned long, absl::hash_internal::Hash<int>, std::equal_to<int>, std::allocator<std::pair<int const, int> > >, 3, true>> = {
                  <std::allocator<std::pair<int const, int> >> = {
                    <__gnu_cxx::new_allocator<std::pair<int const, int> >> = {<No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}
          }, <No data fields>}, <No data fields>}
      

      where it previously would have appeared as

      myMap = std::unordered_map with 2 elements = {
        [2] = 20,
        [1] = 10
      }
      

            Assignee:
            mark.benvenuto@mongodb.com Mark Benvenuto
            Reporter:
            william.schultz@mongodb.com Will Schultz
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: