From e851e566d4aee6770ac4f347b80373492d46e674 Mon Sep 17 00:00:00 2001 From: Christian Sigg Date: Mon, 26 Oct 2020 22:13:59 +0100 Subject: [PATCH] [mlir] Fix TypeID lookup in GDB pretty printers. The TypeID instance was moved in D89153. It wasn't caught that it broke MLIR pretty printers because pre-merge checks don't run check-debuginfo. Avoid disabling all MLIR printers in case this happens again by catching the exception. Reviewed By: stellaraccident Differential Revision: https://reviews.llvm.org/D90191 --- mlir/utils/gdb-scripts/prettyprinters.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mlir/utils/gdb-scripts/prettyprinters.py b/mlir/utils/gdb-scripts/prettyprinters.py index 39246bf..6dd97c6 100644 --- a/mlir/utils/gdb-scripts/prettyprinters.py +++ b/mlir/utils/gdb-scripts/prettyprinters.py @@ -103,8 +103,12 @@ class StorageTypeMap: self.map = {} for type_name in self.type_names: concrete_type = gdb.lookup_type(type_name) - storage = gdb.parse_and_eval( - "&'mlir::TypeID::get<%s>()::instance'" % type_name) + try: + storage = gdb.parse_and_eval( + "&'mlir::detail::TypeIDExported::get<%s>()::instance'" % type_name) + except gdb.error: + # Skip when TypeID instance cannot be found in current context. + continue if concrete_type and storage: self.map[int(storage)] = concrete_type -- 2.7.4