Line 1... |
Line 1... |
Opcode analysis program
|
Opcode analysis program
|
|
|
This program is designed to help look at the frequency of opcodes, and the
|
This program is designed to help look at the frequency of opcodes, and the
|
occurance of groups of opcodes together.
|
occurance of groups of opcodes together.
|
|
|
This can also be done on the command line, but it was felt, at the time a C
|
It takes input from a file, and generates output to stdout via printf.
|
program might be a quicker way. 3 hours later, it's not the author's intention
|
|
to now try doing this with sed, awk and sort.
|
|
|
|
The list of instructions/opcodes should be one per line, with a newline at the
|
The list of instructions/opcodes should be one per line, with a newline at the
|
end. There is no capability to look at register numbers. An example of
|
end. There is no capability to look at register numbers. An example of
|
generating suitable input to the program is given below.
|
generating suitable input to the program is given below.
|
|
|
|
Two output formats are possible - switchable by the #define DISPLAY options in
|
|
the C source.
|
|
1) Human readable output, enabled by uncommenting the DISPLAY_STRING define
|
|
2) CSV output, enabled by uncommenting the DISPLAY_CSV define
|
|
|
At the moment this program only analyses up to quadruples, and is not codeded
|
At the moment this program only analyses up to quadruples, and is not codeded
|
in such a way that makes an arbitrary number of instruction groups easily
|
in such a way that makes an arbitrary number of instruction groups easily
|
testable. Fix this if you like.
|
testable. Fix this if you like.
|
|
|
There are no options when running the program. It will simply spit out a list
|
There are no options when running the program. It will simply spit out a list
|
of individual opcodes, then list of pairs, triples and quadruples.
|
of individual opcodes, then list of pairs, triples and quadruples, in one of
|
|
the two formats described above.
|
|
|
Compile the program with
|
Compile the program with
|
$ make all
|
$ make all
|
|
|
Generate a list of opcodes from a large set of code, with the following:
|
Generate a list of opcodes from a large set of code, with the following:
|
Line 33... |
Line 37... |
argument. It's best to pipe the output it generates to a file:
|
argument. It's best to pipe the output it generates to a file:
|
$ opcodeanalysis opcodes > opcodes.analsys
|
$ opcodeanalysis opcodes > opcodes.analsys
|
|
|
Things that might be good:
|
Things that might be good:
|
* Actually verifying the pair/triple/quadruple results are correct/true
|
* Actually verifying the pair/triple/quadruple results are correct/true
|
* Limiting the output of set results to the first 5/10/20
|
|
* Provide an option to perform register analysis, also.
|
* Provide an option to perform register analysis, also.
|
* Generate CSV formatted output
|
|
|
|
|
|
Julius Baxter
|
Julius Baxter
|
14 July, 2010
|
15 July, 2010
|
15 July, 2010
|
15 July, 2010
|