summaryrefslogtreecommitdiff
path: root/buildscripts/gdb
diff options
context:
space:
mode:
authorMax Hirschhorn <max.hirschhorn@mongodb.com>2018-08-02 10:28:14 -0400
committerMax Hirschhorn <max.hirschhorn@mongodb.com>2018-08-02 10:28:14 -0400
commit684d7fce79006ba7d18ddf44e67a2f1aec6f8fbb (patch)
treee96a5e83ecfcd759ac7246a12a0a896ad0931b7f /buildscripts/gdb
parent5e97e5813e7ad1127d79454e52fcfe49ed129096 (diff)
downloadmongo-684d7fce79006ba7d18ddf44e67a2f1aec6f8fbb.tar.gz
SERVER-36230 Handle non-templatized LockerImpl class in gdb scripts.
Diffstat (limited to 'buildscripts/gdb')
-rw-r--r--buildscripts/gdb/mongo_lock.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/buildscripts/gdb/mongo_lock.py b/buildscripts/gdb/mongo_lock.py
index 62ba46f8194..18f5228c78f 100644
--- a/buildscripts/gdb/mongo_lock.py
+++ b/buildscripts/gdb/mongo_lock.py
@@ -303,7 +303,10 @@ def find_mutex_holder(graph, thread_dict, show):
def find_lock_manager_holders(graph, thread_dict, show): # pylint: disable=too-many-locals
"""Find lock manager holders."""
- frame = find_frame(r'mongo::LockerImpl\<.*\>::')
+ # In versions of MongoDB 4.0 and older, the LockerImpl class is templatized with a boolean
+ # parameter. With the removal of the MMAPv1 storage engine in MongoDB 4.2, the LockerImpl class
+ # is no longer templatized.
+ frame = find_frame(r'mongo::LockerImpl(?:\<.*\>)?::')
if not frame:
return
@@ -312,7 +315,16 @@ def find_lock_manager_holders(graph, thread_dict, show): # pylint: disable=too-
(_, lock_waiter_lwpid, _) = gdb.selected_thread().ptid
lock_waiter = thread_dict[lock_waiter_lwpid]
- locker_ptr_type = gdb.lookup_type("mongo::LockerImpl<false>").pointer()
+ try:
+ locker_ptr_type = gdb.lookup_type("mongo::LockerImpl<false>").pointer()
+ except gdb.error as err:
+ # If we don't find the templatized version of the LockerImpl class, then we try to find the
+ # non-templatized version.
+ if not err.args[0].startswith("No type named"):
+ raise
+
+ locker_ptr_type = gdb.lookup_type("mongo::LockerImpl").pointer()
+
lock_head = gdb.parse_and_eval(
"mongo::getGlobalLockManager()->_getBucket(resId)->findOrInsert(resId)")