Re: Weird Problem, is this an XCode Bug?

2016-02-04 Thread Richard Charles

> On Feb 4, 2016, at 7:59 AM, Dave  wrote:

> What could cause then Debugger to think that a regular object is an 
> Array/Dictionary?

The debugger is not perfect. You may need to use logging.

> The object in question is subclass from a custom base class.

Have you properly designed your custom base class for subclassing?

I ran into a situation about a month ago when the debugger was broken. Working 
around it was painful.

--Richard Charles


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Weird Problem, is this an XCode Bug?

2016-02-04 Thread Alex Zavatone


On Feb 4, 2016, at 11:12 AM, Dave  wrote:

> Jeez, really? I need a broken debugger like a hole in the dead at the moment. 
> Any idea what causes it and how to get rid of it? Using “po” won’t help as 
> it’s a custom object, I need to look at the properties. Any ideas how I can 
> do this?

OK.  This is exactly what the autoDescribe category is meant for.

Sending it your way off line

In the debugger simply type this at a breakpoint:

po [myAwesomeObject autoDescribe]

And you’ll get something like this.

(lldb) po [indexPath autoDescribe]
2016-02-04 19:50:29.819 SWNDirect[76380:29705304] -[NSObject(AutoDescribe) 
autoDescriptionForClassType:] [Line 90] length
2016-02-04 19:50:29.819 SWNDirect[76380:29705304] -[NSObject(AutoDescribe) 
autoDescriptionForClassType:] [Line 90] row
2016-02-04 19:50:29.820 SWNDirect[76380:29705304] -[NSObject(AutoDescribe) 
autoDescriptionForClassType:] [Line 90] section
2016-02-04 19:50:29.820 SWNDirect[76380:29705304] -[NSObject(AutoDescribe) 
autoDescriptionForClassType:] [Line 90] item
2016-02-04 19:50:29.820 SWNDirect[76380:29705304] -[NSObject(AutoDescribe) 
autoDescriptionForClassType:] [Line 90] ab_item
2016-02-04 19:50:29.822 SWNDirect[76380:29705304] -[NSObject(AutoDescribe) 
autoDescriptionForClassType:] [Line 90] ab_group
[NSIndexPath {length: Q = 2; 
row: q = 0; 
section: q = 2; 
item: q = 0; 
ab_item: q = 0; 
ab_group: q = 2; 
}]

Instead of something like this:

(lldb) po indexPath
 {length = 2, path = 2 - 0}


You can even use it in your log statements:

GeofenceControllerSingleton.m:1337:DLog(@"%@", [[_geofenceObjects 
objectForKey:myKey] autoDescribe]);


All in all, I find it a major lack of consideration on Apple’s end to not have 
something like this (and better written) in the Cocoa libs.  Apple and 
Objective-C tout object introspection, but Apple doesn’t hand you tools that 
let you spit out your object’s guts.  We shouldn’t have to write this stuff.  
Really.  It’s like selling a mechanic a car with no gauges.

Hope this helps.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Weird Problem, is this an XCode Bug?

2016-02-04 Thread Alex Zavatone

On Feb 4, 2016, at 9:59 AM, Dave  wrote:

> XCode 7.2 (7C68).
> Mac OS X (not iOS).
> 
> Hi,
> 
> I sent the following message to the XCode List, but now I’m wondering if 
> there is a bug in my code that is causing this weird behaviour? What could 
> cause then Debugger to think that a regular object is an Array/Dictionary? 
> 
> The object in question is subclass from a custom base class. Apart from 
> being, NSCopying and NSCoding complaint there isn’t really anything strange 
> about it.
> 
> I’m trying to debug an App. I have a regular object that contains NSString's, 
> NSArray’s and NSDictionary’s.

First of all, they are NSStrings, NSArrays and NSDictionaries. You don’t use an 
apostrophe on a plural.  You’ll cause a fault in our brains’ English compilers.

> I have a method that does an alloc/init to get a new one, but after the init 
> call, the debugger shows the Object as LTWNodeInfo @“0 objects”  as if its an 
> array and if I try to inspect it, it won’t show be any of the properties. If 
> I print it to the log is says its the right class.
> 
> What could someone tell me why this is happening and how to fix it?
> 

Whenever the debugger appears to be barfing, I use a method I call autoDescribe 
that is a category on NSObject.

