Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tcf-dev] symbols.h

Hi!

That makes all perfect sense to me. But unfortunately I don’t understand what a “symbol class” is.

 

What is the fundamental difference between a SYM_CLASS_FUNCTION and a TYPE_CLASS_FUNCTION?

 

int main() {}; // is main a SYM_CLASS_FUNCTION or TYPE_CLASS_FUNCTION?

 

int (*fnc_ptr)(void) = &main; // what about fnc_ptr? TYPE_CLASS _POINTER or _FUNCTION?

 

If SYM_CLASS_REFERENCE is the address of an object (variable) in memory where is the difference to TYPE_CLASS_POINTER?

 

You see, I really don’t get it what symbol classes are.

 

 

 

 

 

From: tcf-dev-bounces@xxxxxxxxxxx [mailto:tcf-dev-bounces@xxxxxxxxxxx] On Behalf Of Kalle Hammarsten
Sent: Thursday, August 28, 2014 1:06 PM
To: TCF Development
Subject: Re: [tcf-dev] symbols.h

 

In symbols.h there are comments explaining the SYM_CLASS_* defines. SYM_CLASS_REFERENCE for instance means a variable.

The TYPE_CLASS_* defines are data type descriptions, the one needing explaining might be TYPE_CLASS_COMPOSITE that means a complex type like a struct or union.

 

/Kalle H.

 

From: tcf-dev-bounces@xxxxxxxxxxx [mailto:tcf-dev-bounces@xxxxxxxxxxx] On Behalf Of Stefan.Falk@xxxxxxxxxxxx
Sent: den 28 augusti 2014 12:44
To: tcf-dev@xxxxxxxxxxx
Subject: Re: [tcf-dev] symbols.h

 

Hi Xavier!

 

Thanks for he fast reply! I already took a look at the windows implementation.

It is where I was starting and step by step adapted it to my version of the tcf-agent.

 

It is good that you took a function as example because this is already the point where I have my struggles.

 

SYM_CLASS_FUNCTION is said to be an address of a function. So when would I have to return this information?

 

I don’t understand what a symbol class and a type class is because this is confusing me a little.

Another thing is SYM_CLASS_REFERENCE and TYPE_CLASS_POINTER. As soon as I reached my aha-moment I think

I can do it without help but right now I’m a little stuck.


J

Thank you and best regards,
Stefan

 

From: tcf-dev-bounces@xxxxxxxxxxx [mailto:tcf-dev-bounces@xxxxxxxxxxx] On Behalf Of Xavier Pouyollon
Sent: Thursday, August 28, 2014 11:40 AM
To: TCF Development
Subject: Re: [tcf-dev] symbols.h

 

On 08/28/2014 09:16 AM, Stefan.Falk@xxxxxxxxxxxx wrote:

Hi folks!

Could someone explain to me a few things about the SYM_CLASS_* and TYPE_CLASS_* macros?

 

E.g. where do things like char, short, void struct, bit, bitfield fall into?

What would be a “cardinal class type”?

 

Thank you.

 

 

_______________________________________________
tcf-dev mailing list
tcf-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tcf-dev

Hi Stefan,

> E.g. where do things like char, short, void struct, bit, bitfield fall into?

Take a look at Dwarf3 specs, page 65.
(http://dwarfstd.org/doc/Dwarf3.pdf)

You'll got an AT_base_type with an encoding.
Depending of the encoding, you can have a boolean, an address.
 (page 146).

symbols_elf.c / get_symbol_type_class will decypher a Symbol object to return it's class.

For instance, on linux, compile a program with debug info and do readelf -wi

 <1><141>: Abbrev Number: 2 (DW_TAG_subprogram)
    <142>   DW_AT_external    : 1   
    <143>   DW_AT_name        : (indirect string, offset: 0x169): usrRtpAppInit
    <147>   DW_AT_decl_file   : 1   
    <148>   DW_AT_decl_line   : 25   
    <149>   DW_AT_prototyped  : 1   
    <14a>   DW_AT_low_pc      : 0x100044   
    <14e>   DW_AT_high_pc     : 0x100048   

That describes a function. Look in get_symbol_type_class, it will convert the TAG_subprogram as TYPE_CLASS_FUNCTION.
Same logic applies for data types like ARRAY, ENUMERATION.

> What would be a “cardinal class type”?

get_symbol_type sees :
DW_ATE_unsigned_char unsigned (character) as cardinal.

I'm not 100% sure what a cardinal type means but cardinal is number used for counting.

Hope it helps a little,
Very Best Regards,
Xavier.


Back to the top