| OLD | NEW |
| 1 /* Low level packing and unpacking of values for GDB, the GNU Debugger. | 1 /* Low level packing and unpacking of values for GDB, the GNU Debugger. |
| 2 | 2 |
| 3 Copyright (C) 1986-2000, 2002-2012 Free Software Foundation, Inc. | 3 Copyright (C) 1986-2000, 2002-2012 Free Software Foundation, Inc. |
| 4 | 4 |
| 5 This file is part of GDB. | 5 This file is part of GDB. |
| 6 | 6 |
| 7 This program is free software; you can redistribute it and/or modify | 7 This program is free software; you can redistribute it and/or modify |
| 8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
| 9 the Free Software Foundation; either version 3 of the License, or | 9 the Free Software Foundation; either version 3 of the License, or |
| 10 (at your option) any later version. | 10 (at your option) any later version. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "regcache.h" | 34 #include "regcache.h" |
| 35 #include "block.h" | 35 #include "block.h" |
| 36 #include "dfp.h" | 36 #include "dfp.h" |
| 37 #include "objfiles.h" | 37 #include "objfiles.h" |
| 38 #include "valprint.h" | 38 #include "valprint.h" |
| 39 #include "cli/cli-decode.h" | 39 #include "cli/cli-decode.h" |
| 40 #include "exceptions.h" | 40 #include "exceptions.h" |
| 41 #include "python/python.h" | 41 #include "python/python.h" |
| 42 #include <ctype.h> | 42 #include <ctype.h> |
| 43 #include "tracepoint.h" | 43 #include "tracepoint.h" |
| 44 #include "cp-abi.h" |
| 44 | 45 |
| 45 /* Prototypes for exported functions. */ | 46 /* Prototypes for exported functions. */ |
| 46 | 47 |
| 47 void _initialize_values (void); | 48 void _initialize_values (void); |
| 48 | 49 |
| 49 /* Definition of a user function. */ | 50 /* Definition of a user function. */ |
| 50 struct internal_function | 51 struct internal_function |
| 51 { | 52 { |
| 52 /* The name of the function. It is a bit odd to have this in the | 53 /* The name of the function. It is a bit odd to have this in the |
| 53 function itself -- the user might use a differently-named | 54 function itself -- the user might use a differently-named |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 161 |
| 161 if (ranges_overlap (r->offset, r->length, offset, length)) | 162 if (ranges_overlap (r->offset, r->length, offset, length)) |
| 162 return 1; | 163 return 1; |
| 163 } | 164 } |
| 164 | 165 |
| 165 return 0; | 166 return 0; |
| 166 } | 167 } |
| 167 | 168 |
| 168 static struct cmd_list_element *functionlist; | 169 static struct cmd_list_element *functionlist; |
| 169 | 170 |
| 171 /* Note that the fields in this structure are arranged to save a bit |
| 172 of memory. */ |
| 173 |
| 170 struct value | 174 struct value |
| 171 { | 175 { |
| 172 /* Type of value; either not an lval, or one of the various | 176 /* Type of value; either not an lval, or one of the various |
| 173 different possible kinds of lval. */ | 177 different possible kinds of lval. */ |
| 174 enum lval_type lval; | 178 enum lval_type lval; |
| 175 | 179 |
| 176 /* Is it modifiable? Only relevant if lval != not_lval. */ | 180 /* Is it modifiable? Only relevant if lval != not_lval. */ |
| 177 int modifiable; | 181 unsigned int modifiable : 1; |
| 182 |
| 183 /* If zero, contents of this value are in the contents field. If |
| 184 nonzero, contents are in inferior. If the lval field is lval_memory, |
| 185 the contents are in inferior memory at location.address plus offset. |
| 186 The lval field may also be lval_register. |
| 187 |
| 188 WARNING: This field is used by the code which handles watchpoints |
| 189 (see breakpoint.c) to decide whether a particular value can be |
| 190 watched by hardware watchpoints. If the lazy flag is set for |
| 191 some member of a value chain, it is assumed that this member of |
| 192 the chain doesn't need to be watched as part of watching the |
| 193 value itself. This is how GDB avoids watching the entire struct |
| 194 or array when the user wants to watch a single struct member or |
| 195 array element. If you ever change the way lazy flag is set and |
| 196 reset, be sure to consider this use as well! */ |
| 197 unsigned int lazy : 1; |
| 198 |
| 199 /* If nonzero, this is the value of a variable which does not |
| 200 actually exist in the program. */ |
| 201 unsigned int optimized_out : 1; |
| 202 |
| 203 /* If value is a variable, is it initialized or not. */ |
| 204 unsigned int initialized : 1; |
| 205 |
| 206 /* If value is from the stack. If this is set, read_stack will be |
| 207 used instead of read_memory to enable extra caching. */ |
| 208 unsigned int stack : 1; |
| 209 |
| 210 /* If the value has been released. */ |
| 211 unsigned int released : 1; |
| 178 | 212 |
| 179 /* Location of value (if lval). */ | 213 /* Location of value (if lval). */ |
| 180 union | 214 union |
| 181 { | 215 { |
| 182 /* If lval == lval_memory, this is the address in the inferior. | 216 /* If lval == lval_memory, this is the address in the inferior. |
| 183 If lval == lval_register, this is the byte offset into the | 217 If lval == lval_register, this is the byte offset into the |
| 184 registers structure. */ | 218 registers structure. */ |
| 185 CORE_ADDR address; | 219 CORE_ADDR address; |
| 186 | 220 |
| 187 /* Pointer to internal variable. */ | 221 /* Pointer to internal variable. */ |
| (...skipping 20 matching lines...) Expand all Loading... |
| 208 int offset; | 242 int offset; |
| 209 | 243 |
| 210 /* Only used for bitfields; number of bits contained in them. */ | 244 /* Only used for bitfields; number of bits contained in them. */ |
| 211 int bitsize; | 245 int bitsize; |
| 212 | 246 |
| 213 /* Only used for bitfields; position of start of field. For | 247 /* Only used for bitfields; position of start of field. For |
| 214 gdbarch_bits_big_endian=0 targets, it is the position of the LSB. For | 248 gdbarch_bits_big_endian=0 targets, it is the position of the LSB. For |
| 215 gdbarch_bits_big_endian=1 targets, it is the position of the MSB. */ | 249 gdbarch_bits_big_endian=1 targets, it is the position of the MSB. */ |
| 216 int bitpos; | 250 int bitpos; |
| 217 | 251 |
| 252 /* The number of references to this value. When a value is created, |
| 253 the value chain holds a reference, so REFERENCE_COUNT is 1. If |
| 254 release_value is called, this value is removed from the chain but |
| 255 the caller of release_value now has a reference to this value. |
| 256 The caller must arrange for a call to value_free later. */ |
| 257 int reference_count; |
| 258 |
| 218 /* Only used for bitfields; the containing value. This allows a | 259 /* Only used for bitfields; the containing value. This allows a |
| 219 single read from the target when displaying multiple | 260 single read from the target when displaying multiple |
| 220 bitfields. */ | 261 bitfields. */ |
| 221 struct value *parent; | 262 struct value *parent; |
| 222 | 263 |
| 223 /* Frame register value is relative to. This will be described in | 264 /* Frame register value is relative to. This will be described in |
| 224 the lval enum above as "lval_register". */ | 265 the lval enum above as "lval_register". */ |
| 225 struct frame_id frame_id; | 266 struct frame_id frame_id; |
| 226 | 267 |
| 227 /* Type of the value. */ | 268 /* Type of the value. */ |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 314 |
| 274 /* Values are stored in a chain, so that they can be deleted easily | 315 /* Values are stored in a chain, so that they can be deleted easily |
| 275 over calls to the inferior. Values assigned to internal | 316 over calls to the inferior. Values assigned to internal |
| 276 variables, put into the value history or exposed to Python are | 317 variables, put into the value history or exposed to Python are |
| 277 taken off this list. */ | 318 taken off this list. */ |
| 278 struct value *next; | 319 struct value *next; |
| 279 | 320 |
| 280 /* Register number if the value is from a register. */ | 321 /* Register number if the value is from a register. */ |
| 281 short regnum; | 322 short regnum; |
| 282 | 323 |
| 283 /* If zero, contents of this value are in the contents field. If | |
| 284 nonzero, contents are in inferior. If the lval field is lval_memory, | |
| 285 the contents are in inferior memory at location.address plus offset. | |
| 286 The lval field may also be lval_register. | |
| 287 | |
| 288 WARNING: This field is used by the code which handles watchpoints | |
| 289 (see breakpoint.c) to decide whether a particular value can be | |
| 290 watched by hardware watchpoints. If the lazy flag is set for | |
| 291 some member of a value chain, it is assumed that this member of | |
| 292 the chain doesn't need to be watched as part of watching the | |
| 293 value itself. This is how GDB avoids watching the entire struct | |
| 294 or array when the user wants to watch a single struct member or | |
| 295 array element. If you ever change the way lazy flag is set and | |
| 296 reset, be sure to consider this use as well! */ | |
| 297 char lazy; | |
| 298 | |
| 299 /* If nonzero, this is the value of a variable which does not | |
| 300 actually exist in the program. */ | |
| 301 char optimized_out; | |
| 302 | |
| 303 /* If value is a variable, is it initialized or not. */ | |
| 304 int initialized; | |
| 305 | |
| 306 /* If value is from the stack. If this is set, read_stack will be | |
| 307 used instead of read_memory to enable extra caching. */ | |
| 308 int stack; | |
| 309 | |
| 310 /* Actual contents of the value. Target byte-order. NULL or not | 324 /* Actual contents of the value. Target byte-order. NULL or not |
| 311 valid if lazy is nonzero. */ | 325 valid if lazy is nonzero. */ |
| 312 gdb_byte *contents; | 326 gdb_byte *contents; |
| 313 | 327 |
| 314 /* Unavailable ranges in CONTENTS. We mark unavailable ranges, | 328 /* Unavailable ranges in CONTENTS. We mark unavailable ranges, |
| 315 rather than available, since the common and default case is for a | 329 rather than available, since the common and default case is for a |
| 316 value to be available. This is filled in at value read time. */ | 330 value to be available. This is filled in at value read time. */ |
| 317 VEC(range_s) *unavailable; | 331 VEC(range_s) *unavailable; |
| 318 | |
| 319 /* The number of references to this value. When a value is created, | |
| 320 the value chain holds a reference, so REFERENCE_COUNT is 1. If | |
| 321 release_value is called, this value is removed from the chain but | |
| 322 the caller of release_value now has a reference to this value. | |
| 323 The caller must arrange for a call to value_free later. */ | |
| 324 int reference_count; | |
| 325 }; | 332 }; |
| 326 | 333 |
| 327 int | 334 int |
| 328 value_bytes_available (const struct value *value, int offset, int length) | 335 value_bytes_available (const struct value *value, int offset, int length) |
| 329 { | 336 { |
| 330 gdb_assert (!value->lazy); | 337 gdb_assert (!value->lazy); |
| 331 | 338 |
| 332 return !ranges_contain (value->unavailable, offset, length); | 339 return !ranges_contain (value->unavailable, offset, length); |
| 333 } | 340 } |
| 334 | 341 |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 return value->bitsize; | 796 return value->bitsize; |
| 790 } | 797 } |
| 791 void | 798 void |
| 792 set_value_bitsize (struct value *value, int bit) | 799 set_value_bitsize (struct value *value, int bit) |
| 793 { | 800 { |
| 794 value->bitsize = bit; | 801 value->bitsize = bit; |
| 795 } | 802 } |
| 796 | 803 |
| 797 struct value * | 804 struct value * |
| 798 value_parent (struct value *value) | 805 value_parent (struct value *value) |
error: old chunk mismatch |
None
| OLD | NEW |