msan_dump_shadow.cc revision 7c9150579ed0278492f51cc8434b1d63a44b9bd1
1// RUN: %clangxx_msan -O0 -g %s -o %t && %run %t >%t.out 2>&1
2// RUN: FileCheck %s < %t.out
3
4// RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 -g %s -o %t && %run %t >%t.out 2>&1
5// RUN: FileCheck %s < %t.out
6
7// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -O0 -g %s -o %t && %run %t >%t.out 2>&1
8// RUN: FileCheck %s < %t.out
9
10#include <sanitizer/msan_interface.h>
11
12int main(void) {
13  char *p = new char[16];
14  __msan_dump_shadow(p, 5);
15  delete[] p;
16  const char *q = "abc";
17  __msan_dump_shadow(q, 3);
18  return 0;
19}
20
21// CHECK: ff ff ff ff ff
22// CHECK: 00 00 00
23