1From 68425b541e88f9f03a418cfda052b46b2a185e4e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 25 Jul 2024 20:18:17 -0700
4Subject: [PATCH] libsysprof: Check for unw_set_caching_policy before using
5
6llvm libunwind does not implement unw_cache_* functions yet
7
8Upstream-Status: Submitted [https://gitlab.gnome.org/GNOME/sysprof/-/merge_requests/95]
9
10Original-by: Khem Raj <raj.khem@gmail.com>
11Modified-by: Pablo Saavedra <psaavedra@igalia.com>
12
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14Signed-off-by: Pablo Saavedra <psaavedra@igalia.com>
15---
16 src/preload/backtrace-helper.h | 2 ++
17 1 file changed, 2 insertions(+)
18
19diff --git a/src/preload/backtrace-helper.h b/src/preload/backtrace-helper.h
20index ac4f8e9..e60032d 100644
21--- a/src/preload/backtrace-helper.h
22+++ b/src/preload/backtrace-helper.h
23@@ -26,7 +26,9 @@
24 static void
25 backtrace_init (void)
26 {
27+# ifdef UNW_CACHE_PER_THREAD
28   unw_set_caching_policy (unw_local_addr_space, UNW_CACHE_PER_THREAD);
29+#endif
30 #ifdef HAVE_UNW_SET_CACHE_SIZE
31   unw_set_cache_size (unw_local_addr_space, 1024, 0);
32 #endif
33