public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/8588] symbols present in multiple files are displayed wrongly
       [not found] <bug-8588-4717@http.sourceware.org/bugzilla/>
@ 2013-01-27  0:30 ` naesten at gmail dot com
  2013-01-28  3:26 ` naesten at gmail dot com
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 14+ messages in thread
From: naesten at gmail dot com @ 2013-01-27  0:30 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=8588

Samuel Bronson <naesten at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |naesten at gmail dot com
           See Also|                            |http://bugs.debian.org/5360
                   |                            |24

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug gdb/8588] symbols present in multiple files are displayed wrongly
       [not found] <bug-8588-4717@http.sourceware.org/bugzilla/>
  2013-01-27  0:30 ` [Bug gdb/8588] symbols present in multiple files are displayed wrongly naesten at gmail dot com
@ 2013-01-28  3:26 ` naesten at gmail dot com
  2013-01-29 23:56 ` naesten at gmail dot com
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 14+ messages in thread
From: naesten at gmail dot com @ 2013-01-28  3:26 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=8588

--- Comment #1 from Samuel Bronson <naesten at gmail dot com> 2013-01-28 03:26:29 UTC ---
Is it just me, or has this been fixed?  (I'm using "GNU gdb (GDB)
7.4.1-debian".)

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug gdb/8588] symbols present in multiple files are displayed wrongly
       [not found] <bug-8588-4717@http.sourceware.org/bugzilla/>
  2013-01-27  0:30 ` [Bug gdb/8588] symbols present in multiple files are displayed wrongly naesten at gmail dot com
  2013-01-28  3:26 ` naesten at gmail dot com
@ 2013-01-29 23:56 ` naesten at gmail dot com
  2013-01-30  9:08 ` john at calva dot com
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 14+ messages in thread
From: naesten at gmail dot com @ 2013-01-29 23:56 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=8588

Samuel Bronson <naesten at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #2 from Samuel Bronson <naesten at gmail dot com> 2013-01-29 23:56:07 UTC ---
I'm pretty sure it has...

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug gdb/8588] symbols present in multiple files are displayed wrongly
       [not found] <bug-8588-4717@http.sourceware.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2013-01-29 23:56 ` naesten at gmail dot com
@ 2013-01-30  9:08 ` john at calva dot com
  2013-02-01 21:56 ` naesten at gmail dot com
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 14+ messages in thread
From: john at calva dot com @ 2013-01-30  9:08 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=8588

John Hughes <john at calva dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |john at calva dot com
         Resolution|FIXED                       |

