gdb
[platform/upstream/binutils.git] / gdb / dwarf2loc.h
1 /* DWARF 2 location expression support for GDB.
2
3    Copyright (C) 2003, 2005, 2007, 2008, 2009, 2010
4    Free Software Foundation, Inc.
5
6    This file is part of GDB.
7
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 3 of the License, or
11    (at your option) any later version.
12
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
20
21 #if !defined (DWARF2LOC_H)
22 #define DWARF2LOC_H
23
24 struct symbol_computed_ops;
25 struct objfile;
26 struct dwarf2_per_cu_data;
27
28 /* This header is private to the DWARF-2 reader.  It is shared between
29    dwarf2read.c and dwarf2loc.c.  */
30
31 /* Return the OBJFILE associated with the compilation unit CU.  */
32 struct objfile *dwarf2_per_cu_objfile (struct dwarf2_per_cu_data *cu);
33
34 /* Return the address size given in the compilation unit header for CU.  */
35 CORE_ADDR dwarf2_per_cu_addr_size (struct dwarf2_per_cu_data *cu);
36
37 /* Return the offset size given in the compilation unit header for CU.  */
38 int dwarf2_per_cu_offset_size (struct dwarf2_per_cu_data *cu);
39
40 /* The symbol location baton types used by the DWARF-2 reader (i.e.
41    SYMBOL_LOCATION_BATON for a LOC_COMPUTED symbol).  "struct
42    dwarf2_locexpr_baton" is for a symbol with a single location
43    expression; "struct dwarf2_loclist_baton" is for a symbol with a
44    location list.  */
45
46 struct dwarf2_locexpr_baton
47 {
48   /* Pointer to the start of the location expression.  */
49   const gdb_byte *data;
50
51   /* Length of the location expression.  */
52   unsigned long size;
53
54   /* The compilation unit containing the symbol whose location
55      we're computing.  */
56   struct dwarf2_per_cu_data *per_cu;
57 };
58
59 struct dwarf2_loclist_baton
60 {
61   /* The initial base address for the location list, based on the compilation
62      unit.  */
63   CORE_ADDR base_address;
64
65   /* Pointer to the start of the location list.  */
66   const gdb_byte *data;
67
68   /* Length of the location list.  */
69   unsigned long size;
70
71   /* The compilation unit containing the symbol whose location
72      we're computing.  */
73   struct dwarf2_per_cu_data *per_cu;
74 };
75
76 extern const struct symbol_computed_ops dwarf2_locexpr_funcs;
77 extern const struct symbol_computed_ops dwarf2_loclist_funcs;
78
79 #endif /* dwarf2loc.h */