In gdb python, lookup_type can't see all types

XMLWordPrintableJSON

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

      While maintaining some of our pretty printers, I've encountered an issue with debug symbols in mongod maybe not being fully loaded. To reproduce the exact issues is a bit complicated, but I'll also give simpler repros.

      First, run the attached jstest (python buildscripts/resmoke.py run test.js). This will set up a replica set with the primary on port 20040 with a bunch of sessions in the primary's session catalog. Then, attach gdb to the primary. To do so, you can run lsof -i :20040 and attach to the PID with the NAME column is *:20040 (LISTEN) by running bazel run --config=dbg gdb – -p <pid>.

      Now, run mongod-dump-sessions. You'll encounter the first issue: No type named <very long type name I've excluded for readability>. If you jump up to the frame for main and then back down (for example, run frame 8 then frame 0), that error will go away and you'll have a different problem:

      (gdb) mongod-dump-sessions
      Dumping 20 Session objects from the SessionCatalog
      Traceback (most recent call last):
        File "buildscripts/gdb/mongo.py", line 486, in invoke
          lsids_to_print = [str(s["first"]["_id"]) for s in session_kv_pairs]
        File "buildscripts/gdb/mongo.py", line 486, in <listcomp>
          lsids_to_print = [str(s["first"]["_id"]) for s in session_kv_pairs]
      gdb.error: There is no member named first.
      Error occurred in Python: There is no member named first.
      

      The issue here seems to be that std::pair<mongo::LogicalSessionId const, std::unique_ptr<mongo::SessionCatalog::SessionRuntimeInfo, std::default_delete<mongo::SessionCatalog::SessionRuntimeInfo> > > is an incomplete type according to gdb. Running python pair = get_session_kv_pairs()[0] followed by python print(pair.dereference()) gives <incomplete type>. I think this is also an issues with debug symbols, but to be honest, I'm not really sure.

        1. test.js
          0.5 kB
          Ryan Berryhill

            Assignee:
            Unassigned
            Reporter:
            Ryan Berryhill
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: