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: email@hidden
- Date: Wed, 23 Jan 2008 13:37:43 -0800 (PST)
I followed your observation and made the variable an instance vs local variable.
Then I used the assessor compiler directive:
@property(readwrite,copy) NSString *xmlString; (header)
@synthesize xmlString; (body)
..and access the variable via self.xmlString within a called routine vs awakeFromNib().
That worked.
Then out-of-curiosity, I tried to break within awakeFromNib() again
to repeat the gdb>po myString. This time it works.
I can't explain it.
I could view the xmlDoc local, so I should see others; I would think.
If I find a reproducable pattern here, I'll report it.
Thanks for the reply.
Ric.
On 01/23/2008 13:12 Jonathan del Strother wrote ..
> 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