mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-04 03:44:59 +00:00
[tsan] workaround for a crash in deadlock detector, bug https://github.com/google/sanitizers/issues/594
llvm-svn: 246592
This commit is contained in:
parent
b8ed364d8a
commit
94dd76aefa
@ -472,7 +472,7 @@ void ReportDeadlock(ThreadState *thr, uptr pc, DDReport *r) {
|
||||
for (int i = 0; i < r->n; i++) {
|
||||
for (int j = 0; j < (flags()->second_deadlock_stack ? 2 : 1); j++) {
|
||||
u32 stk = r->loop[i].stk[j];
|
||||
if (stk) {
|
||||
if (stk && stk != 0xffffffff) {
|
||||
rep.AddStack(StackDepotGet(stk), true);
|
||||
} else {
|
||||
// Sometimes we fail to extract the stack trace (FIXME: investigate),
|
||||
|
@ -498,6 +498,19 @@ class LockTest {
|
||||
delete [] l;
|
||||
}
|
||||
|
||||
void Test19() {
|
||||
if (test_number > 0 && test_number != 19) return;
|
||||
fprintf(stderr, "Starting Test19: lots of lock inversions\n");
|
||||
const int kNumLocks = 45;
|
||||
Init(kNumLocks);
|
||||
for (int i = 0; i < kNumLocks; i++) {
|
||||
for (int j = 0; j < kNumLocks; j++)
|
||||
L((i + j) % kNumLocks);
|
||||
for (int j = 0; j < kNumLocks; j++)
|
||||
U((i + j) % kNumLocks);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void Lock2(size_t l1, size_t l2) { L(l1); L(l2); U(l2); U(l1); }
|
||||
|
||||
@ -602,6 +615,7 @@ int main(int argc, char **argv) {
|
||||
LockTest().Test16();
|
||||
LockTest().Test17();
|
||||
LockTest().Test18();
|
||||
LockTest().Test19();
|
||||
fprintf(stderr, "ALL-DONE\n");
|
||||
// CHECK: ALL-DONE
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user