public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: WANG Rui <r@hev.cc>
To: gdb-patches@sourceware.org
Cc: Lancelot SIX <lancelot.six@amd.com>, WANG Rui <r@hev.cc>
Subject: [PATCH v2] gdb: Fix false match issue in skip_prologue_using_linetable
Date: Tue, 18 Apr 2023 11:16:22 +0800	[thread overview]
Message-ID: <20230418031622.55130-1-r@hev.cc> (raw)

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(-)

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)};
-- 
2.40.0


             reply	other threads:[~2023-04-18  3:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-18  3:16 WANG Rui [this message]
2023-04-18 12:11 ` Tom de Vries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230418031622.55130-1-r@hev.cc \
    --to=r@hev.cc \
    --cc=gdb-patches@sourceware.org \
    --cc=lancelot.six@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).