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

Toolchain gcc-generated debug symbols may be malformed

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Server Development Platform
    • Fully Compatible
    • Dev Platform 2021-08-23, Dev Platform 2021-09-20, Dev Platform 2021-10-04, Dev Platform 2021-10-18, Dev Platform 2021-11-29

      The toolchain gcc generated debug symbols can't be read entirely by the toolchain's llvm-symbolizer; there are line numbers missing and maybe other issues. This is possibly only affecting statically linked binaries as some shared library builds and possibly only mongod. Static mongos and shared libraries seem to be fine.

      Using llvm-symbolizer-10 and above works. Drew tried 10 and I tried 12.

      Copying some of Drew's research from Slack for context:

      Running various versions of llvm-symbolizer

      andrew@acm-workstation:~/asdf/dist-test/bin$ time llvm-symbolizer-7 --obj=./mongod <<< 0x2D5A0F0
      mongo::LockRequestList::push_back(mongo::LockRequest*)
      ??:0:0
      real	0m0.905s
      user	0m0.828s
      sys	0m0.061s
      andrew@acm-workstation:~/asdf/dist-test/bin$ time llvm-symbolizer-8 --obj=./mongod <<< 0x2D5A0F0
      mongo::LockRequestList::push_back(mongo::LockRequest*)
      ??:0:0
      real	0m0.905s
      user	0m0.816s
      sys	0m0.073s
      andrew@acm-workstation:~/asdf/dist-test/bin$ time llvm-symbolizer-9 --obj=./mongod <<< 0x2D5A0F0
      mongo::LockRequestList::push_back(mongo::LockRequest*)
      ??:0:0
      real	0m0.889s
      user	0m0.810s
      sys	0m0.060s
      andrew@acm-workstation:~/asdf/dist-test/bin$ time llvm-symbolizer-10 --obj=./mongod <<< 0x2D5A0F0
      mongo::LockRequestList::push_back(mongo::LockRequest*)
      /data/mci/49914e6e89befead31fc1fecb83f2a54/src/src/mongo/db/concurrency/lock_request_list.h:74:25
      real	0m7.524s
      user	0m7.100s
      sys	0m0.404s
      

      Checking the debug symbols format with dwarfdump:

      # mongod
      # $ dwarfdump -ka ./mongod.debug
      dwarfdump ERROR:  Failure reading CU header or DIE, corrupt DWARF:  DW_DLE_READ_ERROR(419). Read failed, corrupt object. Attempting to continue.
      dwarfdump ERROR:  attempting to print .debug_info:  DW_DLE_READ_ERROR(419). Read failed, corrupt object (419)
      attempting to continue.
      dwarfdump ERROR:  dwarf_get_aranges:  DW_DLE_READ_ERROR(419). Read failed, corrupt object
      
      # mongos
      *** DWARF CHECK: DW_TAG_enumeration_type -> DW_AT_encoding: check the tag-attr combination ***
      CU Name = src/mongo/s/mongos.cpp
      CU Producer = GNU C++17 8.5.0 -march=sandybridge -mtune=generic -mprefer-vector-width=128 -ggdb -O2 -std=c++17 -fsized-deallocation -fasynchronous-unwind-tables -fno-omit-frame-pointer -fno-strict-aliasing -fstack-protector-strong -fno-builtin-memcmp -fPIE
      DIE OFF = 0x00000036 GOFF = 0x00000036, Low PC = 0x00000000, High PC = unknown
      DW_AT_encoding              DW_ATE_signed
      *** DWARF CHECK: DW_TAG_enumeration_type -> DW_AT_encoding: check the tag-attr combination ***
      

      readelf seems to work for both mongod and mongos with both showing debug symbols and source files.

            Assignee:
            alex.neben@mongodb.com Alex Neben
            Reporter:
            robert.guo@mongodb.com Robert Guo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: