4 * Babeltrace - Executable and Shared Object Debug Info Reader
6 * Copyright 2015 Antoine Busque <abusque@efficios.com>
8 * Author: Antoine Busque <abusque@efficios.com>
10 * Permission is hereby granted, free of charge, to any person obtaining a copy
11 * of this software and associated documentation files (the "Software"), to deal
12 * in the Software without restriction, including without limitation the rights
13 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 * copies of the Software, and to permit persons to whom the Software is
15 * furnished to do so, subject to the following conditions:
17 * The above copyright notice and this permission notice shall be included in
18 * all copies or substantial portions of the Software.
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
39 #include <babeltrace/dwarf.h>
40 #include <babeltrace/so-info.h>
41 #include <babeltrace/crc32.h>
42 #include <babeltrace/babeltrace-internal.h>
43 #include <babeltrace/utils.h>
46 * An address printed in hex is at most 20 bytes (16 for 64-bits +
47 * leading 0x + optional leading '+' if addr is an offset + null
50 #define ADDR_STR_LEN 20
53 int so_info_init(void)
57 if (elf_version(EV_CURRENT
) == EV_NONE
) {
58 fprintf(stderr
, "ELF library initialization failed: %s\n",
67 struct so_info
*so_info_create(const char *path
, uint64_t low_addr
,
68 uint64_t memsz
, bool is_pic
)
70 struct so_info
*so
= NULL
;
76 so
= g_new0(struct so_info
, 1);
81 so
->elf_path
= strdup(path
);
88 so
->low_addr
= low_addr
;
89 so
->high_addr
= so
->low_addr
+ so
->memsz
;
99 void so_info_destroy(struct so_info
*so
)
105 dwarf_end(so
->dwarf_info
);
108 free(so
->dwarf_path
);
110 free(so
->dbg_link_filename
);
112 elf_end(so
->elf_file
);
122 int so_info_set_build_id(struct so_info
*so
, uint8_t *build_id
,
125 if (!so
|| !build_id
) {
129 so
->build_id
= malloc(build_id_len
);
134 memcpy(so
->build_id
, build_id
, build_id_len
);
135 so
->build_id_len
= build_id_len
;
138 * Reset the is_elf_only flag in case it had been set
139 * previously, because we might find separate debug info using
140 * the new build id information.
142 so
->is_elf_only
= false;
152 int so_info_set_debug_link(struct so_info
*so
, char *filename
, uint32_t crc
)
154 if (!so
|| !filename
) {
158 so
->dbg_link_filename
= strdup(filename
);
159 if (!so
->dbg_link_filename
) {
163 so
->dbg_link_crc
= crc
;
166 * Reset the is_elf_only flag in case it had been set
167 * previously, because we might find separate debug info using
168 * the new build id information.
170 so
->is_elf_only
= false;
180 * Tries to read DWARF info from the location given by path, and
181 * attach it to the given so_info instance if it exists.
183 * @param so so_info instance for which to set DWARF info
184 * @param path Presumed location of the DWARF info
185 * @returns 0 on success, -1 on failure
188 int so_info_set_dwarf_info_from_path(struct so_info
*so
, char *path
)
190 int fd
= -1, ret
= 0;
191 struct bt_dwarf_cu
*cu
= NULL
;
192 Dwarf
*dwarf_info
= NULL
;
198 fd
= open(path
, O_RDONLY
);
203 dwarf_info
= dwarf_begin(fd
, DWARF_C_READ
);
209 * Check if the dwarf info has any CU. If not, the SO's object
210 * file contains no DWARF info.
212 cu
= bt_dwarf_cu_create(dwarf_info
);
217 ret
= bt_dwarf_cu_next(cu
);
223 so
->dwarf_path
= strdup(path
);
224 if (!so
->dwarf_path
) {
227 so
->dwarf_info
= dwarf_info
;
234 dwarf_end(dwarf_info
);
242 * Try to set the dwarf_info for a given so_info instance via the
245 * @param so so_info instance for which to retrieve the
246 * DWARF info via build ID
247 * @returns 0 on success (i.e. dwarf_info set), -1 on failure
250 int so_info_set_dwarf_info_build_id(struct so_info
*so
)
252 int i
= 0, ret
= 0, dbg_dir_trailing_slash
= 0;
253 char *path
= NULL
, *build_id_file
= NULL
;
254 const char *dbg_dir
= NULL
;
255 size_t build_id_file_len
, path_len
;
257 if (!so
|| !so
->build_id
) {
261 dbg_dir
= opt_debug_info_dir
? : DEFAULT_DEBUG_DIR
;
263 dbg_dir_trailing_slash
= dbg_dir
[strlen(dbg_dir
) - 1] == '/';
265 /* 2 characters per byte printed in hex, +2 for '/' and '\0' */
266 build_id_file_len
= (2 * so
->build_id_len
) + 2;
267 build_id_file
= malloc(build_id_file_len
);
268 if (!build_id_file
) {
272 snprintf(build_id_file
, 4, "%02x/", so
->build_id
[0]);
273 for (i
= 1; i
< so
->build_id_len
; ++i
) {
274 int path_idx
= 3 + 2 * (i
- 1);
276 snprintf(&build_id_file
[path_idx
], 3, "%02x", so
->build_id
[i
]);
279 path_len
= strlen(dbg_dir
) + strlen(BUILD_ID_SUBDIR
) +
280 strlen(build_id_file
) + strlen(BUILD_ID_SUFFIX
) + 1;
281 if (!dbg_dir_trailing_slash
) {
285 path
= malloc(path_len
);
290 strcpy(path
, dbg_dir
);
291 if (!dbg_dir_trailing_slash
) {
294 strcat(path
, BUILD_ID_SUBDIR
);
295 strcat(path
, build_id_file
);
296 strcat(path
, BUILD_ID_SUFFIX
);
298 ret
= so_info_set_dwarf_info_from_path(so
, path
);
315 * Tests whether the file located at path exists and has the expected
318 * This predicate is used when looking up separate debug info via the
319 * GNU debuglink method. The expected crc can be found .gnu_debuglink
320 * section in the original ELF file, along with the filename for the
321 * file containing the debug info.
323 * @param path Full path at which to look for the debug file
324 * @param crc Expected checksum for the debug file
325 * @returns 1 if the file exists and has the correct checksum,
329 int is_valid_debug_file(char *path
, uint32_t crc
)
331 int ret
= 0, fd
= -1;
338 fd
= open(path
, O_RDONLY
);
343 ret
= crc32(fd
, &_crc
);
357 * Try to set the dwarf_info for a given so_info instance via the
360 * @param so so_info instance for which to retrieve the
361 * DWARF info via debug link
362 * @returns 0 on success (i.e. dwarf_info set), -1 on failure
365 int so_info_set_dwarf_info_debug_link(struct so_info
*so
)
368 const char *dbg_dir
= NULL
;
369 char *dir_name
= NULL
, *so_dir
= NULL
, *path
= NULL
;
370 size_t max_path_len
= 0;
372 if (!so
|| !so
->dbg_link_filename
) {
376 dbg_dir
= opt_debug_info_dir
? : DEFAULT_DEBUG_DIR
;
378 dir_name
= dirname(so
->elf_path
);
383 /* so_dir is just dir_name with a trailing slash */
384 so_dir
= malloc(strlen(dir_name
) + 2);
389 strcpy(so_dir
, dir_name
);
392 max_path_len
= strlen(dbg_dir
) + strlen(so_dir
) +
393 strlen(DEBUG_SUBDIR
) + strlen(so
->dbg_link_filename
)
395 path
= malloc(max_path_len
);
400 /* First look in the SO's dir */
401 strcpy(path
, so_dir
);
402 strcat(path
, so
->dbg_link_filename
);
404 if (is_valid_debug_file(path
, so
->dbg_link_crc
)) {
408 /* If not found, look in .debug subdir */
409 strcpy(path
, so_dir
);
410 strcat(path
, DEBUG_SUBDIR
);
411 strcat(path
, so
->dbg_link_filename
);
413 if (is_valid_debug_file(path
, so
->dbg_link_crc
)) {
417 /* Lastly, look under the global debug directory */
418 strcpy(path
, dbg_dir
);
419 strcat(path
, so_dir
);
420 strcat(path
, so
->dbg_link_filename
);
422 if (is_valid_debug_file(path
, so
->dbg_link_crc
)) {
435 ret
= so_info_set_dwarf_info_from_path(so
, path
);
444 * Initialize the DWARF info for a given executable.
446 * @param so so_info instance
447 * @returns 0 on success, -1 on failure
450 int so_info_set_dwarf_info(struct so_info
*so
)
458 /* First try to set the DWARF info from the ELF file */
459 ret
= so_info_set_dwarf_info_from_path(so
, so
->elf_path
);
465 * If that fails, try to find separate debug info via build ID
468 ret
= so_info_set_dwarf_info_build_id(so
);
473 ret
= so_info_set_dwarf_info_debug_link(so
);
485 * Initialize the ELF file for a given executable.
487 * @param so so_info instance
488 * @returns 0 on success, -1 on failure
491 int so_info_set_elf_file(struct so_info
*so
)
494 Elf
*elf_file
= NULL
;
500 elf_fd
= open(so
->elf_path
, O_RDONLY
);
502 fprintf(stderr
, "Failed to open %s\n", so
->elf_path
);
506 elf_file
= elf_begin(elf_fd
, ELF_C_READ
, NULL
);
508 fprintf(stderr
, "elf_begin failed: %s\n", elf_errmsg(-1));
512 if (elf_kind(elf_file
) != ELF_K_ELF
) {
513 fprintf(stderr
, "Error: %s is not an ELF object\n",
519 so
->elf_file
= elf_file
;
530 void source_location_destroy(struct source_location
*src_loc
)
536 free(src_loc
->filename
);
541 * Try to find the symbol closest to an address within a given ELF
544 * Only function symbols are taken into account. The symbol's address
545 * must precede `addr`. A symbol with a closer address might exist
546 * after `addr` but is irrelevant because it cannot encompass `addr`.
548 * On success, if found, the out parameters `sym` and `shdr` are
549 * set. On failure or if none are found, they remain unchanged.
551 * @param scn ELF section in which to look for the address
552 * @param addr Virtual memory address for which to find the
553 * nearest function symbol
554 * @param sym Out parameter, the nearest function symbol
555 * @param shdr Out parameter, the section header for scn
556 * @returns 0 on success, -1 on failure
559 int so_info_get_nearest_symbol_from_section(Elf_Scn
*scn
, uint64_t addr
,
560 GElf_Sym
**sym
, GElf_Shdr
**shdr
)
564 Elf_Data
*data
= NULL
;
565 GElf_Shdr
*_shdr
= NULL
;
566 GElf_Sym
*nearest_sym
= NULL
;
568 if (!scn
|| !sym
|| !shdr
) {
572 _shdr
= g_new0(GElf_Shdr
, 1);
577 _shdr
= gelf_getshdr(scn
, _shdr
);
582 if (_shdr
->sh_type
!= SHT_SYMTAB
) {
584 * We are only interested in symbol table (symtab)
585 * sections, skip this one.
590 data
= elf_getdata(scn
, NULL
);
595 symbol_count
= _shdr
->sh_size
/ _shdr
->sh_entsize
;
597 for (i
= 0; i
< symbol_count
; ++i
) {
598 GElf_Sym
*cur_sym
= NULL
;
600 cur_sym
= g_new0(GElf_Sym
, 1);
604 cur_sym
= gelf_getsym(data
, i
, cur_sym
);
608 if (GELF_ST_TYPE(cur_sym
->st_info
) != STT_FUNC
) {
609 /* We're only interested in the functions. */
614 if (cur_sym
->st_value
<= addr
&&
616 cur_sym
->st_value
> nearest_sym
->st_value
)) {
618 nearest_sym
= cur_sym
;
641 * Get the name of the function containing a given address within an
642 * executable using ELF symbols.
644 * The function name is in fact the name of the nearest ELF symbol,
645 * followed by the offset in bytes between the address and the symbol
646 * (in hex), separated by a '+' character.
648 * If found, the out parameter `func_name` is set on success. On failure,
649 * it remains unchanged.
651 * @param so so_info instance for the executable containing
653 * @param addr Virtual memory address for which to find the
655 * @param func_name Out parameter, the function name
656 * @returns 0 on success, -1 on failure
659 int so_info_lookup_elf_function_name(struct so_info
*so
, uint64_t addr
,
663 * TODO (possible optimisation): if an ELF has no symtab
664 * section, it has been stripped. Therefore, it would be wise
665 * to store a flag indicating the stripped status after the
666 * first iteration to prevent subsequent ones.
670 GElf_Sym
*sym
= NULL
;
671 GElf_Shdr
*shdr
= NULL
;
672 char *sym_name
= NULL
;
673 char *_func_name
= NULL
;
674 char offset_str
[ADDR_STR_LEN
];
676 /* Set ELF file if it hasn't been accessed yet. */
678 ret
= so_info_set_elf_file(so
);
680 /* Failed to set ELF file. */
685 scn
= elf_nextscn(so
->elf_file
, scn
);
690 while (scn
&& !sym
) {
691 ret
= so_info_get_nearest_symbol_from_section(
692 scn
, addr
, &sym
, &shdr
);
697 scn
= elf_nextscn(so
->elf_file
, scn
);
701 sym_name
= elf_strptr(so
->elf_file
, shdr
->sh_link
,
707 snprintf(offset_str
, ADDR_STR_LEN
, "+%#0" PRIx64
,
708 addr
- sym
->st_value
);
709 _func_name
= malloc(strlen(sym_name
) + ADDR_STR_LEN
);
714 strcpy(_func_name
, sym_name
);
715 strcat(_func_name
, offset_str
);
716 *func_name
= _func_name
;
731 * Get the name of the function containing a given address within a
732 * given compile unit (CU).
734 * If found, the out parameter `func_name` is set on success. On
735 * failure, it remains unchanged.
737 * @param cu bt_dwarf_cu instance which may contain the address
738 * @param addr Virtual memory address for which to find the
740 * @param func_name Out parameter, the function name
741 * @returns 0 on success, -1 on failure
744 int so_info_lookup_cu_function_name(struct bt_dwarf_cu
*cu
, uint64_t addr
,
747 int ret
= 0, found
= 0;
748 char *_func_name
= NULL
;
749 struct bt_dwarf_die
*die
= NULL
;
751 if (!cu
|| !func_name
) {
755 die
= bt_dwarf_die_create(cu
);
760 while (bt_dwarf_die_next(die
) == 0) {
763 ret
= bt_dwarf_die_get_tag(die
, &tag
);
768 if (tag
== DW_TAG_subprogram
) {
769 ret
= bt_dwarf_die_contains_addr(die
, addr
, &found
);
781 ret
= bt_dwarf_die_get_name(die
, &_func_name
);
786 *func_name
= _func_name
;
789 bt_dwarf_die_destroy(die
);
793 bt_dwarf_die_destroy(die
);
798 * Get the name of the function containing a given address within an
799 * executable using DWARF debug info.
801 * If found, the out parameter `func_name` is set on success. On
802 * failure, it remains unchanged.
804 * @param so so_info instance for the executable containing
806 * @param addr Virtual memory address for which to find the
808 * @param func_name Out parameter, the function name
809 * @returns 0 on success, -1 on failure
812 int so_info_lookup_dwarf_function_name(struct so_info
*so
, uint64_t addr
,
816 char *_func_name
= NULL
;
817 struct bt_dwarf_cu
*cu
= NULL
;
819 if (!so
|| !func_name
) {
823 cu
= bt_dwarf_cu_create(so
->dwarf_info
);
828 while (bt_dwarf_cu_next(cu
) == 0) {
829 ret
= so_info_lookup_cu_function_name(cu
, addr
, &_func_name
);
840 *func_name
= _func_name
;
843 bt_dwarf_cu_destroy(cu
);
847 bt_dwarf_cu_destroy(cu
);
852 int so_info_lookup_function_name(struct so_info
*so
, uint64_t addr
,
856 char *_func_name
= NULL
;
858 if (!so
|| !func_name
) {
862 /* Set DWARF info if it hasn't been accessed yet. */
863 if (!so
->dwarf_info
&& !so
->is_elf_only
) {
864 ret
= so_info_set_dwarf_info(so
);
866 /* Failed to set DWARF info, fallback to ELF. */
867 so
->is_elf_only
= true;
871 if (!so_info_has_address(so
, addr
)) {
876 * Addresses in ELF and DWARF are relative to base address for
877 * PIC, so make the address argument relative too if needed.
880 addr
-= so
->low_addr
;
883 if (so
->is_elf_only
) {
884 ret
= so_info_lookup_elf_function_name(so
, addr
, &_func_name
);
886 ret
= so_info_lookup_dwarf_function_name(so
, addr
, &_func_name
);
889 if (ret
|| !_func_name
) {
893 *func_name
= _func_name
;
901 int so_info_get_bin_loc(struct so_info
*so
, uint64_t addr
, char **bin_loc
)
904 char *_bin_loc
= NULL
;
906 if (!so
|| !bin_loc
) {
911 addr
-= so
->low_addr
;
912 ret
= asprintf(&_bin_loc
, "+%#0" PRIx64
, addr
);
914 ret
= asprintf(&_bin_loc
, "@%#0" PRIx64
, addr
);
917 if (ret
== -1 || !_bin_loc
) {
929 * Predicate used to determine whether the children of a given DIE
930 * contain a specific address.
932 * More specifically, the parameter `die` is expected to be a
933 * subprogram (function) DIE, and this predicate tells whether any
934 * subroutines are inlined within this function and would contain
937 * Do note that this function advances the position of `die`. If the
938 * address is found within one of its children, `die` will be pointing
939 * to that child upon returning from the function, allowing to extract
940 * the information deemed necessary.
942 * @param die The parent DIE in whose children the address will be
944 * @param addr The address for which to look for in the DIEs
945 * @returns Returns 1 if the address was found, 0 if not
948 int so_info_child_die_has_address(struct bt_dwarf_die
*die
, uint64_t addr
)
950 int ret
= 0, contains
= 0;
956 ret
= bt_dwarf_die_child(die
);
964 ret
= bt_dwarf_die_get_tag(die
, &tag
);
969 if (tag
== DW_TAG_inlined_subroutine
) {
970 ret
= bt_dwarf_die_contains_addr(die
, addr
, &contains
);
980 } while (bt_dwarf_die_next(die
) == 0);
991 * Lookup the source location for a given address within a CU, making
992 * the assumption that it is contained within an inline routine in a
995 * @param cu bt_dwarf_cu instance in which to look for the address
996 * @param addr The address for which to look for
997 * @param src_loc Out parameter, the source location (filename and
998 * line number) for the address
999 * @returns 0 on success, -1 on failure
1002 int so_info_lookup_cu_src_loc_inl(struct bt_dwarf_cu
*cu
, uint64_t addr
,
1003 struct source_location
**src_loc
)
1005 int ret
= 0, found
= 0;
1006 struct bt_dwarf_die
*die
= NULL
;
1007 struct source_location
*_src_loc
= NULL
;
1009 if (!cu
|| !src_loc
) {
1013 die
= bt_dwarf_die_create(cu
);
1018 while (bt_dwarf_die_next(die
) == 0) {
1021 ret
= bt_dwarf_die_get_tag(die
, &tag
);
1026 if (tag
== DW_TAG_subprogram
) {
1029 ret
= bt_dwarf_die_contains_addr(die
, addr
, &contains
);
1036 * Try to find an inlined subroutine
1037 * child of this DIE containing addr.
1039 found
= so_info_child_die_has_address(
1048 char *filename
= NULL
;
1051 _src_loc
= g_new0(struct source_location
, 1);
1056 ret
= bt_dwarf_die_get_call_file(die
, &filename
);
1060 ret
= bt_dwarf_die_get_call_line(die
, &line_no
);
1066 _src_loc
->filename
= filename
;
1067 _src_loc
->line_no
= line_no
;
1068 *src_loc
= _src_loc
;
1071 bt_dwarf_die_destroy(die
);
1075 source_location_destroy(_src_loc
);
1076 bt_dwarf_die_destroy(die
);
1081 * Lookup the source location for a given address within a CU,
1082 * assuming that it is contained within an inlined function.
1084 * A source location can be found regardless of inlining status for
1085 * this method, but in the case of an inlined function, the returned
1086 * source location will point not to the callsite but rather to the
1087 * definition site of the inline function.
1089 * @param cu bt_dwarf_cu instance in which to look for the address
1090 * @param addr The address for which to look for
1091 * @param src_loc Out parameter, the source location (filename and
1092 * line number) for the address
1093 * @returns 0 on success, -1 on failure
1096 int so_info_lookup_cu_src_loc_no_inl(struct bt_dwarf_cu
*cu
, uint64_t addr
,
1097 struct source_location
**src_loc
)
1099 struct source_location
*_src_loc
= NULL
;
1100 struct bt_dwarf_die
*die
= NULL
;
1101 const char *filename
= NULL
;
1102 Dwarf_Line
*line
= NULL
;
1103 Dwarf_Addr line_addr
;
1106 if (!cu
|| !src_loc
) {
1110 die
= bt_dwarf_die_create(cu
);
1115 line
= dwarf_getsrc_die(die
->dwarf_die
, addr
);
1120 ret
= dwarf_lineaddr(line
, &line_addr
);
1125 filename
= dwarf_linesrc(line
, NULL
, NULL
);
1130 if (addr
== line_addr
) {
1131 _src_loc
= g_new0(struct source_location
, 1);
1136 ret
= dwarf_lineno(line
, &line_no
);
1141 _src_loc
->line_no
= line_no
;
1142 _src_loc
->filename
= strdup(filename
);
1145 bt_dwarf_die_destroy(die
);
1148 *src_loc
= _src_loc
;
1154 source_location_destroy(_src_loc
);
1155 bt_dwarf_die_destroy(die
);
1160 * Get the source location (file name and line number) for a given
1161 * address within a compile unit (CU).
1163 * On success, the out parameter `src_loc` is set if found. On
1164 * failure, it remains unchanged.
1166 * @param so bt_dwarf_cu instance for the compile unit which
1167 * may contain the address
1168 * @param addr Virtual memory address for which to find the
1170 * @param src_loc Out parameter, the source location
1171 * @returns 0 on success, -1 on failure
1174 int so_info_lookup_cu_src_loc(struct bt_dwarf_cu
*cu
, uint64_t addr
,
1175 struct source_location
**src_loc
)
1178 struct source_location
*_src_loc
= NULL
;
1180 if (!cu
|| !src_loc
) {
1184 ret
= so_info_lookup_cu_src_loc_inl(cu
, addr
, &_src_loc
);
1193 ret
= so_info_lookup_cu_src_loc_no_inl(cu
, addr
, &_src_loc
);
1204 *src_loc
= _src_loc
;
1210 source_location_destroy(_src_loc
);
1215 int so_info_lookup_source_location(struct so_info
*so
, uint64_t addr
,
1216 struct source_location
**src_loc
)
1218 struct bt_dwarf_cu
*cu
= NULL
;
1219 struct source_location
*_src_loc
= NULL
;
1221 if (!so
|| !src_loc
) {
1225 /* Set DWARF info if it hasn't been accessed yet. */
1226 if (!so
->dwarf_info
&& !so
->is_elf_only
) {
1227 if (so_info_set_dwarf_info(so
)) {
1228 /* Failed to set DWARF info. */
1229 so
->is_elf_only
= true;
1233 if (so
->is_elf_only
) {
1234 /* We cannot lookup source location without DWARF info. */
1238 if (!so_info_has_address(so
, addr
)) {
1243 * Addresses in ELF and DWARF are relative to base address for
1244 * PIC, so make the address argument relative too if needed.
1247 addr
-= so
->low_addr
;
1250 cu
= bt_dwarf_cu_create(so
->dwarf_info
);
1255 while (bt_dwarf_cu_next(cu
) == 0) {
1258 ret
= so_info_lookup_cu_src_loc(cu
, addr
, &_src_loc
);
1268 bt_dwarf_cu_destroy(cu
);
1270 *src_loc
= _src_loc
;
1276 source_location_destroy(_src_loc
);
1277 bt_dwarf_cu_destroy(cu
);