if (!isSameObject(env, clazz, cachedClass)) { /* Not the same - swap out the info */
/* Delete existing info */ if ( cachedClass != null ) {
tossGlobalRef(env, &cachedClass);
cachedClass = null;
} if ( sourceDebugExtension!=null ) {
jvmtiDeallocate(sourceDebugExtension);
}
sourceDebugExtension = null;
/* Init info */
lineTable = null;
fileTable = null;
stratumTable = null;
lineTableSize = 0;
fileTableSize = 0;
stratumTableSize = 0;
fileIndex = 0;
lineIndex = 0;
stratumIndex = 0;
currentFileId = 0;
defaultStratumId = null;
defaultStratumIndex = -1;
baseStratumIndex = -2; /* so as not to match -1 above */
sourceMapIsValid = JNI_FALSE;
if (getSourceDebugExtension(clazz, &sourceDebugExtension) ==
JVMTI_ERROR_NONE) {
sdePos = sourceDebugExtension; if (setjmp(jmp_buf_env) == 0) { /* this is the initial (non-error) case, do parse */
decode();
}
}
/* Return 1 if match, 0 if no match */ privateint
patternMatch(char *classname, constchar *pattern) { int pattLen; int compLen; char *start; int offset;
/** *Return1ifp1isaSourceNameforstratumsti, *else,return0.
*/ privateint
searchOneSourceName(int sti, char *p1) { int fileIndexStart = stratumTable[sti].fileIndex; /* one past end */ int fileIndexEnd = stratumTable[sti+1].fileIndex; int ii; for (ii = fileIndexStart; ii < fileIndexEnd; ++ii) { if (patternMatch(fileTable[ii].sourceName, p1)) { return1;
}
} return0;
}
/** *Return1ifp1isaSourceNameforanystratum *else,return0.
*/ int searchAllSourceNames(JNIEnv *env,
jclass clazz, char *p1) { int ii;
loadDebugInfo(env, clazz); if (!isValid()) { return0; /* no SDE or not SourceMap */
}
for (ii = 0; ii < stratumIndex - 1; ++ii) { if (searchOneSourceName(ii, p1) == 1) { return1;
}
} return0;
}
privatevoid fileLine(void) { int hasAbsolute = 0; /* acts as boolean */ int fileId;
String sourceName;
String sourcePath = null;
/* is there an absolute filename? */ if (sdePeek() == '+') {
sdeAdvance();
hasAbsolute = 1;
}
fileId = readNumber();
sourceName = readLine(); if (hasAbsolute == 1) {
sourcePath = readLine();
}
storeFile(fileId, sourceName, sourcePath);
}
privatevoid storeLine(int jplsStart, int jplsEnd, int jplsLineInc, int njplsStart, int njplsEnd, int fileId) {
assureLineTableSize();
lineTable[lineIndex].jplsStart = jplsStart;
lineTable[lineIndex].jplsEnd = jplsEnd;
lineTable[lineIndex].jplsLineInc = jplsLineInc;
lineTable[lineIndex].njplsStart = njplsStart;
lineTable[lineIndex].njplsEnd = njplsEnd;
lineTable[lineIndex].fileId = fileId;
++lineIndex;
}
/** *Parselinetranslationinfo.Syntaxis *<NJ-start-line>[#<file-id>][,<line-count>]: *<J-start-line>[,<line-increment>]CR
*/ privatevoid lineLine(void) { int lineCount = 1; int lineIncrement = 1; int njplsStart; int jplsStart;
njplsStart = readNumber();
/* is there a fileID? */ if (sdePeek() == '#') {
sdeAdvance();
currentFileId = readNumber();
}
/* is there a line count? */ if (sdePeek() == ',') {
sdeAdvance();
lineCount = readNumber();
}
if (sdeRead() != ':') {
syntax("expected ':'");
}
jplsStart = readNumber(); if (sdePeek() == ',') {
sdeAdvance();
lineIncrement = readNumber();
}
ignoreLine(); /* flush the rest */
privateint stiLineTableIndex(int sti, int jplsLine) { int i; int lineIndexStart; int lineIndexEnd;
lineIndexStart = stratumTable[sti].lineIndex; /* one past end */
lineIndexEnd = stratumTable[sti+1].lineIndex; for (i = lineIndexStart; i < lineIndexEnd; ++i) { if ((jplsLine >= lineTable[i].jplsStart) &&
(jplsLine <= lineTable[i].jplsEnd)) { return i;
}
} return -1;
}
privateint stiLineNumber(int sti, int lti, int jplsLine) { return lineTable[lti].njplsStart +
(((jplsLine - lineTable[lti].jplsStart) /
lineTable[lti].jplsLineInc));
}
privateint fileTableIndex(int sti, int fileId) { int i; int fileIndexStart = stratumTable[sti].fileIndex; /* one past end */ int fileIndexEnd = stratumTable[sti+1].fileIndex; for (i = fileIndexStart; i < fileIndexEnd; ++i) { if (fileTable[i].fileId == fileId) { return i;
}
} return -1;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.