@@ -60,7 +60,7 @@ struct CLockLocation {
60
60
std::string ToString () const
61
61
{
62
62
return strprintf (
63
- " %s %s:%s%s (in thread %s )" ,
63
+ " '%s' in %s:%s%s (in thread '%s' )" ,
64
64
mutexName, sourceFile, sourceLine, (fTry ? " (TRY)" : " " ), m_thread_name);
65
65
}
66
66
@@ -105,7 +105,7 @@ static void potential_deadlock_detected(const LockPair& mismatch, const LockStac
105
105
{
106
106
LogPrintf (" POTENTIAL DEADLOCK DETECTED\n " );
107
107
LogPrintf (" Previous lock order was:\n " );
108
- for (const LockStackItem& i : s2 ) {
108
+ for (const LockStackItem& i : s1 ) {
109
109
if (i.first == mismatch.first ) {
110
110
LogPrintf (" (1)" ); /* Continued */
111
111
}
@@ -114,21 +114,25 @@ static void potential_deadlock_detected(const LockPair& mismatch, const LockStac
114
114
}
115
115
LogPrintf (" %s\n " , i.second .ToString ());
116
116
}
117
+
118
+ std::string mutex_a, mutex_b;
117
119
LogPrintf (" Current lock order is:\n " );
118
- for (const LockStackItem& i : s1 ) {
120
+ for (const LockStackItem& i : s2 ) {
119
121
if (i.first == mismatch.first ) {
120
122
LogPrintf (" (1)" ); /* Continued */
123
+ mutex_a = i.second .Name ();
121
124
}
122
125
if (i.first == mismatch.second ) {
123
126
LogPrintf (" (2)" ); /* Continued */
127
+ mutex_b = i.second .Name ();
124
128
}
125
129
LogPrintf (" %s\n " , i.second .ToString ());
126
130
}
127
131
if (g_debug_lockorder_abort) {
128
- tfm::format (std::cerr, " Assertion failed: detected inconsistent lock order at %s:%i , details in debug log.\n " , __FILE__, __LINE__ );
132
+ tfm::format (std::cerr, " Assertion failed: detected inconsistent lock order for %s, details in debug log.\n " , s2. back (). second . ToString () );
129
133
abort ();
130
134
}
131
- throw std::logic_error (" potential deadlock detected" );
135
+ throw std::logic_error (strprintf ( " potential deadlock detected: %s -> %s -> %s " , mutex_b, mutex_a, mutex_b) );
132
136
}
133
137
134
138
static void push_lock (void * c, const CLockLocation& locklocation)
0 commit comments