public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/30369] New: [gdb/symtab] False match issue in skip_prologue_using_linetable
@ 2023-04-18  8:32 vries at gcc dot gnu.org
  2023-04-18  8:34 ` [Bug symtab/30369] " vries at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2023-04-18  8:32 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30369

            Bug ID: 30369
           Summary: [gdb/symtab] False match issue in
                    skip_prologue_using_linetable
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: symtab
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

[ Reported here (
https://sourceware.org/pipermail/gdb-patches/2023-April/198927.html ), without
reproducer. ]

Consider mockup functions foo and bar:
...
00000000004004b2 <foo_label>:
  4004b2:       c7 45 f8 02 00 00 00    movl   $0x2,-0x8(%rbp)

00000000004004b9 <bar_label>:
  4004b9:       c7 45 f4 03 00 00 00    movl   $0x3,-0xc(%rbp)

00000000004004c0 <bar_end>:
...
with line info:
...
INDEX  LINE   REL-ADDRESS        UNREL-ADDRESS      IS-STMT PROLOGUE-END 
0      22     0x00000000004004b2 0x00000000004004b2 Y                    
1      26     0x00000000004004b9 0x00000000004004b9 Y       Y            
2      END    0x00000000004004c0 0x00000000004004c0 Y                    
...

When setting a breakpoint on foo, we get:
...
(gdb) break foo
Breakpoint 1 at 0x4004b9: file $src, line 26.
...
In other words, the breakpoint was set in bar instead.

With the fix from aforementioned patch, we have instead:
...
Breakpoint 1 at 0x4004b2: file $src, line 22.
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug symtab/30369] [gdb/symtab] False match issue in skip_prologue_using_linetable
  2023-04-18  8:32 [Bug symtab/30369] New: [gdb/symtab] False match issue in skip_prologue_using_linetable vries at gcc dot gnu.org
@ 2023-04-18  8:34 ` vries at gcc dot gnu.org
  2023-04-18 10:00 ` vries at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2023-04-18  8:34 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30369

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Created attachment 14837
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14837&action=edit
Patch with dwarf assembly reproducer

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug symtab/30369] [gdb/symtab] False match issue in skip_prologue_using_linetable
  2023-04-18  8:32 [Bug symtab/30369] New: [gdb/symtab] False match issue in skip_prologue_using_linetable vries at gcc dot gnu.org
  2023-04-18  8:34 ` [Bug symtab/30369] " vries at gcc dot gnu.org
@ 2023-04-18 10:00 ` vries at gcc dot gnu.org
  2023-04-18 12:16 ` vries at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2023-04-18 10:00 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30369

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|HEAD                        |13.1

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
Reproduced with trunk and gdb-13-branch.

Doesn't reproduce with gdb-12-branch (executed manually, test-case doesn't
compile that far back):
...
$ gdb -q -batch dw2-prologue-end-2 -ex "b foo" -ex "print &foo_label"
Breakpoint 1 at 0x4004b2: file $src, line 22.
$1 = (void (*)()) 0x4004b2 <foo>
...
which is not surprising because prologue_end support was only added in gdb 13.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug symtab/30369] [gdb/symtab] False match issue in skip_prologue_using_linetable
  2023-04-18  8:32 [Bug symtab/30369] New: [gdb/symtab] False match issue in skip_prologue_using_linetable vries at gcc dot gnu.org
  2023-04-18  8:34 ` [Bug symtab/30369] " vries at gcc dot gnu.org
  2023-04-18 10:00 ` vries at gcc dot gnu.org
@ 2023-04-18 12:16 ` vries at gcc dot gnu.org
  2023-04-22  5:50 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2023-04-18 12:16 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30369

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Submitted v3:
https://sourceware.org/pipermail/gdb-patches/2023-April/198967.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug symtab/30369] [gdb/symtab] False match issue in skip_prologue_using_linetable
  2023-04-18  8:32 [Bug symtab/30369] New: [gdb/symtab] False match issue in skip_prologue_using_linetable vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-04-18 12:16 ` vries at gcc dot gnu.org
@ 2023-04-22  5:50 ` cvs-commit at gcc dot gnu.org
  2023-04-22  7:33 ` cvs-commit at gcc dot gnu.org
  2023-04-22  7:35 ` vries at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-22  5:50 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30369

--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a88ee931eee4ba7339c481735b9405f66161e2f6

commit a88ee931eee4ba7339c481735b9405f66161e2f6
Author: WANG Rui <r@hev.cc>
Date:   Sat Apr 22 07:50:08 2023 +0200

    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

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug symtab/30369] [gdb/symtab] False match issue in skip_prologue_using_linetable
  2023-04-18  8:32 [Bug symtab/30369] New: [gdb/symtab] False match issue in skip_prologue_using_linetable vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-04-22  5:50 ` cvs-commit at gcc dot gnu.org
@ 2023-04-22  7:33 ` cvs-commit at gcc dot gnu.org
  2023-04-22  7:35 ` vries at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-22  7:33 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30369

--- Comment #5 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The gdb-13-branch branch has been updated by Tom de Vries
<vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3310ec8b5b6a7578c80a9da81c8357fa9205bba3

commit 3310ec8b5b6a7578c80a9da81c8357fa9205bba3
Author: WANG Rui <r@hev.cc>
Date:   Sat Apr 22 09:33:45 2023 +0200

    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

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug symtab/30369] [gdb/symtab] False match issue in skip_prologue_using_linetable
  2023-04-18  8:32 [Bug symtab/30369] New: [gdb/symtab] False match issue in skip_prologue_using_linetable vries at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-04-22  7:33 ` cvs-commit at gcc dot gnu.org
@ 2023-04-22  7:35 ` vries at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2023-04-22  7:35 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30369

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.2
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #6 from Tom de Vries <vries at gcc dot gnu.org> ---
Fixed on master, backported to gdb-13-branch.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-04-22  7:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-18  8:32 [Bug symtab/30369] New: [gdb/symtab] False match issue in skip_prologue_using_linetable vries at gcc dot gnu.org
2023-04-18  8:34 ` [Bug symtab/30369] " vries at gcc dot gnu.org
2023-04-18 10:00 ` vries at gcc dot gnu.org
2023-04-18 12:16 ` vries at gcc dot gnu.org
2023-04-22  5:50 ` cvs-commit at gcc dot gnu.org
2023-04-22  7:33 ` cvs-commit at gcc dot gnu.org
2023-04-22  7:35 ` vries at gcc dot gnu.org

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