1 /* Test program for dwarf_entry_breakpoints.
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 *func, void *arg)
46 const char *name = dwarf_diename (func);
47 char **argv = a->argv;
52 match = fnmatch (*argv, name, 0) == 0;
53 while (!match && *++argv);
58 if (dwarf_func_inline (func))
62 if (dwarf_entrypc (func, &entrypc) != 0)
63 error (EXIT_FAILURE, 0, "dwarf_entrypc: %s: %s",
64 dwarf_diename (func), dwarf_errmsg (-1));
67 printf ("%-16s %#.16" PRIx64, dwarf_diename (func), entrypc);
69 Dwarf_Addr *bkpts = NULL;
70 int result = dwarf_entry_breakpoints (func, &bkpts);
72 printf ("\t%s\n", dwarf_errmsg (-1));
75 for (int i = 0; i < result; ++i)
76 printf (" %#.16" PRIx64 "%s", bkpts[i] + a->dwbias,
77 i == result - 1 ? "\n" : "");
86 main (int argc, char *argv[])
91 (void) setlocale (LC_ALL, "");
93 struct args a = { .dwfl = NULL, .cu = NULL };
95 (void) argp_parse (dwfl_standard_argp (), argc, argv, 0, &remaining,
97 assert (a.dwfl != NULL);
98 a.argv = &argv[remaining];
102 while ((a.cu = dwfl_nextcu (a.dwfl, a.cu, &a.dwbias)) != NULL)
103 dwarf_getfuncs (a.cu, &handle_function, &a, 0);