1 /* Convenience functions for handling DWARF descriptions of inline functions.
2 Copyright (C) 2005,2006,2015 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 either
8 * the GNU Lesser General Public License as published by the Free
9 Software Foundation; either version 3 of the License, or (at
10 your option) any later version
14 * the GNU General Public License as published by the Free
15 Software Foundation; either version 2 of the License, or (at
16 your option) any later version
18 or both in parallel, as here.
20 elfutils is distributed in the hope that it will be useful, but
21 WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 General Public License for more details.
25 You should have received copies of the GNU General Public License and
26 the GNU Lesser General Public License along with this program. If
27 not, see <http://www.gnu.org/licenses/>. */
39 int (*callback) (Dwarf_Die *, void *);
44 scope_visitor (unsigned int depth __attribute__ ((unused)),
45 struct Dwarf_Die_Chain *die, void *arg)
47 struct visitor_info *const v = arg;
49 if (INTUSE(dwarf_tag) (&die->die) != DW_TAG_inlined_subroutine)
52 Dwarf_Attribute attr_mem;
53 Dwarf_Attribute *attr = INTUSE(dwarf_attr) (&die->die, DW_AT_abstract_origin,
59 Dwarf_Die *origin = INTUSE(dwarf_formref_die) (attr, &origin_mem);
61 return DWARF_CB_ABORT;
63 if (origin->addr != v->die_addr)
66 return (*v->callback) (&die->die, v->arg);
70 dwarf_func_inline (Dwarf_Die *func)
72 Dwarf_Attribute attr_mem;
74 if (INTUSE(dwarf_formudata) (INTUSE(dwarf_attr) (func, DW_AT_inline,
79 case DW_INL_not_inlined:
82 case DW_INL_declared_not_inlined:
86 case DW_INL_declared_inlined:
94 dwarf_func_inline_instances (Dwarf_Die *func,
95 int (*callback) (Dwarf_Die *, void *),
98 struct visitor_info v = { func->addr, callback, arg };
99 struct Dwarf_Die_Chain cu = { .die = CUDIE (func->cu), .parent = NULL };
100 return __libdw_visit_scopes (0, &cu, NULL, &scope_visitor, NULL, &v);