This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: optind
On Wed, Dec 10, 2003 at 04:20:47PM +0200, Baurjan Ismagulov wrote:
> Hello,
>
> given the following program:
>
> #include <unistd.h>
>
> int main()
> {
> printf("%p\n", &optind);
> }
>
>
> I do:
>
> gcc -g a.c
> ./a.out
> nm a.out |grep optind
>
>
> I see, respectively:
>
> 0x80495ac
> 080495ac B optind@@GLIBC_2.0
>
>
> After that I do:
>
> gdb a.out
> b main
> r
> p &optind
>
>
> I see:
>
> $1 = (int *) 0x4014814c,
>
> whereas I expect it to be 080495ac. Naturally, "p optind" displays
> another value, too. What is going on?
The symbol exists in multiple shared objects, and gdb gets confused
about which copy to print. We can't get this right all the time, but I
would have thought we'd get this one right; might want to file a bug
report.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer