MELT plugin: Help to access local variables in c functions

24 views
Skip to first unread message

nagendra

unread,
Jan 30, 2017, 12:56:44 PM1/30/17
to gcc-melt
Hi All,

I'm working on a project to remove vulnerabilities of a software by writing a GCC plugin in MELT. I need some directions on how to access local variables of functions in MELT. I'm a beginner, so any help is appreciated.

Thanks,
Nagendra. 

Basile Starynkevitch

unread,
Jan 30, 2017, 3:13:38 PM1/30/17
to gcc-...@googlegroups.com


On 01/30/2017 06:56 PM, nagendra wrote:
> Hi All,
>
> I'm working on a project to remove vulnerabilities of a software by
> writing a GCC plugin in MELT.
You need to define what "removing vulnerabilities of a software" means
to you (in GCC, but perhaps independently -or not- of MELT). I don't
guess what that could mean.
> I need some directions on how to access local variables of functions
> in MELT. I'm a beginner, so any help is appreciated.
>

Did you have a short example of code to "compile" in some sample.c? Did
you try to compile it with gcc -c -O2 -fdump-tree-all ?

You probably should read first the many slides I have wrote which are
available in http://gcc-melt.org/docum.html

You first need to understand GCC internals. Read also
https://gcc.gnu.org/onlinedocs/gccint/

You need to understand on what kind of internal representations you want
to work. I am not sure that local variables has a well defined meaning.
(e.g. is it Gimple, or Gimple/SSA; and at what precise optimization pass)?

Regards.

PS. MELT is just a Lispy language to code inside GCC. The most difficult
part is to understand GCC internals. Once you did that, you might
perhaps even not use MELT and just code your thing in "ordinary" C++ -
or you could still prefer MELT. My point is that you need first to focus
on understanding how GCC works, and I did wrote many slides on it, and
you should also look into http://www.cse.iitb.ac.in/grc/

--
Basile Starynkevitch http://starynkevitch.net/Basile
Bourg La Reine, France mobile: +33 6 8501 2359
opinions are only mine

Reply all
Reply to author
Forward
0 new messages