diff options
author | Andreas Krebbel <krebbel@linux.vnet.ibm.com> | 2016-09-29 10:04:44 +0200 |
---|---|---|
committer | Andreas Krebbel <krebbel@linux.vnet.ibm.com> | 2016-09-29 16:34:57 +0200 |
commit | 50751e18f3f2fc47959a577a5754f1a2d80baf18 (patch) | |
tree | d345d503eab9c8b47adedc4b9312233069771ee8 /gas | |
parent | 084303b8c636944564d7be3b85dde55e8c371e91 (diff) | |
download | gdb-50751e18f3f2fc47959a577a5754f1a2d80baf18.zip gdb-50751e18f3f2fc47959a577a5754f1a2d80baf18.tar.gz gdb-50751e18f3f2fc47959a577a5754f1a2d80baf18.tar.bz2 |
Frame info dump: Fix bad register marks.
On S/390 we see quite often registers marked as "bad register" in the
readelf --debug-dump=frames or objdump -Wf output.
00000000 0000000000000014 00000000 CIE
Version: 1
Augmentation: "zR"
Code alignment factor: 1
Data alignment factor: -8
Return address column: 14
Augmentation data: 1b
DW_CFA_def_cfa: r15 ofs 160
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
...
00000050 000000000000001c 00000054 FDE cie=00000000 pc=0000000080000e58..0000000080000e84
DW_CFA_advance_loc: 6 to 0000000080000e5e
DW_CFA_offset: r14 at cfa-48
DW_CFA_offset: r15 at cfa-40
DW_CFA_advance_loc: 6 to 0000000080000e64
DW_CFA_def_cfa_offset: 320
DW_CFA_advance_loc: 18 to 0000000080000e76
DW_CFA_restore: bad register: r15 <------
DW_CFA_restore: r14
DW_CFA_def_cfa_offset: 160
This is triggered by this check in display_debug_frames (dwarf.c):
case DW_CFA_restore:
if (opa >= (unsigned int) cie->ncols
|| opa >= (unsigned int) fc->ncols)
reg_prefix = bad_reg;
cie->ncols is number of registers referenced in the CIE which is 15 due
to r14 being given as return address column. So for the CFA_restore of
r15 a "bad register" is being printed while the same rule on r14 is ok.
The reason for this check is to prevent wild memory accesses when
reading input with corrupted register values while accessing the
col_type/col_offset arrays. However in that case r15 is a perfectly
valid register. It just happens not to be mentioned in the CIE. Hence
restoring the CIE rule for r15 should end up with the default rule which
is DW_CFA_undefined.
This probably wasn't observed on other platforms because they either do
not use CFA_restore (x86-64) or do not issue CFA_restore on registers
with a higher number than the return address column.
binutils/ChangeLog:
2016-09-29 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* dwarf.c (frame_display_row): Fix formatting of return address
register column.
(display_debug_frames): Ignore invalid indices into
cie->col_type/cie->col_offset arrays and default to
DW_CF_undefined instead.
Diffstat (limited to 'gas')
0 files changed, 0 insertions, 0 deletions