It goes through each object that you pass to it and walks into objects and 
dumps their properties, the name of the property and its value.

It’s not bulletproof and when an object contains a struct or some more 
foundation item, it might bail on you, but for all the objects that are build 
off of NSObject, it recurses through the object and spits out the items it 
finds.

If you have custom classes with properties that are NSStrings, it’s a stupid 
easy way to get a print out of the object’s internals.  

I’m not sure what the internal structure of your LTWNodeInfo is, but I’ll be 
happy to send this over if you think you’d find it useful.

There are other projects out there in the wild that appear to be called the 
same thing.  I’m not sure if they work better or worse than mine, but here’s 
one that looks useful and easy to try out.

https://github.com/neoneye/autodescribe

Good luck.

> I’m trying to get something finished for tomorrow and I can’t debug my code. 
> I’ve tried Cleaning the Build Folder, Cleaning the Project, Restarting XCode, 
> 
> Thanks in advance
> Dave
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
> 
> This email sent to z...@mac.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Weird Problem, is this an XCode Bug?

2016-02-04 Thread Gary L. Wade
You're not alone. I see this every so often and just make do with the console 
view to see what I need (po is your friend). If you have more than one project 
open, you might try closing those before restarting Xcode. Another flake that 
Xcode has is putting the wrong project's source file in the Debug tab, a 
problem exacerbated by some of the projects I open from others who never 
bothered to change the names of their source files from template names; the 
worst offender is ViewController.m.

The only way to fix this is to file a bug against Xcode in 
http://bugreport.apple.com/ and wait for it to be marked as a duplicate and 
hope it gets fixed by Xcode 8.
--
Gary L. Wade (Sent from my iPad)
http://www.garywade.com/

> On Feb 4, 2016, at 6:59 AM, Dave  wrote:
> 
> XCode 7.2 (7C68).
> Mac OS X (not iOS).
> 
> Hi,
> 
> I sent the following message to the XCode List, but now I’m wondering if 
> there is a bug in my code that is causing this weird behaviour? What could 
> cause then Debugger to think that a regular object is an Array/Dictionary? 
> 
> The object in question is subclass from a custom base class. Apart from 
> being, NSCopying and NSCoding complaint there isn’t really anything strange 
> about it.
> 
> I’m trying to debug an App. I have a regular object that contains NSString's, 
> NSArray’s and NSDictionary’s. I have a method that does an alloc/init to get 
> a new one, but after the init call, the debugger shows the Object as 
> LTWNodeInfo @“0 objects”  as if its an array and if I try to inspect it, it 
> won’t show be any of the properties. If I print it to the log is says its the 
> right class.
> 
> What could someone tell me why this is happening and how to fix it?
> 
> I’m trying to get something finished for tomorrow and I can’t debug my code. 
> I’ve tried Cleaning the Build Folder, Cleaning the Project, Restarting XCode, 
> 
> Thanks in advance
> Dave
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Weird Problem, is this an XCode Bug?

2016-02-04 Thread Dave
Hi Again,

I’m trying to debug a network of interwoven objects. To do all that with “po” 
will take at least 10 times longer.

The only other way I can think to fix it, it to write a method on the Custom 
Object subclass that Logs the Properties. Doing it that would would probably 
take 3 or 4 times as long or I could write a self-test method which I suppose 
would work with the logging method(s).

I’ve tracked it down a bit more and it seems to happen with Custom Objects that 
have been unarchived. The Object that is unarchived is LTWNetwork, this 
contains an array property, the array contains instances of my custom subclass, 
its at this point that the debugger refuses to show them as custom objects and 
show @“0 objects”, immediately after the unarchive operation.

Is there something I need to do after unarchiving that resolves the new object 
as the correct class?

All the Best
Dave




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Weird Problem, is this an XCode Bug?

2016-02-04 Thread Gary L. Wade
Writing your own description or debugDescription method is a great way to view 
a large custom object, since you can format it the way you like. For an 
example, check out Apple's tech note about debugging magic (both OS X and iOS 
versions of it) and look at theirs for a view hierarchy description method.
--
Gary L. Wade (Sent from my iPad)
http://www.garywade.com/

