Re: XCode 3.0 gdb>po <obj> --> Cannot access memory at address 0x0
Re: XCode 3.0 gdb>po <obj> --> Cannot access memory at address 0x0
- Subject: Re: XCode 3.0 gdb>po <obj> --> Cannot access memory at address 0x0
- From: "Jonathan del Strother" <email@hidden>
- Date: Wed, 23 Jan 2008 21:12:59 +0000
On Jan 23, 2008 7:21 PM, <email@hidden> wrote:
> Greetings:
>
> I can't get gdb>po <object> to return a value from a simple NS object, other than NSXML objects.
> I suspect it has something to do with the Intel chip; since I had no problem on my G4/G3 machines.
>
> I made sure that all optimization was off; and I tried using Xcode 2.3+ version.
>
> For example, I've created a simple NSString object, but I can't reveal it's value
> using gdb>po. What I get is "Cannot Access Memory Address" as shown below.
>
>
> My environment:
> MacBook Pro on Intel running Leopard (10.5.1)
>
> ------------------------------------------------------
>
> XCode & Debugger:
> Using Xcode 3
> Component versions
> Xcode IDE: 921.0
> Xcode Core: 921.0
> ToolSupport: 893.0
>
> Debug Information Format: DWARF
> Optimization Level: none[-o0]
>
> ===========================================
>
>
> -(void)awakeFromNib {
> NSLog(@"{awakeFromNib}");
> NSXMLElement *root = (NSXMLElement *)[NSXMLNode elementWithName:@"addresses"];
> xmlDoc = [[NSXMLDocument alloc] initWithRootElement:root];
> [xmlDoc setVersion:@"1.0"];
> [xmlDoc setCharacterEncoding:@"UTF-8"];
>
> // The following NSXMLElement generates a parent. Hence you can't add it to root.
> NSXMLElement *xmlNoodle;
> [xmlNoodle setName: @"RicNode"];
> [xmlNoodle setStringValue:@"Pumpkin"]; // Note: this node has a parent; hence can't use "addChild".
> [xmlNoodle attributeForName:@"Spanky"];
>
> NSString *myString = [NSString stringWithString:@"Hello World!"]; <--- I can't see this. ********
> ...
> ==================
> *** Console Window ***
> run
> [Switching to process 2832 local thread 0x2f1b]
> Running…
> 2008-01-23 11:06:25.773 MyXML[2832:817] {awakeFromNib}
>
> (gdb) po myString
> Cannot access memory at address 0x0 <--- my problem
>
> (gdb) po xmlNoodle
> <RicNode>Pumpkin</RicNode>
> Current language: auto; currently objective-c
> (gdb)
>
> ======================================
>
> Any remedy?
>
"Cannot access memory at address 0x0" is normal when you try to do
'po' on any nil object. I would imagine that the line assigning an
NSString to myString hasn't been executed yet, hence myString is still
nil.
_______________________________________________
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