Thank you! This is very helpful. I have added it to the ticket: 
https://github.com/epasveer/seer/issues/350#issuecomment-3344263862
On Sunday, 28 September 2025 at 22:29:12 GMT+13, R Frith-Macdonald 
<[email protected]> wrote: 
 
 
 
On 25/09/2025 00:16, Michael Rans wrote:
> "I'd like to learn more about these ObjectiveC containers, though. Can 
> they be nesting? Can I programatically inquire on them like how many 
> objects, etc...

OK, I used 'container' in an abstract sense ... while every object can 
be seen as a container (because it stores state information which the 
-description method might provide for print-object to display) I really 
meant objects which happen to encapsulate large amounts of data.

That might be objects of class NSString ... containing text.  In a book 
database application this could, for instance, be just the title of a 
book 'War and Peace' or could be the entire text of the book!

Or it could be a collection class such as NSArray ... containing an 
ordered collection of objects ... perhaps the 22 chapter titles in a 
book, or perhaps the 10,000 l;ines of text.

So while printing the description of an object is often very useful, it 
has the potential to produce far too much text for a neatly formatted 
debug display.  I would therefor suggest that SDeer should output 
minimal information by default, with an option to print the full object 
description in a popup window (eg if the user clicks on the minimal 
description).

While many/most classes implement -description to produce human 
readabl;e statre information, the default implementation of -description 
returns an NSString containing a minimal description (class name and 
address of the object) similar to this C code:

printf("<%s: %p>", class_getName(object), (void*)object);

eg. for an instance of MyClass it might print <MyClass: 0x00001234>


 >> Can they be nesting

Collections may be nested, YES.

 >>>  Can I programatically inquire on them like how many objects, etc...

Yes and no; there are methods to do that. Collections generally provide 
a -count method, string and binary data objects provide a -length 
method, but different classes have different behaviors and there's no 
general way to know in advance how big the -description of a particular 
object will be.

> Basically, maybe there's a way I can write my own version of 
> "print-object" that is more flexible..."

Certainly the object introspection features of the objc runtime allow 
you to do that, but trying to cope with all possibilities is an endless 
task, which is why I suggest starting with just the class and address 
along with an easy wayto print-object the description to somewhere that 
copes well if the amount of data returned is large.


> The above questions are from the author of Seer who is adding 
> Objective-C support to his Seer gdb debugger frontend. I am also 
> interested to learn more on this.
>
> Here is a screenshot of Seer debugging Objective-C:
>
> Inline image
> The ticket where Objective-C support is discussed is here: 
> https://github.com/epasveer/seer
>
> Thanks,
> Mike
>
>
>

  
  • R... R Frith-Macdonald
    • ... Michael Rans
    • ... Andreas Fink via Discussion list for the GNUstep programming environment

Reply via email to