Re: about the print command in gdb.
- From: p_cricket_guy@xxxxxxxxxxx
- Date: 18 Dec 2006 22:57:53 -0800
sunil wrote:
Hi,
I am trying to print a variable port using print command , the
port variable is coming as function arguement.See the snippet below.
680 printf("The port number is %d\n",port);
(gdb) p port
$1 = 0
(gdb) n
The port number is 7710
681 while ((stat=listenerSocketFd.Open( port)) != OK &&
triedCount++ < 6 )
(gdb) p port
$2 = 0
(gdb)
The port number is 7710
Why it is showing different value what the actually the
variable is having.But some times it shows the correct value.
Is there any reason,if anybody knows please help me out.
Debuggers are off-topic here. Please post in a gnu/gdb specific or
your OS specific newsgroups.
<OT>
Just a guess: your compiler might have optimized the code. Try
compiling with optimization turned off and then debug.
You can also look into assembly code (you can do that within gdb)
and see how "port" is handled.
.
- References:
- about the print command in gdb.
- From: sunil
- about the print command in gdb.
- Prev by Date: Re: regarding pointer operation in a printf function call
- Next by Date: Re: memcmp() checker: memory access errors
- Previous by thread: about the print command in gdb.
- Next by thread: size of pointers
- Index(es):
Relevant Pages
|