PR28149 part 2, purge generated line info
authorAlan Modra <amodra@gmail.com>
Thu, 16 Sep 2021 23:51:21 +0000 (09:21 +0930)
committerAlan Modra <amodra@gmail.com>
Fri, 17 Sep 2021 22:50:11 +0000 (08:20 +0930)
commitef9768e37e34bec50aa8cbb0ce25708b06f09255
treed614a1afd069ab15693dddfebcda02524b326290
parent51298b330327a568358da069d9808f51c6cb1672
PR28149 part 2, purge generated line info

Mixing compiler generated line info with gas generated line info is
generally just confusing.  Also .loc directives with non-zero view
fields might reference a previous .loc.  It becomes a little more
tricky to locate that previous .loc if there might be gas generated
line info present too.  Mind you, we turn off gas generation of line
info on seeing compiler generated line info, so any reference back
won't hit gas generated line info.  At least, if the view info is
sane.  Unfortunately, gas needs to handle mangled source.

PR 28149
* dwarf2dbg.c (purge_generated_debug): New function.
(dwarf2_directive_filename): Call the above.
(out_debug_line): Don't segfault after purging.
* testsuite/gas/i386/dwarf2-line-4.d: Update expected output.
* testsuite/gas/i386/dwarf4-line-1.d: Likewise.
* testsuite/gas/i386/dwarf5-line-1.d: Likewise.
* testsuite/gas/i386/dwarf5-line-2.d: Likewise.
gas/dwarf2dbg.c
gas/testsuite/gas/i386/dwarf2-line-4.d
gas/testsuite/gas/i386/dwarf4-line-1.d
gas/testsuite/gas/i386/dwarf5-line-1.d
gas/testsuite/gas/i386/dwarf5-line-2.d