1 /* Test program for dwfl_module_return_value_location.
2 Copyright (C) 2009 Red Hat, Inc.
3 This file is part of elfutils.
5 This file is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 elfutils is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 #include ELFUTILS_HEADER(dw)
21 #include <sys/types.h>
29 main (int argc __attribute__ ((unused)), char *argv[])
31 const char *name = argv[1];
32 ptrdiff_t cuoff = strtol (argv[2], NULL, 0);
34 int fd = open (name, O_RDONLY);
35 Dwarf *dbg = dwarf_begin (fd, DWARF_C_READ);
37 Dwarf_Die cudie_mem, *cudie = dwarf_offdie (dbg, cuoff, &cudie_mem);
38 int mac (Dwarf_Macro *macro, void *data __attribute__ ((unused)))
41 dwarf_macro_opcode (macro, &opcode);
42 if (opcode == DW_MACINFO_define)
45 dwarf_macro_param2 (macro, NULL, &value);
48 return DWARF_CB_ABORT;
52 while ((off = dwarf_getmacros (cudie, mac, NULL, off)) > 0)