public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/30103] New: GDB gets confused about what is the current source file for various actions
@ 2023-02-09 16:31 luis.machado at arm dot com
  2023-02-09 16:32 ` [Bug gdb/30103] " luis.machado at arm dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: luis.machado at arm dot com @ 2023-02-09 16:31 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 30103
           Summary: GDB gets confused about what is the current source
                    file for various actions
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: luis.machado at arm dot com
                CC: vries at gcc dot gnu.org
  Target Milestone: ---
              Host: aarch64-linux
            Target: aarch64-linux
             Build: aarch64-linux

As described in here, gdb seems to get confused about what is the current
source file to use for commands like break / list / info source.

In particular, there seems to be a manifestation of this confusion when the
source file is the same and doesn't have any directory components to it.

Attached is an example of how the test fails on aarch64-linux Ubuntu 22.04. It
doesn't fail for aarch64-linux Ubuntu 20.04 though.

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

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

* [Bug gdb/30103] GDB gets confused about what is the current source file for various actions
  2023-02-09 16:31 [Bug gdb/30103] New: GDB gets confused about what is the current source file for various actions luis.machado at arm dot com
@ 2023-02-09 16:32 ` luis.machado at arm dot com
  2023-02-10 11:07 ` [Bug testsuite/30103] " vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: luis.machado at arm dot com @ 2023-02-09 16:32 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Luis Machado <luis.machado at arm dot com> ---
Created attachment 14667
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14667&action=edit
gdb.log on aarch64-linux Ubuntu 22.04.

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

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

* [Bug testsuite/30103] GDB gets confused about what is the current source file for various actions
  2023-02-09 16:31 [Bug gdb/30103] New: GDB gets confused about what is the current source file for various actions luis.machado at arm dot com
  2023-02-09 16:32 ` [Bug gdb/30103] " luis.machado at arm dot com
@ 2023-02-10 11:07 ` vries at gcc dot gnu.org
  2023-02-10 14:58 ` cvs-commit at gcc dot gnu.org
  2023-02-10 14:59 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2023-02-10 11:07 UTC (permalink / raw)
  To: gdb-prs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|gdb                         |testsuite

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
I don't think this is a gdb problem, but a testsuite problem.

I think the fact that the test-case source file is called longjmp.c, and that
due to a KFAIL we're stopping in __libc_siglongjmp, which is in a glibc file
also called longjmp.c is an unfortunate red herring.

In other words, I think we would see the same problem if __libc_siglongjmp was
located in bla.c (or, conversely we'd rename the test-case source file).

Setting component to testsuite.

Subbmitted patch:
https://sourceware.org/pipermail/gdb-patches/2023-February/196807.html.

Btw, as mentioned in the patch, I also managed to reproduce on x86_64/-m32.

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

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

* [Bug testsuite/30103] GDB gets confused about what is the current source file for various actions
  2023-02-09 16:31 [Bug gdb/30103] New: GDB gets confused about what is the current source file for various actions luis.machado at arm dot com
  2023-02-09 16:32 ` [Bug gdb/30103] " luis.machado at arm dot com
  2023-02-10 11:07 ` [Bug testsuite/30103] " vries at gcc dot gnu.org
@ 2023-02-10 14:58 ` cvs-commit at gcc dot gnu.org
  2023-02-10 14:59 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-02-10 14:58 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 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=632652850db23bfec2499febe03c9ac4aa0b8dce

commit 632652850db23bfec2499febe03c9ac4aa0b8dce
Author: Tom de Vries <tdevries@suse.de>
Date:   Fri Feb 10 15:58:00 2023 +0100

    [gdb/testsuite] Fix linespec ambiguity in gdb.base/longjmp.exp

    PR testsuite/30103 reports the following failure on aarch64-linux
    (ubuntu 22.04):
    ...
    (gdb) PASS: gdb.base/longjmp.exp: with_probes=0: pattern 1: next to longjmp
    next
    warning: Breakpoint address adjusted from 0x83dc305fef755015 to \
      0xffdc305fef755015.
    Warning:
    Cannot insert breakpoint 0.
    Cannot access memory at address 0xffdc305fef755015

    __libc_siglongjmp (env=0xaaaaaaab1018 <env>, val=1) at
./setjmp/longjmp.c:30
    30      }
    (gdb) KFAIL: gdb.base/longjmp.exp: with_probes=0: pattern 1: gdb/26967 \
      (PRMS: next over longjmp)
    delete breakpoints
    Delete all breakpoints? (y or n) y
    (gdb) info breakpoints
    No breakpoints or watchpoints.
    (gdb) break 63
    No line 63 in the current file.
    Make breakpoint pending on future shared library load? (y or [n]) n
    (gdb) FAIL: gdb.base/longjmp.exp: with_probes=0: pattern 2: setup:
breakpoint \
      at pattern start (got interactive prompt)
    ...

    The test-case intends to set the breakpoint on line number 63 in
    gdb.base/longjmp.c.

    It tries to do so by specifying "break 63", which specifies a line in the
    "current source file".

    Due to the KFAIL PR, gdb stopped in __libc_siglongjmp, and because of
presence
    of debug info, the "current source file" becomes glibc's
./setjmp/longjmp.c.

    Consequently, setting the breakpoint fails.

    Fix this by adding a $subdir/$srcfile: prefix to the breakpoint linespecs.

    I've managed to reproduce the FAIL on x86_64/-m32, by installing the
    glibc-32bit-debuginfo package.  This allowed me to confirm the "current
source
    file" that is used:
    ...
    (gdb) KFAIL: gdb.base/longjmp.exp: with_probes=0: pattern 1: gdb/26967 \
      (PRMS: next over longjmp)
    info source^M
    Current source file is ../setjmp/longjmp.c^M
    ...

    Tested on x86_64-linux, target boards unix/{-m64,-m32}.

    Reported-By: Luis Machado <luis.machado@arm.com>
    Reviewed-By: Tom Tromey <tom@tromey.com>

    PR testsuite/30103
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30103

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

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

* [Bug testsuite/30103] GDB gets confused about what is the current source file for various actions
  2023-02-09 16:31 [Bug gdb/30103] New: GDB gets confused about what is the current source file for various actions luis.machado at arm dot com
                   ` (2 preceding siblings ...)
  2023-02-10 14:58 ` cvs-commit at gcc dot gnu.org
@ 2023-02-10 14:59 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2023-02-10 14:59 UTC (permalink / raw)
  To: gdb-prs

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

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

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

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
Fixed by commit.

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

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

end of thread, other threads:[~2023-02-10 14:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-09 16:31 [Bug gdb/30103] New: GDB gets confused about what is the current source file for various actions luis.machado at arm dot com
2023-02-09 16:32 ` [Bug gdb/30103] " luis.machado at arm dot com
2023-02-10 11:07 ` [Bug testsuite/30103] " vries at gcc dot gnu.org
2023-02-10 14:58 ` cvs-commit at gcc dot gnu.org
2023-02-10 14:59 ` 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).