aboutsummaryrefslogtreecommitdiff
path: root/lib/tsan/rtl/tsan_suppressions.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tsan/rtl/tsan_suppressions.cc')
-rw-r--r--lib/tsan/rtl/tsan_suppressions.cc34
1 files changed, 17 insertions, 17 deletions
diff --git a/lib/tsan/rtl/tsan_suppressions.cc b/lib/tsan/rtl/tsan_suppressions.cc
index 7549a4f8ba83..5316f6db6a0a 100644
--- a/lib/tsan/rtl/tsan_suppressions.cc
+++ b/lib/tsan/rtl/tsan_suppressions.cc
@@ -26,27 +26,27 @@ static Suppression *g_suppressions;
static char *ReadFile(const char *filename) {
if (filename == 0 || filename[0] == 0)
return 0;
- InternalScopedBuf<char> tmp(4*1024);
- if (filename[0] == '/')
- internal_snprintf(tmp, tmp.Size(), "%s", filename);
+ InternalScopedBuffer<char> tmp(4*1024);
+ if (filename[0] == '/' || GetPwd() == 0)
+ internal_snprintf(tmp.data(), tmp.size(), "%s", filename);
else
- internal_snprintf(tmp, tmp.Size(), "%s/%s", GetPwd(), filename);
- fd_t fd = internal_open(tmp, false);
+ internal_snprintf(tmp.data(), tmp.size(), "%s/%s", GetPwd(), filename);
+ fd_t fd = internal_open(tmp.data(), false);
if (fd == kInvalidFd) {
- TsanPrintf("ThreadSanitizer: failed to open suppressions file '%s'\n",
- tmp.Ptr());
+ Printf("ThreadSanitizer: failed to open suppressions file '%s'\n",
+ tmp.data());
Die();
}
const uptr fsize = internal_filesize(fd);
if (fsize == (uptr)-1) {
- TsanPrintf("ThreadSanitizer: failed to stat suppressions file '%s'\n",
- tmp.Ptr());
+ Printf("ThreadSanitizer: failed to stat suppressions file '%s'\n",
+ tmp.data());
Die();
}
char *buf = (char*)internal_alloc(MBlockSuppression, fsize + 1);
if (fsize != internal_read(fd, buf, fsize)) {
- TsanPrintf("ThreadSanitizer: failed to read suppressions file '%s'\n",
- tmp.Ptr());
+ Printf("ThreadSanitizer: failed to read suppressions file '%s'\n",
+ tmp.data());
Die();
}
internal_close(fd);
@@ -110,7 +110,7 @@ Suppression *SuppressionParse(const char* supp) {
stype = SuppressionSignal;
line += sizeof("signal:") - 1;
} else {
- TsanPrintf("ThreadSanitizer: failed to parse suppressions file\n");
+ Printf("ThreadSanitizer: failed to parse suppressions file\n");
Die();
}
Suppression *s = (Suppression*)internal_alloc(MBlockSuppression,
@@ -134,9 +134,9 @@ void InitializeSuppressions() {
g_suppressions = SuppressionParse(supp);
}
-bool IsSuppressed(ReportType typ, const ReportStack *stack) {
+uptr IsSuppressed(ReportType typ, const ReportStack *stack) {
if (g_suppressions == 0 || stack == 0)
- return false;
+ return 0;
SuppressionType stype;
if (typ == ReportTypeRace)
stype = SuppressionRace;
@@ -147,17 +147,17 @@ bool IsSuppressed(ReportType typ, const ReportStack *stack) {
else if (typ == ReportTypeSignalUnsafe)
stype = SuppressionSignal;
else
- return false;
+ return 0;
for (const ReportStack *frame = stack; frame; frame = frame->next) {
for (Suppression *supp = g_suppressions; supp; supp = supp->next) {
if (stype == supp->type &&
(SuppressionMatch(supp->templ, frame->func) ||
SuppressionMatch(supp->templ, frame->file))) {
DPrintf("ThreadSanitizer: matched suppression '%s'\n", supp->templ);
- return true;
+ return frame->pc;
}
}
}
- return false;
+ return 0;
}
} // namespace __tsan