Debugger fails to see a NSString object that NSLog can see & print.
Debugger fails to see a NSString object that NSLog can see & print.
- Subject: Debugger fails to see a NSString object that NSLog can see & print.
- From: email@hidden
- Date: Wed, 10 Sep 2008 07:59:20 -0700 (PDT)
Environment: Xcode 3.1 (Core: #1100)
Greetings:
Scenario:
1) I'm transmitting data (XML) to a server and got a response.
2) The debugger can see the serverResponse as shown below.
3) But I'm unable to view the actual server data received; although NSLog does see it.
Why?
..
gdb) po serverDataString
Cannot access memory at address 0x0 <-- (see below)
..
Here's a snippet of the source code:
..
// -----------------------
// 4) Get Synchronous Data:
serverData = [NSURLConnection sendSynchronousRequest:theRequest
returningResponse:&serverResponse
error:&myError];
// -----------------------
// 5) Convert Synchronous Data into Human-Readable String (Unicode 8) format:
NSMutableString *serverDataString = [[NSMutableString alloc] initWithData:serverData encoding:NSUTF8StringEncoding];
NSLog(@"{PG_Transmission} serverDataString= %@",serverDataString); // ok.
..
=======================================================
The debugger:
(gdb) print (NSInteger) [serverResponse statusCode]
$1 = 200
(gdb) po [serverResponse allHeaderFields]
{
Connection = "Keep-Alive";
"Content-Length" = 208;
"Content-Type" = "text/plain";
Date = "Wed, 10 Sep 2008 14:18:18 GMT";
"Keep-Alive" = "timeout=15, max=100";
Server = "Apache/2.2.8 (Unix) mod_ssl/2.2.8 OpenSSL/0.9.8g mod_jk/1.2.23";
"X-Powered-By" = "Servlet 2.4; JBoss-4.0.3SP1
(build: CVSTag=JBoss_4_0_3_SP1 date=200510231054)/Tomcat-5.5";
}
(gdb) po serverData
<3c3f786d 6c207665 7273696f 6e3d2231 2e302220 656e636f 64696e67
3d225554 462d3822 20737461 6e64616c 6f6e653d 22796573 223f3e0a
3c454d53 52657370 6f6e7365 3e0a2020 20203c53 74617475 733e303c
2f537461 7475733e 0a202020 203c4d65 73736167 653e4f4b 3c2f4d65
73736167 653e0a20 2020203c 4a6f6253 75626d69 74496e66 6f3e0a20
20202020 2020203c 4a6f6249 643e3430 34373037 34373c2f 4a6f6249
643e0a20 2020203c 2f4a6f62 5375626d 6974496e 666f3e0a 3c2f454d
53526573 706f6e73 653e0a0a>
(gdb) continue
--- here's the NSLog: ---
2008-09-10 10:24:14.331 PGMessenger[673:20b]
{PG_Transmission} serverDataString=
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<EMSResponse>
<Status>0</Status>
<Message>OK</Message>
<JobSubmitInfo>
<JobId>40470747</JobId>
</JobSubmitInfo>
</EMSResponse>
--- but the debugger doesn't see it: --- WHY?
(gdb) po serverDataString
Cannot access memory at address 0x0 <------ ?
================================================
So the debugger retrieves a zero memory address for a NSString object
that NSLog can print/store. Why?
Regards,
Ric.
_______________________________________________
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