Skip to content

Exceptions table management

hydrophobis edited this page Mar 25, 2025 · 2 revisions

WIP: EXCEPTIONS DO NOT WORK

Overview

These functions manage the exceptions table section of the Java class file. The exceptions table describes the exception handlers for different sections of the bytecode.


1. Exception Table Management

  • void exceptions_start()
    Initializes the exceptions table. Reserves space for the exception_table_length and starts the counter for entries.

  • void exceptions_end()
    Finalizes the exceptions table by patching the exception_table_length at the reserved location.


2. Utility Functions

  • void patch_u2(size_t pos, uint16_t v)
    Updates a 2-byte value in the buffer (used to finalize exception_table_length).

  • size_t current_offset()
    Returns the current offset in the bytecode buffer.


Usage Example

exceptions_start();
exceptions_end();

This will generate an exceptions table with two entries.


Clone this wiki locally