aboutsummaryrefslogtreecommitdiff
path: root/gdb/findvar.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@ericsson.com>2015-07-28 11:01:50 -0400
committerSimon Marchi <simon.marchi@ericsson.com>2015-07-28 11:01:50 -0400
commit3ae385afe150f2e001a1cc8fb14f4ba0ab94cdf2 (patch)
tree0984430c0197e8fb667866605cac82e050fd8ce5 /gdb/findvar.c
parente512cdbdffafefa63baeb835ba6636fcef56e17d (diff)
downloadgdb-3ae385afe150f2e001a1cc8fb14f4ba0ab94cdf2.zip
gdb-3ae385afe150f2e001a1cc8fb14f4ba0ab94cdf2.tar.gz
gdb-3ae385afe150f2e001a1cc8fb14f4ba0ab94cdf2.tar.bz2
Consider addressable memory unit size in various value functions
This patch updates various value handling functions to make them consider the addressable memory unit size of the current architecture. This allows to correctly extract and print values on architectures whose addressable memory unit is not 8 bits. The patch doesn't cover all the code that would ideally need to be adjusted, only the code paths that we happen to use, plus a few obvious ones. Specifically, those areas are not covered by this patch: - Management of unavailable bits - Bitfields - C++ stuff Regression-tested on x86-64 Ubuntu 14.04. I saw no related test result change. gdb/ChangeLog: * c-valprint.c (c_val_print_array): Consider addressable memory unit size. (c_val_print_ptr): Likewise. (c_val_print_int): Likewise. * findvar.c (read_frame_register_value): Likewise. * valarith.c (find_size_for_pointer_math): Likewise. (value_ptrdiff): Likewise. (value_subscripted_rvalue): Likewise. * valops.c (read_value_memory): Likewise (and rename variables). (value_assign): Likewise. (value_repeat): Likewise. (value_array): Likewise. (value_slice): Likewise. * valprint.c (generic_val_print_ptr): Likewise. (generic_val_print_enum): Likewise. (generic_val_print_bool): Likewise. (generic_val_print_int): Likewise. (generic_val_print_char): Likewise. (generic_val_print_float): Likewise. (generic_val_print_decfloat): Likewise. (generic_val_print_complex): Likewise. (val_print_scalar_formatted): Likewise. (val_print_array_elements): Likewise. * value.c (set_value_parent): Likewise. (value_contents_copy_raw): Likewise. (set_internalvar_component): Likewise. (value_primitive_field): Likewise. (value_fetch_lazy): Likewise. * value.h (read_value_memory): Update comment.
Diffstat (limited to 'gdb/findvar.c')
-rw-r--r--gdb/findvar.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/findvar.c b/gdb/findvar.c
index 2079b4b..83b4fca 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -662,7 +662,7 @@ read_frame_register_value (struct value *value, struct frame_info *frame)
int offset = 0;
int reg_offset = value_offset (value);
int regnum = VALUE_REGNUM (value);
- int len = TYPE_LENGTH (check_typedef (value_type (value)));
+ int len = type_length_units (check_typedef (value_type (value)));
gdb_assert (VALUE_LVAL (value) == lval_register);
@@ -677,7 +677,7 @@ read_frame_register_value (struct value *value, struct frame_info *frame)
while (len > 0)
{
struct value *regval = get_frame_register_value (frame, regnum);
- int reg_len = TYPE_LENGTH (value_type (regval)) - reg_offset;
+ int reg_len = type_length_units (value_type (regval)) - reg_offset;
/* If the register length is larger than the number of bytes
remaining to copy, then only copy the appropriate bytes. */