Skip to content

Commit 67a031c

Browse files
committed
[Sanitizers][Atos] Remove null-ing of atos process pointer
Currently, when we send an address to atos to be symbolized, it is expected that atos returns with more than it was sent, i.e. symbol information for that address. In the case where only the address is returned, we currently null the pointer to the atos process. Typically, for modules where no symbolication is expected, we do not send the address to atos. However, in new simulators there is an early call that atos does not return any symbol information for. And in this case, because we have gotten rid of the pointer to the process, no subsequent frames are symbolicated, even tho atos is still working/running. This patch removes the nulling of the pointer to the process. This allows subsequent calls to atos even after an unexpected result. It also now Reports what has happened and the address this occurred. This will improve symbolication in cases where we get an unepxected result, and will make it easier to diagnose atos if it is not symbolicating as expected. Filed a radar about the change of behavior 107621524 rdar://107169715 Differential Revision: https://reviews.llvm.org/D147725
1 parent 0a8c0dd commit 67a031c

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_mac.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ bool AtosSymbolizer::SymbolizePC(uptr addr, SymbolizedStack *stack) {
163163
uptr start_address = AddressInfo::kUnknown;
164164
if (!ParseCommandOutput(buf, addr, &stack->info.function, &stack->info.module,
165165
&stack->info.file, &line, &start_address)) {
166-
process_ = nullptr;
166+
Report("WARNING: atos failed to symbolize address \"0x%zx\"\n", addr);
167167
return false;
168168
}
169169
stack->info.line = (int)line;
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Check that there is a warning when atos fails to symbolize an address
2+
// and that atos continues symbolicating correctly after.
3+
4+
// RUN: %clangxx -O0 %s -o %t
5+
// RUN: not %run %t 2>&1 | FileCheck %s
6+
7+
void bar() {
8+
void *invalid_addr = reinterpret_cast<void *>(0xDEADBEEF);
9+
void (*func_ptr)() = reinterpret_cast<void (*)()>(invalid_addr);
10+
func_ptr();
11+
}
12+
13+
int main() {
14+
bar();
15+
return 0;
16+
// CHECK: WARNING: atos failed to symbolize address{{.*}}
17+
// CHECK: {{.*}}atos-symbolized-recover.cpp:[[@LINE-3]]{{.*}}
18+
}

0 commit comments

Comments
 (0)