• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Internal definitions for libdwarf.
2    Copyright (C) 2014 Red Hat, Inc.
3    This file is part of elfutils.
4 
5    This file is free software; you can redistribute it and/or modify
6    it under the terms of either
7 
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
11 
12    or
13 
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
17 
18    or both in parallel, as here.
19 
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.
24 
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/>.  */
28 
29 #ifdef HAVE_CONFIG_H
30 # include <config.h>
31 #endif
32 
33 #include <stddef.h>
34 #include "libdwP.h"
35 
36 
37 Dwarf_Die *
dwarf_cu_die(Dwarf_CU * cu,Dwarf_Die * result,Dwarf_Half * versionp,Dwarf_Off * abbrev_offsetp,uint8_t * address_sizep,uint8_t * offset_sizep,uint64_t * unit_idp,Dwarf_Off * subdie_offsetp)38 dwarf_cu_die (Dwarf_CU *cu, Dwarf_Die *result, Dwarf_Half *versionp,
39 	      Dwarf_Off *abbrev_offsetp, uint8_t *address_sizep,
40 	      uint8_t *offset_sizep, uint64_t *unit_idp,
41 	      Dwarf_Off *subdie_offsetp)
42 {
43   if (cu == NULL)
44     return NULL;
45 
46   *result = CUDIE (cu);
47 
48   if (versionp != NULL)
49     *versionp = cu->version;
50   if (abbrev_offsetp != NULL)
51     *abbrev_offsetp = cu->orig_abbrev_offset;
52   if (address_sizep != NULL)
53     *address_sizep = cu->address_size;
54   if (offset_sizep != NULL)
55     *offset_sizep = cu->offset_size;
56   if (unit_idp != NULL)
57     *unit_idp = cu->unit_id8;
58   if (subdie_offsetp != NULL)
59     *subdie_offsetp = cu->subdie_offset;
60 
61   return result;
62 }
63