diff --git a/cmake/Modules/FindBFD.cmake b/cmake/Modules/FindBFD.cmake index 62faae01..2be00784 100644 --- a/cmake/Modules/FindBFD.cmake +++ b/cmake/Modules/FindBFD.cmake @@ -54,8 +54,8 @@ if((APEX_BUILD_BFD OR (NOT BFD_FOUND)) AND NOT APPLE) set(TMP_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") set(TMP_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fPIC") ExternalProject_Add(project_binutils - URL "http://ftp.gnu.org/gnu/binutils/binutils-2.37.tar.bz2" - URL_HASH SHA256=67fc1a4030d08ee877a4867d3dcab35828148f87e1fd05da6db585ed5a166bd4 + URL "http://ftp.gnu.org/gnu/binutils/binutils-2.42.tar.bz2" + URL_HASH SHA256=5d2a6c1d49686a557869caae08b6c2e83699775efd27505e01b2f4db1a024ffc CONFIGURE_COMMAND /configure CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} CFLAGS=${TMP_C_FLAGS} CXXFLAGS=${TMP_CXX_FLAGS} LDFLAGS=${TMP_LINKER_FLAGS} --prefix=${CMAKE_INSTALL_PREFIX} --disable-dependency-tracking --enable-interwork --disable-multilib --enable-shared --enable-64-bit-bfd --target=${TARGET_ARCH} --enable-install-libiberty --disable-gold --program-prefix=g --disable-nls --disable-ld --disable-lto --disable-gas BUILD_COMMAND make MAKEINFO=true -j${MAKEJOBS} INSTALL_COMMAND make MAKEINFO=true install diff --git a/src/apex/apex_bfd.cpp b/src/apex/apex_bfd.cpp index d9d8d732..4f838ea5 100644 --- a/src/apex/apex_bfd.cpp +++ b/src/apex/apex_bfd.cpp @@ -32,9 +32,6 @@ #define PACKAGE_VERSION #endif #include -#if APEX_BFD >= 022300 -#include -#endif #include #include #include @@ -135,7 +132,7 @@ struct ApexBfdModule return (bfdOpen = false); } -#if APEX_BFD >= 022200 +#if defined(BFD_DECOMPRESS) // Decompress sections bfdImage->flags |= BFD_DECOMPRESS; #endif @@ -1025,7 +1022,7 @@ void Apex_bfd_internal_locateAddress(bfd * bfdptr, // ApexBfdInfo fields without an extra copy. This also means // that the pointers in ApexBfdInfo must never be deleted // since they point directly into the module's BFD. -#if (APEX_BFD >= 022200) +#if defined(bfd_find_nearest_line_discriminator) data.found = bfd_find_nearest_line_discriminator(bfdptr, section, data.module->syms, (data.info.probeAddr - vma), &data.info.filename, &data.info.funcname, diff --git a/src/unit_tests/C++/apex_malloc.cpp b/src/unit_tests/C++/apex_malloc.cpp index 3383c0d9..b698189e 100644 --- a/src/unit_tests/C++/apex_malloc.cpp +++ b/src/unit_tests/C++/apex_malloc.cpp @@ -3,13 +3,21 @@ #include "apex_api.hpp" void bar(char* data) { - apex::scoped_timer(__func__); + apex::scoped_timer((uint64_t)&bar); auto s = strlen(data); std::cout << "Size: " << s << std::endl; } -void test_malloc() { - apex::scoped_timer(__func__); +void test_leak(void) { + apex::scoped_timer((uint64_t)&test_leak); + auto foo = (char*)(malloc(42 * sizeof(char))); + memset(foo, 'a', 41); + foo[41] = 0; + bar(foo); +} + +void test_malloc(void) { + apex::scoped_timer((uint64_t)&test_malloc); auto foo = (char*)(malloc(42 * sizeof(char))); memset(foo, 'a', 41); foo[41] = 0; @@ -17,16 +25,16 @@ void test_malloc() { free(foo); } -void test_calloc() { - apex::scoped_timer(__func__); +void test_calloc(void) { + apex::scoped_timer((uint64_t)&test_calloc); auto foo = (char*)(calloc(42, sizeof(char))); memset(foo, 'a', 41); bar(foo); free(foo); } -void test_realloc() { - apex::scoped_timer(__func__); +void test_realloc(void) { + apex::scoped_timer((uint64_t)&test_realloc); auto foo = (char*)(malloc(42 * sizeof(char))); memset(foo, 'a', 41); foo[41] = 0; @@ -42,6 +50,7 @@ void test_all(void) { test_malloc(); test_calloc(); test_realloc(); + test_leak(); } void apex_enable_memory_wrapper(void);