1372 // returns partial path, which makes life painful.
1373
1374 struct _modinfo mi;
1375 mi.addr = addr;
1376 mi.full_path = buf;
1377 mi.buflen = buflen;
1378 int pid = os::current_process_id();
1379 if (enumerate_modules(pid, _locate_module_by_addr, (void *)&mi)) {
1380 // buf already contains path name
1381 if (offset) *offset = addr - mi.base_addr;
1382 return true;
1383 } else {
1384 if (buf) buf[0] = '\0';
1385 if (offset) *offset = -1;
1386 return false;
1387 }
1388 }
1389
1390 bool os::dll_address_to_function_name(address addr, char *buf,
1391 int buflen, int *offset) {
1392 if (Decoder::decode(addr, buf, buflen, offset) == Decoder::no_error) {
1393 return true;
1394 }
1395 if (offset != NULL) *offset = -1;
1396 if (buf != NULL) buf[0] = '\0';
1397 return false;
1398 }
1399
1400 // save the start and end address of jvm.dll into param[0] and param[1]
1401 static int _locate_jvm_dll(int pid, char* mod_fname, address base_addr,
1402 unsigned size, void * param) {
1403 if (!param) return -1;
1404
1405 if (base_addr <= (address)_locate_jvm_dll &&
1406 base_addr+size > (address)_locate_jvm_dll) {
1407 ((address*)param)[0] = base_addr;
1408 ((address*)param)[1] = base_addr + size;
1409 return 1;
1410 }
1411 return 0;
1412 }
|
1372 // returns partial path, which makes life painful.
1373
1374 struct _modinfo mi;
1375 mi.addr = addr;
1376 mi.full_path = buf;
1377 mi.buflen = buflen;
1378 int pid = os::current_process_id();
1379 if (enumerate_modules(pid, _locate_module_by_addr, (void *)&mi)) {
1380 // buf already contains path name
1381 if (offset) *offset = addr - mi.base_addr;
1382 return true;
1383 } else {
1384 if (buf) buf[0] = '\0';
1385 if (offset) *offset = -1;
1386 return false;
1387 }
1388 }
1389
1390 bool os::dll_address_to_function_name(address addr, char *buf,
1391 int buflen, int *offset) {
1392 if (Decoder::decode(addr, buf, buflen, offset)) {
1393 return true;
1394 }
1395 if (offset != NULL) *offset = -1;
1396 if (buf != NULL) buf[0] = '\0';
1397 return false;
1398 }
1399
1400 // save the start and end address of jvm.dll into param[0] and param[1]
1401 static int _locate_jvm_dll(int pid, char* mod_fname, address base_addr,
1402 unsigned size, void * param) {
1403 if (!param) return -1;
1404
1405 if (base_addr <= (address)_locate_jvm_dll &&
1406 base_addr+size > (address)_locate_jvm_dll) {
1407 ((address*)param)[0] = base_addr;
1408 ((address*)param)[1] = base_addr + size;
1409 return 1;
1410 }
1411 return 0;
1412 }
|