]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
type alignment: Use type_length_units
authorSimon Marchi <simon.marchi@ericsson.com>
Thu, 14 Jun 2018 22:23:39 +0000 (18:23 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Thu, 14 Jun 2018 22:24:55 +0000 (18:24 -0400)
The type alignment value is returned in 8-bit-bytes instead of target
memory addressable units.  For example, on a target with 16-bit-bytes
where sizeof(int) == 1 (one addressable unit), alignof(int) currently
returns 2.  After, this patch, it returns 1.

gdb/ChangeLog:

* arch-utils.c (default_type_align): Use type_length_units.
* gdbtypes.c (type_align): Use type_length_units.

gdb/ChangeLog
gdb/arch-utils.c
gdb/gdbtypes.c

index 60766ca77758833d46f54671e0f306ba457f5eee..aba9a1a1b1f3fbd06e65b33208467dd546ad4591 100644 (file)
@@ -1,3 +1,8 @@
+2018-06-14  Simon Marchi  <simon.marchi@ericsson.com>
+
+       * arch-utils.c (default_type_align): Use type_length_units.
+       * gdbtypes.c (type_align): Use type_length_units.
+
 2018-06-14  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
 
        * cli/cli-script.c (_initialize_cli_script): Fix online documentation
index 76bc16f3750071a2c06fe52a42efeba3a8c14de2..a65f01f83368688d4075b5cc2292ffcd237f462d 100644 (file)
@@ -994,7 +994,7 @@ default_in_indirect_branch_thunk (gdbarch *gdbarch, CORE_ADDR pc)
 ULONGEST
 default_type_align (struct gdbarch *gdbarch, struct type *type)
 {
-  return TYPE_LENGTH (check_typedef (type));
+  return type_length_units (check_typedef (type));
 }
 
 void
index fdd28c0886e3b6e6fe028104808e7d063c5a493c..65b1211ec492a062b2efea766c7e7905d79e7ef6 100644 (file)
@@ -3072,7 +3072,7 @@ type_align (struct type *type)
 
     case TYPE_CODE_METHODPTR:
     case TYPE_CODE_MEMBERPTR:
-      align = TYPE_LENGTH (type);
+      align = type_length_units (type);
       break;
 
     case TYPE_CODE_VOID: