Linux - GeneralThis forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Hi,
I am looking for a solution to find some relativity between *.c and its *.out file in gcc (g++) execution.
as example gcc hello.c -o hello.out
I am looking to find how we can surely conclude that hello.out is generated from hello.c
This I am looking to find semantically identical files, which can be regenerated if it is needed.
Also I am thinking to trace all system calls associated with gcc execution and parse input and output file name, then stored those pair in table.
This seems very difficult, but no whereto start that why I choose this way.
Well, of course the easiest way to relate hello.c to hello.out is run gcc hello.c and compare the output to hello.out. In fact, it's probably the only reliable way, and you'd better use the same version of gcc. If you used a different version of gcc or another compiler, you *might* be able to use sequence matching (as is used for comparing DNA sequences and plagiarized text) to see if stretches of the compiled code are "similar enough". You'd have to set up some arbitrary criteria, and there would be false positives and negatives.
Reversing the process is probably not even theoretically possible, as there isn't a 1:1 reversible mapping between source code and compiled code.
Running a continuous audit on all uses of gcc would work too, for all future compilations.
Last edited by mostlyharmless; 10-22-2009 at 04:34 PM..
Thanks for reply,
First solution is good but not feasible for my case ( recompile same file then compare current .out with previous .out)
I am looking for an audit of the gcc, when you compile your file first time at the same time it will create a semantic pair
(hello.c and hello.out) or related pair and stored this information somewhere in table or log.
But I don't know how to audit gcc, how to find that pair, how to trace all system calls, where to start???
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.