> On Feb 4, 2016, at 9:05 AM, Dave  wrote:
> 
> Hi Again,
> 
> I’m trying to debug a network of interwoven objects. To do all that with “po” 
> will take at least 10 times longer.
> 
> The only other way I can think to fix it, it to write a method on the Custom 
> Object subclass that Logs the Properties. Doing it that would would probably 
> take 3 or 4 times as long or I could write a self-test method which I suppose 
> would work with the logging method(s).
> 
> I’ve tracked it down a bit more and it seems to happen with Custom Objects 
> that have been unarchived. The Object that is unarchived is LTWNetwork, this 
> contains an array property, the array contains instances of my custom 
> subclass, its at this point that the debugger refuses to show them as custom 
> objects and show @“0 objects”, immediately after the unarchive operation.
> 
> Is there something I need to do after unarchiving that resolves the new 
> object as the correct class?
> 
> All the Best
> Dave
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Weird Problem, is this an XCode Bug?

2016-02-04 Thread Dave
Jeez, really? I need a broken debugger like a hole in the dead at the moment. 
Any idea what causes it and how to get rid of it? Using “po” won’t help as it’s 
a custom object, I need to look at the properties. Any ideas how I can do this?

I was wondering if it could be caused by a bug in my code that causes the 
debugger to go AWOL or something?

All the Best
Dave

> On 4 Feb 2016, at 15:56, Gary L. Wade  wrote:
> 
> You're not alone. I see this every so often and just make do with the console 
> view to see what I need (po is your friend). If you have more than one 
> project open, you might try closing those before restarting Xcode. Another 
> flake that Xcode has is putting the wrong project's source file in the Debug 
> tab, a problem exacerbated by some of the projects I open from others who 
> never bothered to change the names of their source files from template names; 
> the worst offender is ViewController.m.
> 
> The only way to fix this is to file a bug against Xcode in 
> http://bugreport.apple.com/ and wait for it to be marked as a duplicate and 
> hope it gets fixed by Xcode 8.
> --
> Gary L. Wade (Sent from my iPad)
> http://www.garywade.com/


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Weird Problem, is this an XCode Bug?

2016-02-04 Thread Gary L. Wade
The command po is for objects and p is for intrinsics; just add a typedef on 
those. If what you mean by properties are actually instance variables, use the 
-> operator on the object.

po [anObject aPropertyThatIsAnObject]
p (BOOL )[anObject aBoolMethod]
p anObject->aBooliVar

Unless you've modified your Xcode application or its constituent tools, you're 
not to blame for this. File the duplicate bug, and work around it like everyone 
else. There are some issues with Xcode worth tracking down; this isn't one of 
those.
--
Gary L. Wade (Sent from my iPad)
http://www.garywade.com/

> On Feb 4, 2016, at 8:12 AM, Dave  wrote:
> 
> Jeez, really? I need a broken debugger like a hole in the dead at the moment. 
> Any idea what causes it and how to get rid of it? Using “po” won’t help as 
> it’s a custom object, I need to look at the properties. Any ideas how I can 
> do this?
> 
> I was wondering if it could be caused by a bug in my code that causes the 
> debugger to go AWOL or something?
> 
> All the Best
> Dave
> 
>> On 4 Feb 2016, at 15:56, Gary L. Wade  wrote:
>> 
>> You're not alone. I see this every so often and just make do with the 
>> console view to see what I need (po is your friend). If you have more than 
>> one project open, you might try closing those before restarting Xcode. 
>> Another flake that Xcode has is putting the wrong project's source file in 
>> the Debug tab, a problem exacerbated by some of the projects I open from 
>> others who never bothered to change the names of their source files from 
>> template names; the worst offender is ViewController.m.
>> 
>> The only way to fix this is to file a bug against Xcode in 
>> http://bugreport.apple.com/ and wait for it to be marked as a duplicate and 
>> hope it gets fixed by Xcode 8.
>> --
>> Gary L. Wade (Sent from my iPad)
>> http://www.garywade.com/
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/garywade%40desisoftsystems.com
> 
> This email sent to garyw...@desisoftsystems.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Weird Problem, is this an XCode Bug?

2016-02-04 Thread Sandor Szatmari
I have traversed object hierarchies in the debugger using predicates and KVC in 
GDB described below. (Last tested in Xcode 4.6.3 compiler Apple LLVM 4.2)

