gdb: Fix false match issue in skip_prologue_using_linetable
authorWANG Rui <r@hev.cc>
Sat, 22 Apr 2023 05:50:08 +0000 (07:50 +0200)
committerTom de Vries <tdevries@suse.de>
Sat, 22 Apr 2023 05:50:08 +0000 (07:50 +0200)
commita88ee931eee4ba7339c481735b9405f66161e2f6
tree67adc6759eafd58665eb8e8200989a5c05e58c0e
parentd89504f0d90dedd3d5ab83d8c91707a354231d2f
gdb: Fix false match issue in skip_prologue_using_linetable

[ Changes in v2:
  - rebase on trunk
  Changes in v3:
  - add test-case ]

We should exclude matches to the ending PC to prevent false matches with the
next function, as prologue_end is located at the end PC.

  <fun1>:
    0x00: ... <-- start_pc
    0x04: ...
    0x08: ... <-- breakpoint
    0x0c: ret
  <fun2>:
    0x10: ret <-- end_pc | prologue_end of fun2

Tested on x86_64-linux.

Co-Authored-By: WANG Rui <r@hev.cc> (fix, tiny change [1])
Co-Authored-By: Tom de Vries <tdevries@suse.de> (test-case)
Approved-by: Kevin Buettner <kevinb@redhat.com>
[1] https://www.gnu.org/prep/maintain/html_node/Legally-Significant.html

PR symtab/30369
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30369
gdb/symtab.c
gdb/testsuite/gdb.dwarf2/dw2-prologue-end-2.c [new file with mode: 0644]
gdb/testsuite/gdb.dwarf2/dw2-prologue-end-2.exp [new file with mode: 0644]