aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/compiler-rt/lib/asan/asan_descriptions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/compiler-rt/lib/asan/asan_descriptions.cpp')
-rw-r--r--contrib/llvm-project/compiler-rt/lib/asan/asan_descriptions.cpp77
1 files changed, 39 insertions, 38 deletions
diff --git a/contrib/llvm-project/compiler-rt/lib/asan/asan_descriptions.cpp b/contrib/llvm-project/compiler-rt/lib/asan/asan_descriptions.cpp
index 2ba8a02f8410..ef6f3e0a096f 100644
--- a/contrib/llvm-project/compiler-rt/lib/asan/asan_descriptions.cpp
+++ b/contrib/llvm-project/compiler-rt/lib/asan/asan_descriptions.cpp
@@ -49,14 +49,14 @@ void DescribeThread(AsanThreadContext *context) {
}
context->announced = true;
InternalScopedString str;
- str.append("Thread %s", AsanThreadIdAndName(context).c_str());
+ str.AppendF("Thread %s", AsanThreadIdAndName(context).c_str());
if (context->parent_tid == kInvalidTid) {
- str.append(" created by unknown thread\n");
+ str.Append(" created by unknown thread\n");
Printf("%s", str.data());
return;
}
- str.append(" created by %s here:\n",
- AsanThreadIdAndName(context->parent_tid).c_str());
+ str.AppendF(" created by %s here:\n",
+ AsanThreadIdAndName(context->parent_tid).c_str());
Printf("%s", str.data());
StackDepotGet(context->stack_id).Print();
// Recursively described parent thread if needed.
@@ -126,29 +126,29 @@ static void GetAccessToHeapChunkInformation(ChunkAccess *descr,
static void PrintHeapChunkAccess(uptr addr, const ChunkAccess &descr) {
Decorator d;
InternalScopedString str;
- str.append("%s", d.Location());
+ str.Append(d.Location());
switch (descr.access_type) {
case kAccessTypeLeft:
- str.append("%p is located %zd bytes to the left of",
- (void *)descr.bad_addr, descr.offset);
+ str.AppendF("%p is located %zd bytes before", (void *)descr.bad_addr,
+ descr.offset);
break;
case kAccessTypeRight:
- str.append("%p is located %zd bytes to the right of",
- (void *)descr.bad_addr, descr.offset);
+ str.AppendF("%p is located %zd bytes after", (void *)descr.bad_addr,
+ descr.offset);
break;
case kAccessTypeInside:
- str.append("%p is located %zd bytes inside of", (void *)descr.bad_addr,
- descr.offset);
+ str.AppendF("%p is located %zd bytes inside of", (void *)descr.bad_addr,
+ descr.offset);
break;
case kAccessTypeUnknown:
- str.append(
+ str.AppendF(
"%p is located somewhere around (this is AddressSanitizer bug!)",
(void *)descr.bad_addr);
}
- str.append(" %zu-byte region [%p,%p)\n", descr.chunk_size,
- (void *)descr.chunk_begin,
- (void *)(descr.chunk_begin + descr.chunk_size));
- str.append("%s", d.Default());
+ str.AppendF(" %zu-byte region [%p,%p)\n", descr.chunk_size,
+ (void *)descr.chunk_begin,
+ (void *)(descr.chunk_begin + descr.chunk_size));
+ str.Append(d.Default());
Printf("%s", str.data());
}
@@ -243,24 +243,24 @@ static void PrintAccessAndVarIntersection(const StackVarDescr &var, uptr addr,
pos_descr = "underflows";
}
InternalScopedString str;
- str.append(" [%zd, %zd)", var.beg, var_end);
+ str.AppendF(" [%zd, %zd)", var.beg, var_end);
// Render variable name.
- str.append(" '");
+ str.AppendF(" '");
for (uptr i = 0; i < var.name_len; ++i) {
- str.append("%c", var.name_pos[i]);
+ str.AppendF("%c", var.name_pos[i]);
}
- str.append("'");
+ str.AppendF("'");
if (var.line > 0) {
- str.append(" (line %d)", var.line);
+ str.AppendF(" (line %zd)", var.line);
}
if (pos_descr) {
Decorator d;
// FIXME: we may want to also print the size of the access here,
// but in case of accesses generated by memset it may be confusing.
- str.append("%s <== Memory access at offset %zd %s this variable%s\n",
- d.Location(), addr, pos_descr, d.Default());
+ str.AppendF("%s <== Memory access at offset %zd %s this variable%s\n",
+ d.Location(), addr, pos_descr, d.Default());
} else {
- str.append("\n");
+ str.AppendF("\n");
}
Printf("%s", str.data());
}
@@ -277,23 +277,23 @@ static void DescribeAddressRelativeToGlobal(uptr addr, uptr access_size,
const __asan_global &g) {
InternalScopedString str;
Decorator d;
- str.append("%s", d.Location());
+ str.Append(d.Location());
if (addr < g.beg) {
- str.append("%p is located %zd bytes to the left", (void *)addr,
- g.beg - addr);
+ str.AppendF("%p is located %zd bytes before", (void *)addr, g.beg - addr);
} else if (addr + access_size > g.beg + g.size) {
if (addr < g.beg + g.size) addr = g.beg + g.size;
- str.append("%p is located %zd bytes to the right", (void *)addr,
- addr - (g.beg + g.size));
+ str.AppendF("%p is located %zd bytes after", (void *)addr,
+ addr - (g.beg + g.size));
} else {
// Can it happen?
- str.append("%p is located %zd bytes inside", (void *)addr, addr - g.beg);
+ str.AppendF("%p is located %zd bytes inside of", (void *)addr,
+ addr - g.beg);
}
- str.append(" of global variable '%s' defined in '",
- MaybeDemangleGlobalName(g.name));
- PrintGlobalLocation(&str, g);
- str.append("' (0x%zx) of size %zu\n", g.beg, g.size);
- str.append("%s", d.Default());
+ str.AppendF(" global variable '%s' defined in '",
+ MaybeDemangleGlobalName(g.name));
+ PrintGlobalLocation(&str, g, /*print_module_name=*/false);
+ str.AppendF("' (0x%zx) of size %zu\n", g.beg, g.size);
+ str.Append(d.Default());
PrintGlobalNameIfASCII(&str, g);
Printf("%s", str.data());
}
@@ -318,7 +318,8 @@ bool DescribeAddressIfGlobal(uptr addr, uptr access_size,
}
void ShadowAddressDescription::Print() const {
- Printf("Address %p is located in the %s area.\n", addr, ShadowNames[kind]);
+ Printf("Address %p is located in the %s area.\n", (void *)addr,
+ ShadowNames[kind]);
}
void GlobalAddressDescription::Print(const char *bug_type) const {
@@ -356,7 +357,7 @@ bool GlobalAddressDescription::PointsInsideTheSameVariable(
void StackAddressDescription::Print() const {
Decorator d;
Printf("%s", d.Location());
- Printf("Address %p is located in stack of thread %s", addr,
+ Printf("Address %p is located in stack of thread %s", (void *)addr,
AsanThreadIdAndName(tid).c_str());
if (!frame_descr) {
@@ -469,7 +470,7 @@ AddressDescription::AddressDescription(uptr addr, uptr access_size,
void WildAddressDescription::Print() const {
Printf("Address %p is a wild pointer inside of access range of size %p.\n",
- addr, access_size);
+ (void *)addr, (void *)access_size);
}
void PrintAddressDescription(uptr addr, uptr access_size,