jdk/src/share/back/SDE.c
author cl
Thu, 21 Nov 2013 09:23:03 -0800
changeset 21741 8cd632761233
parent 19610 2073a59a2787
child 23010 6dadb192ad81
permissions -rw-r--r--
Added tag jdk8-b117 for changeset 03f1370d6d68
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#include <setjmp.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
#include "util.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#include "SDE.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
19610
2073a59a2787 8023786: (jdk) setjmp/longjmp changes the process signal mask on OS X
sla
parents: 5506
diff changeset
    31
#ifdef __APPLE__
2073a59a2787 8023786: (jdk) setjmp/longjmp changes the process signal mask on OS X
sla
parents: 5506
diff changeset
    32
/* use setjmp/longjmp versions that do not save/restore the signal mask */
2073a59a2787 8023786: (jdk) setjmp/longjmp changes the process signal mask on OS X
sla
parents: 5506
diff changeset
    33
#define setjmp _setjmp
2073a59a2787 8023786: (jdk) setjmp/longjmp changes the process signal mask on OS X
sla
parents: 5506
diff changeset
    34
#define longjmp _longjmp
2073a59a2787 8023786: (jdk) setjmp/longjmp changes the process signal mask on OS X
sla
parents: 5506
diff changeset
    35
#endif
2073a59a2787 8023786: (jdk) setjmp/longjmp changes the process signal mask on OS X
sla
parents: 5506
diff changeset
    36
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * This SourceDebugExtension code does not
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * allow concurrent translation - due to caching method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * A separate thread setting the default stratum ID
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * is, however, fine.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
#define INIT_SIZE_FILE 10
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
#define INIT_SIZE_LINE 100
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
#define INIT_SIZE_STRATUM 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
#define BASE_STRATUM_NAME "Java"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
#define null NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
#define true JNI_TRUE
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
#define false JNI_FALSE
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
#define String char *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
#define private static
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
typedef struct {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
  int fileId;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
  String sourceName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
  String sourcePath; // do not read - use accessor
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
  int isConverted;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
} FileTableRecord;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
typedef struct {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    int jplsStart;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    int jplsEnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    int jplsLineInc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    int njplsStart;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    int njplsEnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    int fileId;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
} LineTableRecord;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
typedef struct {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    String id;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    int fileIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    int lineIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
} StratumTableRecord;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
/* back-end wide value for default stratum */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
private String globalDefaultStratumId = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
/* reference type default */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
private String defaultStratumId = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
private jclass cachedClass = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
private FileTableRecord* fileTable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
private LineTableRecord* lineTable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
private StratumTableRecord* stratumTable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
private int fileTableSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
private int lineTableSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
private int stratumTableSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
private int fileIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
private int lineIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
private int stratumIndex = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
private int currentFileId;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
private int defaultStratumIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
private int baseStratumIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
private char* sdePos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
private char* jplsFilename = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
private char* NullString = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
/* mangled in parse, cannot be parsed.  Must be kept. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
private String sourceDebugExtension;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
private jboolean sourceMapIsValid;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
private jmp_buf jmp_buf_env;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
private int stratumTableIndex(String stratumId);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
private int stiLineTableIndex(int sti, int jplsLine);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
private int stiLineNumber(int sti, int lti, int jplsLine);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
private void decode(void);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
private void ignoreWhite(void);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
private jboolean isValid(void);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    private void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    loadDebugInfo(JNIEnv *env, jclass clazz) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        if (!isSameObject(env, clazz, cachedClass)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
            /* Not the same - swap out the info */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
            /* Delete existing info */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
            if ( cachedClass != null ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
                tossGlobalRef(env, &cachedClass);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
                cachedClass = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
            if ( sourceDebugExtension!=null ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
                jvmtiDeallocate(sourceDebugExtension);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
            sourceDebugExtension = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
            /* Init info */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
            lineTable = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
            fileTable = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
            stratumTable = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
            lineTableSize = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
            fileTableSize = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
            stratumTableSize = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
            fileIndex = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
            lineIndex = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
            stratumIndex = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
            currentFileId = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
            defaultStratumId = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
            defaultStratumIndex = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
            baseStratumIndex = -2; /* so as not to match -1 above */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
            sourceMapIsValid = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
            if (getSourceDebugExtension(clazz, &sourceDebugExtension) ==
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
                JVMTI_ERROR_NONE) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
                sdePos = sourceDebugExtension;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
                if (setjmp(jmp_buf_env) == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
                    /* this is the initial (non-error) case, do parse */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
                    decode();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
            cachedClass = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
            saveGlobalRef(env, clazz, &cachedClass);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    /* Return 1 if match, 0 if no match */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
    private int
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    patternMatch(char *classname, const char *pattern) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
        int pattLen;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
        int compLen;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        char *start;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        int offset;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
        if (pattern == NULL || classname == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
            return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        pattLen = (int)strlen(pattern);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        if ((pattern[0] != '*') && (pattern[pattLen-1] != '*')) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
            return strcmp(pattern, classname) == 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
        compLen = pattLen - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        offset = (int)strlen(classname) - compLen;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
        if (offset < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
            return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
        if (pattern[0] == '*') {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
            pattern++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
            start = classname + offset;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
        }  else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
            start = classname;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        return strncmp(pattern, start, compLen) == 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * Return 1 if p1 is a SourceName for stratum sti,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     * else, return 0.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    private int
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    searchOneSourceName(int sti, char *p1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        int fileIndexStart = stratumTable[sti].fileIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        /* one past end */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        int fileIndexEnd = stratumTable[sti+1].fileIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        int ii;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        for (ii = fileIndexStart; ii < fileIndexEnd; ++ii) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
            if (patternMatch(fileTable[ii].sourceName, p1)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
              return 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * Return 1 if p1 is a SourceName for any stratum
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     * else, return 0.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    int searchAllSourceNames(JNIEnv *env,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
                             jclass clazz,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
                             char *p1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        int ii;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
        loadDebugInfo(env, clazz);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        if (!isValid()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
          return 0; /* no SDE or not SourceMap */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        for (ii = 0; ii < stratumIndex - 1; ++ii) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
            if (searchOneSourceName(ii, p1) == 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
                return 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * Convert a line number table, as returned by the JVMTI
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * function GetLineNumberTable, to one for another stratum.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * Conversion is by overwrite.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * Actual line numbers are not returned - just a unique
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     * number (file ID in top 16 bits, line number in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * bottom 16 bits) - this is all stepping needs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
    void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
    convertLineNumberTable(JNIEnv *env, jclass clazz,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
                           jint *entryCountPtr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
                           jvmtiLineNumberEntry **tablePtr) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
        jvmtiLineNumberEntry *fromEntry = *tablePtr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
        jvmtiLineNumberEntry *toEntry = *tablePtr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
        int cnt = *entryCountPtr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
        int lastLn = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
        int sti;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
        loadDebugInfo(env, clazz);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
        if (!isValid()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
            return; /* no SDE or not SourceMap - return unchanged */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
        sti = stratumTableIndex(globalDefaultStratumId);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
        if (sti == baseStratumIndex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
            return; /* Java stratum - return unchanged */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
        LOG_MISC(("SDE is re-ordering the line table"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
        for (; cnt-->0; ++fromEntry) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
            int jplsLine = fromEntry->line_number;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
            int lti = stiLineTableIndex(sti, jplsLine);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
            if (lti >= 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
                int fileId = lineTable[lti].fileId;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
                int ln = stiLineNumber(sti, lti, jplsLine);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
                ln += (fileId << 16); /* create line hash */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
                if (ln != lastLn) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
                    lastLn = ln;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
                    toEntry->start_location = fromEntry->start_location;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
                    toEntry->line_number = ln;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
                    ++toEntry;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
        /*LINTED*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
        *entryCountPtr = (int)(toEntry - *tablePtr);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * Set back-end wide default stratum ID .
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
    setGlobalStratumId(char *id) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
        globalDefaultStratumId = id;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
    private void syntax(String msg) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
        char buf[200];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
        (void)snprintf(buf, sizeof(buf),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
                "bad SourceDebugExtension syntax - position %d - %s\n",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
                /*LINTED*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
                (int)(sdePos-sourceDebugExtension),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
                msg);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
        JDI_ASSERT_FAILED(buf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
        longjmp(jmp_buf_env, 1);  /* abort parse */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
    private char sdePeek(void) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
        if (*sdePos == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
            syntax("unexpected EOF");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
        return *sdePos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
    private char sdeRead(void) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
        if (*sdePos == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
            syntax("unexpected EOF");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
        return *sdePos++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
    private void sdeAdvance(void) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
        sdePos++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
    private void assureLineTableSize(void) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
        if (lineIndex >= lineTableSize) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
            size_t allocSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
            LineTableRecord* new_lineTable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
            int new_lineTableSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
            new_lineTableSize = lineTableSize == 0?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
                                  INIT_SIZE_LINE :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
                                  lineTableSize * 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
            allocSize = new_lineTableSize * (int)sizeof(LineTableRecord);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
            new_lineTable = jvmtiAllocate((jint)allocSize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
            if ( new_lineTable == NULL ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
                EXIT_ERROR(AGENT_ERROR_OUT_OF_MEMORY, "SDE line table");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
            if ( lineTable!=NULL ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
                (void)memcpy(new_lineTable, lineTable,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
                        lineTableSize * (int)sizeof(LineTableRecord));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
                jvmtiDeallocate(lineTable);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
            lineTable     = new_lineTable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
            lineTableSize = new_lineTableSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
    private void assureFileTableSize(void) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
        if (fileIndex >= fileTableSize) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
            size_t allocSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
            FileTableRecord* new_fileTable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
            int new_fileTableSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
            new_fileTableSize = fileTableSize == 0?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
                                  INIT_SIZE_FILE :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
                                  fileTableSize * 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
            allocSize = new_fileTableSize * (int)sizeof(FileTableRecord);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
            new_fileTable = jvmtiAllocate((jint)allocSize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
            if ( new_fileTable == NULL ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
                EXIT_ERROR(AGENT_ERROR_OUT_OF_MEMORY, "SDE file table");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
            if ( fileTable!=NULL ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
                (void)memcpy(new_fileTable, fileTable,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
                        fileTableSize * (int)sizeof(FileTableRecord));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
                jvmtiDeallocate(fileTable);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
            fileTable     = new_fileTable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
            fileTableSize = new_fileTableSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
    private void assureStratumTableSize(void) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
        if (stratumIndex >= stratumTableSize) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
            size_t allocSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
            StratumTableRecord* new_stratumTable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
            int new_stratumTableSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
            new_stratumTableSize = stratumTableSize == 0?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
                                  INIT_SIZE_STRATUM :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
                                  stratumTableSize * 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
            allocSize = new_stratumTableSize * (int)sizeof(StratumTableRecord);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
            new_stratumTable = jvmtiAllocate((jint)allocSize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
            if ( new_stratumTable == NULL ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
                EXIT_ERROR(AGENT_ERROR_OUT_OF_MEMORY, "SDE stratum table");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
            if ( stratumTable!=NULL ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
                (void)memcpy(new_stratumTable, stratumTable,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
                        stratumTableSize * (int)sizeof(StratumTableRecord));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
                jvmtiDeallocate(stratumTable);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
            stratumTable     = new_stratumTable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
            stratumTableSize = new_stratumTableSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
    private String readLine(void) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
        char *initialPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
        char ch;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
        ignoreWhite();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
        initialPos = sdePos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
        while (((ch = *sdePos) != '\n') && (ch != '\r')) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
            if (ch == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
                syntax("unexpected EOF");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
            ++sdePos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
        *sdePos++ = 0; /* null terminate string - mangles SDE */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
        /* check for CR LF */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
        if ((ch == '\r') && (*sdePos == '\n')) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
            ++sdePos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
        ignoreWhite(); /* leading white */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
        return initialPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
    private int defaultStratumTableIndex(void) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
        if ((defaultStratumIndex == -1) && (defaultStratumId != null)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
            defaultStratumIndex =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
                stratumTableIndex(defaultStratumId);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
        return defaultStratumIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
    private int stratumTableIndex(String stratumId) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
        int i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
        if (stratumId == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
            return defaultStratumTableIndex();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
        for (i = 0; i < (stratumIndex-1); ++i) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
            if (strcmp(stratumTable[i].id, stratumId) == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
                return i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
        return defaultStratumTableIndex();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
/*****************************
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
 * below functions/methods are written to compile under either Java or C
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
 * Needed support functions:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
 *   sdePeek()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
 *   sdeRead()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
 *   sdeAdvance()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
 *   readLine()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
 *   assureLineTableSize()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
 *   assureFileTableSize()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
 *   assureStratumTableSize()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
 *   syntax(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
 *   stratumTableIndex(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
 * Needed support variables:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
 *   lineTable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
 *   lineIndex
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
 *   fileTable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
 *   fileIndex
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
 *   currentFileId
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
 * Needed types:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
 *   String
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
 * Needed constants:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
 *   NullString
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
    private void ignoreWhite(void) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
        char ch;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
        while (((ch = sdePeek()) == ' ') || (ch == '\t')) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
            sdeAdvance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
    private void ignoreLine(void) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
        char ch;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
        do {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
           ch = sdeRead();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
        } while ((ch != '\n') && (ch != '\r'));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
        /* check for CR LF */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
        if ((ch == '\r') && (sdePeek() == '\n')) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
            sdeAdvance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
        ignoreWhite(); /* leading white */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
    private int readNumber(void) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
        int value = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
        char ch;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
        ignoreWhite();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
        while (((ch = sdePeek()) >= '0') && (ch <= '9')) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
            sdeAdvance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
            value = (value * 10) + ch - '0';
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
        ignoreWhite();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
        return value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
    private void storeFile(int fileId, String sourceName, String sourcePath) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
        assureFileTableSize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
        fileTable[fileIndex].fileId = fileId;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
        fileTable[fileIndex].sourceName = sourceName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
        fileTable[fileIndex].sourcePath = sourcePath;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
        ++fileIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
    private void fileLine(void) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
        int hasAbsolute = 0; /* acts as boolean */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
        int fileId;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
        String sourceName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
        String sourcePath = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
        /* is there an absolute filename? */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
        if (sdePeek() == '+') {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
            sdeAdvance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
            hasAbsolute = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
        fileId = readNumber();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
        sourceName = readLine();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
        if (hasAbsolute == 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
            sourcePath = readLine();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
        storeFile(fileId, sourceName, sourcePath);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
    private void storeLine(int jplsStart, int jplsEnd, int jplsLineInc,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
                  int njplsStart, int njplsEnd, int fileId) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
        assureLineTableSize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
        lineTable[lineIndex].jplsStart = jplsStart;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
        lineTable[lineIndex].jplsEnd = jplsEnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
        lineTable[lineIndex].jplsLineInc = jplsLineInc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
        lineTable[lineIndex].njplsStart = njplsStart;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
        lineTable[lineIndex].njplsEnd = njplsEnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
        lineTable[lineIndex].fileId = fileId;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
        ++lineIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
     * Parse line translation info.  Syntax is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
     *     <NJ-start-line> [ # <file-id> ] [ , <line-count> ] :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
     *                 <J-start-line> [ , <line-increment> ] CR
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
    private void lineLine(void) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
        int lineCount = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
        int lineIncrement = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
        int njplsStart;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
        int jplsStart;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
        njplsStart = readNumber();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
        /* is there a fileID? */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
        if (sdePeek() == '#') {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
            sdeAdvance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
            currentFileId = readNumber();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
        /* is there a line count? */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
        if (sdePeek() == ',') {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
            sdeAdvance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
            lineCount = readNumber();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
        if (sdeRead() != ':') {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
            syntax("expected ':'");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
        jplsStart = readNumber();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
        if (sdePeek() == ',') {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
            sdeAdvance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
            lineIncrement = readNumber();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
        ignoreLine(); /* flush the rest */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
        storeLine(jplsStart,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
                  jplsStart + (lineCount * lineIncrement) -1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
                  lineIncrement,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
                  njplsStart,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
                  njplsStart + lineCount -1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
                  currentFileId);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
     * Until the next stratum section, everything after this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
     * is in stratumId - so, store the current indicies.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
    private void storeStratum(String stratumId) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
        /* remove redundant strata */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
        if (stratumIndex > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
            if ((stratumTable[stratumIndex-1].fileIndex
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
                                            == fileIndex) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
                (stratumTable[stratumIndex-1].lineIndex
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
                                            == lineIndex)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
                /* nothing changed overwrite it */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
                --stratumIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
        /* store the results */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
        assureStratumTableSize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
        stratumTable[stratumIndex].id = stratumId;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
        stratumTable[stratumIndex].fileIndex = fileIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
        stratumTable[stratumIndex].lineIndex = lineIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
        ++stratumIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
        currentFileId = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
     * The beginning of a stratum's info
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
    private void stratumSection(void) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
        storeStratum(readLine());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
    private void fileSection(void) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
        ignoreLine();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
        while (sdePeek() != '*') {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
            fileLine();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
    private void lineSection(void) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
        ignoreLine();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
        while (sdePeek() != '*') {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
            lineLine();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
     * Ignore a section we don't know about.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
    private void ignoreSection(void) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
        ignoreLine();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
        while (sdePeek() != '*') {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
            ignoreLine();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
     * A base "Java" stratum is always available, though
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
     * it is not in the SourceDebugExtension.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
     * Create the base stratum.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
    private void createJavaStratum(void) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
        baseStratumIndex = stratumIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
        storeStratum(BASE_STRATUM_NAME);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
        storeFile(1, jplsFilename, NullString);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
        /* JPL line numbers cannot exceed 65535 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
        storeLine(1, 65536, 1, 1, 65536, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
        storeStratum("Aux"); /* in case they don't declare */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
     * Decode a SourceDebugExtension which is in SourceMap format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
     * This is the entry point into the recursive descent parser.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
    private void decode(void) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
        /* check for "SMAP" - allow EOF if not ours */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
        if (strlen(sourceDebugExtension) <= 4 ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
            (sdeRead() != 'S') ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
            (sdeRead() != 'M') ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
            (sdeRead() != 'A') ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
            (sdeRead() != 'P')) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
            return; /* not our info */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
        ignoreLine(); /* flush the rest */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
        jplsFilename = readLine();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
        defaultStratumId = readLine();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
        createJavaStratum();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
        while (true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
            if (sdeRead() != '*') {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
                syntax("expected '*'");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
            switch (sdeRead()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
                case 'S':
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
                    stratumSection();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
                case 'F':
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
                    fileSection();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
                case 'L':
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
                    lineSection();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
                case 'E':
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
                    /* set end points */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
                    storeStratum("*terminator*");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
                    sourceMapIsValid = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
                    return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
                default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
                    ignoreSection();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
    /***************** query functions ***********************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
    private int stiLineTableIndex(int sti, int jplsLine) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
        int i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
        int lineIndexStart;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
        int lineIndexEnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
        lineIndexStart = stratumTable[sti].lineIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
        /* one past end */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
        lineIndexEnd = stratumTable[sti+1].lineIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
        for (i = lineIndexStart; i < lineIndexEnd; ++i) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
            if ((jplsLine >= lineTable[i].jplsStart) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
                            (jplsLine <= lineTable[i].jplsEnd)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
                return i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
        return -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
    private int stiLineNumber(int sti, int lti, int jplsLine) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
        return lineTable[lti].njplsStart +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
                (((jplsLine - lineTable[lti].jplsStart) /
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
                                   lineTable[lti].jplsLineInc));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
    private int fileTableIndex(int sti, int fileId) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
        int i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
        int fileIndexStart = stratumTable[sti].fileIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
        /* one past end */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
        int fileIndexEnd = stratumTable[sti+1].fileIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
        for (i = fileIndexStart; i < fileIndexEnd; ++i) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
            if (fileTable[i].fileId == fileId) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
                return i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
        return -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
    private int stiFileTableIndex(int sti, int lti) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
        return fileTableIndex(sti, lineTable[lti].fileId);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
    private jboolean isValid(void) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
        return sourceMapIsValid;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
    }