1 /*
2 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
232 }
233
234 /**
235 * Convert a line number table, as returned by the JVMTI
236 * function GetLineNumberTable, to one for another stratum.
237 * Conversion is by overwrite.
238 * Actual line numbers are not returned - just a unique
239 * number (file ID in top 16 bits, line number in
240 * bottom 16 bits) - this is all stepping needs.
241 */
242 void
243 convertLineNumberTable(JNIEnv *env, jclass clazz,
244 jint *entryCountPtr,
245 jvmtiLineNumberEntry **tablePtr) {
246 jvmtiLineNumberEntry *fromEntry = *tablePtr;
247 jvmtiLineNumberEntry *toEntry = *tablePtr;
248 int cnt = *entryCountPtr;
249 int lastLn = 0;
250 int sti;
251
252 loadDebugInfo(env, clazz);
253 if (!isValid()) {
254 return; /* no SDE or not SourceMap - return unchanged */
255 }
256 sti = stratumTableIndex(globalDefaultStratumId);
257 if (sti == baseStratumIndex) {
258 return; /* Java stratum - return unchanged */
259 }
260 LOG_MISC(("SDE is re-ordering the line table"));
261 for (; cnt-->0; ++fromEntry) {
262 int jplsLine = fromEntry->line_number;
263 int lti = stiLineTableIndex(sti, jplsLine);
264 if (lti >= 0) {
265 int fileId = lineTable[lti].fileId;
266 int ln = stiLineNumber(sti, lti, jplsLine);
267 ln += (fileId << 16); /* create line hash */
268 if (ln != lastLn) {
269 lastLn = ln;
270 toEntry->start_location = fromEntry->start_location;
271 toEntry->line_number = ln;
272 ++toEntry;
273 }
274 }
275 }
276 /*LINTED*/
277 *entryCountPtr = (int)(toEntry - *tablePtr);
278 }
279
280 /**
281 * Set back-end wide default stratum ID .
|
1 /*
2 * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
232 }
233
234 /**
235 * Convert a line number table, as returned by the JVMTI
236 * function GetLineNumberTable, to one for another stratum.
237 * Conversion is by overwrite.
238 * Actual line numbers are not returned - just a unique
239 * number (file ID in top 16 bits, line number in
240 * bottom 16 bits) - this is all stepping needs.
241 */
242 void
243 convertLineNumberTable(JNIEnv *env, jclass clazz,
244 jint *entryCountPtr,
245 jvmtiLineNumberEntry **tablePtr) {
246 jvmtiLineNumberEntry *fromEntry = *tablePtr;
247 jvmtiLineNumberEntry *toEntry = *tablePtr;
248 int cnt = *entryCountPtr;
249 int lastLn = 0;
250 int sti;
251
252 if (cnt < 0) {
253 return;
254 }
255 loadDebugInfo(env, clazz);
256 if (!isValid()) {
257 return; /* no SDE or not SourceMap - return unchanged */
258 }
259 sti = stratumTableIndex(globalDefaultStratumId);
260 if (sti == baseStratumIndex || sti < 0) {
261 return; /* Java stratum - return unchanged */
262 }
263 LOG_MISC(("SDE is re-ordering the line table"));
264 for (; cnt-- > 0; ++fromEntry) {
265 int jplsLine = fromEntry->line_number;
266 int lti = stiLineTableIndex(sti, jplsLine);
267 if (lti >= 0) {
268 int fileId = lineTable[lti].fileId;
269 int ln = stiLineNumber(sti, lti, jplsLine);
270 ln += (fileId << 16); /* create line hash */
271 if (ln != lastLn) {
272 lastLn = ln;
273 toEntry->start_location = fromEntry->start_location;
274 toEntry->line_number = ln;
275 ++toEntry;
276 }
277 }
278 }
279 /*LINTED*/
280 *entryCountPtr = (int)(toEntry - *tablePtr);
281 }
282
283 /**
284 * Set back-end wide default stratum ID .
|