503 // NOTE: At this point there were not enough frames on the stack 504 // to walk to depth. Callers of this method have to check for at_end. 505 } 506 507 508 void vframeStreamCommon::security_next() { 509 if (method()->is_prefixed_native()) { 510 skip_prefixed_method_and_wrappers(); // calls next() 511 } else { 512 next(); 513 } 514 } 515 516 517 void vframeStreamCommon::skip_prefixed_method_and_wrappers() { 518 ResourceMark rm; 519 HandleMark hm; 520 521 int method_prefix_count = 0; 522 char** method_prefixes = JvmtiExport::get_all_native_method_prefixes(&method_prefix_count); 523 KlassHandle prefixed_klass(method()->method_holder()); 524 const char* prefixed_name = method()->name()->as_C_string(); 525 size_t prefixed_name_len = strlen(prefixed_name); 526 int prefix_index = method_prefix_count-1; 527 528 while (!at_end()) { 529 next(); 530 if (method()->method_holder() != prefixed_klass()) { 531 break; // classes don't match, can't be a wrapper 532 } 533 const char* name = method()->name()->as_C_string(); 534 size_t name_len = strlen(name); 535 size_t prefix_len = prefixed_name_len - name_len; 536 if (prefix_len <= 0 || strcmp(name, prefixed_name + prefix_len) != 0) { 537 break; // prefixed name isn't prefixed version of method name, can't be a wrapper 538 } 539 for (; prefix_index >= 0; --prefix_index) { 540 const char* possible_prefix = method_prefixes[prefix_index]; 541 size_t possible_prefix_len = strlen(possible_prefix); 542 if (possible_prefix_len == prefix_len && 543 strncmp(possible_prefix, prefixed_name, prefix_len) == 0) { 544 break; // matching prefix found 545 } 546 } 547 if (prefix_index < 0) { 548 break; // didn't find the prefix, can't be a wrapper 549 } 550 prefixed_name = name; | 503 // NOTE: At this point there were not enough frames on the stack 504 // to walk to depth. Callers of this method have to check for at_end. 505 } 506 507 508 void vframeStreamCommon::security_next() { 509 if (method()->is_prefixed_native()) { 510 skip_prefixed_method_and_wrappers(); // calls next() 511 } else { 512 next(); 513 } 514 } 515 516 517 void vframeStreamCommon::skip_prefixed_method_and_wrappers() { 518 ResourceMark rm; 519 HandleMark hm; 520 521 int method_prefix_count = 0; 522 char** method_prefixes = JvmtiExport::get_all_native_method_prefixes(&method_prefix_count); 523 Klass* prefixed_klass = method()->method_holder(); 524 const char* prefixed_name = method()->name()->as_C_string(); 525 size_t prefixed_name_len = strlen(prefixed_name); 526 int prefix_index = method_prefix_count-1; 527 528 while (!at_end()) { 529 next(); 530 if (method()->method_holder() != prefixed_klass) { 531 break; // classes don't match, can't be a wrapper 532 } 533 const char* name = method()->name()->as_C_string(); 534 size_t name_len = strlen(name); 535 size_t prefix_len = prefixed_name_len - name_len; 536 if (prefix_len <= 0 || strcmp(name, prefixed_name + prefix_len) != 0) { 537 break; // prefixed name isn't prefixed version of method name, can't be a wrapper 538 } 539 for (; prefix_index >= 0; --prefix_index) { 540 const char* possible_prefix = method_prefixes[prefix_index]; 541 size_t possible_prefix_len = strlen(possible_prefix); 542 if (possible_prefix_len == prefix_len && 543 strncmp(possible_prefix, prefixed_name, prefix_len) == 0) { 544 break; // matching prefix found 545 } 546 } 547 if (prefix_index < 0) { 548 break; // didn't find the prefix, can't be a wrapper 549 } 550 prefixed_name = name; |