Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(524)

Unified Diff: tests_lit/asan_tests/instrumentmalloc.ll

Issue 2079723002: Instrumented malloc and free with dummy functions. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Cleaned up instrumentCall() Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/IceInstrumentation.cpp ('K') | « src/IceInstrumentation.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests_lit/asan_tests/instrumentmalloc.ll
diff --git a/tests_lit/asan_tests/instrumentmalloc.ll b/tests_lit/asan_tests/instrumentmalloc.ll
new file mode 100644
index 0000000000000000000000000000000000000000..9cc704d3eda3314a4488f75404ef61d20d401636
--- /dev/null
+++ b/tests_lit/asan_tests/instrumentmalloc.ll
@@ -0,0 +1,23 @@
+; Test that calls to malloc() and free() are replaced
+
+; REQUIRES: allow_dump
+
+; RUN: %p2i -i %s --args -verbose=inst -threads=0 -fsanitize-address \
+; RUN: --allow-externally-defined-symbols | FileCheck --check-prefix=DUMP %s
+
+declare external i32 @malloc(i32)
+declare external void @free(i32)
+
+define internal void @func() {
+ %ptr = call i32 @malloc(i32 42)
+ call void @free(i32 %ptr)
+ ret void
+}
+
+; DUMP-LABEL: ================ Instrumented CFG ================
+; DUMP-NEXT: define internal void @func() {
+; DUMP-NEXT: __0:
+; DUMP-NEXT: %ptr = call i32 @__asan_malloc(i32 42)
+; DUMP-NEXT: call void @__asan_free(i32 %ptr)
+; DUMP-NEXT: ret void
+; DUMP-NEXT: }
« src/IceInstrumentation.cpp ('K') | « src/IceInstrumentation.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698