blob: 14d320c6ca25eae0721154cf3c020ce31b67265d [file] [log] [blame]
njn4bbdc972003-10-16 10:10:55 +00001/*--------------------------------------------------------------------*/
2/*--- Intra-Valgrind interfaces for vg_symtypes.c. vg_symtypes.h ---*/
3/*--------------------------------------------------------------------*/
4
5/*
njnb9c427c2004-12-01 14:14:42 +00006 This file is part of Valgrind, a dynamic binary instrumentation
7 framework.
njn4bbdc972003-10-16 10:10:55 +00008
njn53612422005-03-12 16:22:54 +00009 Copyright (C) 2000-2005 Julian Seward
njn4bbdc972003-10-16 10:10:55 +000010 jseward@acm.org
11
12 This program is free software; you can redistribute it and/or
13 modify it under the terms of the GNU General Public License as
14 published by the Free Software Foundation; either version 2 of the
15 License, or (at your option) any later version.
16
17 This program is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
25 02111-1307, USA.
26
27 The GNU General Public License is contained in the file COPYING.
28*/
29
jsgfcb1d1c02003-10-14 21:55:10 +000030#ifndef __VG_SYMTYPES_H
31#define __VG_SYMTYPES_H
32
jsgfcb1d1c02003-10-14 21:55:10 +000033/* Lets try to make these opaque */
34typedef struct _SymType SymType;
35
36/* ------------------------------------------------------------
37 Constructors for various SymType nodes
38 ------------------------------------------------------------ */
39
40/* Find the basetype for a given type: that is, if type is a typedef,
41 return the typedef'd type. If resolve is true, it will resolve
42 unresolved symbols. If type is not a typedef, then this is just
43 returns type.
44*/
45SymType *VG_(st_basetype)(SymType *type, Bool resolve);
46
47void VG_(st_setname)(SymType *ty, Char *name);
48
49typedef void (SymResolver)(SymType *, void *);
50
51/* Create an unresolved type */
52SymType *VG_(st_mkunresolved)(SymType *, SymResolver *resolve, void *data);
53
54/* update an unresolved type's data */
55void VG_(st_unresolved_setdata)(SymType *, SymResolver *resolve, void *data);
56
57Bool VG_(st_isresolved)(SymType *);
58UInt VG_(st_sizeof)(SymType *);
59
60/* Unknown type (unparsable) */
61SymType *VG_(st_mkunknown)(SymType *);
62
63SymType *VG_(st_mkvoid)(SymType *);
64
65SymType *VG_(st_mkint)(SymType *, UInt size, Bool isSigned);
66SymType *VG_(st_mkbool)(SymType *, UInt size);
67SymType *VG_(st_mkchar)(SymType *, Bool isSigned);
68SymType *VG_(st_mkfloat)(SymType *, UInt size);
69SymType *VG_(st_mkdouble)(SymType *, UInt size);
70
71SymType *VG_(st_mkpointer)(SymType *, SymType *);
72SymType *VG_(st_mkrange)(SymType *, SymType *, Int min, Int max);
73
74SymType *VG_(st_mkstruct)(SymType *, UInt size, UInt nfields);
75SymType *VG_(st_mkunion)(SymType *, UInt size, UInt nfields);
76void VG_(st_addfield)(SymType *, Char *name, SymType *, UInt off, UInt size);
77
78SymType *VG_(st_mkenum)(SymType *, UInt ntags);
79SymType *VG_(st_addtag)(SymType *, Char *name, Int val);
80
81SymType *VG_(st_mkarray)(SymType *, SymType *idxtype, SymType *artype);
82
83SymType *VG_(st_mktypedef)(SymType *, Char *name, SymType *type);
84
85Bool VG_(st_isstruct)(SymType *);
86Bool VG_(st_isunion)(SymType *);
87Bool VG_(st_isenum)(SymType *);
88
89/* ------------------------------------------------------------
90 Interface with vg_symtab2.c
91 ------------------------------------------------------------ */
92
93/* Typed value */
94typedef struct _Variable Variable;
95
96struct _Variable {
97 Char *name; /* name */
98 SymType *type; /* type of value */
99 Addr valuep; /* pointer to value */
100 UInt size; /* size of value */
101 UInt distance; /* "distance" from site of interest */
102 Variable *next;
103 Variable *container;
104};
105
106Variable *VG_(get_scope_variables)(ThreadId tid);
107
108#endif /* VG_SYMTYPES_H */
njn4bbdc972003-10-16 10:10:55 +0000109
110/*--------------------------------------------------------------------*/
111/*--- end vg_symtypes.h ---*/
112/*--------------------------------------------------------------------*/