public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "yangyibiao at nju dot edu.cn" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug backtrace/29775] New: An valid address cannot be reached in instruction-level stepping
Date: Fri, 11 Nov 2022 06:52:34 +0000	[thread overview]
Message-ID: <bug-29775-4717@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 29775
           Summary: An valid address cannot be reached in
                    instruction-level stepping
           Product: gdb
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: backtrace
          Assignee: unassigned at sourceware dot org
          Reporter: yangyibiao at nju dot edu.cn
  Target Milestone: ---

$ cat small.c
/* { dg-do run }  */
/* { dg-require-ifunc "" } */
/* { dg-options "" } */

static int implementation (void)
{
  __builtin_printf ("'ere I am JH\n");
  return 0;
}

static __typeof__ (implementation)* resolver (void)
{
  return implementation;
}

extern int magic (void) __attribute__ ((ifunc ("resolver")));

int main ()
{
  return magic () != 0;
}


$ gcc -O0 -g small.c; gdb a.out
GNU gdb (GDB) 13.0.50.20221107-git
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from a.out...
(gdb) b main
Breakpoint 1 at 0x40115a: file small.c, line 20.
(gdb) r
Starting program: /root/DeVIL/a.out

Breakpoint 1, main () at small.c:20
20        return magic () != 0;
(gdb) si
0x0000000000401030 in *ABS*+0x40114b@plt ()
(gdb)
implementation () at small.c:6
6       {
(gdb)
0x0000000000401137      6       {
(gdb)
7         __builtin_printf ("'ere I am JH\n");
(gdb)
0x000000000040113f      7         __builtin_printf ("'ere I am JH\n");
(gdb)



$ gdb a.out
GNU gdb (GDB) 13.0.50.20221107-git
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from a.out...
(gdb) b main
Breakpoint 1 at 0x40115a: file small.c, line 20.
(gdb) r
Starting program: /root/DeVIL/a.out

Breakpoint 1, main () at small.c:20
20        return magic () != 0;
(gdb) bt -frame-info location-and-address
#0  0x000000000040115a in main () at small.c:20
(gdb) s
implementation () at small.c:7
7         __builtin_printf ("'ere I am JH\n");
(gdb) bt -frame-info location-and-address
#0  0x000000000040113a in implementation ()
    at small.c:7
#1  0x000000000040115f in main () at small.c:20
(gdb)


(gdb) maint info line-table
objfile: /root/DeVIL/a.out ((struct objfile *) 0x2d42120)
compunit_symtab: small.c ((struct compunit_symtab *) 0x2d385b0)
symtab: /root/DeVIL/small.c ((struct symtab *) 0x2d38630)
linetable: ((struct linetable *) 0x2d92ae0):
INDEX  LINE   ADDRESS            IS-STMT PROLOGUE-END
0      6      0x0000000000401136 Y
1      7      0x000000000040113a Y
2      8      0x0000000000401144 Y
3      9      0x0000000000401149 Y
4      12     0x000000000040114b Y
5      13     0x000000000040114f Y
6      14     0x0000000000401154 Y
7      19     0x0000000000401156 Y
8      20     0x000000000040115a Y
9      21     0x0000000000401167 Y
10     END    0x0000000000401169 Y

(gdb)

We can found that is a valid address, when stepping this program at source
level, the address 0x000000000040113a can be reached.

However, when stepping at instruction level, the address cannot be reached.

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

             reply	other threads:[~2022-11-11  6:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-11  6:52 yangyibiao at nju dot edu.cn [this message]
2022-11-11  6:52 ` [Bug backtrace/29775] " yangyibiao at nju dot edu.cn
2022-11-11  7:22 ` yangyibiao at nju dot edu.cn
2022-11-11  7:57 ` vries at gcc dot gnu.org
2022-11-11  8:09 ` yangyibiao at nju dot edu.cn

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-29775-4717@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).