This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gdb/8588] symbols present in multiple files are displayedwrongly


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]