Discussion:
[Libunwind-devel] [PATCH] Fix unwind cache flush
Sergey Korolev
2018-06-17 18:26:09 UTC
Permalink
Fix after "dwarf: do not allocate in load_debug_frame (#72)".
This patch also adds munmap() for unw_debug_frame_list elements.
---
src/mi/flush_cache.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/mi/flush_cache.c b/src/mi/flush_cache.c
index cbd93e1a..9a344c0d 100644
--- a/src/mi/flush_cache.c
+++ b/src/mi/flush_cache.c
@@ -30,21 +30,24 @@ unw_flush_cache (unw_addr_space_t as, unw_word_t lo,
unw_word_t hi)
{
#if !UNW_TARGET_IA64
struct unw_debug_frame_list *w = as->debug_frames;
-#endif

- /* clear dyn_info_list_addr cache: */
- as->dyn_info_list_addr = 0;
-
-#if !UNW_TARGET_IA64
- for (; w; w = w->next)
+ while (w)
{
+ struct unw_debug_frame_list *n = w->next;
+
if (w->index)
free (w->index);
- free (w->debug_frame);
+
+ munmap (w->debug_frame, w->debug_frame_size);
+ munmap (w, sizeof (*w));
+ w = n;
}
as->debug_frames = NULL;
#endif

+ /* clear dyn_info_list_addr cache: */
+ as->dyn_info_list_addr = 0;
+
/* This lets us flush caches lazily. The implementation currently
ignores the flush range arguments (lo-hi). This is OK because
unw_flush_cache() is allowed to flush more than the requested
--
2.11.0
Dave Watson
2018-06-20 17:42:44 UTC
Permalink
Post by Sergey Korolev
Fix after "dwarf: do not allocate in load_debug_frame (#72)".
This patch also adds munmap() for unw_debug_frame_list elements.
Merged, thanks.

Loading...