Re: building of call tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 2, 2010 at 9:16 AM, Sergey Lapin <slapinid@xxxxxxxxx> wrote:
> but I fail with scoping. I need to detect which function that
> particular reference belongs to,
> and how to detect if that reference is really a function.

What do you mean by "reference"? If you mean the struct symbol *
in the AST. It can point to the function prototype or declaration. It is easy to
find out the symbol is a function or not.

Some thing along the lines of :

if (sym->type == SYM_NODE)
    sym = sym->ctype.base_type
if (sym && sym->type = SYM_FN) {
    /* sym is a function */
}


> sym->type isn't what I need, sym->ctype.base_type is used to print base type,
> but I'd like to print type as is, and detect if that is a function a proper way.

You need understand that, each local variable or function start with a SYM_NODE.
SYM_NODE bind a type to a instance of the type. e.g. a variable.
A function is just a SYM_NODE with base type as SYM_FN.

You can also try debug_symbol(), see how it print out the function prototype.

I am about to post a AST inspection patch series. That tool should
help you understand
the AST as well. Stay tuned.

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux