Results 1 to 4 of 4
Hello,i am an engineering student,working on my first os project in linux using gcc compiler.
and the project definition goes like this-Given a C file and it's executable, the program(which ...
- 04-10-2011 #1Just Joined!
- Join Date
- Apr 2011
- Posts
- 1
help for a linux project of making a C code analyser in C and Linux


Hello,i am an engineering student,working on my first os project in linux using gcc compiler.
and the project definition goes like this-Given a C file and it's executable, the program(which should also be in C)should contain the features as
1) finding all the system calls used by the program and their corresponding lines in the code.
2)Listing the line of a code whenever the value of a variable changes and also the other variables being affected by
it.
3)with the help of command line arguements,showing signals,interrupts and other flow changes like
loop,jump,conditional statements and also showing their effects.
4)finding out independent sections of a program i.e finding out boundary sections of code which can run parallely or
independently
5)finding out time spent by the program on different sections of code.
P.S. I am not asking the members of this forum to make the code for me.Any help/suggestions provided by you would be very helpful.Please reply to this thread ASAP.
Thank you.
- 04-10-2011 #2Just Joined!
- Join Date
- Apr 2011
- Posts
- 2
its good i like it

i hope that program will be able to find all the definitions of functions and where they've been called in the code?
- 04-10-2011 #3Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
The executable will need to be built with a -g (debuggable) flag and not be stripped. Then what you are building is essentially what gdb, the gnu debugger, does, along with (for #5) the gnu profiler. Also, the valgrind tools do this - debugging and profiling. Check here: Valgrind Home
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 04-12-2011 #4Just Joined!
- Join Date
- Jun 2006
- Posts
- 47
The work you have to perform looks a lot like code analysis and optimizations. These are, basically, performed by the compiler. Consequently, you may be interested to learn more about compilation techniques, refer "the Dragon Book".
Lots of things in compilation theory are both peculiar and well theoretically conceptualized.
Maybe you'll have to modify an existing compiler - gcc looks a little extreme for this purpose, but maybe tcc ...
As for your requirements ...
1) What about syscalls nested deep in library functions ?
2) Do you take into account that compiler might create new variables for its purposes and optimize out yours ?
3) On x86 (at least), a simple if-else clause may be encoded without branch instructions, thanks to conditional instructions ...
4) In compilation they call it 'basic blocks' ...
5) That's Ok ...


Reply With Quote