diff options
| author | Kostya Serebryany <kcc@google.com> | 2014-03-17 14:41:36 +0000 |
|---|---|---|
| committer | Kostya Serebryany <kcc@google.com> | 2014-03-17 14:41:36 +0000 |
| commit | 897653962728e595f52ddd55382253c1d4dbabc8 (patch) | |
| tree | 14faf049214a5e9690af6460cd81f8300ef61107 /compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h | |
| parent | 1fd6f1f8d6ce5dda212260c90a357f93087de536 (diff) | |
| download | bcm5719-llvm-897653962728e595f52ddd55382253c1d4dbabc8.tar.gz bcm5719-llvm-897653962728e595f52ddd55382253c1d4dbabc8.zip | |
[sanitizer] make the deadlock detector print 2*N stack traces on lock-order-inversion with N locks (i.e. print stack traces for both lock acquisitions in every edge in the graph). More improvements to follow
llvm-svn: 204042
Diffstat (limited to 'compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h')
| -rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h b/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h index a3731017858..a75612a032f 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h @@ -231,20 +231,24 @@ class DeadlockDetector { added_edges, ARRAY_SIZE(added_edges)); for (uptr i = 0; i < n_added_edges; i++) { if (n_edges_ < ARRAY_SIZE(edges_)) - edges_[n_edges_++] = Edge((u16)added_edges[i], (u16)cur_idx, stk); + edges_[n_edges_++] = Edge((u16)added_edges[i], (u16)cur_idx, stk, + dtls->findLockContext(added_edges[i])); // Printf("Edge [%zd]: %u %zd=>%zd\n", i, stk, added_edges[i], cur_idx); } return n_added_edges; } - u32 findEdge(uptr from_node, uptr to_node) { + bool findEdge(uptr from_node, uptr to_node, u32 *stk_from, u32 *stk_to) { uptr from_idx = nodeToIndex(from_node); uptr to_idx = nodeToIndex(to_node); for (uptr i = 0; i < n_edges_; i++) { - if (edges_[i].from == from_idx && edges_[i].to == to_idx) - return edges_[i].stk; + if (edges_[i].from == from_idx && edges_[i].to == to_idx) { + *stk_from = edges_[i].stk_from; + *stk_to = edges_[i].stk_to; + return true; + } } - return 0; + return false; } // Test-only function. Handles the before/after lock events, @@ -367,9 +371,11 @@ class DeadlockDetector { struct Edge { u16 from; u16 to; - u32 stk; + u32 stk_from; + u32 stk_to; // FIXME: replace with initializer list once the tests are built as c++11. - Edge(u16 f, u16 t, u32 s) : from(f), to(t), stk(s) {} + Edge(u16 f, u16 t, u32 sf, u32 st) + : from(f), to(t), stk_from(sf), stk_to(st) {} Edge() {} }; |

