From 528b729be1a293a21f44149351f3eba5b4e2d870 Mon Sep 17 00:00:00 2001 From: Guinevere Larsen Date: Wed, 1 Nov 2023 17:25:32 +0100 Subject: 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 --- gdb/doc/gdb.texinfo | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'gdb/doc') diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 42a9123..4ada257 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -20453,25 +20453,27 @@ objfile: /home/gnu/build/a.out ((struct objfile *) 0x6120000e0d40) compunit_symtab: simple.cpp ((struct compunit_symtab *) 0x6210000ff450) symtab: /home/gnu/src/simple.cpp ((struct symtab *) 0x6210000ff4d0) linetable: ((struct linetable *) 0x62100012b760): -INDEX LINE ADDRESS IS-STMT PROLOGUE-END +INDEX LINE ADDRESS IS-STMT PROLOGUE-END EPILOGUE-BEGIN 0 3 0x0000000000401110 Y -1 4 0x0000000000401114 Y Y +1 4 0x0000000000401114 Y Y Y 2 9 0x0000000000401120 Y 3 10 0x0000000000401124 Y Y -4 10 0x0000000000401129 +4 10 0x0000000000401129 Y Y 5 15 0x0000000000401130 Y 6 16 0x0000000000401134 Y Y 7 16 0x0000000000401139 -8 21 0x0000000000401140 Y +8 21 0x0000000000401140 Y Y 9 22 0x000000000040114f Y Y -10 22 0x0000000000401154 +10 22 0x0000000000401154 Y 11 END 0x000000000040115a Y @end smallexample @noindent The @samp{IS-STMT} column indicates if the address is a recommended breakpoint location to represent a line or a statement. The @samp{PROLOGUE-END} column indicates that a given address is an adequate place to set a breakpoint at the -first instruction following a function prologue. +first instruction following a function prologue. The @samp{EPILOGUE-BEGIN} +column indicates that a given address marks the point where a block's frame is +destroyed, making local variables hard or impossible to find. @kindex set always-read-ctf [on|off] @kindex show always-read-ctf -- cgit v1.1