diff options
author | Peter Schauer <Peter.Schauer@mytum.de> | 1995-08-26 07:35:13 +0000 |
---|---|---|
committer | Peter Schauer <Peter.Schauer@mytum.de> | 1995-08-26 07:35:13 +0000 |
commit | 080868b4662cf9f1930714d09ad1d446dfd3a196 (patch) | |
tree | 18515318b28c97cb5214cda2e171624382018314 /gdb/values.c | |
parent | 13ba8b69271683f5cc4c723a6dbd1070b9aa671f (diff) | |
download | gdb-080868b4662cf9f1930714d09ad1d446dfd3a196.zip gdb-080868b4662cf9f1930714d09ad1d446dfd3a196.tar.gz gdb-080868b4662cf9f1930714d09ad1d446dfd3a196.tar.bz2 |
* mdebugread.c (parse_symbol): Handle sh.value of zero for enums.
Determine signedness of enum type from enumerators.
(parse_type): Handle btIndirect types, handle fBitfield for
some non-member types.
(upgrade_type): Use TYPE_FLAG_TARGET_STUB for arrays with
unknown length.
(cross_ref): Handle stIndirect forward reference to btTypedef.
* stabsread.c (read_enum_type): Determine signedness of enum
type from enumerators.
* top.c (execute_command): Remove trailing whitespace from
command arguments, except for `set' and `complete' commands.
(validate_comname): Allow underscores in user defined command
names.
* values.c (modify_field): Change `Value does not fit in %d bits'
error to a warning. Exclude sign extension bits of negative field
values from fit check.
Diffstat (limited to 'gdb/values.c')
-rw-r--r-- | gdb/values.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/gdb/values.c b/gdb/values.c index 53a4117..9a2301e 100644 --- a/gdb/values.c +++ b/gdb/values.c @@ -1,5 +1,5 @@ /* Low level packing and unpacking of values for GDB, the GNU Debugger. - Copyright 1986, 1987, 1989, 1991, 1993, 1994 + Copyright 1986, 1987, 1989, 1991, 1993, 1994, 1995 Free Software Foundation, Inc. This file is part of GDB. @@ -1288,14 +1288,22 @@ modify_field (addr, fieldval, bitpos, bitsize) { LONGEST oword; - /* Reject values too big to fit in the field in question, - otherwise adjoining fields may be corrupted. */ + /* If a negative fieldval fits in the field in question, chop + off the sign extension bits. */ + if (bitsize < (8 * sizeof (fieldval)) + && (~fieldval & ~((1 << (bitsize - 1)) - 1)) == 0) + fieldval = fieldval & ((1 << bitsize) - 1); + + /* Warn if value is too big to fit in the field in question. */ if (bitsize < (8 * sizeof (fieldval)) && 0 != (fieldval & ~((1<<bitsize)-1))) { /* FIXME: would like to include fieldval in the message, but we don't have a sprintf_longest. */ - error ("Value does not fit in %d bits.", bitsize); + warning ("Value does not fit in %d bits.", bitsize); + + /* Truncate it, otherwise adjoining fields may be corrupted. */ + fieldval = fieldval & ((1 << bitsize) - 1); } oword = extract_signed_integer (addr, sizeof oword); |