Re: X-Code strangeness...
Re: X-Code strangeness...
- Subject: Re: X-Code strangeness...
- From: Chris Espinosa <email@hidden>
- Date: Mon, 21 Nov 2005 23:53:16 -0800
On Nov 21, 2005, at 11:41 PM, John Draper wrote:
I have a C++ Method like so...
infoServer::SetServerInfo(SipBridge *theBridge, ushort port1, ushort
port2, char *srv1_IP, char *srv2_IP)
{
short tport;
in_addr_t saddr;
ushort serverPort; // Info Server port
char *serverIP; // Info Server IP pointer
int rc;
struct hostent *h;
int i; // loop index
< my code here >
}
Using the source level debugger, I step into this method... but the
source level
debugger only shows 4 local variables or structures... when as you see
above
I declare 7 of them, and yet the source debugger only shows 4, why?
Locals:
tport = 5060
serverPort = 5060
rc = 16909060
h = 6544e80
Where is "i", "serverIP", and "saddr", are not snowing up in the
variable list in the source debugger when I'm inside this method.
Ok, so In "gdb" I also test this... and get:
(gdb) x h <--- I examine "h"
0x6544e80: 0x003bc23c <--- looks good
(gdb) x rc <---- I examine "rc"
0x6545700: 0x00000000 <--- Also looks good
But, when I look at "i"
(gdb) x i
No symbol "i" in current context. <---- Look at this!!! WTF? I
declare i as
a local var and yet it's not showing up.
And as expected:
(gdb) x saddr
No symbol "saddr" in current context.
(gdb) x serverPort
0x13c4: 0x6c380000
(gdb) x serverIP
No symbol "serverIP" in current context.
What's your optimization level? For debugging it should be -O0 (no
optimization), otherwise the compiler will share registers, omit unused
variables until the scope in which they're used, and other tricks that
confuse the debugger.
Even with unoptimized code, if i is uninitialized and unused, the
compiler may never allocate resources to it and never tell the debugger
where to look for it.
Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden