From 725aad5d2f8b78ed21a5e253fb38f9722c2c8b2d Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Wed, 23 Feb 2011 19:52:46 -0800 Subject: Support reading .zdebug_* DWARF sections compressed via zlib. --- libdw/dwarf_end.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'libdw/dwarf_end.c') 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 , 2002. @@ -54,6 +54,8 @@ #include #include +#include +#include #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); -- cgit v1.2.3