njn | 4bbdc97 | 2003-10-16 10:10:55 +0000 | [diff] [blame] | 1 | /*--------------------------------------------------------------------*/ |
| 2 | /*--- Intra-Valgrind interfaces for vg_symtypes.c. vg_symtypes.h ---*/ |
| 3 | /*--------------------------------------------------------------------*/ |
| 4 | |
| 5 | /* |
njn | b9c427c | 2004-12-01 14:14:42 +0000 | [diff] [blame] | 6 | This file is part of Valgrind, a dynamic binary instrumentation |
| 7 | framework. |
njn | 4bbdc97 | 2003-10-16 10:10:55 +0000 | [diff] [blame] | 8 | |
njn | 5361242 | 2005-03-12 16:22:54 +0000 | [diff] [blame] | 9 | Copyright (C) 2000-2005 Julian Seward |
njn | 4bbdc97 | 2003-10-16 10:10:55 +0000 | [diff] [blame] | 10 | 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 | |
jsgf | cb1d1c0 | 2003-10-14 21:55:10 +0000 | [diff] [blame] | 30 | #ifndef __VG_SYMTYPES_H |
| 31 | #define __VG_SYMTYPES_H |
| 32 | |
jsgf | cb1d1c0 | 2003-10-14 21:55:10 +0000 | [diff] [blame] | 33 | /* Lets try to make these opaque */ |
| 34 | typedef 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 | */ |
| 45 | SymType *VG_(st_basetype)(SymType *type, Bool resolve); |
| 46 | |
| 47 | void VG_(st_setname)(SymType *ty, Char *name); |
| 48 | |
| 49 | typedef void (SymResolver)(SymType *, void *); |
| 50 | |
| 51 | /* Create an unresolved type */ |
| 52 | SymType *VG_(st_mkunresolved)(SymType *, SymResolver *resolve, void *data); |
| 53 | |
| 54 | /* update an unresolved type's data */ |
| 55 | void VG_(st_unresolved_setdata)(SymType *, SymResolver *resolve, void *data); |
| 56 | |
| 57 | Bool VG_(st_isresolved)(SymType *); |
| 58 | UInt VG_(st_sizeof)(SymType *); |
| 59 | |
| 60 | /* Unknown type (unparsable) */ |
| 61 | SymType *VG_(st_mkunknown)(SymType *); |
| 62 | |
| 63 | SymType *VG_(st_mkvoid)(SymType *); |
| 64 | |
| 65 | SymType *VG_(st_mkint)(SymType *, UInt size, Bool isSigned); |
| 66 | SymType *VG_(st_mkbool)(SymType *, UInt size); |
| 67 | SymType *VG_(st_mkchar)(SymType *, Bool isSigned); |
| 68 | SymType *VG_(st_mkfloat)(SymType *, UInt size); |
| 69 | SymType *VG_(st_mkdouble)(SymType *, UInt size); |
| 70 | |
| 71 | SymType *VG_(st_mkpointer)(SymType *, SymType *); |
| 72 | SymType *VG_(st_mkrange)(SymType *, SymType *, Int min, Int max); |
| 73 | |
| 74 | SymType *VG_(st_mkstruct)(SymType *, UInt size, UInt nfields); |
| 75 | SymType *VG_(st_mkunion)(SymType *, UInt size, UInt nfields); |
| 76 | void VG_(st_addfield)(SymType *, Char *name, SymType *, UInt off, UInt size); |
| 77 | |
| 78 | SymType *VG_(st_mkenum)(SymType *, UInt ntags); |
| 79 | SymType *VG_(st_addtag)(SymType *, Char *name, Int val); |
| 80 | |
| 81 | SymType *VG_(st_mkarray)(SymType *, SymType *idxtype, SymType *artype); |
| 82 | |
| 83 | SymType *VG_(st_mktypedef)(SymType *, Char *name, SymType *type); |
| 84 | |
| 85 | Bool VG_(st_isstruct)(SymType *); |
| 86 | Bool VG_(st_isunion)(SymType *); |
| 87 | Bool VG_(st_isenum)(SymType *); |
| 88 | |
| 89 | /* ------------------------------------------------------------ |
| 90 | Interface with vg_symtab2.c |
| 91 | ------------------------------------------------------------ */ |
| 92 | |
| 93 | /* Typed value */ |
| 94 | typedef struct _Variable Variable; |
| 95 | |
| 96 | struct _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 | |
| 106 | Variable *VG_(get_scope_variables)(ThreadId tid); |
| 107 | |
| 108 | #endif /* VG_SYMTYPES_H */ |
njn | 4bbdc97 | 2003-10-16 10:10:55 +0000 | [diff] [blame] | 109 | |
| 110 | /*--------------------------------------------------------------------*/ |
| 111 | /*--- end vg_symtypes.h ---*/ |
| 112 | /*--------------------------------------------------------------------*/ |