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