public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug breakpoints/27151] Step will skip subsequent statements for malloc functions
Date: Wed, 06 Jan 2021 12:22:03 +0000	[thread overview]
Message-ID: <bug-27151-4717-6OpnazmgHS@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-27151-4717@http.sourceware.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-01-06
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
I managed to reproduce this on ubuntu 20.

Configurations:
- gcc-10, system gdb,
- gcc-10, gdb build from current trunk.

The problem goes away when small.c is build with fcf-protection=none.

I tried to reproduce this on my usual setup, openSUSE Leap 15.2, by forcing
fcf-protection=full.  Didn't reproduce.

Copied Leap executable to ubuntu, and tried using gdb there.  Didn't reproduce.

Then copied ubuntu executable to Leap.  Reproduced.

So, sofar this seems specific to the ubuntu executable.

The two executables have similar line info and insns for main.

There is a difference in the plt.

For leap, we have:
...
00000000000005f0 <malloc@plt>:
 5f0:   ff 25 32 0a 20 00       jmpq   *0x200a32(%rip) \
          # 201028 <malloc@GLIBC_2.2.5>
 5f6:   68 02 00 00 00          pushq  $0x2
 5fb:   e9 c0 ff ff ff          jmpq   5c0 <.plt>
...

For ubuntu, we have:
...
0000000000001090 <malloc@plt>:
    1090:       f3 0f 1e fa             endbr64
    1094:       f2 ff 25 35 2f 00 00    bnd jmpq *0x2f35(%rip) \
                  # 3fd0 <malloc@GLIBC_2.2.5>
    109b:       0f 1f 44 00 00          nopl   0x0(%rax,%rax,1)
...

Using "set debug infrun 1", with leap we have:
...
[infrun] handle_signal_stop: stop_pc=0x5555555545f0
[infrun] process_event_stop_test: stepped into dynsym resolve code
...
where:
...
(gdb) info sym 0x5555555545f0        
malloc@plt in section .plt of /home/vries/gdb_versions/devel/a.leap.out
...

But with ubuntu we have:
...
[infrun] handle_signal_stop: stop_pc=0x555555555090
[infrun] process_event_stop_test: stepped into subroutine
[infrun] insert_step_resume_breakpoint_at_sal_1: inserting step-resume
breakpoint at 0x7ffff7df0710
...
where:
...
(gdb) info sym 0x555555555090
malloc@plt in section .plt.sec of /home/vries/gdb_versions/devel/a.out
...
and:
...
(gdb) info sym 0x7ffff7df0710
malloc in section .text of /lib64/ld-linux-x86-64.so.2
...
Looking for the "stepped into dynsym resolve code" in the gdb sources, we find
in_solib_dynsym_resolve_code, which returns false with the ubuntu exec, and
true with the leap exec.

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

  parent reply	other threads:[~2021-01-06 12:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-05 15:31 [Bug breakpoints/27151] New: " yangyibiao at outlook dot com
2021-01-06  0:57 ` [Bug breakpoints/27151] " yangyibiao at outlook dot com
2021-01-06 12:22 ` vries at gcc dot gnu.org [this message]
2021-01-06 12:22 ` vries at gcc dot gnu.org
2021-01-06 12:25 ` vries at gcc dot gnu.org
2021-01-06 12:28 ` vries at gcc dot gnu.org
2021-01-06 13:44 ` yangyibiao at outlook dot com
2021-01-06 13:53 ` vries at gcc dot gnu.org
2021-01-06 15:37 ` vries at gcc dot gnu.org
2021-01-14  9:35 ` cvs-commit at gcc dot gnu.org
2021-01-14  9:41 ` vries at gcc dot gnu.org

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=bug-27151-4717-6OpnazmgHS@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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).