1 /*
2 * Copyright 2003-2007 Sun Microsystems, Inc. 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.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
385 jvmtiAddrLocationMap** map_ptr,
386 jint *map_length_ptr)
387 {
388 ResourceMark rm;
389 jvmtiAddrLocationMap* map = NULL;
390 jint map_length = 0;
391
392
393 // Generate line numbers using PcDesc and ScopeDesc info
394 methodHandle mh(nm->method());
395
396 if (!mh->is_native()) {
397 PcDesc *pcd;
398 int pcds_in_method;
399
400 pcds_in_method = (nm->scopes_pcs_end() - nm->scopes_pcs_begin());
401 map = NEW_C_HEAP_ARRAY(jvmtiAddrLocationMap, pcds_in_method);
402
403 address scopes_data = nm->scopes_data_begin();
404 for( pcd = nm->scopes_pcs_begin(); pcd < nm->scopes_pcs_end(); ++pcd ) {
405 ScopeDesc sc0(nm, pcd->scope_decode_offset());
406 ScopeDesc *sd = &sc0;
407 while( !sd->is_top() ) { sd = sd->sender(); }
408 int bci = sd->bci();
409 if (bci != InvocationEntryBci) {
410 assert(map_length < pcds_in_method, "checking");
411 map[map_length].start_address = (const void*)pcd->real_pc(nm);
412 map[map_length].location = bci;
413 ++map_length;
414 }
415 }
416 }
417
418 *map_ptr = map;
419 *map_length_ptr = map_length;
420 }
|
1 /*
2 * Copyright 2003-2009 Sun Microsystems, Inc. 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.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
385 jvmtiAddrLocationMap** map_ptr,
386 jint *map_length_ptr)
387 {
388 ResourceMark rm;
389 jvmtiAddrLocationMap* map = NULL;
390 jint map_length = 0;
391
392
393 // Generate line numbers using PcDesc and ScopeDesc info
394 methodHandle mh(nm->method());
395
396 if (!mh->is_native()) {
397 PcDesc *pcd;
398 int pcds_in_method;
399
400 pcds_in_method = (nm->scopes_pcs_end() - nm->scopes_pcs_begin());
401 map = NEW_C_HEAP_ARRAY(jvmtiAddrLocationMap, pcds_in_method);
402
403 address scopes_data = nm->scopes_data_begin();
404 for( pcd = nm->scopes_pcs_begin(); pcd < nm->scopes_pcs_end(); ++pcd ) {
405 ScopeDesc sc0(nm, pcd->scope_decode_offset(), pcd->should_reexecute());
406 ScopeDesc *sd = &sc0;
407 while( !sd->is_top() ) { sd = sd->sender(); }
408 int bci = sd->bci();
409 if (bci != InvocationEntryBci) {
410 assert(map_length < pcds_in_method, "checking");
411 map[map_length].start_address = (const void*)pcd->real_pc(nm);
412 map[map_length].location = bci;
413 ++map_length;
414 }
415 }
416 }
417
418 *map_ptr = map;
419 *map_length_ptr = map_length;
420 }
|