|
|
1.1 root 1: /* Definitions for values of C expressions, for GDB.
2: Copyright (C) 1986, 1987 Free Software Foundation, Inc.
3:
4: GDB is distributed in the hope that it will be useful, but WITHOUT ANY
5: WARRANTY. No author or distributor accepts responsibility to anyone
6: for the consequences of using it or for whether it serves any
7: particular purpose or works at all, unless he says so in writing.
8: Refer to the GDB General Public License for full details.
9:
10: Everyone is granted permission to copy, modify and redistribute GDB,
11: but only under the conditions described in the GDB General Public
12: License. A copy of this license is supposed to have been given to you
13: along with GDB so you can know your rights and responsibilities. It
14: should be in a file named COPYING. Among other things, the copyright
15: notice and this notice must be preserved on all copies.
16:
17: In other words, go ahead and share GDB, but don't try to stop
18: anyone else from sharing it farther. Help stamp out software hoarding!
19: */
20:
21: enum lval_type { not_lval, lval_memory, lval_register, lval_internalvar,
22: lval_internalvar_component };
23:
24: struct 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:
43: typedef 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.
59: If ARG is an enum, convert it to an integer. */
60:
61: #define COERCE_ARRAY(arg) \
62: { if (VALUE_REPEATED (arg) \
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) \
72: { if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ENUM) \
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:
79: struct internalvar
80: {
81: struct internalvar *next;
82: char *name;
83: value value;
84: };
85:
86: long value_as_long ();
87: double value_as_double ();
88: long unpack_long ();
89: double unpack_double ();
90: long unpack_field_as_long ();
91: value value_from_long ();
92: value value_from_double ();
93: value value_at ();
94: value value_of_variable ();
95: value value_of_register ();
96: value read_var_value ();
97: value locate_var_value ();
98: value allocate_value ();
99: value allocate_repeat_value ();
100: value value_string ();
101:
102: value value_binop ();
103: value value_add ();
104: value value_sub ();
105: value value_coerce_array ();
106: value value_ind ();
107: value value_addr ();
108: value value_assign ();
109: value value_neg ();
110: value value_lognot ();
111: value value_struct_elt ();
112: value value_field ();
113: value value_cast ();
114: value value_repeat ();
115: value value_subscript ();
116:
117: value call_function ();
118: value value_being_returned ();
119:
120: value evaluate_expression ();
121: value evaluate_type ();
122: value parse_and_eval ();
123: value parse_to_comma_and_eval ();
124:
125: value access_value_history ();
126: value value_of_internalvar ();
127: struct internalvar *lookup_internalvar ();
128:
129: int value_equal ();
130: int value_less ();
131: int value_zerop ();
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.