./dis_class ../classfile/tests/Pathetic.class Method Name:There 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. The starter code is currently about to read in the entire class file, and print out information found in the class file in human readable form, but it currently uses the default printing function, which you don't want to be using, because it prints way too much stuff out; you only want information about one method.2a b7 00 01 b1 Method Name: main b1 ./dis_class ../classfile/tests/Multinewarray.class Method Name: 2a b7 00 01 b1 Method Name: main 05 08 c5 00 02 02 4c b1
The format is as follows: Each method should be printed on two lines. The first line should contain the words, "Method Name:" followed by a space, followed by the method's name as looked up in the constant table. On the next line the entire contents of the method character string should be printed out, one at a time. The characters should be printed in hex, always printing 2 characters, followed by a space after each character, including the last character. Note that we want only the code, not the entire contents of the attribute_info field.
-bash-4.2$ ./dis_class ../classfile/tests/Pathetic.class > Pathetic.mine -bash-4.2$ ~cs520/lab5_ref ../classfile/tests/Pathetic.class > Pathetic.ref -bash-4.2$ diff Pathetic.mine Pathetic.ref -bash-4.2$ cat Pathetic.mine Method Name:The > 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.2a b7 00 01 b1 Method Name: main b1 -bash-4.2$
makeand the make tool will construct your program.
~cs520/bin/DoSubmission.py lab5 disassemble.cI will use my own copy of the makefile and other components. The only difference is I will call disassemble(cf) instead of print_classfile(cf, stdout) and I will have disasemble.h not commented out.
In addition, remember, you may lose points if your program is not properly structured or adequately documented. Coding guidelines are given on the course overview webpage.