gdb-2.8
[deliverable/binutils-gdb.git] / gdb / value.h
CommitLineData
7b4ac7e1 1/* Definitions for values of C expressions, for GDB.
2 Copyright (C) 1986, 1987 Free Software Foundation, Inc.
3
4GDB is distributed in the hope that it will be useful, but WITHOUT ANY
5WARRANTY. No author or distributor accepts responsibility to anyone
6for the consequences of using it or for whether it serves any
7particular purpose or works at all, unless he says so in writing.
8Refer to the GDB General Public License for full details.
9
10Everyone is granted permission to copy, modify and redistribute GDB,
11but only under the conditions described in the GDB General Public
12License. A copy of this license is supposed to have been given to you
13along with GDB so you can know your rights and responsibilities. It
14should be in a file named COPYING. Among other things, the copyright
15notice and this notice must be preserved on all copies.
16
17In other words, go ahead and share GDB, but don't try to stop
18anyone else from sharing it farther. Help stamp out software hoarding!
19*/
20
21enum lval_type { not_lval, lval_memory, lval_register, lval_internalvar,
22 lval_internalvar_component };
23
24struct value
25 {
26 enum lval_type lval;
27 union
28 {
29 CORE_ADDR address;
30 struct internalvar *internalvar;
31 } location;
32 int offset;
33 int bitsize;
34 int bitpos;
35 struct type *type;
36 struct value *next;
37 short repeated;
38 short repetitions;
39 short regno;
40 long contents[1];
41 };
42
43typedef struct value *value;
44
45#define VALUE_TYPE(val) (val)->type
46#define VALUE_CONTENTS(val) ((char *) (val)->contents)
47#define VALUE_LVAL(val) (val)->lval
48#define VALUE_ADDRESS(val) (val)->location.address
49#define VALUE_INTERNALVAR(val) (val)->location.internalvar
50#define VALUE_OFFSET(val) (val)->offset
51#define VALUE_BITSIZE(val) (val)->bitsize
52#define VALUE_BITPOS(val) (val)->bitpos
53#define VALUE_NEXT(val) (val)->next
54#define VALUE_REPEATED(val) (val)->repeated
55#define VALUE_REPETITIONS(val) (val)->repetitions
56#define VALUE_REGNO(val) (val)->regno
57
58/* If ARG is an array, convert it to a pointer.
3bf57d21 59 If ARG is an enum, convert it to an integer. */
7b4ac7e1 60
61#define COERCE_ARRAY(arg) \
3bf57d21 62{ if (VALUE_REPEATED (arg) \
7b4ac7e1 63 || TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ARRAY) \
64 arg = value_coerce_array (arg); \
65 if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ENUM) \
66 arg = value_cast (builtin_type_unsigned_int, arg); \
67}
68
69/* If ARG is an enum, convert it to an integer. */
70
71#define COERCE_ENUM(arg) \
3bf57d21 72{ if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ENUM) \
7b4ac7e1 73 arg = value_cast (builtin_type_unsigned_int, arg); \
74}
75
76/* Internal variables (variables for convenience of use of debugger)
77 are recorded as a chain of these structures. */
78
79struct internalvar
80{
81 struct internalvar *next;
82 char *name;
83 value value;
84};
85\f
86long value_as_long ();
87double value_as_double ();
88long unpack_long ();
89double unpack_double ();
90long unpack_field_as_long ();
91value value_from_long ();
92value value_from_double ();
93value value_at ();
94value value_of_variable ();
95value value_of_register ();
96value read_var_value ();
97value locate_var_value ();
98value allocate_value ();
99value allocate_repeat_value ();
100value value_string ();
101
102value value_binop ();
103value value_add ();
104value value_sub ();
105value value_coerce_array ();
106value value_ind ();
107value value_addr ();
108value value_assign ();
109value value_neg ();
110value value_lognot ();
3bf57d21 111value value_struct_elt ();
7b4ac7e1 112value value_field ();
113value value_cast ();
114value value_repeat ();
115value value_subscript ();
116
117value call_function ();
118value value_being_returned ();
119
120value evaluate_expression ();
121value evaluate_type ();
122value parse_and_eval ();
632ea0cc 123value parse_to_comma_and_eval ();
7b4ac7e1 124
125value access_value_history ();
126value value_of_internalvar ();
127struct internalvar *lookup_internalvar ();
128
129int value_equal ();
130int value_less ();
131int value_zerop ();
This page took 0.028436 seconds and 4 git commands to generate.