2 * Copyright (c) 2009 Kai Wang
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 #include <sys/param.h>
45 ELFTC_VCSID("$Id: addr2line.c 3499 2016-11-25 16:06:29Z emaste $");
51 Dwarf_Unsigned call_file;
52 Dwarf_Unsigned call_line;
54 Dwarf_Signed ranges_cnt;
55 struct Func *inlined_caller;
56 STAILQ_ENTRY(Func) next;
60 RB_ENTRY(range) entry;
65 Dwarf_Signed nsrcfiles;
66 STAILQ_HEAD(, Func) funclist;
71 static struct option longopts[] = {
72 {"addresses", no_argument, NULL, 'a'},
73 {"target" , required_argument, NULL, 'b'},
74 {"demangle", no_argument, NULL, 'C'},
75 {"exe", required_argument, NULL, 'e'},
76 {"functions", no_argument, NULL, 'f'},
77 {"inlines", no_argument, NULL, 'i'},
78 {"section", required_argument, NULL, 'j'},
79 {"pretty-print", no_argument, NULL, 'p'},
80 {"basename", no_argument, NULL, 's'},
81 {"help", no_argument, NULL, 'H'},
82 {"version", no_argument, NULL, 'V'},
86 static int demangle, func, base, inlines, print_addr, pretty_print;
87 static char unknown[] = { '?', '?', '\0' };
88 static Dwarf_Addr section_base;
89 /* Need a new curlopc that stores last lopc value. */
90 static Dwarf_Unsigned curlopc = ~0ULL;
91 static RB_HEAD(cutree, range) cuhead = RB_INITIALIZER(&cuhead);
94 lopccmp(struct range *e1, struct range *e2)
96 return (e1->lopc < e2->lopc ? -1 : e1->lopc > e2->lopc);
99 RB_PROTOTYPE(cutree, range, entry, lopccmp);
100 RB_GENERATE(cutree, range, entry, lopccmp)
102 #define USAGE_MESSAGE "\
103 Usage: %s [options] hexaddress...\n\
104 Map program addresses to source file names and line numbers.\n\n\
106 -a | --addresses Display address prior to line number info.\n\
107 -b TGT | --target=TGT (Accepted but ignored).\n\
108 -e EXE | --exe=EXE Use program \"EXE\" to translate addresses.\n\
109 -f | --functions Display function names.\n\
110 -i | --inlines Display caller info for inlined functions.\n\
111 -j NAME | --section=NAME Values are offsets into section \"NAME\".\n\
112 -p | --pretty-print Display line number info and function name\n\
113 in human readable manner.\n\
114 -s | --basename Only show the base name for each file name.\n\
115 -C | --demangle Demangle C++ names.\n\
116 -H | --help Print a help message.\n\
117 -V | --version Print a version identifier and exit.\n"
122 (void) fprintf(stderr, USAGE_MESSAGE, ELFTC_GETPROGNAME());
130 fprintf(stderr, "%s (%s)\n", ELFTC_GETPROGNAME(), elftc_version());
135 * Handle DWARF 4 'offset from' DW_AT_high_pc. Although we don't
136 * fully support DWARF 4, some compilers (like FreeBSD Clang 3.5.1)
137 * generate DW_AT_high_pc as an offset from DW_AT_low_pc.
139 * "If the value of the DW_AT_high_pc is of class address, it is the
140 * relocated address of the first location past the last instruction
141 * associated with the entity; if it is of class constant, the value
142 * is an unsigned integer offset which when added to the low PC gives
143 * the address of the first location past the last instruction
144 * associated with the entity."
146 * DWARF4 spec, section 2.17.2.
149 handle_high_pc(Dwarf_Die die, Dwarf_Unsigned lopc, Dwarf_Unsigned *hipc)
156 ret = dwarf_attr(die, DW_AT_high_pc, &at, &de);
157 if (ret == DW_DLV_ERROR) {
158 warnx("dwarf_attr failed: %s", dwarf_errmsg(de));
161 ret = dwarf_whatform(at, &form, &de);
162 if (ret == DW_DLV_ERROR) {
163 warnx("dwarf_whatform failed: %s", dwarf_errmsg(de));
166 if (dwarf_get_form_class(2, 0, 0, form) == DW_FORM_CLASS_CONSTANT)
173 search_func(struct range *range, Dwarf_Unsigned addr)
176 Dwarf_Unsigned lopc, hipc, addr_base;
181 STAILQ_FOREACH(f, &range->funclist, next) {
182 if (f->ranges != NULL) {
184 for (i = 0; i < f->ranges_cnt; i++) {
185 if (f->ranges[i].dwr_type == DW_RANGES_END)
187 if (f->ranges[i].dwr_type ==
188 DW_RANGES_ADDRESS_SELECTION) {
189 addr_base = f->ranges[i].dwr_addr2;
193 /* DW_RANGES_ENTRY */
194 lopc = f->ranges[i].dwr_addr1 + addr_base;
195 hipc = f->ranges[i].dwr_addr2 + addr_base;
196 if (addr >= lopc && addr < hipc) {
207 } else if (addr >= f->lopc && addr < f->hipc) {
209 (f->lopc >= f0->lopc && f->hipc <= f0->hipc))
218 collect_func(Dwarf_Debug dbg, Dwarf_Die die, struct Func *parent,
221 Dwarf_Die ret_die, abst_die, spec_die;
224 Dwarf_Unsigned lopc, hipc, ranges_off;
225 Dwarf_Signed ranges_cnt;
227 Dwarf_Attribute abst_at, spec_at;
228 Dwarf_Ranges *ranges;
229 const char *funcname;
231 int found_ranges, ret;
234 abst_die = spec_die = NULL;
236 if (dwarf_tag(die, &tag, &de)) {
237 warnx("dwarf_tag: %s", dwarf_errmsg(de));
240 if (tag == DW_TAG_subprogram || tag == DW_TAG_entry_point ||
241 tag == DW_TAG_inlined_subroutine || tag == DW_TAG_label) {
243 * Function address range can be specified by either
244 * a DW_AT_ranges attribute which points to a range list or
245 * by a pair of DW_AT_low_pc and DW_AT_high_pc attributes.
250 if (dwarf_attrval_unsigned(die, DW_AT_ranges, &ranges_off,
252 dwarf_get_ranges(dbg, (Dwarf_Off) ranges_off, &ranges,
253 &ranges_cnt, NULL, &de) == DW_DLV_OK) {
254 if (ranges != NULL && ranges_cnt > 0) {
261 * Ranges pointer not found. Search for DW_AT_low_pc, and
262 * DW_AT_high_pc iff die is not a label. Labels doesn't have
264 if (tag == DW_TAG_label) {
265 if (dwarf_attrval_unsigned(die, DW_AT_low_pc, &lopc,
269 if (dwarf_attrval_unsigned(die, DW_AT_low_pc, &lopc,
270 &de) || dwarf_attrval_unsigned(die, DW_AT_high_pc,
273 if (handle_high_pc(die, lopc, &hipc) != DW_DLV_OK)
279 * Most common case the function name is stored in DW_AT_name
282 if (dwarf_attrval_string(die, DW_AT_name, &funcname, &de) ==
287 * For inlined function, the actual name is probably in the DIE
288 * referenced by DW_AT_abstract_origin. (if present)
290 if (dwarf_attr(die, DW_AT_abstract_origin, &abst_at, &de) ==
292 dwarf_global_formref(abst_at, &ref, &de) == DW_DLV_OK &&
293 dwarf_offdie(dbg, ref, &abst_die, &de) == DW_DLV_OK &&
294 dwarf_attrval_string(abst_die, DW_AT_name, &funcname,
299 * If DW_AT_name is not present, but DW_AT_specification is
300 * present, then probably the actual name is in the DIE
301 * referenced by DW_AT_specification.
303 if (dwarf_attr(die, DW_AT_specification, &spec_at, &de) ==
305 dwarf_global_formref(spec_at, &ref, &de) == DW_DLV_OK &&
306 dwarf_offdie(dbg, ref, &spec_die, &de) == DW_DLV_OK &&
307 dwarf_attrval_string(spec_die, DW_AT_name, &funcname,
311 /* Skip if no name associated with this DIE. */
315 if ((f = calloc(1, sizeof(*f))) == NULL)
316 err(EXIT_FAILURE, "calloc");
317 if ((f->name = strdup(funcname)) == NULL)
318 err(EXIT_FAILURE, "strdup");
321 f->ranges_cnt = ranges_cnt;
326 if (tag == DW_TAG_inlined_subroutine) {
327 f->inlined_caller = parent;
328 dwarf_attrval_unsigned(die, DW_AT_call_file,
330 dwarf_attrval_unsigned(die, DW_AT_call_line,
333 STAILQ_INSERT_TAIL(&range->funclist, f, next);
338 /* Search children. */
339 ret = dwarf_child(die, &ret_die, &de);
340 if (ret == DW_DLV_ERROR)
341 warnx("dwarf_child: %s", dwarf_errmsg(de));
342 else if (ret == DW_DLV_OK) {
344 collect_func(dbg, ret_die, f, range);
346 collect_func(dbg, ret_die, parent, range);
349 /* Search sibling. */
350 ret = dwarf_siblingof(dbg, die, &ret_die, &de);
351 if (ret == DW_DLV_ERROR)
352 warnx("dwarf_siblingof: %s", dwarf_errmsg(de));
353 else if (ret == DW_DLV_OK)
354 collect_func(dbg, ret_die, parent, range);
357 if (die != range->die)
358 dwarf_dealloc(dbg, die, DW_DLA_DIE);
360 if (abst_die != NULL)
361 dwarf_dealloc(dbg, abst_die, DW_DLA_DIE);
363 if (spec_die != NULL)
364 dwarf_dealloc(dbg, spec_die, DW_DLA_DIE);
368 print_inlines(struct range *range, struct Func *f, Dwarf_Unsigned call_file,
369 Dwarf_Unsigned call_line)
371 char demangled[1024];
374 if (call_file > 0 && (Dwarf_Signed) call_file <= range->nsrcfiles)
375 file = range->srcfiles[call_file - 1];
380 printf(" (inlined by) ");
383 if (demangle && !elftc_demangle(f->name, demangled,
384 sizeof(demangled), 0)) {
386 printf("%s at ", demangled);
388 printf("%s\n", demangled);
391 printf("%s at ", f->name);
393 printf("%s\n", f->name);
396 (void) printf("%s:%ju\n", base ? basename(file) : file,
397 (uintmax_t) call_line);
399 if (f->inlined_caller != NULL)
400 print_inlines(range, f->inlined_caller, f->call_file,
404 static struct range *
405 culookup(Dwarf_Unsigned addr)
407 struct range find, *res;
410 res = RB_NFIND(cutree, &cuhead, &find);
412 if (res->lopc != addr)
413 res = RB_PREV(cutree, &cuhead, res);
414 if (res != NULL && addr >= res->lopc && addr < res->hipc)
417 res = RB_MAX(cutree, &cuhead);
418 if (res != NULL && addr >= res->lopc && addr < res->hipc)
425 * When DW_AT_ranges, DW_AT_low_pc/DW_AT_high_pc are all absent, we check the
426 * children of cu die for labels. If the address falls into one of the labels
427 * ranges(aranges), return the label DIE.
430 check_labels(Dwarf_Debug dbg, Dwarf_Die die, Dwarf_Unsigned addr,
431 struct range **range) {
433 Dwarf_Arange *aranges;
434 Dwarf_Die prev_die, ret_die;
438 Dwarf_Unsigned lopc, length;
440 struct range *labelp, **labels;
441 int i, j, label_cnt, ret;
443 prev_die = ret_die = NULL;
448 ret = dwarf_get_aranges(dbg, &aranges, &arcnt, &de);
449 if (ret != DW_DLV_OK && ret != DW_DLV_NO_ENTRY)
450 warnx("dwarf_get_aranges failed: %s", dwarf_errmsg(de));
452 /* Child of current CU. */
453 ret = dwarf_child(die, &prev_die, &de);
454 if (ret == DW_DLV_ERROR)
455 warnx("dwarf_child: %s", dwarf_errmsg(de));
459 if (dwarf_tag(prev_die, &tag, &de) != DW_DLV_OK) {
460 warnx("dwarf_tag failed: %s",
464 if (tag == DW_TAG_label) {
465 if (dwarf_attrval_unsigned(prev_die, DW_AT_low_pc,
466 &lopc, &de) == DW_DLV_OK)
470 if (dwarf_siblingof(dbg, prev_die, &ret_die, &de) != DW_DLV_OK)
473 if (prev_die != NULL)
474 dwarf_dealloc(dbg, prev_die, DW_DLA_DIE);
479 return (DW_DLV_NO_ENTRY);
481 /* Allocate space for labels. */
482 if ((labels = calloc(label_cnt, sizeof(struct range *))) == NULL)
483 err(EXIT_FAILURE, "calloc");
485 /* Add labels to list. */
486 ret = dwarf_child(die, &prev_die, &de);
487 if (ret == DW_DLV_ERROR)
488 warnx("dwarf_child: %s", dwarf_errmsg(de));
490 if (dwarf_tag(prev_die, &tag, &de) != DW_DLV_OK) {
491 warnx("dwarf_tag failed: %s",
496 if (tag == DW_TAG_label) {
497 if (dwarf_attrval_unsigned(prev_die, DW_AT_low_pc,
498 &lopc, &de) == DW_DLV_OK) {
499 if (curlopc == lopc) {
500 for (i = 0; i < label_cnt - 1; i++) {
501 if (labels[i] != *range)
507 labelp = calloc(1, sizeof(struct range));
509 err(EXIT_FAILURE, "calloc");
511 labelp->die = prev_die;
513 STAILQ_INIT(&labelp->funclist);
514 labels[i++] = labelp;
517 if (dwarf_siblingof(dbg, prev_die, &ret_die, &de) != DW_DLV_OK)
519 if (prev_die != NULL && tag != DW_TAG_label)
520 dwarf_dealloc(dbg, prev_die, DW_DLA_DIE);
524 /* Set hipc for each label using aranges */
525 for (i = 0; i < label_cnt; i++) {
526 for (j = 0; j < arcnt; j++) {
527 if (dwarf_get_arange_info(aranges[j], &start, &length,
528 &die_off, &de) != DW_DLV_OK) {
529 warnx("dwarf_get_arange_info failed: %s",
533 if (labels[i]->lopc == (Dwarf_Unsigned)start) {
534 labels[i]->hipc = start + length;
540 /* If addr in label's range, we have found the range for this label. */
541 for (i = 0; i < label_cnt; i++) {
542 if (addr >= labels[i]->lopc && addr < labels[i]->hipc) {
544 RB_INSERT(cutree, &cuhead, (*range));
545 curlopc = (*range)->lopc;
550 for (i = 0; i < label_cnt - 1; i++) {
551 if (labels[i] != *range)
559 return (DW_DLV_NO_ENTRY);
563 * Check whether addr falls into range(s) of current CU.
564 * If so, save current CU to lookup tree.
567 check_range(Dwarf_Debug dbg, Dwarf_Die die, Dwarf_Unsigned addr,
568 struct range **range)
571 Dwarf_Unsigned addr_base, lopc, hipc;
572 Dwarf_Off ranges_off;
573 Dwarf_Signed ranges_cnt;
574 Dwarf_Ranges *ranges;
583 if (dwarf_attrval_unsigned(die, DW_AT_ranges, &ranges_off, &de) ==
585 ret = dwarf_get_ranges(dbg, ranges_off, &ranges,
586 &ranges_cnt, NULL, &de);
587 if (ret != DW_DLV_OK)
590 if (!ranges || ranges_cnt <= 0)
591 return (DW_DLV_ERROR);
593 for (i = 0; i < ranges_cnt; i++) {
594 if (ranges[i].dwr_type == DW_RANGES_END)
595 return (DW_DLV_NO_ENTRY);
597 if (ranges[i].dwr_type ==
598 DW_RANGES_ADDRESS_SELECTION) {
599 addr_base = ranges[i].dwr_addr2;
603 /* DW_RANGES_ENTRY */
604 lopc = ranges[i].dwr_addr1 + addr_base;
605 hipc = ranges[i].dwr_addr2 + addr_base;
608 return (DW_DLV_ERROR);
610 if (addr >= lopc && addr < hipc){
615 } else if (dwarf_attrval_unsigned(die, DW_AT_low_pc, &lopc, &de) ==
618 return (DW_DLV_ERROR);
619 if (dwarf_attrval_unsigned(die, DW_AT_high_pc, &hipc, &de) ==
622 * Check if the address falls into the PC
625 if (handle_high_pc(die, lopc, &hipc) != DW_DLV_OK)
626 return (DW_DLV_ERROR);
628 /* Assume ~0ULL if DW_AT_high_pc not present. */
632 if (addr >= lopc && addr < hipc) {
636 /* Addr not found above, try labels. */
637 ret = check_labels(dbg, die, addr, range);
642 if ((*range = calloc(1, sizeof(struct range))) == NULL)
643 err(EXIT_FAILURE, "calloc");
644 (*range)->lopc = lopc;
645 (*range)->hipc = hipc;
648 STAILQ_INIT(&(*range)->funclist);
649 RB_INSERT(cutree, &cuhead, *range);
653 return (DW_DLV_NO_ENTRY);
658 translate(Dwarf_Debug dbg, Elf *e, const char* addrstr)
660 Dwarf_Die die, ret_die;
664 Dwarf_Unsigned addr, lineno, plineno;
666 Dwarf_Addr lineaddr, plineaddr;
669 const char *funcname;
670 char *file, *file0, *pfile;
671 char demangled[1024];
674 addr = strtoull(addrstr, NULL, 16);
675 addr += section_base;
681 range = culookup(addr);
690 * We resume the CU scan from the last place we found a match.
691 * Because when we have 2 sequential addresses, and the second
692 * one is of the next CU, it is faster to just go to the next CU
693 * instead of starting from the beginning.
695 ret = dwarf_next_cu_header(dbg, NULL, NULL, NULL, NULL, NULL,
697 if (ret == DW_DLV_NO_ENTRY) {
698 if (curlopc == ~0ULL)
700 ret = dwarf_next_cu_header(dbg, NULL, NULL, NULL, NULL,
704 while (dwarf_siblingof(dbg, die, &ret_die, &de) == DW_DLV_OK) {
706 dwarf_dealloc(dbg, die, DW_DLA_DIE);
708 if (dwarf_tag(die, &tag, &de) != DW_DLV_OK) {
709 warnx("dwarf_tag failed: %s",
714 /* XXX: What about DW_TAG_partial_unit? */
715 if (tag == DW_TAG_compile_unit)
719 if (ret_die == NULL) {
720 warnx("could not find DW_TAG_compile_unit die");
723 ret = check_range(dbg, die, addr, &range);
724 if (ret == DW_DLV_OK)
726 if (ret == DW_DLV_ERROR)
730 dwarf_dealloc(dbg, die, DW_DLA_DIE);
735 if (ret != DW_DLV_OK || die == NULL)
739 switch (dwarf_srclines(die, &lbuf, &lcount, &de)) {
742 case DW_DLV_NO_ENTRY:
743 /* If a CU lacks debug info, just skip it. */
746 warnx("dwarf_srclines: %s", dwarf_errmsg(de));
753 for (i = 0; i < lcount; i++) {
754 if (dwarf_lineaddr(lbuf[i], &lineaddr, &de)) {
755 warnx("dwarf_lineaddr: %s", dwarf_errmsg(de));
758 if (dwarf_lineno(lbuf[i], &lineno, &de)) {
759 warnx("dwarf_lineno: %s", dwarf_errmsg(de));
762 if (dwarf_linesrc(lbuf[i], &file0, &de)) {
763 warnx("dwarf_linesrc: %s", dwarf_errmsg(de));
766 if (addr == lineaddr)
768 else if (addr < lineaddr && addr > plineaddr) {
773 plineaddr = lineaddr;
781 if (ret == DW_DLV_OK && (func || inlines) && range != NULL) {
782 if (range->srcfiles == NULL)
783 if (dwarf_srcfiles(die, &range->srcfiles,
784 &range->nsrcfiles, &de))
785 warnx("dwarf_srcfiles: %s", dwarf_errmsg(de));
786 if (STAILQ_EMPTY(&range->funclist)) {
787 collect_func(dbg, range->die, NULL, range);
790 f = search_func(range, addr);
796 if ((ec = gelf_getclass(e)) == ELFCLASSNONE) {
797 warnx("gelf_getclass failed: %s", elf_errmsg(-1));
800 if (ec == ELFCLASS32) {
802 printf("0x%08jx: ", (uintmax_t) addr);
804 printf("0x%08jx\n", (uintmax_t) addr);
807 printf("0x%016jx: ", (uintmax_t) addr);
809 printf("0x%016jx\n", (uintmax_t) addr);
814 if (funcname == NULL)
816 if (demangle && !elftc_demangle(funcname, demangled,
817 sizeof(demangled), 0)) {
819 printf("%s at ", demangled);
821 printf("%s\n", demangled);
824 printf("%s at ", funcname);
826 printf("%s\n", funcname);
830 (void) printf("%s:%ju\n", base ? basename(file) : file,
833 if (ret == DW_DLV_OK && inlines && range != NULL &&
834 range->srcfiles != NULL && f != NULL && f->inlined_caller != NULL)
835 print_inlines(range, f->inlined_caller, f->call_file,
840 find_section_base(const char *exe, Elf *e, const char *section)
850 if (gelf_getehdr(e, &eh) != &eh) {
851 warnx("gelf_getehdr failed: %s", elf_errmsg(-1));
855 if (!elf_getshstrndx(e, &shstrndx)) {
856 warnx("elf_getshstrndx failed: %s", elf_errmsg(-1));
863 while ((scn = elf_nextscn(e, scn)) != NULL) {
864 if (gelf_getshdr(scn, &sh) == NULL) {
865 warnx("gelf_getshdr failed: %s", elf_errmsg(-1));
868 if ((name = elf_strptr(e, shstrndx, sh.sh_name)) == NULL)
870 if (!strcmp(section, name)) {
871 if (eh.e_type == ET_EXEC || eh.e_type == ET_DYN) {
873 * For executables, section base is the virtual
874 * address of the specified section.
876 section_base = sh.sh_addr;
877 } else if (eh.e_type == ET_REL) {
879 * For relocatables, section base is the
880 * relative offset of the specified section
881 * to the start of the first section.
885 warnx("unknown e_type %u", eh.e_type);
891 elferr = elf_errno();
893 warnx("elf_nextscn failed: %s", elf_errmsg(elferr));
895 errx(EXIT_FAILURE, "%s: cannot find section %s", exe, section);
899 main(int argc, char **argv)
904 const char *exe, *section;
910 while ((opt = getopt_long(argc, argv, "ab:Ce:fij:psHV", longopts,
955 if ((fd = open(exe, O_RDONLY)) < 0)
956 err(EXIT_FAILURE, "%s", exe);
958 if (dwarf_init(fd, DW_DLC_READ, NULL, NULL, &dbg, &de))
959 errx(EXIT_FAILURE, "dwarf_init: %s", dwarf_errmsg(de));
961 if (dwarf_get_elf(dbg, &e, &de) != DW_DLV_OK)
962 errx(EXIT_FAILURE, "dwarf_get_elf: %s", dwarf_errmsg(de));
965 find_section_base(exe, e, section);
970 for (i = 0; i < argc; i++)
971 translate(dbg, e, argv[i]);
973 setvbuf(stdout, NULL, _IOLBF, 0);
974 while (fgets(line, sizeof(line), stdin) != NULL)
975 translate(dbg, e, line);
978 dwarf_finish(dbg, &de);