blob: 5eac6113de9490a9f36dfff2db6f5c44dc3265bb [file] [log] [blame]
njnea27e462005-05-31 02:38:09 +00001
njn4bbdc972003-10-16 10:10:55 +00002/*--------------------------------------------------------------------*/
njnea27e462005-05-31 02:38:09 +00003/*--- Intra-Valgrind interfaces for symtypes.c. priv_symtypes.h ---*/
njn4bbdc972003-10-16 10:10:55 +00004/*--------------------------------------------------------------------*/
5
6/*
njnb9c427c2004-12-01 14:14:42 +00007 This file is part of Valgrind, a dynamic binary instrumentation
8 framework.
njn4bbdc972003-10-16 10:10:55 +00009
njn53612422005-03-12 16:22:54 +000010 Copyright (C) 2000-2005 Julian Seward
njn4bbdc972003-10-16 10:10:55 +000011 jseward@acm.org
12
13 This program is free software; you can redistribute it and/or
14 modify it under the terms of the GNU General Public License as
15 published by the Free Software Foundation; either version 2 of the
16 License, or (at your option) any later version.
17
18 This program is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
26 02111-1307, USA.
27
28 The GNU General Public License is contained in the file COPYING.
29*/
30
njnea27e462005-05-31 02:38:09 +000031#ifndef __PRIV_SYMTYPES_H
32#define __PRIV_SYMTYPES_H
jsgfcb1d1c02003-10-14 21:55:10 +000033
jsgfcb1d1c02003-10-14 21:55:10 +000034/* Lets try to make these opaque */
35typedef struct _SymType SymType;
36
37/* ------------------------------------------------------------
38 Constructors for various SymType nodes
39 ------------------------------------------------------------ */
40
41/* Find the basetype for a given type: that is, if type is a typedef,
42 return the typedef'd type. If resolve is true, it will resolve
43 unresolved symbols. If type is not a typedef, then this is just
44 returns type.
45*/
sewardj7eb7c582005-06-23 01:02:53 +000046SymType *ML_(st_basetype)(SymType *type, Bool resolve);
jsgfcb1d1c02003-10-14 21:55:10 +000047
sewardj7eb7c582005-06-23 01:02:53 +000048void ML_(st_setname)(SymType *ty, Char *name);
jsgfcb1d1c02003-10-14 21:55:10 +000049
50typedef void (SymResolver)(SymType *, void *);
51
52/* Create an unresolved type */
sewardj7eb7c582005-06-23 01:02:53 +000053SymType *ML_(st_mkunresolved)(SymType *, SymResolver *resolve, void *data);
jsgfcb1d1c02003-10-14 21:55:10 +000054
55/* update an unresolved type's data */
sewardj7eb7c582005-06-23 01:02:53 +000056void ML_(st_unresolved_setdata)(SymType *, SymResolver *resolve, void *data);
jsgfcb1d1c02003-10-14 21:55:10 +000057
sewardj7eb7c582005-06-23 01:02:53 +000058Bool ML_(st_isresolved)(SymType *);
59UInt ML_(st_sizeof)(SymType *);
jsgfcb1d1c02003-10-14 21:55:10 +000060
61/* Unknown type (unparsable) */
sewardj7eb7c582005-06-23 01:02:53 +000062SymType *ML_(st_mkunknown)(SymType *);
jsgfcb1d1c02003-10-14 21:55:10 +000063
sewardj7eb7c582005-06-23 01:02:53 +000064SymType *ML_(st_mkvoid)(SymType *);
jsgfcb1d1c02003-10-14 21:55:10 +000065
sewardj7eb7c582005-06-23 01:02:53 +000066SymType *ML_(st_mkint)(SymType *, UInt size, Bool isSigned);
67SymType *ML_(st_mkbool)(SymType *, UInt size);
68SymType *ML_(st_mkchar)(SymType *, Bool isSigned);
69SymType *ML_(st_mkfloat)(SymType *, UInt size);
70SymType *ML_(st_mkdouble)(SymType *, UInt size);
jsgfcb1d1c02003-10-14 21:55:10 +000071
sewardj7eb7c582005-06-23 01:02:53 +000072SymType *ML_(st_mkpointer)(SymType *, SymType *);
73SymType *ML_(st_mkrange)(SymType *, SymType *, Int min, Int max);
jsgfcb1d1c02003-10-14 21:55:10 +000074
sewardj7eb7c582005-06-23 01:02:53 +000075SymType *ML_(st_mkstruct)(SymType *, UInt size, UInt nfields);
76SymType *ML_(st_mkunion)(SymType *, UInt size, UInt nfields);
77void ML_(st_addfield)(SymType *, Char *name, SymType *, UInt off, UInt size);
jsgfcb1d1c02003-10-14 21:55:10 +000078
sewardj7eb7c582005-06-23 01:02:53 +000079SymType *ML_(st_mkenum)(SymType *, UInt ntags);
80SymType *ML_(st_addtag)(SymType *, Char *name, Int val);
jsgfcb1d1c02003-10-14 21:55:10 +000081
sewardj7eb7c582005-06-23 01:02:53 +000082SymType *ML_(st_mkarray)(SymType *, SymType *idxtype, SymType *artype);
jsgfcb1d1c02003-10-14 21:55:10 +000083
sewardj7eb7c582005-06-23 01:02:53 +000084SymType *ML_(st_mktypedef)(SymType *, Char *name, SymType *type);
jsgfcb1d1c02003-10-14 21:55:10 +000085
sewardj7eb7c582005-06-23 01:02:53 +000086Bool ML_(st_isstruct)(SymType *);
87Bool ML_(st_isunion)(SymType *);
88Bool ML_(st_isenum)(SymType *);
jsgfcb1d1c02003-10-14 21:55:10 +000089
90/* ------------------------------------------------------------
njnea27e462005-05-31 02:38:09 +000091 Interface with symtab.c
jsgfcb1d1c02003-10-14 21:55:10 +000092 ------------------------------------------------------------ */
93
94/* Typed value */
95typedef struct _Variable Variable;
96
97struct _Variable {
98 Char *name; /* name */
99 SymType *type; /* type of value */
100 Addr valuep; /* pointer to value */
101 UInt size; /* size of value */
102 UInt distance; /* "distance" from site of interest */
103 Variable *next;
104 Variable *container;
105};
106
sewardj7eb7c582005-06-23 01:02:53 +0000107Variable *ML_(get_scope_variables)(ThreadId tid);
jsgfcb1d1c02003-10-14 21:55:10 +0000108
njnea27e462005-05-31 02:38:09 +0000109#endif // __PRIV_SYMTYPES_H
njn4bbdc972003-10-16 10:10:55 +0000110
111/*--------------------------------------------------------------------*/
njnea27e462005-05-31 02:38:09 +0000112/*--- end ---*/
njn4bbdc972003-10-16 10:10:55 +0000113/*--------------------------------------------------------------------*/