diff options
Diffstat (limited to 'gdb/value.c')
-rw-r--r-- | gdb/value.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/gdb/value.c b/gdb/value.c index 0f1be2e..c78bb98 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -35,7 +35,6 @@ #include "valprint.h" #include "cli/cli-decode.h" #include "extension.h" -#include <ctype.h> #include "tracepoint.h" #include "cp-abi.h" #include "user-regs.h" @@ -45,6 +44,7 @@ #include <utility> #include <vector> #include "completer.h" +#include "gdbsupport/cleanups.h" #include "gdbsupport/selftest.h" #include "gdbsupport/array-view.h" #include "cli/cli-style.h" @@ -3266,6 +3266,9 @@ unpack_bits_as_long (struct type *field_type, const gdb_byte *valaddr, } } + if (field_type->code () == TYPE_CODE_RANGE) + val += field_type->bounds ()->bias; + return val; } @@ -3296,21 +3299,28 @@ unpack_value_field_as_long (struct type *type, const gdb_byte *valaddr, return 1; } -/* Unpack a field FIELDNO of the specified TYPE, from the anonymous - object at VALADDR. See unpack_bits_as_long for more details. */ +/* See value.h. */ LONGEST -unpack_field_as_long (struct type *type, const gdb_byte *valaddr, int fieldno) +unpack_field_as_long (const gdb_byte *valaddr, struct field *field) { - int bitpos = type->field (fieldno).loc_bitpos (); - int bitsize = type->field (fieldno).bitsize (); - struct type *field_type = type->field (fieldno).type (); + int bitpos = field->loc_bitpos (); + int bitsize = field->bitsize (); + struct type *field_type = field->type (); return unpack_bits_as_long (field_type, valaddr, bitpos, bitsize); } /* See value.h. */ +LONGEST +unpack_field_as_long (struct type *type, const gdb_byte *valaddr, int fieldno) +{ + return unpack_field_as_long (valaddr, &type->field (fieldno)); +} + +/* See value.h. */ + void value::unpack_bitfield (struct value *dest_val, LONGEST bitpos, LONGEST bitsize, @@ -3712,11 +3722,11 @@ value_from_history_ref (const char *h, const char **endp) len = 2; /* Find length of numeral string. */ - for (; isdigit (h[len]); len++) + for (; c_isdigit (h[len]); len++) ; /* Make sure numeral string is not part of an identifier. */ - if (h[len] == '_' || isalpha (h[len])) + if (h[len] == '_' || c_isalpha (h[len])) return NULL; /* Now collect the index value. */ @@ -4486,9 +4496,7 @@ test_value_copy () } /* namespace selftests */ #endif /* GDB_SELF_TEST */ -void _initialize_values (); -void -_initialize_values () +INIT_GDB_FILE (values) { cmd_list_element *show_convenience_cmd = add_cmd ("convenience", no_class, show_convenience, _("\ |