--- Comment #3 from John Hughes <john at calva dot com> 2013-01-30 09:08:26 UTC ---
(In reply to comment #2)
> I'm pretty sure it has...

I'm pretty sure it hasn't.

john@celtic:~$ cat a.c
#include <unistd.h>

int main()
{
    printf("%p\n", &optind);
}
john@celtic:~$ gcc -g a.c
a.c: In function ‘main’:
a.c:5:2: warning: incompatible implicit declaration of built-in function
‘printf’ [enabled by default]
john@celtic:~$ gdb a.out 
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 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-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/john/a.out...done.
(gdb) b main
Breakpoint 1 at 0x400550: file a.c, line 5.
(gdb) r
Starting program: /home/john/a.out 

Breakpoint 1, main () at a.c:5
5        printf("%p\n", &optind);
(gdb) p &optind
$1 = (int *) 0x7ffff7dd7130
(gdb) c
Continuing.
0x600930
[Inferior 1 (process 25283) exited with code 011]
(gdb) q
john@celtic:~$ nm a.out | grep optind
0000000000600930 B optind@@GLIBC_2.2.5

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug gdb/8588] symbols present in multiple files are displayed wrongly
       [not found] <bug-8588-4717@http.sourceware.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2013-01-30  9:08 ` john at calva dot com
@ 2013-02-01 21:56 ` naesten at gmail dot com
  2013-02-01 22:56 ` naesten at gmail dot com
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 14+ messages in thread
From: naesten at gmail dot com @ 2013-02-01 21:56 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=8588

--- Comment #4 from Samuel Bronson <naesten at gmail dot com> 2013-02-01 21:56:51 UTC ---
Strange. This is what I get:

naesten@hydrogen:~/hacking/bugs% cat a.c
#include <unistd.h>

int main()
{
        printf("%p\n", &optind);
}
naesten@hydrogen:~/hacking/bugs% gcc -g a.c
a.c: In function ‘main’:
a.c:5:2: warning: incompatible implicit declaration of built-in function
‘printf’ [enabled by default]
naesten@hydrogen:~/hacking/bugs% gcc --version
gcc (Debian 4.7.2-5) 4.7.2
Copyright (C) 2012 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.

naesten@hydrogen:~/hacking/bugs% ./a.out
0x8049740
naesten@hydrogen:~/hacking/bugs% nm a.out | grep optind
08049740 B optind
naesten@hydrogen:~/hacking/bugs% nm --dynamic a.out | grep optind
08049740 B optind
naesten@hydrogen:~/hacking/bugs% cat a.c
#include <unistd.h>

int main()
{
        printf("%p\n", &optind);
}
naesten@hydrogen:~/hacking/bugs% gcc --version
gcc (Debian 4.7.2-5) 4.7.2
Copyright (C) 2012 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.

naesten@hydrogen:~/hacking/bugs% ./a.out
0x8049740
naesten@hydrogen:~/hacking/bugs% nm a.out |grep optind
08049740 B optind
naesten@hydrogen:~/hacking/bugs% gdb a.out
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 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 "i486-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/naesten/hacking/bugs/a.out...done.
(gdb) b main
Breakpoint 1 at 0x80484d5: file a.c, line 5.
(gdb) r
Starting program: /home/naesten/hacking/bugs/a.out

Breakpoint 1, main () at a.c:5
5               printf("%p\n", &optind);
(gdb) p &optind
$1 = (int *) 0x8049740
(gdb) info variables optind
All variables matching regular expression "optind":

File getopt.c:
int optind;
(gdb)


This leaves me wondering: Is this really architecture-dependent, or is it just
due to chance (different addresses, hash collisions, etc.) that it works for me
and not for you?

My questions for you are:

1. What version of libc6-dev do you have installed?

2. What do you get for "info variables optind"?

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug gdb/8588] symbols present in multiple files are displayed wrongly
       [not found] <bug-8588-4717@http.sourceware.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2013-02-01 21:56 ` naesten at gmail dot com
@ 2013-02-01 22:56 ` naesten at gmail dot com
  2013-02-02 11:27 ` john at calva dot com
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 14+ messages in thread
From: naesten at gmail dot com @ 2013-02-01 22:56 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=8588

Samuel Bronson <naesten at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86_64-linux-gnu
               Host|                            |x86_64-linux-gnu
            Version|6.0                         |7.4

--- Comment #5 from Samuel Bronson <naesten at gmail dot com> 2013-02-01 22:56:25 UTC ---
<http://bugs.debian.org/58322> reported the same problem in what Debian called
gdb/4.18.19990928-1.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug gdb/8588] symbols present in multiple files are displayed wrongly
       [not found] <bug-8588-4717@http.sourceware.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2013-02-01 22:56 ` naesten at gmail dot com
@ 2013-02-02 11:27 ` john at calva dot com
  2013-02-04 17:43 ` tromey at redhat dot com
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 14+ messages in thread
From: john at calva dot com @ 2013-02-02 11:27 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=8588

--- Comment #6 from John Hughes <john at calva dot com> 2013-02-02 11:27:47 UTC ---
On 02/01/2013 10:56 PM, naesten at gmail dot com wrote:
> This leaves me wondering: Is this really architecture-dependent, or is it just
> due to chance (different addresses, hash collisions, etc.) that it works for me
> and not for you?

I guess you're on x86?  My machines are amd64

>
> My questions for you are:
>
> 1. What version of libc6-dev do you have installed?

ii  gcc            4:4.7.2-1    amd64        GNU C compiler
ii  gdb            7.4.1-3      amd64        The GNU Debugger
ii  libc6-dev:amd6 2.13-38      amd64        Embedded GNU C Library: Developme

>
> 2. What do you get for "info variables optind"?
>
Not at all the same as you:

    (gdb) info variables optind
    All variables matching regular expression "optind":

    Non-debugging symbols:
    0x0000000000600930  optind@@GLIBC_2.2.5

Interesting - "non-debugging symbols"?   Maybe I should install libc6-dbg?

Well, with libc6-dbg I get different output from info variables:

    All variables matching regular expression "optind":

    File getopt.c:
    int optind;

    Non-debugging symbols:
    0x0000000000600930  optind@@GLIBC_2.2.5

But "p" still doesn't show the version I want:

    (gdb) p &optind
    $1 = (int *) 0x7ffff7dd7130

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug gdb/8588] symbols present in multiple files are displayed wrongly
       [not found] <bug-8588-4717@http.sourceware.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2013-02-02 11:27 ` john at calva dot com
