1 /* Test program for dwfl_module_return_value_location.
2 Copyright (C) 2005 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/>. */
21 #include ELFUTILS_HEADER(dwfl)
25 #include <stdio_ext.h>
42 handle_function (Dwarf_Die *funcdie, void *arg)
46 const char *name = dwarf_diename (funcdie);
47 char **argv = a->argv;
52 match = fnmatch (*argv, name, 0) == 0;
53 while (!match && *++argv);
58 printf ("(%s) %s: ", dwfl_module_info (dwfl_cumodule (a->cu), NULL,
63 const Dwarf_Op *locops;
64 int nlocops = dwfl_module_return_value_location (dwfl_cumodule (a->cu),
67 error (EXIT_FAILURE, 0, "dwfl_module_return_value_location: %s",
69 else if (nlocops == 0)
70 puts ("returns no value");
73 printf ("return value location:");
74 for (int i = 0; i < nlocops; ++i)
75 printf (" {%#x, %#" PRIx64 "}", locops[i].atom, locops[i].number);
84 main (int argc, char *argv[])
89 (void) setlocale (LC_ALL, "");
91 struct args a = { .dwfl = NULL, .cu = NULL };
93 (void) argp_parse (dwfl_standard_argp (), argc, argv, 0, &remaining,
95 assert (a.dwfl != NULL);
96 a.argv = &argv[remaining];
100 while ((a.cu = dwfl_nextcu (a.dwfl, a.cu, &a.dwbias)) != NULL)
101 dwarf_getfuncs (a.cu, &handle_function, &a, 0);