[sysprof] build: check for unw_set_cache_size()



commit 5b88e9c3aabc3ebc2475eafddba71bf3e94c68ab
Author: Christian Hergert <chergert redhat com>
Date:   Thu Feb 20 11:22:56 2020 -0800

    build: check for unw_set_cache_size()
    
    This may not be available on older libunwind versions such as 1.2.

 meson.build                                       | 3 +++
 src/libsysprof/preload/sysprof-memory-collector.c | 2 ++
 2 files changed, 5 insertions(+)
---
diff --git a/meson.build b/meson.build
index 3bbd883..ea6f206 100644
--- a/meson.build
+++ b/meson.build
@@ -93,6 +93,9 @@ if get_option('libunwind')
   libunwind_dep = dependency('libunwind-generic', required: false)
   if libunwind_dep.found()
     config_h.set10('ENABLE_LIBUNWIND', libunwind_dep.found())
+    if cc.has_header_symbol('libunwind.h', 'unw_set_cache_size', dependencies: [libunwind_dep])
+      config_h.set10('HAVE_UNW_SET_CACHE_SIZE', 1)
+    endif
   endif
 endif
 
diff --git a/src/libsysprof/preload/sysprof-memory-collector.c 
b/src/libsysprof/preload/sysprof-memory-collector.c
index 33b1d0e..6a13b64 100644
--- a/src/libsysprof/preload/sysprof-memory-collector.c
+++ b/src/libsysprof/preload/sysprof-memory-collector.c
@@ -64,7 +64,9 @@ collector_init_ctor (void)
 {
 #ifdef ENABLE_LIBUNWIND
   unw_set_caching_policy (unw_local_addr_space, UNW_CACHE_PER_THREAD);
+# ifdef HAVE_UNW_SET_CACHE_SIZE
   unw_set_cache_size (unw_local_addr_space, 1024, 0);
+#endif
 #endif
   sysprof_collector_init ();
   collector_ready = TRUE;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]