[LVu] base subseg head view on prev subseg's tail
authorAlexandre Oliva <aoliva@redhat.com>
Mon, 6 May 2019 02:07:20 +0000 (23:07 -0300)
committerAlexandre Oliva <aoliva@redhat.com>
Mon, 6 May 2019 02:07:20 +0000 (23:07 -0300)
commit62e6b7b3b3c6f2fffe9f5863ddebf430533b79f0
tree5f3534e2151489c6d41da254ef1c65d2710e51d1
parentbd1efd7d2111e37e2471facca117650a213f332e
[LVu] base subseg head view on prev subseg's tail

Location views at borders between subsegments/subsections in the same
segment/section are computed as if each new subsegment/subsection
started with a forced view reset to zero, but the line number program
does not introduce resets that are not explicitly requested, so if a
subsegment ends at the same address another starts, the line number
program will have a continuity of views at the border address, whereas
the initial view number label in the latter subsegment will be
miscomputed as zero.

This patch delays the assignment of view expressions at subsegment
heads to the time of chaining the frags of subsegments into a single
segment, so that they are set based on the view at the end of the
previous subsegment in the same segment.

The line number program created for the test program had an
unnecessary DW_LNS_advance_pc at the end.  This patch also arranges
for us not to emit it.

for  gas/ChangeLog

* dwarf2dbg.c (set_or_check_view): Skip heads when assigning
views of prior locs.
(dwarf2_gen_line_info_1): Skip heads.
(size_inc_line_addr, emit_inc_line_addr): Drop
DW_LNS_advance_pc for zero addr delta.
(dwarf2_finish): Assign views for heads of segments.
* testsuite/gas/elf/dwarf2-19.d: New.
* testsuite/gas/elf/dwarf2-19.s: New.
* testsuite/gas/elf/elf.exp: Test it.
gas/ChangeLog
gas/dwarf2dbg.c
gas/testsuite/gas/elf/dwarf2-19.d [new file with mode: 0644]
gas/testsuite/gas/elf/dwarf2-19.s [new file with mode: 0644]
gas/testsuite/gas/elf/elf.exp