aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2019-02-18 18:10:09 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2019-02-18 23:24:53 +0000
commit70cd633e87e683a2233e852b96e5f1ef8591d4d1 (patch)
treef7700b8e7b85a18af17663fc8a6c40a8046fde79 /gdb
parent040b3e95e41f7af82e95c781aadc56a16019fd68 (diff)
downloadgdb-70cd633e87e683a2233e852b96e5f1ef8591d4d1.zip
gdb-70cd633e87e683a2233e852b96e5f1ef8591d4d1.tar.gz
gdb-70cd633e87e683a2233e852b96e5f1ef8591d4d1.tar.bz2
gdb: Allow gdbarch to override alignment for method and member pointers
The code in type_align (gdbtypes.c) currently hard-codes the rules for aligning method and member pointers. It would seem better to forward these types through the gdbarch hook, so that an architecture could override the alignment of these types if needed. Only 3 architectures currently override the gdbarch alignment hook, these are arc, i386, and nio2. For arc and nios the alignment rules are that alignment is the minimum of 4-bytes and the type length. As pointers are 4-bytes on these targets, then (assuming method and members pointers are also 4-bytes) there should be no change to the alignment after this patch. For i386 the gdbarch alignment hook overrides for some INT and FLOAT types only. For method and member pointers we align on the type size still, so there should be no change to the alignment after this patch. I tested this on x86-64 GNU Linux with no regressions. gdb/ChangeLog: * gdbtypes.c (type_align): Allow alignment of TYPE_CODE_METHODPTR and TYPE_CODE_MEMBERPTR to be overridden by the gdbarch.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/gdbtypes.c7
2 files changed, 7 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 65d6548..1cf2f07 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2019-02-18 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * gdbtypes.c (type_align): Allow alignment of TYPE_CODE_METHODPTR
+ and TYPE_CODE_MEMBERPTR to be overridden by the gdbarch.
+
2019-02-18 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* ada-task.c (_initialize_tasks): Use 'with_cleanup' register
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 6758783..0d29339 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -3011,6 +3011,8 @@ type_align (struct type *type)
case TYPE_CODE_CHAR:
case TYPE_CODE_BOOL:
case TYPE_CODE_DECFLOAT:
+ case TYPE_CODE_METHODPTR:
+ case TYPE_CODE_MEMBERPTR:
{
struct gdbarch *arch = get_type_arch (type);
align = gdbarch_type_align (arch, type);
@@ -3053,11 +3055,6 @@ type_align (struct type *type)
anyway. */
break;
- case TYPE_CODE_METHODPTR:
- case TYPE_CODE_MEMBERPTR:
- align = type_length_units (type);
- break;
-
case TYPE_CODE_VOID:
align = 1;
break;