forked from OSchip/llvm-project
[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 i = 0; i < r->n; i++) {
|
||||||
for (int j = 0; j < (flags()->second_deadlock_stack ? 2 : 1); j++) {
|
for (int j = 0; j < (flags()->second_deadlock_stack ? 2 : 1); j++) {
|
||||||
u32 stk = r->loop[i].stk[j];
|
u32 stk = r->loop[i].stk[j];
|
||||||
if (stk) {
|
if (stk && stk != 0xffffffff) {
|
||||||
rep.AddStack(StackDepotGet(stk), true);
|
rep.AddStack(StackDepotGet(stk), true);
|
||||||
} else {
|
} else {
|
||||||
// Sometimes we fail to extract the stack trace (FIXME: investigate),
|
// Sometimes we fail to extract the stack trace (FIXME: investigate),
|
||||||
|
|
|
@ -498,6 +498,19 @@ class LockTest {
|
||||||
delete [] l;
|
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:
|
private:
|
||||||
void Lock2(size_t l1, size_t l2) { L(l1); L(l2); U(l2); U(l1); }
|
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().Test16();
|
||||||
LockTest().Test17();
|
LockTest().Test17();
|
||||||
LockTest().Test18();
|
LockTest().Test18();
|
||||||
|
LockTest().Test19();
|
||||||
fprintf(stderr, "ALL-DONE\n");
|
fprintf(stderr, "ALL-DONE\n");
|
||||||
// CHECK: ALL-DONE
|
// CHECK: ALL-DONE
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue