2014-11-19 01:22:58 +01:00
|
|
|
; Test -sanitizer-coverage-experimental-tracing
|
2016-02-17 22:34:43 +01:00
|
|
|
; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-trace-pc -S | FileCheck %s --check-prefix=CHECK_PC
|
2016-09-14 03:39:35 +02:00
|
|
|
; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-trace-pc-guard -S | FileCheck %s --check-prefix=CHECK_PC_GUARD
|
2017-02-01 03:38:39 +01:00
|
|
|
; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-trace-pc-guard -S -mtriple=x86_64-apple-macosx | FileCheck %s --check-prefix=CHECK_PC_GUARD_DARWIN
|
2019-07-25 22:53:15 +02:00
|
|
|
|
2019-09-04 22:30:29 +02:00
|
|
|
; RUN: opt < %s -passes='module(sancov-module)' -sanitizer-coverage-level=3 -sanitizer-coverage-trace-pc -S | FileCheck %s --check-prefix=CHECK_PC
|
|
|
|
; RUN: opt < %s -passes='module(sancov-module)' -sanitizer-coverage-level=3 -sanitizer-coverage-trace-pc-guard -S | FileCheck %s --check-prefix=CHECK_PC_GUARD
|
|
|
|
; RUN: opt < %s -passes='module(sancov-module)' -sanitizer-coverage-level=3 -sanitizer-coverage-trace-pc-guard -S -mtriple=x86_64-apple-macosx | FileCheck %s --check-prefix=CHECK_PC_GUARD_DARWIN
|
2014-11-19 01:22:58 +01:00
|
|
|
|
|
|
|
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
|
|
|
|
target triple = "x86_64-unknown-linux-gnu"
|
|
|
|
define void @foo(i32* %a) sanitize_address {
|
|
|
|
entry:
|
|
|
|
%tobool = icmp eq i32* %a, null
|
|
|
|
br i1 %tobool, label %if.end, label %if.then
|
|
|
|
|
|
|
|
if.then: ; preds = %entry
|
|
|
|
store i32 0, i32* %a, align 4
|
|
|
|
br label %if.end
|
|
|
|
|
|
|
|
if.end: ; preds = %entry, %if.then
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-07-31 22:00:22 +02:00
|
|
|
define available_externally void @external_bar(i32* %a) sanitize_address {
|
|
|
|
entry:
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
[sancov] Instrument reachable blocks that end in unreachable
Summary:
These sorts of blocks often contain calls to noreturn functions, like
longjmp, throw, or trap. If they don't end the program, they are
"interesting" from the perspective of sanitizer coverage, so we should
instrument them. This was discussed in https://reviews.llvm.org/D57982.
Reviewers: kcc, vitalybuka
Subscribers: llvm-commits, craig.topper, efriedma, morehouse, hiraditya
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58740
llvm-svn: 355152
2019-02-28 23:54:30 +01:00
|
|
|
declare void @longjmp(i8*) noreturn
|
|
|
|
|
|
|
|
; We expect three coverage points here for each BB.
|
|
|
|
define void @cond_longjmp(i1 %cond, i8* %jmp_buf) sanitize_address {
|
|
|
|
entry:
|
|
|
|
br i1 %cond, label %lj, label %done
|
|
|
|
done:
|
|
|
|
ret void
|
|
|
|
lj:
|
|
|
|
call void @longjmp(i8* %jmp_buf)
|
|
|
|
unreachable
|
|
|
|
}
|
|
|
|
|
2017-07-31 22:00:22 +02:00
|
|
|
|
2016-02-17 22:34:43 +01:00
|
|
|
; CHECK_PC-LABEL: define void @foo
|
|
|
|
; CHECK_PC: call void @__sanitizer_cov_trace_pc
|
|
|
|
; CHECK_PC: call void @__sanitizer_cov_trace_pc
|
|
|
|
; CHECK_PC: call void @__sanitizer_cov_trace_pc
|
|
|
|
; CHECK_PC-NOT: call void @__sanitizer_cov_trace_pc
|
|
|
|
; CHECK_PC: ret void
|
2016-02-27 06:45:12 +01:00
|
|
|
; CHECK_PC-NOT: call void @__sanitizer_cov_module_init
|
[sancov] Instrument reachable blocks that end in unreachable
Summary:
These sorts of blocks often contain calls to noreturn functions, like
longjmp, throw, or trap. If they don't end the program, they are
"interesting" from the perspective of sanitizer coverage, so we should
instrument them. This was discussed in https://reviews.llvm.org/D57982.
Reviewers: kcc, vitalybuka
Subscribers: llvm-commits, craig.topper, efriedma, morehouse, hiraditya
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58740
llvm-svn: 355152
2019-02-28 23:54:30 +01:00
|
|
|
; CHECK_PC-LABEL: @cond_longjmp
|
|
|
|
; CHECK_PC: call void @__sanitizer_cov_trace_pc
|
|
|
|
; CHECK_PC: call void @__sanitizer_cov_trace_pc
|
|
|
|
; CHECK_PC: ret void
|
|
|
|
; CHECK_PC: call void @__sanitizer_cov_trace_pc
|
|
|
|
; CHECK_PC: call void @longjmp
|
|
|
|
; CHECK_PC: unreachable
|
2016-09-14 03:39:35 +02:00
|
|
|
|
2018-09-13 23:45:55 +02:00
|
|
|
; CHECK_PC_GUARD: section "__sancov_guards", comdat($foo), align 4
|
2016-09-14 03:39:35 +02:00
|
|
|
; CHECK_PC_GUARD-LABEL: define void @foo
|
|
|
|
; CHECK_PC_GUARD: call void @__sanitizer_cov_trace_pc_guard
|
|
|
|
; CHECK_PC_GUARD: call void @__sanitizer_cov_trace_pc_guard
|
|
|
|
; CHECK_PC_GUARD: call void @__sanitizer_cov_trace_pc_guard
|
|
|
|
; CHECK_PC_GUARD-NOT: call void @__sanitizer_cov_trace_pc
|
|
|
|
; CHECK_PC_GUARD: ret void
|
2017-07-31 22:00:22 +02:00
|
|
|
; CHECK_PC_GUARD-LABEL: @external_bar
|
|
|
|
; CHECK_PC_GUARD-NOT: call void @__sanitizer_cov_trace_pc
|
|
|
|
; CHECK_PC_GUARD: ret void
|
[sancov] Instrument reachable blocks that end in unreachable
Summary:
These sorts of blocks often contain calls to noreturn functions, like
longjmp, throw, or trap. If they don't end the program, they are
"interesting" from the perspective of sanitizer coverage, so we should
instrument them. This was discussed in https://reviews.llvm.org/D57982.
Reviewers: kcc, vitalybuka
Subscribers: llvm-commits, craig.topper, efriedma, morehouse, hiraditya
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58740
llvm-svn: 355152
2019-02-28 23:54:30 +01:00
|
|
|
; CHECK_PC_GUARD-LABEL: @cond_longjmp
|
|
|
|
; CHECK_PC_GUARD: call void @__sanitizer_cov_trace_pc_guard
|
|
|
|
; CHECK_PC_GUARD: call void @__sanitizer_cov_trace_pc_guard
|
|
|
|
; CHECK_PC_GUARD: ret void
|
|
|
|
; CHECK_PC_GUARD: call void @__sanitizer_cov_trace_pc_guard
|
|
|
|
; CHECK_PC_GUARD: call void @longjmp
|
|
|
|
; CHECK_PC_GUARD: unreachable
|
2017-07-31 22:00:22 +02:00
|
|
|
|
2016-09-29 19:43:24 +02:00
|
|
|
; CHECK_PC_GUARD: call void @__sanitizer_cov_trace_pc_guard_init(i32* bitcast (i32** @__start___sancov_guards to i32*), i32* bitcast (i32** @__stop___sancov_guards to i32*))
|
2017-02-01 03:38:39 +01:00
|
|
|
|
|
|
|
; CHECK_PC_GUARD_DARWIN-LABEL: define void @foo
|
|
|
|
; CHECK_PC_GUARD_DARWIN: call void @__sanitizer_cov_trace_pc_guard
|
|
|
|
; CHECK_PC_GUARD_DARWIN: call void @__sanitizer_cov_trace_pc_guard
|
|
|
|
; CHECK_PC_GUARD_DARWIN: call void @__sanitizer_cov_trace_pc_guard
|
|
|
|
; CHECK_PC_GUARD_DARWIN-NOT: call void @__sanitizer_cov_trace_pc
|
|
|
|
; CHECK_PC_GUARD_DARWIN: ret void
|
|
|
|
; CHECK_PC_GUARD_DARWIN: call void @__sanitizer_cov_trace_pc_guard_init(i32* bitcast (i32** @"\01section$start$__DATA$__sancov_guards" to i32*), i32* bitcast (i32** @"\01section$end$__DATA$__sancov_guards" to i32*))
|