This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] type alignment: Use type_length_units


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=55c748a1c01f33cec0f762969db1bae457e8bcca

commit 55c748a1c01f33cec0f762969db1bae457e8bcca
Author: Simon Marchi <simon.marchi@ericsson.com>
Date:   Thu Jun 14 18:23:39 2018 -0400

    type alignment: Use type_length_units
    
    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.

Diff:
---
 gdb/ChangeLog    | 5 +++++
 gdb/arch-utils.c | 2 +-
 gdb/gdbtypes.c   | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 60766ca..aba9a1a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 76bc16f..a65f01f 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -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
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index fdd28c0..65b1211 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]