1 // RUN: %clangxx_memprof %s -o %t
3 // RUN: %env_memprof_opts=print_text=true:log_path=stdout %run %t | FileCheck --check-prefix=CHECK-TEXT %s
4 // RUN: %env_memprof_opts=log_path=stdout %run %t > %t.memprofraw
5 // RUN: od -c -N 8 %t.memprofraw | FileCheck --check-prefix=CHECK-RAW %s
7 #include <sanitizer/memprof_interface.h>
10 int main(int argc
, char **argv
) {
11 char *x
= (char *)malloc(10);
14 __memprof_profile_dump();
15 x
= (char *)malloc(10);
20 // We should get 2 rounds of profile info, one from the explicit dump request,
23 // CHECK-TEXT: Recorded MIBs (incl. live on exit):
24 // CHECK-TEXT: Memory allocation stack id
25 // CHECK-TEXT: Stack for id
27 // CHECK-TEXT: Recorded MIBs (incl. live on exit):
28 // CHECK-TEXT: Memory allocation stack id
29 // CHECK-TEXT: Stack for id
31 // For the raw profile just check the header magic. The following check assumes that memprof
32 // runs on little endian architectures.
33 // CHECK-RAW: 0000000 201 r f o r p m 377