Some students have already gone well past this point in their program. For those students, this lab would represent a step backwards, and I realize you may not want to do that. If you feel you already have a good grasp on how to do this lab because you are pretty much done the program, and would rather not bother with this lab, if you do not submit anything at all for this lab I will take the grade you receive on P3 and use it in place of this lab.
cmw@paris:~/cs520/p3/lab6$ ./dis_class ../classfile/tests/Pathetic.class Method Name: <init> 0 aload_0 1 invokespecial 2 nop 3 aconst_null 4 return Method Name: main 0 return cmw@paris:~/cs520/p3/lab6$ ./dis_class ../classfile/tests/Multinewarray.class Method Name: <init> 0 aload_0 1 invokespecial 2 nop 3 aconst_null 4 return Method Name: main 0 iconst_2 1 iconst_5 2 multianewarray 3 nop 4 iconst_m1 5 iconst_m1 6 astore_1 7 returnThere is to be 1 command line argument, which should be a java class file. You may assume the input argument, if present, is a valid java class file. Your lab 5 code should be able to print out the opcode's numbers one at a time, but now you will instead be printing out the opcode's name.
The format is as follows. Each method should be printed in two parts. The first part should contain the words, "Method Name:" followed by a space, followed by the method's name as looked up in the constant table. The next part is the individual opcode names. Each opcode (or argument that is interpreted as an opcode) should appear on its own line. Each opcode should be preceded by a tab, followed by the index of the opcode, followed by a space, followed by the opcode's name.
It can be copied from ~cs520/lab6_ref which is world readable.
Note that the reference solution may not handle non existent opcodes correctly.
-bash-4.2$ ./dis_class ../classfile/tests/Pathetic.class > Pathetic.mine -bash-4.2$ ~cs520/lab6_ref ../classfile/tests/Pathetic.class > Pathetic.ref -bash-4.2$ diff Pathetic.mine Pathetic.refThe > redirects the standard out stream from the program to a file, in the first case the file is named Pathetic.mine and the second is called Pathetic.ref. Next, the diff program compares the two outputs and notes what the differences, if any, are.
Testing files like that one at a time is labor intensive and annoying if there are a lot of files you want to test. It may be worth investing in learning how to make bash scripts (if you're old school) or python scripts (if you're new school) to automate this testing. For example, the grading scripts are all python scripts that automatically run the programs and look at the outputs, which is very effective for identifying stuff that passes perfectly.
Note that I expect all students to have done at least one diff test on a basic test file, and if your program has an error that makes it clear you did not do a diff test, you will lose points.
~cs520/bin/DoSubmission.py lab6 file1.c file2.c file3.c file1.h \ file2.h file3.h makefileNote that for this program, just like the assignment, you are free to structure your code however you wish, with a few restrictions. I copy all the files you submit into a directory, and then run make in that directory. That should build your program, meaning you must submit the makefile, as well as all of the different code files required to build your program.