public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug backtrace/29775] New: An valid address cannot be reached in instruction-level stepping
@ 2022-11-11  6:52 yangyibiao at nju dot edu.cn
  2022-11-11  6:52 ` [Bug backtrace/29775] " yangyibiao at nju dot edu.cn
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: yangyibiao at nju dot edu.cn @ 2022-11-11  6:52 UTC (permalink / raw)
  To: gdb-prs

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.

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

* [Bug backtrace/29775] An valid address cannot be reached in instruction-level stepping
  2022-11-11  6:52 [Bug backtrace/29775] New: An valid address cannot be reached in instruction-level stepping yangyibiao at nju dot edu.cn
@ 2022-11-11  6:52 ` yangyibiao at nju dot edu.cn
  2022-11-11  7:22 ` yangyibiao at nju dot edu.cn
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: yangyibiao at nju dot edu.cn @ 2022-11-11  6:52 UTC (permalink / raw)
  To: gdb-prs

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

Yibiao Yang <yangyibiao at nju dot edu.cn> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vries at gcc dot gnu.org

-- 
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 backtrace/29775] An valid address cannot be reached in instruction-level stepping
  2022-11-11  6:52 [Bug backtrace/29775] New: An valid address cannot be reached in instruction-level stepping yangyibiao at nju dot edu.cn
  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
  3 siblings, 0 replies; 5+ messages in thread
From: yangyibiao at nju dot edu.cn @ 2022-11-11  7:22 UTC (permalink / raw)
  To: gdb-prs

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

Yibiao Yang <yangyibiao at nju dot edu.cn> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org,
                   |                            |yangyibiao at nju dot edu.cn

-- 
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 backtrace/29775] An valid address cannot be reached in instruction-level stepping
  2022-11-11  6:52 [Bug backtrace/29775] New: An valid address cannot be reached in instruction-level stepping yangyibiao at nju dot edu.cn
  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
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2022-11-11  7:57 UTC (permalink / raw)
  To: gdb-prs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Yibiao Yang from comment #0)
> (gdb)
> 7         __builtin_printf ("'ere I am JH\n");

This is where the address you mention ( 0x000000000040113a ) is reached.

Because the address is at a line entry, the address is not printed.

Do "print /x $pc" here and you'll find the address.

Try for instance the setting:
...
(gdb) set print frame-info location-and-address
...
that forces the address to be printed also at line entries, that'll make it
easier to keep track at which address you're at (
https://sourceware.org/gdb/onlinedocs/gdb/Print-Settings.html ).

-- 
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 backtrace/29775] An valid address cannot be reached in instruction-level stepping
  2022-11-11  6:52 [Bug backtrace/29775] New: An valid address cannot be reached in instruction-level stepping yangyibiao at nju dot edu.cn
                   ` (2 preceding siblings ...)
  2022-11-11  7:57 ` vries at gcc dot gnu.org
@ 2022-11-11  8:09 ` yangyibiao at nju dot edu.cn
  3 siblings, 0 replies; 5+ messages in thread
From: yangyibiao at nju dot edu.cn @ 2022-11-11  8:09 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Yibiao Yang <yangyibiao at nju dot edu.cn> ---
(In reply to Tom de Vries from comment #1)
> (In reply to Yibiao Yang from comment #0)
> > (gdb)
> > 7         __builtin_printf ("'ere I am JH\n");
> 
> This is where the address you mention ( 0x000000000040113a ) is reached.
> 
> Because the address is at a line entry, the address is not printed.
> 
> Do "print /x $pc" here and you'll find the address.
> 
> Try for instance the setting:
> ...
> (gdb) set print frame-info location-and-address
> ...
> that forces the address to be printed also at line entries, that'll make it
> easier to keep track at which address you're at (
> https://sourceware.org/gdb/onlinedocs/gdb/Print-Settings.html ).

Got it, thank you very much.

-- 
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:[~2022-11-11  8:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-11  6:52 [Bug backtrace/29775] New: An valid address cannot be reached in instruction-level stepping yangyibiao at nju dot edu.cn
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

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