diff options
author | Kostya Serebryany <kcc@google.com> | 2014-02-18 14:56:19 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2014-02-18 14:56:19 +0000 |
commit | 42e50b8071b803a440b39d6b2767b4c5e7a80aa8 (patch) | |
tree | 3eb2cddbc6bd5e4be1c9472c1075479b9dad19b1 /lib/sanitizer_common/sanitizer_bvgraph.h | |
parent | a52e2dc237ebe66e0ee014cf44ed8e562ceb3f88 (diff) |
[sanitizer] when reporting a deadlock also report the lock cycle
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201576 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_bvgraph.h')
-rw-r--r-- | lib/sanitizer_common/sanitizer_bvgraph.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/sanitizer_common/sanitizer_bvgraph.h b/lib/sanitizer_common/sanitizer_bvgraph.h index c54955a5a..157b9320e 100644 --- a/lib/sanitizer_common/sanitizer_bvgraph.h +++ b/lib/sanitizer_common/sanitizer_bvgraph.h @@ -129,6 +129,15 @@ class BVGraph { return 0; } + // Same as findPath, but finds a shortest path. + uptr findShortestPath(uptr from, const BV &targets, uptr *path, + uptr path_size) { + for (uptr p = 1; p <= path_size; p++) + if (findPath(from, targets, path, p) == p) + return p; + return 0; + } + private: void check(uptr idx1, uptr idx2) const { CHECK_LT(idx1, size()); |