Each function's PC is recorded in the ring buffer. From there we can access the function's local variables and reconstruct the tag of each one with the help of the information printed by llvm-symbolizer's new FRAME command. We can then find the variable that was likely being accessed by matching the pointer's tag against the reconstructed tag. Differential Revision: https://reviews.llvm.org/D63469 llvm-svn: 364607
24 lines
526 B
C
24 lines
526 B
C
// RUN: %clang_hwasan -g %s -o %t && not %run %t 2>&1 | FileCheck %s
|
|
|
|
// Dynamic allocation of stack objects does not affect FP, so the backend should
|
|
// still be using FP-relative debug info locations that we can use to find stack
|
|
// objects.
|
|
|
|
__attribute((noinline))
|
|
char *buggy(int b) {
|
|
char c[64];
|
|
char *volatile p = c;
|
|
if (b) {
|
|
p = __builtin_alloca(64);
|
|
p = c;
|
|
}
|
|
return p;
|
|
}
|
|
|
|
int main() {
|
|
char *p = buggy(1);
|
|
// CHECK: Potentially referenced stack objects:
|
|
// CHECK-NEXT: c in buggy
|
|
p[0] = 0;
|
|
}
|