xref: /dflybsd-src/contrib/gdb-7/gdb/dwarf2loc.h (revision cf7f2e2d389e8012d562650bd94d7e433f449d6e)
15796c8dcSSimon Schubert /* DWARF 2 location expression support for GDB.
25796c8dcSSimon Schubert 
3*cf7f2e2dSJohn Marino    Copyright (C) 2003, 2005, 2007, 2008, 2009, 2010
4*cf7f2e2dSJohn Marino    Free Software Foundation, Inc.
55796c8dcSSimon Schubert 
65796c8dcSSimon Schubert    This file is part of GDB.
75796c8dcSSimon Schubert 
85796c8dcSSimon Schubert    This program is free software; you can redistribute it and/or modify
95796c8dcSSimon Schubert    it under the terms of the GNU General Public License as published by
105796c8dcSSimon Schubert    the Free Software Foundation; either version 3 of the License, or
115796c8dcSSimon Schubert    (at your option) any later version.
125796c8dcSSimon Schubert 
135796c8dcSSimon Schubert    This program is distributed in the hope that it will be useful,
145796c8dcSSimon Schubert    but WITHOUT ANY WARRANTY; without even the implied warranty of
155796c8dcSSimon Schubert    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
165796c8dcSSimon Schubert    GNU General Public License for more details.
175796c8dcSSimon Schubert 
185796c8dcSSimon Schubert    You should have received a copy of the GNU General Public License
195796c8dcSSimon Schubert    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
205796c8dcSSimon Schubert 
215796c8dcSSimon Schubert #if !defined (DWARF2LOC_H)
225796c8dcSSimon Schubert #define DWARF2LOC_H
235796c8dcSSimon Schubert 
245796c8dcSSimon Schubert struct symbol_computed_ops;
255796c8dcSSimon Schubert struct objfile;
265796c8dcSSimon Schubert struct dwarf2_per_cu_data;
275796c8dcSSimon Schubert 
285796c8dcSSimon Schubert /* This header is private to the DWARF-2 reader.  It is shared between
295796c8dcSSimon Schubert    dwarf2read.c and dwarf2loc.c.  */
305796c8dcSSimon Schubert 
31*cf7f2e2dSJohn Marino /* Return the OBJFILE associated with the compilation unit CU.  If CU
32*cf7f2e2dSJohn Marino    came from a separate debuginfo file, then the master objfile is
33*cf7f2e2dSJohn Marino    returned.  */
345796c8dcSSimon Schubert struct objfile *dwarf2_per_cu_objfile (struct dwarf2_per_cu_data *cu);
355796c8dcSSimon Schubert 
365796c8dcSSimon Schubert /* Return the address size given in the compilation unit header for CU.  */
375796c8dcSSimon Schubert CORE_ADDR dwarf2_per_cu_addr_size (struct dwarf2_per_cu_data *cu);
385796c8dcSSimon Schubert 
39*cf7f2e2dSJohn Marino /* Return the offset size given in the compilation unit header for CU.  */
40*cf7f2e2dSJohn Marino int dwarf2_per_cu_offset_size (struct dwarf2_per_cu_data *cu);
41*cf7f2e2dSJohn Marino 
42*cf7f2e2dSJohn Marino /* Return the text offset of the CU.  The returned offset comes from
43*cf7f2e2dSJohn Marino    this CU's objfile.  If this objfile came from a separate debuginfo
44*cf7f2e2dSJohn Marino    file, then the offset may be different from the corresponding
45*cf7f2e2dSJohn Marino    offset in the parent objfile.  */
46*cf7f2e2dSJohn Marino CORE_ADDR dwarf2_per_cu_text_offset (struct dwarf2_per_cu_data *cu);
47*cf7f2e2dSJohn Marino 
48*cf7f2e2dSJohn Marino struct dwarf2_locexpr_baton dwarf2_fetch_die_location_block
49*cf7f2e2dSJohn Marino   (unsigned int offset, struct dwarf2_per_cu_data *per_cu);
50*cf7f2e2dSJohn Marino 
515796c8dcSSimon Schubert /* The symbol location baton types used by the DWARF-2 reader (i.e.
525796c8dcSSimon Schubert    SYMBOL_LOCATION_BATON for a LOC_COMPUTED symbol).  "struct
535796c8dcSSimon Schubert    dwarf2_locexpr_baton" is for a symbol with a single location
545796c8dcSSimon Schubert    expression; "struct dwarf2_loclist_baton" is for a symbol with a
555796c8dcSSimon Schubert    location list.  */
565796c8dcSSimon Schubert 
575796c8dcSSimon Schubert struct dwarf2_locexpr_baton
585796c8dcSSimon Schubert {
595796c8dcSSimon Schubert   /* Pointer to the start of the location expression.  */
60*cf7f2e2dSJohn Marino   const gdb_byte *data;
615796c8dcSSimon Schubert 
625796c8dcSSimon Schubert   /* Length of the location expression.  */
635796c8dcSSimon Schubert   unsigned long size;
645796c8dcSSimon Schubert 
655796c8dcSSimon Schubert   /* The compilation unit containing the symbol whose location
665796c8dcSSimon Schubert      we're computing.  */
675796c8dcSSimon Schubert   struct dwarf2_per_cu_data *per_cu;
685796c8dcSSimon Schubert };
695796c8dcSSimon Schubert 
705796c8dcSSimon Schubert struct dwarf2_loclist_baton
715796c8dcSSimon Schubert {
725796c8dcSSimon Schubert   /* The initial base address for the location list, based on the compilation
735796c8dcSSimon Schubert      unit.  */
745796c8dcSSimon Schubert   CORE_ADDR base_address;
755796c8dcSSimon Schubert 
765796c8dcSSimon Schubert   /* Pointer to the start of the location list.  */
77*cf7f2e2dSJohn Marino   const gdb_byte *data;
785796c8dcSSimon Schubert 
795796c8dcSSimon Schubert   /* Length of the location list.  */
805796c8dcSSimon Schubert   unsigned long size;
815796c8dcSSimon Schubert 
825796c8dcSSimon Schubert   /* The compilation unit containing the symbol whose location
835796c8dcSSimon Schubert      we're computing.  */
845796c8dcSSimon Schubert   struct dwarf2_per_cu_data *per_cu;
855796c8dcSSimon Schubert };
865796c8dcSSimon Schubert 
875796c8dcSSimon Schubert extern const struct symbol_computed_ops dwarf2_locexpr_funcs;
885796c8dcSSimon Schubert extern const struct symbol_computed_ops dwarf2_loclist_funcs;
895796c8dcSSimon Schubert 
905796c8dcSSimon Schubert #endif /* dwarf2loc.h */
91