Revisión | 1022c627dbd9d7f7f67ac68f16de05474de7a75a (tree) |
---|---|
Tiempo | 2019-08-10 03:27:03 |
Autor | Andreas Arnez <arnez@linu...> |
Commiter | Andreas Arnez |
s390: Implement 'type_align' gdbarch method
The align.exp test case yields many FAILs on s390x, since GDB's _Alignoff
doesn't always agree with the compiler's. On s390x, the maximum alignment
is 8, but GDB returns an alignment of 16 for 16-byte data types such as
"long double".
This is fixed by implementing the type_align gdbarch method. The new
method returns an alignment of 8 for all integer, floating-point, and
vector types larger than 8 bytes. With this change, all align.exp tests
pass.
gdb/ChangeLog:
* s390-tdep.c (s390_type_align): New function.
(s390_gdbarch_init): Set it as type_align gdbarch method.
@@ -1,3 +1,8 @@ | ||
1 | +2019-08-09 Andreas Arnez <arnez@linux.ibm.com> | |
2 | + | |
3 | + * s390-tdep.c (s390_type_align): New function. | |
4 | + (s390_gdbarch_init): Set it as type_align gdbarch method. | |
5 | + | |
1 | 6 | 2019-08-09 Tom de Vries <tdevries@suse.de> |
2 | 7 | |
3 | 8 | PR gdb/24591 |
@@ -52,6 +52,37 @@ constexpr gdb_byte s390_break_insn[] = { 0x0, 0x1 }; | ||
52 | 52 | |
53 | 53 | typedef BP_MANIPULATION (s390_break_insn) s390_breakpoint; |
54 | 54 | |
55 | +/* Types. */ | |
56 | + | |
57 | +/* Implement the gdbarch type alignment method. */ | |
58 | + | |
59 | +static ULONGEST | |
60 | +s390_type_align (gdbarch *gdbarch, struct type *t) | |
61 | +{ | |
62 | + t = check_typedef (t); | |
63 | + | |
64 | + if (TYPE_LENGTH (t) > 8) | |
65 | + { | |
66 | + switch (TYPE_CODE (t)) | |
67 | + { | |
68 | + case TYPE_CODE_INT: | |
69 | + case TYPE_CODE_RANGE: | |
70 | + case TYPE_CODE_FLT: | |
71 | + case TYPE_CODE_ENUM: | |
72 | + case TYPE_CODE_CHAR: | |
73 | + case TYPE_CODE_BOOL: | |
74 | + case TYPE_CODE_DECFLOAT: | |
75 | + return 8; | |
76 | + | |
77 | + case TYPE_CODE_ARRAY: | |
78 | + if (TYPE_VECTOR (t)) | |
79 | + return 8; | |
80 | + break; | |
81 | + } | |
82 | + } | |
83 | + return 0; | |
84 | +} | |
85 | + | |
55 | 86 | /* Decoding S/390 instructions. */ |
56 | 87 | |
57 | 88 | /* Read a single instruction from address AT. */ |
@@ -6944,6 +6975,8 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) | ||
6944 | 6975 | set_gdbarch_long_double_bit (gdbarch, 128); |
6945 | 6976 | set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad); |
6946 | 6977 | |
6978 | + set_gdbarch_type_align (gdbarch, s390_type_align); | |
6979 | + | |
6947 | 6980 | /* Breakpoints. */ |
6948 | 6981 | /* Amount PC must be decremented by after a breakpoint. This is |
6949 | 6982 | often the number of bytes returned by gdbarch_breakpoint_from_pc but not |