public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/27036] New: An address is mapping to more than one source line of code
@ 2020-12-09  1:05 yangyibiao at outlook dot com
  2020-12-27  6:02 ` [Bug symtab/27036] " yangyibiao at outlook dot com
  0 siblings, 1 reply; 2+ messages in thread
From: yangyibiao at outlook dot com @ 2020-12-09  1:05 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 27036
           Summary: An address is mapping to more than one source line of
                    code
           Product: gdb
           Version: 10.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: symtab
          Assignee: unassigned at sourceware dot org
          Reporter: yangyibiao at outlook dot com
  Target Milestone: ---

Created attachment 13027
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13027&action=edit
the binary

$ gcc -O1 -g small.c

$ gdb a.out
(gdb) b main
Breakpoint 1 at 0x68e: file small.c, line 13.
(gdb) r
Starting program: /root/DeVIL/a.out

Breakpoint 1, main (argc=1, argv=0x7fffffffe588) at small.c:13
13      {
(gdb) s
18        pa = &a;
(gdb) s
19        pb = &b;
(gdb) s
20        pc = &c;
(gdb) s
22        access (pb);
(gdb) where -frame-info location-and-address
#0  0x00005555555546c6 in main (argc=1, argv=0x7fffffffe588) at small.c:22
(gdb) s
access (ptr=0x7fffffffe496 "") at small.c:9
9         *ptr = 'x';
(gdb) where -frame-info location-and-address
#0  0x00005555555546c6 in access (ptr=0x7fffffffe496 "") at small.c:9
#1  0x00005555555546c6 in main (argc=1, argv=0x7fffffffe588) at small.c:22


############################################################
We can found that 0x00005555555546c6 not only belongs to source line
"small.c:22" but also belongs to "small.c:9"
If compiling small.c without optimization, there is no such problem. 
############################################################


$ cat small.c
/* { dg-do run } */

char *pa;
char *pb;
char *pc;

void access (volatile char *ptr)
{
  *ptr = 'x';
}

int main (int argc, char **argv)
{
  char a;
  char b;
  char c;

  pa = &a;
  pb = &b;
  pc = &c;

  access (pb);
  access (pc);
  // access 'b' here
  access (pa + 32);

  return 0;
}


$ gcc --version; gdb --version
gcc-10 (Ubuntu 10.1.0-2ubuntu1~18.04) 10.1.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

GNU gdb (GDB) 10.1
Copyright (C) 2020 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.

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

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

* [Bug symtab/27036] An address is mapping to more than one source line of code
  2020-12-09  1:05 [Bug symtab/27036] New: An address is mapping to more than one source line of code yangyibiao at outlook dot com
@ 2020-12-27  6:02 ` yangyibiao at outlook dot com
  0 siblings, 0 replies; 2+ messages in thread
From: yangyibiao at outlook dot com @ 2020-12-27  6:02 UTC (permalink / raw)
  To: gdb-prs

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

Yibiao Yang <yangyibiao at outlook dot com> changed:

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

--- Comment #1 from Yibiao Yang <yangyibiao at outlook dot com> ---
Sorry. Invalid bug report.

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

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

end of thread, other threads:[~2020-12-27  6:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-09  1:05 [Bug symtab/27036] New: An address is mapping to more than one source line of code yangyibiao at outlook dot com
2020-12-27  6:02 ` [Bug symtab/27036] " yangyibiao at outlook dot com

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