From 6d3689fcf6cff397187028344570489db3e6ecf4 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Thu, 26 Nov 2020 14:16:10 +0100 Subject: [PATCH] sync: print proper lock order location when double lock is detected Before: ``` Assertion failed: detected double lock at src/sync.cpp:153, details in debug log. ``` After: ``` Assertion failed: detected double lock for 'm' in src/test/sync_tests.cpp:40 (in thread ''), details in debug log. ``` --- src/sync.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sync.cpp b/src/sync.cpp index 2e431720e6c..2160940952a 100644 --- a/src/sync.cpp +++ b/src/sync.cpp @@ -150,7 +150,9 @@ static void double_lock_detected(const void* mutex, LockStack& lock_stack) LogPrintf(" %s\n", i.second.ToString()); } if (g_debug_lockorder_abort) { - tfm::format(std::cerr, "Assertion failed: detected double lock at %s:%i, details in debug log.\n", __FILE__, __LINE__); + tfm::format(std::cerr, + "Assertion failed: detected double lock for %s, details in debug log.\n", + lock_stack.back().second.ToString()); abort(); } throw std::logic_error("double lock detected");