[v2] gdb: Fix false match issue in skip_prologue_using_linetable

Message ID 20230418031622.55130-1-r@hev.cc
State New
Headers
Series [v2] gdb: Fix false match issue in skip_prologue_using_linetable |

Commit Message

hev April 18, 2023, 3:16 a.m. UTC
  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
---
 gdb/symtab.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Tom de Vries April 18, 2023, 12:11 p.m. UTC | #1
On 4/18/23 05:16, WANG Rui wrote:

I've submitted a v3, including test-case here ( 
https://sourceware.org/pipermail/gdb-patches/2023-April/198967.html ).

Thanks,
- Tom
  

Patch

diff --git a/gdb/symtab.c b/gdb/symtab.c
index 9e9798676cb..a789512d60b 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -3705,7 +3705,7 @@  skip_prologue_using_linetable (CORE_ADDR func_addr)
 
       for (;
 	   (it < linetable->item + linetable->nitems
-	    && it->raw_pc () <= unrel_end);
+	    && it->raw_pc () < unrel_end);
 	   it++)
 	if (it->prologue_end)
 	  return {it->pc (objfile)};