Hi,

I'm running gdb 5.3 under Red Hat 7.2 (up2date'd) on
php5 CGI with the "broken" RH 2.96-112.7.2 gcc.

However, when I try to print variables within gdb, gdb
tries to print variables using the wrong addresses in
VM (off by a some hundreds of bytes).  I can add code
to the source code such that I know things are
working, but gdb just gives me garbage back when I use
the "print" or "display" commands, since its reading
values from the wrong addresses.  It shows the right
source code, and appears to step through the correct
lines of code based on the input.

Any idea what I've done wrong?  I'm compiling php5
with --enable-debug, and CFLAGS -g (no -O), but gdb is
clearly messed up in figuring out where the symbols
are in the stack, even when I set a breakpoint at
main().

Example output showing that program works, and gdb
doesn't (added near the top of cgi_main.c):

gdb /usr/local/php/bin/php
.
.
951     printf(" argv[0]=%s \n argv[1]=%s \n &argv=%lx
\n *argv=%s\n", argv[0], argv[1], &argv, *argv);
(gdb)
 argv[0]=/usr/local/php/bin/php
 argv[1]=-b
 &argv=bffff5b4             <=====program output shows
real location
 *argv=/usr/local/php/bin/php
(gdb) print argv
$6 = (char **) 0x0
(gdb) print (&argv)
$1 = (char ***) 0xbffff7c0  <=====gdb should say
"0xbffff5b4"!
(gdb) print (*(char***) 0xbffff5b4)
$3 = (char **) 0xbffff614
(gdb) print (*(char**) 0xbffff614)
$5 = 0xbffffc1e "/usr/local/php/bin/php"
                 ^^^^^^^^^^^^^^^^^^^^^^
                 So, I can show that argv is ok ..
                 just not where gdb thinks it is.

Nothing unexpected in the process "maps" file showing
that argv, argc is in the usual segment:
bfffd000-c0000000 rwxp ffffe000 00:00 0

Thanks,
Henry

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to