Home | History | Annotate | Download | only in file
      1 /*
      2  * Copyright (C) 2007 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.dx.dex.file;
     18 
     19 /**
     20  * Constants for the dex debug info state machine format.
     21  */
     22 public interface DebugInfoConstants {
     23 
     24     /*
     25      * normal opcodes
     26      */
     27 
     28     /**
     29      * Terminates a debug info sequence for a method.<p>
     30      * Args: none
     31      *
     32      */
     33     static final int DBG_END_SEQUENCE = 0x00;
     34 
     35     /**
     36      * Advances the program counter/address register without emitting
     37      * a positions entry.<p>
     38      *
     39      * Args:
     40      * <ol>
     41      * <li>Unsigned LEB128 &mdash; amount to advance pc by
     42      * </ol>
     43      */
     44     static final int DBG_ADVANCE_PC = 0x01;
     45 
     46     /**
     47      * Advances the line register without emitting
     48      * a positions entry.<p>
     49      *
     50      * Args:
     51      * <ol>
     52      * <li>Signed LEB128 &mdash; amount to change line register by.
     53      * </ol>
     54      */
     55     static final int DBG_ADVANCE_LINE = 0x02;
     56 
     57     /**
     58      * Introduces a local variable at the current address.<p>
     59      *
     60      * Args:
     61      * <ol>
     62      * <li>Unsigned LEB128 &mdash; register that will contain local.
     63      * <li>Unsigned LEB128 &mdash; string index (shifted by 1) of local name.
     64      * <li>Unsigned LEB128 &mdash; type index (shifted by 1) of type.
     65      * </ol>
     66      */
     67     static final int DBG_START_LOCAL = 0x03;
     68 
     69     /**
     70      * Introduces a local variable at the current address with a type
     71      * signature specified.<p>
     72      *
     73      * Args:
     74      * <ol>
     75      * <li>Unsigned LEB128 &mdash; register that will contain local.
     76      * <li>Unsigned LEB128 &mdash; string index (shifted by 1) of local name.
     77      * <li>Unsigned LEB128 &mdash; type index (shifted by 1) of type.
     78      * <li>Unsigned LEB128 &mdash; string index (shifted by 1) of
     79      * type signature.
     80      * </ol>
     81      */
     82     static final int DBG_START_LOCAL_EXTENDED = 0x04;
     83 
     84     /**
     85      * Marks a currently-live local variable as out of scope at the
     86      * current address.<p>
     87      *
     88      * Args:
     89      * <ol>
     90      * <li>Unsigned LEB128 &mdash; register that contained local
     91      * </ol>
     92      */
     93     static final int DBG_END_LOCAL = 0x05;
     94 
     95     /**
     96      * Re-introduces a local variable at the current address. The name
     97      * and type are the same as the last local that was live in the specified
     98      * register.<p>
     99      *
    100      * Args:
    101      * <ol>
    102      * <li>Unsigned LEB128 &mdash; register to re-start.
    103      * </ol>
    104      */
    105     static final int DBG_RESTART_LOCAL = 0x06;
    106 
    107 
    108     /**
    109      * Sets the "prologue_end" state machine register, indicating that the
    110      * next position entry that is added should be considered the end of
    111      * a method prologue (an appropriate place for a method breakpoint).<p>
    112      *
    113      * The prologue_end register is cleared by any special
    114      * ({@code >= OPCODE_BASE}) opcode.
    115      */
    116     static final int DBG_SET_PROLOGUE_END = 0x07;
    117 
    118     /**
    119      * Sets the "epilogue_begin" state machine register, indicating that the
    120      * next position entry that is added should be considered the beginning of
    121      * a method epilogue (an appropriate place to suspend execution before
    122      * method exit).<p>
    123      *
    124      * The epilogue_begin register is cleared by any special
    125      * ({@code >= OPCODE_BASE}) opcode.
    126      */
    127     static final int DBG_SET_EPILOGUE_BEGIN = 0x08;
    128 
    129     /**
    130      * Sets the current file that that line numbers refer to. All subsequent
    131      * line number entries make reference to this source file name, instead
    132      * of the default name specified in code_item.
    133      *
    134      * Args:
    135      * <ol>
    136      * <li>Unsigned LEB128 &mdash; string index (shifted by 1) of source
    137      * file name.
    138      * </ol>
    139      */
    140     static final int DBG_SET_FILE = 0x09;
    141 
    142     /* IF YOU ADD A NEW OPCODE, increase OPCODE_BASE */
    143 
    144     /*
    145      * "special opcode" configuration, essentially what's found in
    146      * the line number program header in DWARFv3, Section 6.2.4
    147      */
    148 
    149     /** the smallest value a special opcode can take */
    150     static final int DBG_FIRST_SPECIAL = 0x0a;
    151     static final int DBG_LINE_BASE = -4;
    152     static final int DBG_LINE_RANGE = 15;
    153     // MIN_INSN_LENGTH is always 1
    154 }
    155