comparison src/share/vm/prims/jvmtiEnv.cpp @ 6203:04ade88d9712

6294277: java -Xdebug crashes on SourceDebugExtension attribute larger than 64K Reviewed-by: sspitsyn, dholmes, coleenp, kamg
author fparain
date Mon, 09 Jul 2012 01:28:37 -0700
parents d2a62e0f25eb
children 957c266d8bc5 da91efe96a93
comparison
equal deleted inserted replaced
6202:5a1f452f8f90 6203:04ade88d9712
1 /* 1 /*
2 * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 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 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
2539 klassOop k = java_lang_Class::as_klassOop(k_mirror); 2539 klassOop k = java_lang_Class::as_klassOop(k_mirror);
2540 NULL_CHECK(k, JVMTI_ERROR_INVALID_CLASS); 2540 NULL_CHECK(k, JVMTI_ERROR_INVALID_CLASS);
2541 if (!Klass::cast(k)->oop_is_instance()) { 2541 if (!Klass::cast(k)->oop_is_instance()) {
2542 return JVMTI_ERROR_ABSENT_INFORMATION; 2542 return JVMTI_ERROR_ABSENT_INFORMATION;
2543 } 2543 }
2544 Symbol* sdeOop = instanceKlass::cast(k)->source_debug_extension(); 2544 char* sde = instanceKlass::cast(k)->source_debug_extension();
2545 NULL_CHECK(sdeOop, JVMTI_ERROR_ABSENT_INFORMATION); 2545 NULL_CHECK(sde, JVMTI_ERROR_ABSENT_INFORMATION);
2546 2546
2547 { 2547 {
2548 JavaThread* current_thread = JavaThread::current(); 2548 *source_debug_extension_ptr = (char *) jvmtiMalloc(strlen(sde)+1);
2549 ResourceMark rm(current_thread); 2549 strcpy(*source_debug_extension_ptr, sde);
2550 const char* sdecp = (const char*) sdeOop->as_C_string();
2551 *source_debug_extension_ptr = (char *) jvmtiMalloc(strlen(sdecp)+1);
2552 strcpy(*source_debug_extension_ptr, sdecp);
2553 } 2550 }
2554 } 2551 }
2555 2552
2556 return JVMTI_ERROR_NONE; 2553 return JVMTI_ERROR_NONE;
2557 } /* end GetSourceDebugExtension */ 2554 } /* end GetSourceDebugExtension */