1*e04c7b34Sjkoshy /* $NetBSD: libdwarf_info.c,v 1.4 2022/05/01 17:20:47 jkoshy Exp $ */
24bd933feSchristos
33ae86eb5Schristos /*-
43ae86eb5Schristos * Copyright (c) 2007 John Birrell (jb@freebsd.org)
59262d0f3Schristos * Copyright (c) 2010,2011,2014 Kai Wang
63ae86eb5Schristos * All rights reserved.
73ae86eb5Schristos *
83ae86eb5Schristos * Redistribution and use in source and binary forms, with or without
93ae86eb5Schristos * modification, are permitted provided that the following conditions
103ae86eb5Schristos * are met:
113ae86eb5Schristos * 1. Redistributions of source code must retain the above copyright
123ae86eb5Schristos * notice, this list of conditions and the following disclaimer.
133ae86eb5Schristos * 2. Redistributions in binary form must reproduce the above copyright
143ae86eb5Schristos * notice, this list of conditions and the following disclaimer in the
153ae86eb5Schristos * documentation and/or other materials provided with the distribution.
163ae86eb5Schristos *
173ae86eb5Schristos * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
183ae86eb5Schristos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
193ae86eb5Schristos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
203ae86eb5Schristos * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
213ae86eb5Schristos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
223ae86eb5Schristos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
233ae86eb5Schristos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
243ae86eb5Schristos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
253ae86eb5Schristos * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
263ae86eb5Schristos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
273ae86eb5Schristos * SUCH DAMAGE.
283ae86eb5Schristos */
293ae86eb5Schristos
303ae86eb5Schristos #include "_libdwarf.h"
313ae86eb5Schristos
32*e04c7b34Sjkoshy __RCSID("$NetBSD: libdwarf_info.c,v 1.4 2022/05/01 17:20:47 jkoshy Exp $");
339262d0f3Schristos ELFTC_VCSID("Id: libdwarf_info.c 3136 2014-12-24 16:04:38Z kaiwang27");
343ae86eb5Schristos
353ae86eb5Schristos int
_dwarf_info_first_cu(Dwarf_Debug dbg,Dwarf_Error * error)363ae86eb5Schristos _dwarf_info_first_cu(Dwarf_Debug dbg, Dwarf_Error *error)
373ae86eb5Schristos {
383ae86eb5Schristos Dwarf_CU cu;
393ae86eb5Schristos int ret;
403ae86eb5Schristos
413ae86eb5Schristos assert(dbg->dbg_cu_current == NULL);
423ae86eb5Schristos cu = STAILQ_FIRST(&dbg->dbg_cu);
433ae86eb5Schristos if (cu != NULL) {
443ae86eb5Schristos dbg->dbg_cu_current = cu;
453ae86eb5Schristos return (DW_DLE_NONE);
463ae86eb5Schristos }
473ae86eb5Schristos
483ae86eb5Schristos if (dbg->dbg_info_loaded)
493ae86eb5Schristos return (DW_DLE_NO_ENTRY);
503ae86eb5Schristos
513ae86eb5Schristos dbg->dbg_info_off = 0;
529262d0f3Schristos ret = _dwarf_info_load(dbg, 0, 1, error);
533ae86eb5Schristos if (ret != DW_DLE_NONE)
543ae86eb5Schristos return (ret);
553ae86eb5Schristos
563ae86eb5Schristos dbg->dbg_cu_current = STAILQ_FIRST(&dbg->dbg_cu);
573ae86eb5Schristos
583ae86eb5Schristos return (DW_DLE_NONE);
593ae86eb5Schristos }
603ae86eb5Schristos
613ae86eb5Schristos int
_dwarf_info_first_tu(Dwarf_Debug dbg,Dwarf_Error * error)629262d0f3Schristos _dwarf_info_first_tu(Dwarf_Debug dbg, Dwarf_Error *error)
639262d0f3Schristos {
649262d0f3Schristos Dwarf_CU tu;
659262d0f3Schristos int ret;
669262d0f3Schristos
679262d0f3Schristos assert(dbg->dbg_tu_current == NULL);
689262d0f3Schristos tu = STAILQ_FIRST(&dbg->dbg_tu);
699262d0f3Schristos if (tu != NULL) {
709262d0f3Schristos dbg->dbg_tu_current = tu;
719262d0f3Schristos return (DW_DLE_NONE);
729262d0f3Schristos }
739262d0f3Schristos
749262d0f3Schristos if (dbg->dbg_types_loaded)
759262d0f3Schristos return (DW_DLE_NO_ENTRY);
769262d0f3Schristos
779262d0f3Schristos dbg->dbg_types_off = 0;
789262d0f3Schristos ret = _dwarf_info_load(dbg, 0, 0, error);
799262d0f3Schristos if (ret != DW_DLE_NONE)
809262d0f3Schristos return (ret);
819262d0f3Schristos
829262d0f3Schristos dbg->dbg_tu_current = STAILQ_FIRST(&dbg->dbg_tu);
839262d0f3Schristos
849262d0f3Schristos return (DW_DLE_NONE);
859262d0f3Schristos }
869262d0f3Schristos
879262d0f3Schristos int
_dwarf_info_next_cu(Dwarf_Debug dbg,Dwarf_Error * error)883ae86eb5Schristos _dwarf_info_next_cu(Dwarf_Debug dbg, Dwarf_Error *error)
893ae86eb5Schristos {
903ae86eb5Schristos Dwarf_CU cu;
913ae86eb5Schristos int ret;
923ae86eb5Schristos
933ae86eb5Schristos assert(dbg->dbg_cu_current != NULL);
943ae86eb5Schristos cu = STAILQ_NEXT(dbg->dbg_cu_current, cu_next);
953ae86eb5Schristos if (cu != NULL) {
963ae86eb5Schristos dbg->dbg_cu_current = cu;
973ae86eb5Schristos return (DW_DLE_NONE);
983ae86eb5Schristos }
993ae86eb5Schristos
1003ae86eb5Schristos if (dbg->dbg_info_loaded) {
1013ae86eb5Schristos dbg->dbg_cu_current = NULL;
1023ae86eb5Schristos return (DW_DLE_NO_ENTRY);
1033ae86eb5Schristos }
1043ae86eb5Schristos
1059262d0f3Schristos ret = _dwarf_info_load(dbg, 0, 1, error);
1063ae86eb5Schristos if (ret != DW_DLE_NONE)
1073ae86eb5Schristos return (ret);
1083ae86eb5Schristos
1093ae86eb5Schristos dbg->dbg_cu_current = STAILQ_NEXT(dbg->dbg_cu_current, cu_next);
1103ae86eb5Schristos
1113ae86eb5Schristos return (DW_DLE_NONE);
1123ae86eb5Schristos }
1133ae86eb5Schristos
1143ae86eb5Schristos int
_dwarf_info_next_tu(Dwarf_Debug dbg,Dwarf_Error * error)1159262d0f3Schristos _dwarf_info_next_tu(Dwarf_Debug dbg, Dwarf_Error *error)
1169262d0f3Schristos {
1179262d0f3Schristos Dwarf_CU cu;
1189262d0f3Schristos int ret;
1199262d0f3Schristos
1209262d0f3Schristos assert(dbg->dbg_tu_current != NULL);
1219262d0f3Schristos cu = STAILQ_NEXT(dbg->dbg_tu_current, cu_next);
1229262d0f3Schristos if (cu != NULL) {
1239262d0f3Schristos dbg->dbg_tu_current = cu;
1249262d0f3Schristos return (DW_DLE_NONE);
1259262d0f3Schristos }
1269262d0f3Schristos
1279262d0f3Schristos if (dbg->dbg_types_loaded) {
1289262d0f3Schristos dbg->dbg_tu_current = NULL;
1299262d0f3Schristos return (DW_DLE_NO_ENTRY);
1309262d0f3Schristos }
1319262d0f3Schristos
1329262d0f3Schristos ret = _dwarf_info_load(dbg, 0, 0, error);
1339262d0f3Schristos if (ret != DW_DLE_NONE)
1349262d0f3Schristos return (ret);
1359262d0f3Schristos
1369262d0f3Schristos dbg->dbg_tu_current = STAILQ_NEXT(dbg->dbg_tu_current, cu_next);
1379262d0f3Schristos
1389262d0f3Schristos return (DW_DLE_NONE);
1399262d0f3Schristos }
1409262d0f3Schristos
1419262d0f3Schristos int
_dwarf_info_load(Dwarf_Debug dbg,Dwarf_Bool load_all,Dwarf_Bool is_info,Dwarf_Error * error)1429262d0f3Schristos _dwarf_info_load(Dwarf_Debug dbg, Dwarf_Bool load_all, Dwarf_Bool is_info,
1439262d0f3Schristos Dwarf_Error *error)
1443ae86eb5Schristos {
1453ae86eb5Schristos Dwarf_CU cu;
1463ae86eb5Schristos Dwarf_Section *ds;
1473ae86eb5Schristos int dwarf_size, ret;
1483ae86eb5Schristos uint64_t length;
1493ae86eb5Schristos uint64_t next_offset;
1503ae86eb5Schristos uint64_t offset;
1513ae86eb5Schristos
1523ae86eb5Schristos ret = DW_DLE_NONE;
1533ae86eb5Schristos
1549262d0f3Schristos if (is_info) {
1559262d0f3Schristos if (dbg->dbg_info_loaded)
1569262d0f3Schristos return (ret);
1573ae86eb5Schristos offset = dbg->dbg_info_off;
1583ae86eb5Schristos ds = dbg->dbg_info_sec;
1599262d0f3Schristos if (ds == NULL)
1609262d0f3Schristos return (DW_DLE_NO_ENTRY);
1619262d0f3Schristos } else {
1629262d0f3Schristos if (dbg->dbg_types_loaded)
1639262d0f3Schristos return (ret);
1649262d0f3Schristos offset = dbg->dbg_types_off;
1659262d0f3Schristos ds = dbg->dbg_types_sec;
1669262d0f3Schristos if (ds == NULL)
1679262d0f3Schristos return (DW_DLE_NO_ENTRY);
1689262d0f3Schristos }
1699262d0f3Schristos
1703ae86eb5Schristos while (offset < ds->ds_size) {
1713ae86eb5Schristos if ((cu = calloc(1, sizeof(struct _Dwarf_CU))) == NULL) {
1723ae86eb5Schristos DWARF_SET_ERROR(dbg, error, DW_DLE_MEMORY);
1733ae86eb5Schristos return (DW_DLE_MEMORY);
1743ae86eb5Schristos }
1753ae86eb5Schristos
1763ae86eb5Schristos cu->cu_dbg = dbg;
1779262d0f3Schristos cu->cu_is_info = is_info;
1783ae86eb5Schristos cu->cu_offset = offset;
1793ae86eb5Schristos
1803ae86eb5Schristos length = dbg->read(ds->ds_data, &offset, 4);
1813ae86eb5Schristos if (length == 0xffffffff) {
1823ae86eb5Schristos length = dbg->read(ds->ds_data, &offset, 8);
1833ae86eb5Schristos dwarf_size = 8;
1843ae86eb5Schristos } else
1853ae86eb5Schristos dwarf_size = 4;
1863ae86eb5Schristos cu->cu_dwarf_size = dwarf_size;
1873ae86eb5Schristos
1883ae86eb5Schristos /*
1893ae86eb5Schristos * Check if there is enough ELF data for this CU. This assumes
1903ae86eb5Schristos * that libelf gives us the entire section in one Elf_Data
1913ae86eb5Schristos * object.
1923ae86eb5Schristos */
1933ae86eb5Schristos if (length > ds->ds_size - offset) {
1943ae86eb5Schristos free(cu);
1953ae86eb5Schristos DWARF_SET_ERROR(dbg, error, DW_DLE_CU_LENGTH_ERROR);
1963ae86eb5Schristos return (DW_DLE_CU_LENGTH_ERROR);
1973ae86eb5Schristos }
1983ae86eb5Schristos
1993ae86eb5Schristos /* Compute the offset to the next compilation unit: */
2003ae86eb5Schristos next_offset = offset + length;
2019262d0f3Schristos if (is_info)
2023ae86eb5Schristos dbg->dbg_info_off = next_offset;
2039262d0f3Schristos else
2049262d0f3Schristos dbg->dbg_types_off = next_offset;
2053ae86eb5Schristos
2063ae86eb5Schristos /* Initialise the compilation unit. */
2073ae86eb5Schristos cu->cu_length = length;
2083ae86eb5Schristos cu->cu_length_size = (dwarf_size == 4 ? 4 : 12);
2093ae86eb5Schristos cu->cu_version = dbg->read(ds->ds_data, &offset, 2);
2103ae86eb5Schristos cu->cu_abbrev_offset = dbg->read(ds->ds_data, &offset,
2113ae86eb5Schristos dwarf_size);
2123ae86eb5Schristos cu->cu_abbrev_offset_cur = cu->cu_abbrev_offset;
2133ae86eb5Schristos cu->cu_pointer_size = dbg->read(ds->ds_data, &offset, 1);
2143ae86eb5Schristos cu->cu_next_offset = next_offset;
2153ae86eb5Schristos
2169262d0f3Schristos /* .debug_types extra fields. */
2179262d0f3Schristos if (!is_info) {
2189262d0f3Schristos memcpy(cu->cu_type_sig.signature,
2199262d0f3Schristos (char *) ds->ds_data + offset, 8);
2209262d0f3Schristos offset += 8;
2219262d0f3Schristos cu->cu_type_offset = dbg->read(ds->ds_data, &offset,
2229262d0f3Schristos dwarf_size);
2239262d0f3Schristos }
2249262d0f3Schristos
2253ae86eb5Schristos /* Add the compilation unit to the list. */
2269262d0f3Schristos if (is_info)
2273ae86eb5Schristos STAILQ_INSERT_TAIL(&dbg->dbg_cu, cu, cu_next);
2289262d0f3Schristos else
2299262d0f3Schristos STAILQ_INSERT_TAIL(&dbg->dbg_tu, cu, cu_next);
2303ae86eb5Schristos
2313ae86eb5Schristos if (cu->cu_version < 2 || cu->cu_version > 4) {
2323ae86eb5Schristos DWARF_SET_ERROR(dbg, error, DW_DLE_VERSION_STAMP_ERROR);
2333ae86eb5Schristos ret = DW_DLE_VERSION_STAMP_ERROR;
2343ae86eb5Schristos break;
2353ae86eb5Schristos }
2363ae86eb5Schristos
2373ae86eb5Schristos cu->cu_1st_offset = offset;
2383ae86eb5Schristos
2393ae86eb5Schristos offset = next_offset;
2403ae86eb5Schristos
2413ae86eb5Schristos if (!load_all)
2423ae86eb5Schristos break;
2433ae86eb5Schristos }
2443ae86eb5Schristos
2459262d0f3Schristos if (is_info) {
2463ae86eb5Schristos if ((Dwarf_Unsigned) dbg->dbg_info_off >= ds->ds_size)
2473ae86eb5Schristos dbg->dbg_info_loaded = 1;
2489262d0f3Schristos } else {
2499262d0f3Schristos if ((Dwarf_Unsigned) dbg->dbg_types_off >= ds->ds_size)
2509262d0f3Schristos dbg->dbg_types_loaded = 1;
2519262d0f3Schristos }
2523ae86eb5Schristos
2533ae86eb5Schristos return (ret);
2543ae86eb5Schristos }
2553ae86eb5Schristos
2563ae86eb5Schristos void
_dwarf_info_cleanup(Dwarf_Debug dbg)2573ae86eb5Schristos _dwarf_info_cleanup(Dwarf_Debug dbg)
2583ae86eb5Schristos {
2593ae86eb5Schristos Dwarf_CU cu, tcu;
2603ae86eb5Schristos
2613ae86eb5Schristos assert(dbg != NULL && dbg->dbg_mode == DW_DLC_READ);
2623ae86eb5Schristos
2633ae86eb5Schristos STAILQ_FOREACH_SAFE(cu, &dbg->dbg_cu, cu_next, tcu) {
2643ae86eb5Schristos STAILQ_REMOVE(&dbg->dbg_cu, cu, _Dwarf_CU, cu_next);
2653ae86eb5Schristos _dwarf_abbrev_cleanup(cu);
2663ae86eb5Schristos if (cu->cu_lineinfo != NULL) {
2673ae86eb5Schristos _dwarf_lineno_cleanup(cu->cu_lineinfo);
2683ae86eb5Schristos cu->cu_lineinfo = NULL;
2693ae86eb5Schristos }
2703ae86eb5Schristos free(cu);
2713ae86eb5Schristos }
2729262d0f3Schristos
2739262d0f3Schristos _dwarf_type_unit_cleanup(dbg);
2749262d0f3Schristos }
2759262d0f3Schristos
2769262d0f3Schristos void
_dwarf_type_unit_cleanup(Dwarf_Debug dbg)2779262d0f3Schristos _dwarf_type_unit_cleanup(Dwarf_Debug dbg)
2789262d0f3Schristos {
2799262d0f3Schristos Dwarf_CU cu, tcu;
2809262d0f3Schristos
2819262d0f3Schristos assert(dbg != NULL && dbg->dbg_mode == DW_DLC_READ);
2829262d0f3Schristos
2839262d0f3Schristos STAILQ_FOREACH_SAFE(cu, &dbg->dbg_tu, cu_next, tcu) {
2849262d0f3Schristos STAILQ_REMOVE(&dbg->dbg_tu, cu, _Dwarf_CU, cu_next);
2859262d0f3Schristos _dwarf_abbrev_cleanup(cu);
2869262d0f3Schristos free(cu);
2879262d0f3Schristos }
2883ae86eb5Schristos }
2893ae86eb5Schristos
2903ae86eb5Schristos int
_dwarf_info_gen(Dwarf_P_Debug dbg,Dwarf_Error * error)2913ae86eb5Schristos _dwarf_info_gen(Dwarf_P_Debug dbg, Dwarf_Error *error)
2923ae86eb5Schristos {
2933ae86eb5Schristos Dwarf_P_Section ds;
2943ae86eb5Schristos Dwarf_Rel_Section drs;
2953ae86eb5Schristos Dwarf_Unsigned offset;
2963ae86eb5Schristos Dwarf_CU cu;
2973ae86eb5Schristos int ret;
2983ae86eb5Schristos
2993ae86eb5Schristos assert(dbg != NULL && dbg->write_alloc != NULL);
3003ae86eb5Schristos
3013ae86eb5Schristos if (dbg->dbgp_root_die == NULL)
3023ae86eb5Schristos return (DW_DLE_NONE);
3033ae86eb5Schristos
3043ae86eb5Schristos /* Create the single CU for this debugging object. */
3053ae86eb5Schristos if ((cu = calloc(1, sizeof(struct _Dwarf_CU))) == NULL) {
3063ae86eb5Schristos DWARF_SET_ERROR(dbg, error, DW_DLE_MEMORY);
3073ae86eb5Schristos return (DW_DLE_MEMORY);
3083ae86eb5Schristos }
3093ae86eb5Schristos cu->cu_dbg = dbg;
3103ae86eb5Schristos cu->cu_version = 2; /* DWARF2 */
3113ae86eb5Schristos cu->cu_pointer_size = dbg->dbg_pointer_size;
3123ae86eb5Schristos STAILQ_INSERT_TAIL(&dbg->dbg_cu, cu, cu_next);
3133ae86eb5Schristos
3143ae86eb5Schristos /* Create .debug_info section. */
3153ae86eb5Schristos if ((ret = _dwarf_section_init(dbg, &dbg->dbgp_info, ".debug_info", 0,
3163ae86eb5Schristos error)) != DW_DLE_NONE)
3173ae86eb5Schristos goto gen_fail1;
3183ae86eb5Schristos ds = dbg->dbgp_info;
3193ae86eb5Schristos
3203ae86eb5Schristos /* Create relocation section for .debug_init */
3213ae86eb5Schristos if ((ret = _dwarf_reloc_section_init(dbg, &drs, ds, error)) !=
3223ae86eb5Schristos DW_DLE_NONE)
3233ae86eb5Schristos goto gen_fail0;
3243ae86eb5Schristos
3253ae86eb5Schristos /* Length placeholder. (We only use 32-bit DWARF format) */
3263ae86eb5Schristos RCHECK(WRITE_VALUE(cu->cu_length, 4));
3273ae86eb5Schristos
3283ae86eb5Schristos /* Write CU version */
3293ae86eb5Schristos RCHECK(WRITE_VALUE(cu->cu_version, 2));
3303ae86eb5Schristos
3313ae86eb5Schristos /*
3323ae86eb5Schristos * Write abbrev offset. (always 0, we only support single CU)
3333ae86eb5Schristos * Also generate a relocation entry for this offset.
3343ae86eb5Schristos */
3353ae86eb5Schristos RCHECK(_dwarf_reloc_entry_add(dbg, drs, ds, dwarf_drt_data_reloc, 4,
3363ae86eb5Schristos ds->ds_size, 0, cu->cu_abbrev_offset, ".debug_abbrev", error));
3373ae86eb5Schristos
3383ae86eb5Schristos /* Pointer size. */
3393ae86eb5Schristos RCHECK(WRITE_VALUE(cu->cu_pointer_size, 1));
3403ae86eb5Schristos
3413ae86eb5Schristos /* Transform the DIE(s) of this CU. */
3423ae86eb5Schristos RCHECK(_dwarf_die_gen(dbg, cu, drs, error));
3433ae86eb5Schristos
3443ae86eb5Schristos /* Now we can fill in the length of this CU. */
3453ae86eb5Schristos cu->cu_length = ds->ds_size - 4;
3463ae86eb5Schristos offset = 0;
3473ae86eb5Schristos dbg->write(ds->ds_data, &offset, cu->cu_length, 4);
3483ae86eb5Schristos
3493ae86eb5Schristos /* Inform application the creation of .debug_info ELF section. */
3503ae86eb5Schristos RCHECK(_dwarf_section_callback(dbg, ds, SHT_PROGBITS, 0, 0, 0, error));
3513ae86eb5Schristos
3523ae86eb5Schristos /*
3533ae86eb5Schristos * Inform application the creation of relocation section for
3543ae86eb5Schristos * .debug_info.
3553ae86eb5Schristos */
3563ae86eb5Schristos RCHECK(_dwarf_reloc_section_finalize(dbg, drs, error));
3573ae86eb5Schristos
3583ae86eb5Schristos return (DW_DLE_NONE);
3593ae86eb5Schristos
3603ae86eb5Schristos gen_fail:
3613ae86eb5Schristos _dwarf_reloc_section_free(dbg, &drs);
3623ae86eb5Schristos
3633ae86eb5Schristos gen_fail0:
3643ae86eb5Schristos _dwarf_section_free(dbg, &dbg->dbgp_info);
3653ae86eb5Schristos
3663ae86eb5Schristos gen_fail1:
3673ae86eb5Schristos STAILQ_REMOVE(&dbg->dbg_cu, cu, _Dwarf_CU, cu_next);
3683ae86eb5Schristos free(cu);
3693ae86eb5Schristos
3703ae86eb5Schristos return (ret);
3713ae86eb5Schristos }
3723ae86eb5Schristos
3733ae86eb5Schristos void
_dwarf_info_pro_cleanup(Dwarf_P_Debug dbg)3743ae86eb5Schristos _dwarf_info_pro_cleanup(Dwarf_P_Debug dbg)
3753ae86eb5Schristos {
3763ae86eb5Schristos Dwarf_CU cu;
3773ae86eb5Schristos
3783ae86eb5Schristos assert(dbg != NULL && dbg->dbg_mode == DW_DLC_WRITE);
3793ae86eb5Schristos
3803ae86eb5Schristos cu = STAILQ_FIRST(&dbg->dbg_cu);
3813ae86eb5Schristos if (cu != NULL) {
3823ae86eb5Schristos STAILQ_REMOVE(&dbg->dbg_cu, cu, _Dwarf_CU, cu_next);
3833ae86eb5Schristos _dwarf_abbrev_cleanup(cu);
3843ae86eb5Schristos free(cu);
3853ae86eb5Schristos }
3863ae86eb5Schristos }
387