summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_deadlock_detector.h
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2014-03-21 13:00:18 +0000
committerKostya Serebryany <kcc@google.com>2014-03-21 13:00:18 +0000
commit5f1e426432f0136977bb6c813db4b1edf99090b5 (patch)
treed87bac847f30b1120738be198c548972b706d28a /lib/sanitizer_common/sanitizer_deadlock_detector.h
parentd1e7977823ff09a14ea58c7dee1d9a38b02e17af (diff)
[sanitizer] print threads in deadlock report
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@204461 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_deadlock_detector.h')
-rw-r--r--lib/sanitizer_common/sanitizer_deadlock_detector.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/sanitizer_common/sanitizer_deadlock_detector.h b/lib/sanitizer_common/sanitizer_deadlock_detector.h
index 36638c4a8..a0a03ccbb 100644
--- a/lib/sanitizer_common/sanitizer_deadlock_detector.h
+++ b/lib/sanitizer_common/sanitizer_deadlock_detector.h
@@ -231,7 +231,8 @@ class DeadlockDetector {
// returns the number of added edges, and puts the sources of added edges
// into added_edges[].
// Should be called before onLockAfter.
- uptr addEdges(DeadlockDetectorTLS<BV> *dtls, uptr cur_node, u32 stk = 0) {
+ uptr addEdges(DeadlockDetectorTLS<BV> *dtls, uptr cur_node, u32 stk,
+ int unique_tid) {
ensureCurrentEpoch(dtls);
uptr cur_idx = nodeToIndex(cur_node);
uptr added_edges[40];
@@ -240,19 +241,23 @@ class DeadlockDetector {
for (uptr i = 0; i < n_added_edges; i++) {
if (n_edges_ < ARRAY_SIZE(edges_))
edges_[n_edges_++] = {(u16)added_edges[i], (u16)cur_idx,
- dtls->findLockContext(added_edges[i]), stk};
- // Printf("E%zd: %u %zd=>%zd\n", n_edges_, stk, added_edges[i], cur_idx);
+ dtls->findLockContext(added_edges[i]), stk,
+ unique_tid};
+ // Printf("Edge%zd: %u %zd=>%zd in T%d\n",
+ // n_edges_, stk, added_edges[i], cur_idx, unique_tid);
}
return n_added_edges;
}
- bool findEdge(uptr from_node, uptr to_node, u32 *stk_from, u32 *stk_to) {
+ bool findEdge(uptr from_node, uptr to_node, u32 *stk_from, u32 *stk_to,
+ int *unique_tid) {
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) {
*stk_from = edges_[i].stk_from;
*stk_to = edges_[i].stk_to;
+ *unique_tid = edges_[i].unique_tid;
return true;
}
}
@@ -264,7 +269,7 @@ class DeadlockDetector {
bool onLock(DeadlockDetectorTLS<BV> *dtls, uptr cur_node, u32 stk = 0) {
ensureCurrentEpoch(dtls);
bool is_reachable = !isHeld(dtls, cur_node) && onLockBefore(dtls, cur_node);
- addEdges(dtls, cur_node, stk);
+ addEdges(dtls, cur_node, stk, 0);
onLockAfter(dtls, cur_node, stk);
return is_reachable;
}
@@ -381,6 +386,7 @@ class DeadlockDetector {
u16 to;
u32 stk_from;
u32 stk_to;
+ int unique_tid;
};
uptr current_epoch_;