Bytecode Visualizer

bytecode viewer

Inspect, understand and debug Java bytecode, no matter if you have the corresponding source.


To install Bytecode Visualizer via Eclipse Marketplace Client drag and drop the install button into a running Eclipse Indigo workspace.

Typical Use Cases

  • Inspect the result of your own bytecode instrumentation
  • Check the efficiency of your implementation on the bytecode level
  • If you have a third-party or legacy Java application code for which you — for whatever reason — do not have the corresponding source code:
    • Analyze the implementation details
    • Identify error conditions and find bugs using Bytecode Debugger

Features Overview

General

  • Reading bytecode from both *.class files or *.jar archives located in the filesystem.
  • Classes can be also read from a running JVM over Java Debug Interface (JDI)
  • Thorough Eclipse Integration (see also File Associations)
    • Opening class files from Package Explorer, Navigator, stack trace of an Exception in the Console view, clicking the stack and stepping into in Debugger, etc.
    • Open Declaration (CTRL-Click or F3) of a class or method without source code from Java Editor

Bytecode Viewer

Example class visualized in Bytecode Visualizer
Control Flow Graph Panel helps to understand the execution paths of the given method
Signatures of classes, fields and methods rendered as in java source
The opcodes of instructions represented by their mnemonics as specified in The Java Virtual Machine Specification
Comments making it easy to understand the instructions and their parameters
Easy-to-follow scope of exception handlers (see also Preferences)
Line Number Table and Local Variable Table as a comment (see also Preferences)
Two tabs for easy switching between bytecode and source code (see also Preferences)
Control Flow Graph View

Control Flow Graph Panel

Control Flow Graph Panel can be displayed in a split pane (picture above) or in a freely dockable view as shown in the picture on the right (see also Preferences)

Two alternative representations of Control Flow Graphs are supported:

  • Single Instructions (as in the above picture)
  • Basic Blocks (picture on the right)

Class File Outline

Bytecode Visualizer with Outline window
The Class File Outline is both ways synchronized with the Bytecode Viewer: by clicking the method in outline, the viewer scrolls to the given method and vice versa

Bytecode Debugger for Instruction-by-Instruction Debugging

See also: How to Debug Bytecode with Bytecode Visualizer.

Example class visualized with Bytecode Visualizer in Debug Perspective
Single Instruction Stepping Buttons
Supported breakpoints:
  • Class Load breakpoint
  • Field Watchpoint
  • Method Entry breakpoint
Breakpoints can be set by double clicking the left ruler
Dr. Garbage Bytecode Debugger works even for classes without Line Number Table

Customization through Preferences

The behavior of Bytecode Visualizer is adjustable in many respects, just go to

Window > Preferences > Dr. Garbage > Bytecode Visualizer

and adjust the preferences to suit your needs:

  • Where the control flow graph should be displayed: split pane in the editor or separate view
  • Appearance
    • Displaying/not displaying Line Number Table
    • Displaying/not displaying Local Variable Table
    • Rendering/not rendering try/catch blocks
  • Source Code - which editor tab should be active when opening a class file
    • Sourcecode if available
    • Always Source
    • Always Bytecode
  • Graph Colors
  • Syntax Highlighting
  • File Associations: Bytecode Visualizer can be set/unset as a default editor for *.class files on the File Associations preference page:

    Window > Preferences > General > Editors > File Associations

    This influences the behavior of several Eclipse actions, e.g. Open Declaration (CTRL-Click or F3), Step Into in Debugger, etc.