object header and class name

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

object header and class name

Ang BeePeng
Hi.

We can know which class is an object from the object header. But how can we know what is the class name of that class? By this I mean only with object pointer.

Thanks.

Ang Beepeng
Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] object header and class name

Bert Freudenberg

On 13.08.2009, at 09:08, Ang Beepeng wrote:

>
> Hi.
>
> We can know which class is an object from the object header. But how  
> can we
> know what is the class name of that class? By this I mean only with  
> object
> pointer.


It's the 7th instance variable in the class. So

        self fetchPointer: 6 ofObject: aClass.

See, for example, Interpreter>>classNameOf:Is:.

- Bert -



Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] object header and class name

Ang BeePeng
Thanks a lot.

Yes, I've come across this method, but I wonder if I can know what is the class name while I'm debugging, while I'm stepping through the source code. aClass will be just a pointer, which has address as its value.

Thanks.

Ang Beepeng

Bert Freudenberg wrote
It's the 7th instance variable in the class. So

        self fetchPointer: 6 ofObject: aClass.

See, for example, Interpreter>>classNameOf:Is:.

- Bert -


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] object header and class name

Bert Freudenberg
Oh, in that case, why don't you use the printCallStack function? There  
are more useful functions in the "debug printing" and "debug support"  
protocols.

- Bert -

On 13.08.2009, at 10:21, Ang Beepeng wrote:

>
> Thanks a lot.
>
> Yes, I've come across this method, but I wonder if I can know what  
> is the
> class name while I'm debugging, while I'm stepping through the  
> source code.
> aClass will be just a pointer, which has address as its value.
>
> Thanks.
>
> Ang Beepeng
>
>
> Bert Freudenberg wrote:
>>
>>
>> It's the 7th instance variable in the class. So
>>
>> self fetchPointer: 6 ofObject: aClass.
>>
>> See, for example, Interpreter>>classNameOf:Is:.
>>
>> - Bert -
>>
>>
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/object-header-and-class-name-tp24949929p24950851.html
> Sent from the Squeak - Dev mailing list archive at Nabble.com.
>
>