For an array, something like... (typed in mail )
po (NSArray*)[arr filteredArrayUsingPredicate:(NSPredicate*)[NSPredicate 
predicateWithFormat:@"property == 'find me'"]]

This can be used to isolate/locate what objects are in my graph and what their 
values are.

I usually have overridden -description and can tweak that for custom debug 
information.

You can use key paths and other fun stuff to extract data while stopped in the 
debugger (valueForKey:/valueForKeyPath: using collection operators like 
@distinctUnionOfObjects...)

It is very picky about requiring you to specify return types though.

I haven't yet figured out how to do this in LLDB.  Creating the predicates on 
the fly yields a warning about forward declarations.

Sandor Szatmari

> On Feb 4, 2016, at 12:05, Dave  wrote:
> 
> Hi Again,
> 
> I’m trying to debug a network of interwoven objects. To do all that with “po” 
> will take at least 10 times longer.
> 
> The only other way I can think to fix it, it to write a method on the Custom 
> Object subclass that Logs the Properties. Doing it that would would probably 
> take 3 or 4 times as long or I could write a self-test method which I suppose 
> would work with the logging method(s).
> 
> I’ve tracked it down a bit more and it seems to happen with Custom Objects 
> that have been unarchived. The Object that is unarchived is LTWNetwork, this 
> contains an array property, the array contains instances of my custom 
> subclass, its at this point that the debugger refuses to show them as custom 
> objects and show @“0 objects”, immediately after the unarchive operation.
> 
> Is there something I need to do after unarchiving that resolves the new 
> object as the correct class?
> 
> All the Best
> Dave
> 
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/admin.szatmari.net%40gmail.com
> 
> This email sent to admin.szatmari@gmail.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Weird Problem, is this an XCode Bug?

2016-02-04 Thread Dave
There are 100’s/1000’s of nodes, would take forever, I’m writing a self-test 
method now…..

Shame about the debugger in XCode, still at least we have lots of lovely 
animations to make up for it, thanks Apple.

I’m wondering if the cause of my problems is to do with archiving/unarchiving 
as I’ve found a problem an array in an unarchived array.

Thanks for lot
All the Best
Dave

> On 4 Feb 2016, at 18:22, Sandor Szatmari  wrote:
> 
> I have traversed object hierarchies in the debugger using predicates and KVC 
> in GDB described below. (Last tested in Xcode 4.6.3 compiler Apple LLVM 4.2)
> 
> For an array, something like... (typed in mail )
> po (NSArray*)[arr filteredArrayUsingPredicate:(NSPredicate*)[NSPredicate 
> predicateWithFormat:@"property == 'find me'"]]
> 
> This can be used to isolate/locate what objects are in my graph and what 
> their values are.
> 
> I usually have overridden -description and can tweak that for custom debug 
> information.
> 
> You can use key paths and other fun stuff to extract data while stopped in 
> the debugger (valueForKey:/valueForKeyPath: using collection operators like 
> @distinctUnionOfObjects...)
> 
> It is very picky about requiring you to specify return types though.
> 
> I haven't yet figured out how to do this in LLDB.  Creating the predicates on 
> the fly yields a warning about forward declarations.
> 
> Sandor Szatmari
> 
>> On Feb 4, 2016, at 12:05, Dave > > wrote:
>> 
>> Hi Again,
>> 
>> I’m trying to debug a network of interwoven objects. To do all that with 
>> “po” will take at least 10 times longer.
>> 
>> The only other way I can think to fix it, it to write a method on the Custom 
>> Object subclass that Logs the Properties. Doing it that would would probably 
>> take 3 or 4 times as long or I could write a self-test method which I 
>> suppose would work with the logging method(s).
>> 
>> I’ve tracked it down a bit more and it seems to happen with Custom Objects 
>> that have been unarchived. The Object that is unarchived is LTWNetwork, this 
>> contains an array property, the array contains instances of my custom 
>> subclass, its at this point that the debugger refuses to show them as custom 
>> objects and show @“0 objects”, immediately after the unarchive operation.
>> 
>> Is there something I need to do after unarchiving that resolves the new 
>> object as the correct class?
>> 
>> All the Best
>> Dave
>> 
>> 
>> 
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/admin.szatmari.net%40gmail.com
>>  
>> 
>> 
>> This email sent to admin.szatmari@gmail.com 
>> 
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com