@ 2013-02-04 17:43 ` tromey at redhat dot com
  2013-02-04 20:15 ` naesten at gmail dot com
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 14+ messages in thread
From: tromey at redhat dot com @ 2013-02-04 17:43 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=8588

Tom Tromey <tromey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at redhat dot com

--- Comment #7 from Tom Tromey <tromey at redhat dot com> 2013-02-04 17:43:00 UTC ---
See also PR 13800, which has some analysis.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug gdb/8588] symbols present in multiple files are displayed wrongly
       [not found] <bug-8588-4717@http.sourceware.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2013-02-04 17:43 ` tromey at redhat dot com
@ 2013-02-04 20:15 ` naesten at gmail dot com
  2013-02-04 20:18 ` naesten at gmail dot com
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 14+ messages in thread
From: naesten at gmail dot com @ 2013-02-04 20:15 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=8588

--- Comment #8 from Samuel Bronson <naesten at gmail dot com> 2013-02-04 20:15:32 UTC ---
Note this diagnosis by Daniel Jacobowitz and Andeas Schwab
<http://www.sourceware.org/ml/gdb/2003-12/msg00163.html>:

Baurjan Ismagulov <ibr@ata.cs.hun.edu.tr> writes:

> Hello, Daniel!
>
> That was fast 8) , thanks much!
>
> On Wed, Dec 10, 2003 at 09:49:18AM -0500, Daniel Jacobowitz wrote:
>> The symbol exists in multiple shared objects...
>
> Do you mean weak symbols within libc, or multiple definitions in other
> libraries? ldd shows libc.so.6 and ld-linux.so.2, and nm -D shows that
> optind exists only in libc.

It also exists in the executable, due to a COPY relocation.

Andreas.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug gdb/8588] symbols present in multiple files are displayed wrongly
       [not found] <bug-8588-4717@http.sourceware.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2013-02-04 20:15 ` naesten at gmail dot com
@ 2013-02-04 20:18 ` naesten at gmail dot com
  2013-02-04 20:18 ` naesten at gmail dot com
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 14+ messages in thread
From: naesten at gmail dot com @ 2013-02-04 20:18 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=8588

Samuel Bronson <naesten at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |spuebla at hotmail dot com

