1 /* Copyright (C) 2002, 2004, 2005 Red Hat, Inc.
2 Written by Ulrich Drepper <drepper@redhat.com>, 2002.
4 This program is Open Source software; you can redistribute it and/or
5 modify it under the terms of the Open Software License version 1.0 as
6 published by the Open Source Initiative.
8 You should have received a copy of the Open Software License along
9 with this program; if not, you may obtain a copy of the Open Software
10 License version 1.0 from http://www.opensource.org/licenses/osl.php or
11 by writing the Open Source Initiative c/o Lawrence Rosen, Esq.,
12 3001 King Ranch Road, Ukiah, CA 95482. */
22 main (int argc, char *argv[])
27 for (cnt = 1; cnt < argc; ++cnt)
29 int fd = open (argv[cnt], O_RDONLY);
31 Dwarf *dbg = dwarf_begin (fd, DWARF_C_READ);
34 printf ("%s not usable\n", argv[cnt]);
47 while (dwarf_nextcu (dbg, o, &ncu, &cuhl, &ao, &asz, &osz) == 0)
49 printf ("cuhl = %zu, o = %llu, asz = %hhu, osz = %hhu, ncu = %llu\n",
50 cuhl, (unsigned long long int) ao,
51 asz, osz, (unsigned long long int) ncu);
54 Dwarf_Die *die = dwarf_offdie (dbg, o + cuhl, &die_mem);
57 printf ("%s: cannot get CU die\n", argv[cnt]);
64 if (dwarf_getsrcfiles (die, &files, &nfiles) != 0)
66 printf ("%s: cannot get files\n", argv[cnt]);
71 for (size_t i = 0; i < nfiles; ++i)
72 printf (" file[%zu] = \"%s\"\n", i,
73 dwarf_filesrc (files, i, NULL, NULL));