Skip to content

Commit

Permalink
[Sanitizers][Atos] Remove null-ing of atos process pointer
Browse files Browse the repository at this point in the history
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
  • Loading branch information
thetruestblue committed Apr 7, 2023
1 parent 5315ca6 commit 0f9bfe0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Expand Up @@ -163,7 +163,7 @@ bool AtosSymbolizer::SymbolizePC(uptr addr, SymbolizedStack *stack) {
uptr start_address = AddressInfo::kUnknown;
if (!ParseCommandOutput(buf, addr, &stack->info.function, &stack->info.module,
&stack->info.file, &line, &start_address)) {
process_ = nullptr;
Report("WARNING: atos failed to symbolize address \"0x%zx\"\n", addr);
return false;
}
stack->info.line = (int)line;
Expand Down
@@ -0,0 +1,18 @@
// Check that there is a warning when atos fails to symbolize an address
// and that atos continues symbolicating correctly after.

// RUN: %clangxx -O0 %s -o %t
// RUN: not %run %t 2>&1 | FileCheck %s

void bar() {
void *invalid_addr = reinterpret_cast<void *>(0xDEADBEEF);
void (*func_ptr)() = reinterpret_cast<void (*)()>(invalid_addr);
func_ptr();
}

int main() {
bar();
return 0;
// CHECK: WARNING: atos failed to symbolize address{{.*}}
// CHECK: {{.*}}atos-symbolized-recover.cpp:[[@LINE-3]]{{.*}}
}

0 comments on commit 0f9bfe0

Please sign in to comment.