summaryrefslogtreecommitdiffstats
path: root/libdw/dwarf_end.c
diff options
context:
space:
mode:
authorRoland McGrath <[email protected]>2011-02-23 19:52:46 -0800
committerRoland McGrath <[email protected]>2011-02-23 19:52:46 -0800
commit725aad5d2f8b78ed21a5e253fb38f9722c2c8b2d (patch)
tree83ef8e065a191c5fa897bf13211df9964cc67f7e /libdw/dwarf_end.c
parent47c5323527dcc954d2d60e9ee87211597aabd101 (diff)
Support reading .zdebug_* DWARF sections compressed via zlib.
Diffstat (limited to 'libdw/dwarf_end.c')
-rw-r--r--libdw/dwarf_end.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/libdw/dwarf_end.c b/libdw/dwarf_end.c
index ec10542e..1e733cae 100644
--- a/libdw/dwarf_end.c
+++ b/libdw/dwarf_end.c
@@ -1,5 +1,5 @@
/* Release debugging handling context.
- Copyright (C) 2002-2010 Red Hat, Inc.
+ Copyright (C) 2002-2011 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <[email protected]>, 2002.
@@ -54,6 +54,8 @@
#include <search.h>
#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
#include "libdwP.h"
#include "cfi.h"
@@ -76,6 +78,24 @@ cu_free (void *arg)
}
+#if USE_ZLIB
+void
+internal_function
+__libdw_free_zdata (Dwarf *dwarf)
+{
+ unsigned int gzip_mask = dwarf->sectiondata_gzip_mask;
+ while (gzip_mask != 0)
+ {
+ int i = ffs (gzip_mask);
+ assert (i > 0);
+ --i;
+ assert (i < IDX_last);
+ free (dwarf->sectiondata[i]);
+ gzip_mask &= ~(1U << i);
+ }
+}
+#endif
+
int
dwarf_end (dwarf)
Dwarf *dwarf;
@@ -106,6 +126,8 @@ dwarf_end (dwarf)
/* Free the pubnames helper structure. */
free (dwarf->pubnames_sets);
+ __libdw_free_zdata (dwarf);
+
/* Free the ELF descriptor if necessary. */
if (dwarf->free_elf)
elf_end (dwarf->elf);