Browse Prior Art Database

Format-insensitive debugging using symbol numbers instead of line numbers

IP.com Disclosure Number: IPCOM000021568D
Original Publication Date: 2004-Jan-23
Included in the Prior Art Database: 2004-Jan-23
Document File: 4 page(s) / 89K

Publishing Venue

IBM

Abstract

Languages like Java* can be compiled such that line number information is held within compiled code. This information can be used when diagnosing a problem in the program code as it relates instructions in the compiled code back to the exact line of source which generated the instructions. If the source code file is re-formatted, but not recompiled, then the relationship between source code and line number information in the compiled code is lost. Instead of using line-numbers, the system could use token-numbers instead, thereby allowing the re-formatting of source code files freely, without destroying the relationship between the source code and compiled code.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 47% of the total text.

Page 1 of 4

Format-insensitive debugging using symbol numbers instead of line numbers

Problem Description

Languages like Java* can be compiled such that line number information is held within compiled code.

    This information can be used when diagnosing a problem in the program code as it relates instructions in the compiled code back to the exact line of source which generated the instructions. Details of how line numbers are used within java.class files:
The LineNumberTable attribute has the following format:

LineNumberTable_attribute {

u2 attribute_name_index;

u4 attribute_length;

u2 line_number_table_length;

{ u2 start_pc;

u2 line_number;

} line_number_table[line_number_table_length];

}

The items of the LineNumberTable_attribute structure are as follows:

attribute_name_index

The value of the attribute_name_index item must be a valid index into the constant_pool table. The constant_pool entry at that index must be a CONSTANT_Utf8_info (ยง4.4.7) structure representing the string "LineNumberTable".

attribute_length

The value of the attribute_length item indicates the length of the attribute, excluding the initial six bytes.

line_number_table_length

The value of the line_number_table_length item indicates the number of entries in the line_number_table array.

line_number_table[]

Each entry in the line_number_table array indicates that the line number in the original source file changes at a given point in the code array. Each line_number_table entry must contain the following two items:

start_pc

The value of the start_pc item must indicate the index into the code array at which the code for a new line in the original source file begins. The value of start_pc must be less than the value of the code_length item of the Code attribute of which this LineNumberTable is an attribute.

Page 2 of 4

line_number

The value of the line_number item must give the corresponding line number in the original source file.

    If the source code is re-formatted, extra comments added to the code, or blank lines, then the line number information held within compiled applications no longer relates to the exact statement of source code which generated the instructions being executed.

    The use of source code formatters is much more prevalent than it used to be. For example, the eclipse development platform has one built-in.

    This can be a problem if different people want to re-format source code to their preferred viewing style, and still relate their version of source code back to the same compiled code.

    For example, line 20 in the object code might relate to line 20 before a re-format, and line 23 after the re-format.

    As a result of re-formatting code layout, the relationship between source code, and the generated instructions is lost.

    Problems on line XXX reported from customers using the executable code require the person doing problem diagnosis to obtain the source code which was used to generate that executable code, and view that source code in the format used when it was...