public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: WANG Rui <r@hev.cc>, gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb: Fix false match issue in skip_prologue_using_linetable
Date: Mon, 17 Apr 2023 10:38:38 -0700	[thread overview]
Message-ID: <901e6d84-2476-9108-b79c-0a3747d02b2f@redhat.com> (raw)
In-Reply-To: <20230417162428.48426-1-r@hev.cc>

On 4/17/23 09:24, WANG Rui wrote:
> 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

Thank you for the patch. Indeed, my recollection is that we always
record/search for pc's in [start, end). find_pc_partial_function seems to
concur.

> ---
>   gdb/symtab.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gdb/symtab.c b/gdb/symtab.c
> index f2b1a14e006..a662d7d1869 100644
> --- a/gdb/symtab.c
> +++ b/gdb/symtab.c
> @@ -3735,7 +3735,7 @@ skip_prologue_using_linetable (CORE_ADDR func_addr)
>   	 });
>   
>         for (;
> -	   it < linetable->item + linetable->nitems && it->pc <= end_pc;
> +	   it < linetable->item + linetable->nitems && it->pc < end_pc;
>   	   it++)
>   	if (it->prologue_end)
>   	  return {it->pc};

This appears to be against gdb 13 and will need to be rebased.

I have regression tested this on x86_64 and found nothing of concern.
[The patch which introduced this function contained a test case,
gdb.dwarf2/dw2-prologue-end.exp, and that test also shows no regressions.]

I have to ask, though, is there a way to write a test case for this? Maybe
by using dw2-prologue-end.exp as an example?

Keith


  reply	other threads:[~2023-04-17 17:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-17 16:24 WANG Rui
2023-04-17 17:38 ` Keith Seitz [this message]
2023-04-18  2:26   ` hev
2023-04-18  8:43     ` Tom de Vries
2023-04-18  9:59       ` hev
2023-04-17 21:12 ` Lancelot SIX
2023-04-18  2:26   ` hev
2023-04-22  8:36 ` Tom de Vries
2023-04-23  1:24   ` hev

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=901e6d84-2476-9108-b79c-0a3747d02b2f@redhat.com \
    --to=keiths@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=r@hev.cc \
    /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).