Bazel gdb_v5 has an issue with breakpoints on non debug builds

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • DevProd Build
    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

       

      There's a bug in the version of GDB produced by our bazel gdb_v5 target which prevents breakpoints being set. This is most relevant to the VSCode debugging work that I did. I've used AI to help give a hypothesis about this error which I've read through and it makes sense. It seems to be likely related to the bug filed here:

      https://sourceware.org/pipermail/gdb-patches/2025-March/216349.html

      I'll refrain from posting the full AI explanation but long story short this bug prevents dwo file from being reached. This means that every time split DWARF is enabled, deeper source level metadata like line numbers can't be accessed, and therefore breakpoints can't be set

      This is fixed in GDB 17.2. The change introducing this bug also doesn't exist on the toolchain's /opt/mongodbtoolchain/v5/bin/gdb, which is GDB v15.2. The bug doesn't occur there, and I've verified that breakpoints can be set in the toolchain gdb.

       

      When I separately try to set breakpoints using gdb_v5 outside of VSCode, I get this error (which I'm not sure is the same error described above, but I did test this on /opt/mongodbtoolchain's gdb and it works):

      *[lia394126/vscode-debug][~/mongo4]$ bazel build +bson_test
      
      ...
      
      *[lia394126/vscode-debug][~/mongo4]$ bazel run gdb -- bazel-bin/src/mongo/bson/bson_test
      INFO: running wrapper hook...
      INFO: pre-build generation: 812.3 ms
      INFO: Invocation ID: e6a7933d-7084-4ab2-9859-20c6bd7c4e14
      INFO: Streaming build results to: https://sodalite.cluster.engflow.com/invocation/e6a7933d-7084-4ab2-9859-20c6bd7c4e14
      INFO: Analyzed target //:gdb (3 packages loaded, 7 targets configured).
      INFO: Found 1 target...
      Target @@gdb_v5//:gdb up-to-date:
        bazel-bin/external/gdb_v5/gdb
      
      ...
      GNU gdb (GDB) 17.1
      Copyright (C) 2025 Free Software Foundation, Inc.
      ...
      (gdb) b bson_field_test.cpp:47
      ❌️ DWARF Error: unexpected tag 'DW_TAG_skeleton_unit' at offset 0x3f0 

       

       

            Assignee:
            Daniel Moody
            Reporter:
            Alex Li
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: