public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug testsuite/30633] New: [gdb/testsuite, native-gdbserver] FAIL: gdb.dwarf2/typeddwarf.exp: runto: run to main
@ 2023-07-13 13:19 vries at gcc dot gnu.org
  2023-07-13 14:24 ` [Bug testsuite/30633] " vries at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2023-07-13 13:19 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 30633
           Summary: [gdb/testsuite, native-gdbserver] FAIL:
                    gdb.dwarf2/typeddwarf.exp: runto: run to main
           Product: gdb
           Version: unknown
            Status: NEW
          Severity: normal
          Priority: P2
         Component: testsuite
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

On ubuntu 22.04.2 I run into:
...
make check RUNTESTFLAGS="--target_board=native-gdbserver/
gdb.dwarf2/typeddwarf.exp"
   ...
FAIL: gdb.dwarf2/typeddwarf.exp: runto: run to main
...

In more detail:
...
(gdb) continue^M
Continuing.^M
^M
Program received signal SIGSEGV, Segmentation fault.^M
0x0000000000000001 in ?? ()^M
(gdb) FAIL: gdb.dwarf2/typeddwarf.exp: runto: run to main
...

Previously reported here:
https://sourceware.org/pipermail/gdb-patches/2023-July/200591.html .

It's a regression since commit 90cce6c0551 ("[gdb/testsuite] Add nopie in a few
test-cases").

Without nopie we have:
...
$ file outputs/gdb.dwarf2/typeddwarf/typeddwarf
outputs/gdb.dwarf2/typeddwarf/typeddwarf: ELF 64-bit LSB pie executable,
x86-64, version 1 (SYSV), dynamically linked, interpreter
/lib64/ld-linux-x86-64.so.2,
BuildID[sha1]=1f4dde6f634075d45b39826931f143ae350f45ea, with debug_info, not
stripped
...

With nopie we have:
...
outputs/gdb.dwarf2/typeddwarf/typeddwarf: ELF 64-bit LSB executable, x86-64,
version 1 (SYSV), statically linked,
BuildID[sha1]=f99a83c0cb6e5ce8281978bd9e69b05c559fee81, with debug_info, not
stripped
...

Using this information, I can also reproduce the FAIL on openSUSE Leap 15.4, by
adding -static.

We run into the FAIL as follows:
- due to using gdbserver, we attach at the point of the first instruction, in
  _start
- we then set a breakpoint at main
- the test-case is a .s file, that has main renamed to _start in the assembly,
  but not in the debuginfo.
- setting a breakpoint at main sets the breakpoint at the same instruction
  we're currently stopped at (for the amd64 case.  For the i386 case, the
  breakpoint is set one instruction after that).
- continue doesn't hit the breakpoint, and we return out of _start, which
  causes a sigsegv

Without nopie, the executable is not static, and consequently we attach at
_start in the dynamic linker, which means that continue will hit the breakpoint
in main.

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

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

* [Bug testsuite/30633] [gdb/testsuite, native-gdbserver] FAIL: gdb.dwarf2/typeddwarf.exp: runto: run to main
  2023-07-13 13:19 [Bug testsuite/30633] New: [gdb/testsuite, native-gdbserver] FAIL: gdb.dwarf2/typeddwarf.exp: runto: run to main vries at gcc dot gnu.org
@ 2023-07-13 14:24 ` vries at gcc dot gnu.org
  2023-07-26 11:42 ` cvs-commit at gcc dot gnu.org
  2023-07-26 11:44 ` vries at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2023-07-13 14:24 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/pipermail/gdb-patches/2023-July/200867.html

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

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

* [Bug testsuite/30633] [gdb/testsuite, native-gdbserver] FAIL: gdb.dwarf2/typeddwarf.exp: runto: run to main
  2023-07-13 13:19 [Bug testsuite/30633] New: [gdb/testsuite, native-gdbserver] FAIL: gdb.dwarf2/typeddwarf.exp: runto: run to main vries at gcc dot gnu.org
  2023-07-13 14:24 ` [Bug testsuite/30633] " vries at gcc dot gnu.org
@ 2023-07-26 11:42 ` cvs-commit at gcc dot gnu.org
  2023-07-26 11:44 ` vries at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-26 11:42 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 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=bcf43b33cfd3a8415bf272a3ca1af04ec8b9d622

commit bcf43b33cfd3a8415bf272a3ca1af04ec8b9d622
Author: Tom de Vries <tdevries@suse.de>
Date:   Wed Jul 26 13:42:32 2023 +0200

    [gdb/testsuite] Drop -nostdlib in gdb.dwarf2/typeddwarf.exp

    As reported in PR testsuite/30633, when running test-case
    gdb.dwarf2/typeddwarf.exp with target board native-gdbserver on Ubuntu
    22.04.2, we run into:
    ...
    (gdb) continue^M
    Continuing.^M
    ^M
    Program received signal SIGSEGV, Segmentation fault.^M
    0x0000000000000001 in ?? ()^M
    (gdb) FAIL: gdb.dwarf2/typeddwarf.exp: runto: run to main
    ...

    We run into the FAIL as follows:
    - due to using gdbserver, we attach at the point of the first instruction,
in
      _start
    - we then set a breakpoint at main
    - the test-case is a .s file, that has main renamed to _start in the
assembly,
      but not in the debuginfo
    - setting a breakpoint at main sets the breakpoint at the same instruction
      we're currently stopped at
    - continue doesn't hit the breakpoint, and we return out of _start, which
      causes a sigsegv

    Note that this is for the amd64 case (using gdb.dwarf2/typeddwarf-amd64.S).
    For the i386 case (using gdb.dwarf2/typeddwarf.S), setting a breakpoint in
    main sets it one insn after function entry, and consequently the problem
does
    not occur.

    The FAIL is a regression since commit 90cce6c0551 ("[gdb/testsuite] Add
nopie
    in a few test-cases").

    Without nopie the executable is PIE, with nopie it's static instead.

    In the PIE case, we attach at the point of _start in the dynamic linker,
and
    consequently we do not skip the breakpoint in main, and also don't run into
    the FAIL.

    Fix this by:
    - removing the -nostdlib setting, and
    - renaming _start to main in both .S files.

    The change to use -nostdlib and rename main to _start was originally added
    in commit 6edba76fe8b (submitted here:
    https://sourceware.org/pipermail/gdb-patches/2011-May/082657.html ) , I
assume
    to fix the problem now fixed by using nopie.

    Tested on x86_64-linux.

    Reported-By: Simon Marchi <simon.marchi@efficios.com>
    Tested-By: Simon Marchi <simon.marchi@efficios.com>
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30633

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

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

* [Bug testsuite/30633] [gdb/testsuite, native-gdbserver] FAIL: gdb.dwarf2/typeddwarf.exp: runto: run to main
  2023-07-13 13:19 [Bug testsuite/30633] New: [gdb/testsuite, native-gdbserver] FAIL: gdb.dwarf2/typeddwarf.exp: runto: run to main vries at gcc dot gnu.org
  2023-07-13 14:24 ` [Bug testsuite/30633] " vries at gcc dot gnu.org
  2023-07-26 11:42 ` cvs-commit at gcc dot gnu.org
@ 2023-07-26 11:44 ` vries at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2023-07-26 11:44 UTC (permalink / raw)
  To: gdb-prs

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

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

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

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

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

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

end of thread, other threads:[~2023-07-26 11:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-13 13:19 [Bug testsuite/30633] New: [gdb/testsuite, native-gdbserver] FAIL: gdb.dwarf2/typeddwarf.exp: runto: run to main vries at gcc dot gnu.org
2023-07-13 14:24 ` [Bug testsuite/30633] " vries at gcc dot gnu.org
2023-07-26 11:42 ` cvs-commit at gcc dot gnu.org
2023-07-26 11:44 ` 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).