]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/buildsym.c
gdb/dwarf2: Add support for DW_LNS_set_epilogue_begin in line-table
authorGuinevere Larsen <blarsen@redhat.com>
Wed, 1 Nov 2023 16:25:32 +0000 (17:25 +0100)
committerGuinevere Larsen <blarsen@redhat.com>
Tue, 2 Jan 2024 09:21:37 +0000 (10:21 +0100)
commit528b729be1a293a21f44149351f3eba5b4e2d870
tree3959ec9a424c769dfeffe89440fc4c6165df3916
parentb22ee0e49ba2bac8a5295f0426c62e9bd2b311a1
gdb/dwarf2: Add support for DW_LNS_set_epilogue_begin in line-table

This commit adds a mechanism for GDB to detect the linetable opcode
DW_LNS_set_epilogue_begin. This opcode is set by compilers to indicate
that a certain instruction marks the point where the frame is destroyed.

While the standard allows for multiple points marked with epilogue_begin
in the same function, for performance reasons, the function that
searches for the epilogue address will only find the last address that
sets this flag for a given block.

This commit also changes amd64_stack_frame_destroyed_p_1 to attempt to
use the epilogue begin directly, and only if an epilogue can't be found
will it attempt heuristics based on the current instruction.

Finally, this commit also changes the dwarf assembler to be able to emit
epilogue-begin instructions, to make it easier to test this patch

Approved-By: Tom Tromey <tom@tromey.com>
13 files changed:
gdb/NEWS
gdb/amd64-tdep.c
gdb/buildsym.c
gdb/buildsym.h
gdb/doc/gdb.texinfo
gdb/dwarf2/read.c
gdb/symmisc.c
gdb/symtab.c
gdb/symtab.h
gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.c [new file with mode: 0644]
gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.exp [new file with mode: 0644]
gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp
gdb/testsuite/lib/dwarf.exp