diff options
| author | Reid Kleckner <rnk@google.com> | 2019-04-30 20:59:56 +0000 |
|---|---|---|
| committer | Reid Kleckner <rnk@google.com> | 2019-04-30 20:59:56 +0000 |
| commit | 5642c3feb03d020dc06a62e3dc54f3206a97a391 (patch) | |
| tree | b77f2c938bf9e850c976f050859759d0df7f8b54 /compiler-rt/lib/interception/tests | |
| parent | f3ee97731eb524e9c7bc6911c205a38e643dfff4 (diff) | |
| download | bcm5719-llvm-5642c3feb03d020dc06a62e3dc54f3206a97a391.tar.gz bcm5719-llvm-5642c3feb03d020dc06a62e3dc54f3206a97a391.zip | |
Revert r359325 "[NFC][Sanitizer] Change "return type" of INTERCEPT_FUNCTION to void"
Changing INTERCEPT_FUNCTION to return void is not functionally correct.
IMO the best way to communicate failure or success of interception is
with a return value, not some external address comparison.
This change was also creating link errors for _except_handler4_common,
which is exported from ucrtbase.dll in 32-bit Windows.
Also revert dependent changes r359362 and r359466.
llvm-svn: 359611
Diffstat (limited to 'compiler-rt/lib/interception/tests')
| -rw-r--r-- | compiler-rt/lib/interception/tests/interception_linux_test.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler-rt/lib/interception/tests/interception_linux_test.cc b/compiler-rt/lib/interception/tests/interception_linux_test.cc index 3aade45ebcd..5a1ca6ecbf5 100644 --- a/compiler-rt/lib/interception/tests/interception_linux_test.cc +++ b/compiler-rt/lib/interception/tests/interception_linux_test.cc @@ -33,6 +33,17 @@ INTERCEPTOR(int, isdigit, int d) { namespace __interception { +TEST(Interception, GetRealFunctionAddress) { + uptr malloc_address = 0; + EXPECT_TRUE(GetRealFunctionAddress("malloc", &malloc_address, 0, 0)); + EXPECT_NE(0U, malloc_address); + + uptr dummy_address = 0; + EXPECT_TRUE( + GetRealFunctionAddress("dummy_doesnt_exist__", &dummy_address, 0, 0)); + EXPECT_EQ(0U, dummy_address); +} + TEST(Interception, GetFuncAddr) { EXPECT_NE(GetFuncAddr("malloc"), nullptr); EXPECT_EQ(GetFuncAddr("does_not_exist"), nullptr); |

