Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 1 | // Check that ASan prints the faulting instruction bytes on |
| 2 | // dump_instruction_bytes=1 |
| 3 | // RUN: %clangxx_asan %s -o %t |
Pirama Arumuga Nainar | cdce50b | 2015-07-01 12:26:56 -0700 | [diff] [blame] | 4 | // RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:dump_instruction_bytes=1 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-DUMP |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 5 | // RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NODUMP |
| 6 | // |
| 7 | // REQUIRES: x86_64-supported-target,i386-supported-target |
| 8 | |
| 9 | int main() { |
| 10 | #if defined(__x86_64__) |
| 11 | asm("movq $0, %rax"); |
| 12 | asm("movl $0xcafebabe, 0x0(%rax)"); |
| 13 | #elif defined(i386) |
| 14 | asm("movl $0, %eax"); |
| 15 | asm("movl $0xcafebabe, 0x0(%eax)"); |
| 16 | #endif |
| 17 | // CHECK-DUMP: First 16 instruction bytes at pc: c7 00 be ba fe ca |
| 18 | // CHECK-NODUMP-NOT: First 16 instruction bytes |
| 19 | return 0; |
| 20 | } |