Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

CHAPTER  2 

Using the AsmTools

This chapter describes general principles and techniques for using the AsmTools. For detailed information about the syntax of each component and command line examples, see Appendix B. If no command-line options are provided or they are invalid, the tools provide error messages and usage information. To get the help message, launch AsmTools without any parameters as follows:

...

The help system describes how to use all of the AsmTools components and contains the following topics described in this chapter.

Table of Contents
maxLevel3
minLevel2

...

Assemblers and Dissassemblers

Assembly and Dissassembly are reflexive operations.  You can feed one tool into another to achieve the same file.  For example

java -jar asmtools.jar jdec foo.class # produces foo.jcod
java -jar asmtools.jar jcod foo.jcod # produces foo.class

For a given class foo.class, the product of dissassembly, and re-assembly is the same foo.class.

 

...

JASM vs. JCod

Which format to use depends on the task you are trying to do. We can describe some generalizations of when you might wish to use the JASM format versus the JCOD format.  

...

  •  To examine specific parts of a classfile
    • eg. constant-pool (for dependency analysis)
    • constant values
    • inheritance chains (super classes)
    • implementation fullfillment (interface resolution)

 

...


Tool Usage

Asmtools consist of five utilities:

...

Note - See the following sections for the options associated with each tool.

...

 

...

JASM

jasm is an assembler that accepts a text file based on the JASM Specification, and produces a .class file for use with a Java Virtual Machine.

...

To use jasm, specify the filename of the .jasm file you wish to develop a .class file from. The Jasm Specification contains information relative to the format of a .jasm file.

 

...

JDIS

jdis is a disassembler that accepts a .class file, and prints the plain-text translation of jasm source file to the standard output.

...

Refer to the Jasm Assembler documentation for information on the structure of the resultant .jasm file.

 

...

JCod

jcoder jcod is a low-level assembler that accepts text based on the Jcoder Specification. and produces a .class file for use with a Java Virtual Machine. JcoderJcod's primary use is as a tool for producing specialized tests for testing a JVM implementation.

Usage:

$ java -jar asmtools.jar jcoder jcod [options] filename.jcod

or

$ java -cp asmtools.jar com.sun.asmtools.jcoderjcod.Main [options] filename.jcod

Options:

-version Print jcoder jcod version

-d destdir Specifies a directory to place resulting .class files. If a destdir is not provided, the .class file will be written in the current directory.

-nowrite Do not write resulting .class files. This option may be used to verify the integrity of your source jcoder jcod file.

Description:

To use jcoderjcod, specify the filename.jcod file you wish to develop a .class file from. The Jcoder Jcod Specification contains information relative to the format of a .jcod file.

 

...

JDec

jdec is a low-level disassembler that accepts .class file and prints a plain text of jcod source file to the standard output.

...

To use jdec, specify a filename.class that you wish to disassemble.
You may redirect standard output to a filename.jcod file. jdec will disassemble .class file and create a resultant .jcod plain source file.

Refer to the Jcoder Jcod Low-Level Assembler documentation for information on the structure of the resultant .jcod file.

 

...

JCDec

jcdec is a low-level disassembler that accepts .class file and prints a plain text of jcod source file to the standard output.

...

To use jcdec, specify a filename.exp or filename.cap that you wish to disassemble.
You may redirect standard output to a filename.jcod file. jcdec will disassemble the file and create a resultant .jcod plain source file.

Refer to the Jcoder Jcod Low-Level Assembler documentation for information on the structure of the resultant .jcodfile.

...

 

Chapter 3