From 5ff95e345aad15c5bfdb4986b42051233617c555 Mon Sep 17 00:00:00 2001 From: Nicholas Zolnierz Date: Fri, 3 Jun 2022 18:14:34 +0000 Subject: SERVER-62043 Gracefully handle missing ABT types in gdb --- buildscripts/gdb/mongo_printers.py | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'buildscripts') diff --git a/buildscripts/gdb/mongo_printers.py b/buildscripts/gdb/mongo_printers.py index 29844d2a98b..551809314ec 100644 --- a/buildscripts/gdb/mongo_printers.py +++ b/buildscripts/gdb/mongo_printers.py @@ -922,20 +922,23 @@ class MemoPrinter(OptimizerTypePrinter): def register_abt_printers(pp): """Registers a number of pretty printers related to the CQF optimizer.""" - # ABT printer. - abt_type = gdb.lookup_type("mongo::optimizer::ABT").strip_typedefs() - pp.add('ABT', abt_type.name, True, ABTPrinter) - - # IntervalRequirement printer. - pp.add("Interval", "mongo::optimizer::IntervalRequirement", False, IntervalPrinter) - - # PartialSchemaRequirements printer. - schema_req_type = gdb.lookup_type( - "mongo::optimizer::PartialSchemaRequirements").strip_typedefs() - pp.add("PartialSchemaRequirements", schema_req_type.name, False, PartialSchemaReqMapPrinter) - - # Memo printer. - pp.add("Memo", "mongo::optimizer::cascades::Memo", False, MemoPrinter) + try: + # ABT printer. + abt_type = gdb.lookup_type("mongo::optimizer::ABT").strip_typedefs() + pp.add('ABT', abt_type.name, True, ABTPrinter) + + # IntervalRequirement printer. + pp.add("Interval", "mongo::optimizer::IntervalRequirement", False, IntervalPrinter) + + # PartialSchemaRequirements printer. + schema_req_type = gdb.lookup_type( + "mongo::optimizer::PartialSchemaRequirements").strip_typedefs() + pp.add("PartialSchemaRequirements", schema_req_type.name, False, PartialSchemaReqMapPrinter) + + # Memo printer. + pp.add("Memo", "mongo::optimizer::cascades::Memo", False, MemoPrinter) + except gdb.error as gdberr: + print("Failed to add one or more ABT pretty printers, skipping: " + str(gdberr)) def build_pretty_printer(): -- cgit v1.2.1