--- Comment #10 from Samuel Bronson <naesten at gmail dot com> 2013-02-04 20:18:47 UTC ---
*** Bug 13800 has been marked as a duplicate of this bug. ***

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug gdb/8588] symbols present in multiple files are displayed wrongly
       [not found] <bug-8588-4717@http.sourceware.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2013-02-04 20:18 ` naesten at gmail dot com
@ 2013-02-04 20:18 ` naesten at gmail dot com
  2013-09-16 15:40 ` tromey at redhat dot com
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 14+ messages in thread
From: naesten at gmail dot com @ 2013-02-04 20:18 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=8588

--- Comment #9 from Samuel Bronson <naesten at gmail dot com> 2013-02-04 20:18:26 UTC ---
Note also these possible approaches by Ian Lance Taylor
<http://www.sourceware.org/ml/gdb/2003-12/msg00165.html>:

Baurjan Ismagulov <ibr@ata.cs.hun.edu.tr> writes:

> On Wed, Dec 10, 2003 at 05:12:56PM +0100, Andreas Schwab wrote:
> > It also exists in the executable, due to a COPY relocation.
> 
> Thanks much, I see it now!
> 
> And how should gdb know which one to use?

gdb should always use the one in the executable.  That is the one the
code in the shared library will also be using, because that is the
address will be in the GOT.

In principle, while debugging shared library code, gdb could observe
that there is a GOT relocation for optind, and look at the GOT table
in memory to decide which address to use.

Alternatively, gdb could guess that if there is a global variable in
the executable, that any reference to that global variable in the
shared library will refer to the one in the executable.  This will
normally be true, but will fail in cases where the library is
controlling visibility in any of various different ways.

In practice I have no idea what gdb actually does.

Ian

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug gdb/8588] symbols present in multiple files are displayed wrongly
       [not found] <bug-8588-4717@http.sourceware.org/bugzilla/>
                   ` (10 preceding siblings ...)
  2013-02-04 20:18 ` naesten at gmail dot com
@ 2013-09-16 15:40 ` tromey at redhat dot com
  2014-11-06 18:41 ` pguttmann at bloomberg dot net
  2021-10-18 17:39 ` peter.weber at flapflap dot eu
  13 siblings, 0 replies; 14+ messages in thread
From: tromey at redhat dot com @ 2013-09-16 15:40 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bhuvibhuvanesh at gmail dot com

--- Comment #11 from Tom Tromey <tromey at redhat dot com> ---
*** Bug 15955 has been marked as a duplicate of this bug. ***

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


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

* [Bug gdb/8588] symbols present in multiple files are displayed wrongly
       [not found] <bug-8588-4717@http.sourceware.org/bugzilla/>
                   ` (11 preceding siblings ...)
  2013-09-16 15:40 ` tromey at redhat dot com
@ 2014-11-06 18:41 ` pguttmann at bloomberg dot net
  2021-10-18 17:39 ` peter.weber at flapflap dot eu
  13 siblings, 0 replies; 14+ messages in thread
From: pguttmann at bloomberg dot net @ 2014-11-06 18:41 UTC (permalink / raw)
  To: gdb-prs

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

Paul Guttmann <pguttmann at bloomberg dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pguttmann at bloomberg dot net

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


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

* [Bug gdb/8588] symbols present in multiple files are displayed wrongly
       [not found] <bug-8588-4717@http.sourceware.org/bugzilla/>
                   ` (12 preceding siblings ...)
  2014-11-06 18:41 ` pguttmann at bloomberg dot net
@ 2021-10-18 17:39 ` peter.weber at flapflap dot eu
  13 siblings, 0 replies; 14+ messages in thread
From: peter.weber at flapflap dot eu @ 2021-10-18 17:39 UTC (permalink / raw)
  To: gdb-prs

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

Peter <peter.weber at flapflap dot eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |peter.weber at flapflap dot eu

--- Comment #14 from Peter <peter.weber at flapflap dot eu> ---
*** Bug 28428 has been marked as a duplicate of this bug. ***

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

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

end of thread, other threads:[~2021-10-18 17:39 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-8588-4717@http.sourceware.org/bugzilla/>
2013-01-27  0:30 ` [Bug gdb/8588] symbols present in multiple files are displayed wrongly naesten at gmail dot com
2013-01-28  3:26 ` naesten at gmail dot com
2013-01-29 23:56 ` naesten at gmail dot com
2013-01-30  9:08 ` john at calva dot com
2013-02-01 21:56 ` naesten at gmail dot com
2013-02-01 22:56 ` naesten at gmail dot com
2013-02-02 11:27 ` john at calva dot com
2013-02-04 17:43 ` tromey at redhat dot com
2013-02-04 20:15 ` naesten at gmail dot com
2013-02-04 20:18 ` naesten at gmail dot com
2013-02-04 20:18 ` naesten at gmail dot com
2013-09-16 15:40 ` tromey at redhat dot com
2014-11-06 18:41 ` pguttmann at bloomberg dot net
2021-10-18 17:39 ` peter.weber at flapflap dot eu

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