767 }
768 }
769
770 return JDWPTRANSPORT_ERROR_NONE;
771 }
772
773 static jdwpTransportError JNICALL
774 socketTransport_getLastError(jdwpTransportEnv* env, char** msgP) {
775 char *msg = (char *)dbgsysTlsGet(tlsIndex);
776 if (msg == NULL) {
777 return JDWPTRANSPORT_ERROR_MSG_NOT_AVAILABLE;
778 }
779 *msgP = (*callback->alloc)((int)strlen(msg)+1);
780 if (*msgP == NULL) {
781 return JDWPTRANSPORT_ERROR_OUT_OF_MEMORY;
782 }
783 strcpy(*msgP, msg);
784 return JDWPTRANSPORT_ERROR_NONE;
785 }
786
787 JNIEXPORT jint JNICALL
788 jdwpTransport_OnLoad(JavaVM *vm, jdwpTransportCallback* cbTablePtr,
789 jint version, jdwpTransportEnv** result)
790 {
791 if (version != JDWPTRANSPORT_VERSION_1_0) {
792 return JNI_EVERSION;
793 }
794 if (initialized) {
795 /*
796 * This library doesn't support multiple environments (yet)
797 */
798 return JNI_EEXIST;
799 }
800 initialized = JNI_TRUE;
801 jvm = vm;
802 callback = cbTablePtr;
803
804 /* initialize interface table */
805 interface.GetCapabilities = &socketTransport_getCapabilities;
806 interface.Attach = &socketTransport_attach;
807 interface.StartListening = &socketTransport_startListening;
|
767 }
768 }
769
770 return JDWPTRANSPORT_ERROR_NONE;
771 }
772
773 static jdwpTransportError JNICALL
774 socketTransport_getLastError(jdwpTransportEnv* env, char** msgP) {
775 char *msg = (char *)dbgsysTlsGet(tlsIndex);
776 if (msg == NULL) {
777 return JDWPTRANSPORT_ERROR_MSG_NOT_AVAILABLE;
778 }
779 *msgP = (*callback->alloc)((int)strlen(msg)+1);
780 if (*msgP == NULL) {
781 return JDWPTRANSPORT_ERROR_OUT_OF_MEMORY;
782 }
783 strcpy(*msgP, msg);
784 return JDWPTRANSPORT_ERROR_NONE;
785 }
786
787 jint JNICALL
788 jdwpTransport_OnLoad(JavaVM *vm, jdwpTransportCallback* cbTablePtr,
789 jint version, jdwpTransportEnv** result)
790 {
791 if (version != JDWPTRANSPORT_VERSION_1_0) {
792 return JNI_EVERSION;
793 }
794 if (initialized) {
795 /*
796 * This library doesn't support multiple environments (yet)
797 */
798 return JNI_EEXIST;
799 }
800 initialized = JNI_TRUE;
801 jvm = vm;
802 callback = cbTablePtr;
803
804 /* initialize interface table */
805 interface.GetCapabilities = &socketTransport_getCapabilities;
806 interface.Attach = &socketTransport_attach;
807 interface.StartListening = &socketTransport_startListening;
|