2013-09-30 2 views
1

.java 파일에서 내 게임으로 String을 반환하려고하지만 일부 SIG 오류가 발생합니다. 하기 위해JNI를 사용하는 EDK 메서드에서 Const char * 반환

const char* s3eExtensionGetRegisterationID_platform() 

{ 
    JNIEnv* env = s3eEdkJNIGetEnv(); 
    JavaString res((jstring)env->CallObjectMethod(g_Obj, g_s3eExtensionGetRegisterationID); 
    return getCString((jstring)res); 
} 

내가해야 할 것 아무것도가 있나요 -

const char* s3eExtentionGetRegisterationID() run_on_os_thread 

나는이 같은 JNI 방법을 편집 할 수 s3eExtension_platform.cpp 수정 - 다음과 같은 방법 s4e에 선언 문자열을 가져 오십시오. 내가 점점 오전 오류입니다 -

내가 너무 이러한 방법을 선언 할 필요가 있음을 잊어
09-30 20:45:28.183: A/libc(2662): Fatal signal 11 (SIGSEGV) at 0xf400001d (code=1), thread 2678 (Thread-787) 
09-30 20:45:28.293: I/DEBUG(1976): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 
09-30 20:45:28.293: I/DEBUG(1976): Build fingerprint: 'SEMC/LT22i_1261-7821/LT22i:4.1.2/6.2.A.1.100/m_v_zg:user/release-keys' 
09-30 20:45:28.293: I/DEBUG(1976): pid: 2662, tid: 2678, name: Thread-787 >>> com.creator.test <<< 
09-30 20:45:28.293: I/DEBUG(1976): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr f400001d 
09-30 20:45:28.393: I/DEBUG(1976):  r0 0bffffe2 r1 00000000 r2 00000000 r3 f400001d 
09-30 20:45:28.393: I/DEBUG(1976):  r4 59c01590 r5 59c01590 r6 00000000 r7 f400001d 
09-30 20:45:28.393: I/DEBUG(1976):  r8 5a04ff94 r9 00000004 sl 59c01594 fp 00000000 
09-30 20:45:28.393: I/DEBUG(1976):  ip 00000000 sp 5a04fda8 lr 5c423564 pc 5c4566ec cpsr 60000010 
09-30 20:45:28.393: I/DEBUG(1976):  d0 0000000000000000 d1 0000000000000000 
09-30 20:45:28.393: I/DEBUG(1976):  d2 0000000000000000 d3 0000000000000000 
09-30 20:45:28.393: I/DEBUG(1976):  d4 0066007200750053 d5 0054006500630061 
09-30 20:45:28.393: I/DEBUG(1976):  d6 0075007400780065 d7 0000000000650072 
09-30 20:45:28.393: I/DEBUG(1976):  d8 0000000000000000 d9 0000000000000000 
09-30 20:45:28.393: I/DEBUG(1976):  d10 0000000000000000 d11 0000000000000000 
09-30 20:45:28.393: I/DEBUG(1976):  d12 0000000000000000 d13 0000000000000000 
09-30 20:45:28.393: I/DEBUG(1976):  d14 0000000000000000 d15 0000000000000000 
09-30 20:45:28.393: I/DEBUG(1976):  d16 0000000000000000 d17 0000000000000000 
09-30 20:45:28.393: I/DEBUG(1976):  d18 0000000000000000 d19 0000000000000000 
09-30 20:45:28.393: I/DEBUG(1976):  d20 0000000000000000 d21 3ff0000000000000 
09-30 20:45:28.393: I/DEBUG(1976):  d22 8000000000000000 d23 0000000000000000 
09-30 20:45:28.393: I/DEBUG(1976):  d24 0000000000000000 d25 8000000000000000 
09-30 20:45:28.393: I/DEBUG(1976):  d26 3ff0000000000000 d27 0000000000000000 
09-30 20:45:28.393: I/DEBUG(1976):  d28 0000000000000005 d29 0000000000000000 
09-30 20:45:28.393: I/DEBUG(1976):  d30 0000000000000000 d31 0000000000000000 
09-30 20:45:28.393: I/DEBUG(1976):  scr 20000010 
09-30 20:45:28.393: I/DEBUG(1976): backtrace: 
09-30 20:45:28.393: I/DEBUG(1976):  #00 pc 000346ec <unknown> 
09-30 20:45:28.393: I/DEBUG(1976):  #01 pc 00001560 <unknown> 
09-30 20:45:28.393: I/DEBUG(1976): stack: 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fd68 59c01314 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fd6c 5c458aa4 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fd70 59c01314 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fd74 00000052 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fd78 59c00fc0 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fd7c 5c455f00 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fd80 5a04fd98 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fd84 5d2356e7 /data/data/com.creator.test/lib/libtest.so 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fd88 5a04fd98 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fd8c 5d23340b /data/data/com.creator.test/lib/libtest.so 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fd90 5a04fd98 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fd94 5d232aa8 /data/data/com.creator.test/lib/libtest.so 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fd98 59c014f8 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fd9c 5a04ff00 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fda0 df0027ad 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fda4 00000000 
09-30 20:45:28.393: I/DEBUG(1976):  #00 5a04fda8 00000001 
09-30 20:45:28.393: I/DEBUG(1976):   ........ ........ 
09-30 20:45:28.393: I/DEBUG(1976):  #01 5a04fda8 00000001 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fdac 5a04ff00 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fdb0 5a04fe00 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fdb4 5a04ff80 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fdb8 5a04ff94 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fdbc 00000000 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fdc0 00000000 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fdc4 5c4237fc 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fdc8 00000000 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fdcc 5c423058 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fdd0 00000000 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fdd4 00000001 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fdd8 5a04ff00 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fddc 5a04fe00 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fde0 5a04ff80 
09-30 20:45:28.393: I/DEBUG(1976):   5a04fde4 5a04ff94 
09-30 20:45:28.393: I/DEBUG(1976): memory near r0: 
09-30 20:45:28.393: I/DEBUG(1976):  0bffffc0 ffffffff ffffffff ffffffff ffffffff ................ 
09-30 20:45:28.393: I/DEBUG(1976):  0bffffd0 ffffffff ffffffff ffffffff ffffffff ................ 
09-30 20:45:28.393: I/DEBUG(1976):  0bffffe0 ffffffff ffffffff ffffffff ffffffff ................ 
09-30 20:45:28.393: I/DEBUG(1976):  0bfffff0 ffffffff ffffffff ffffffff ffffffff ................ 
09-30 20:45:28.393: I/DEBUG(1976):  0c000000 ffffffff ffffffff ffffffff ffffffff ................ 
09-30 20:45:28.393: I/DEBUG(1976): memory near r4: 
09-30 20:45:28.393: I/DEBUG(1976):  59c01570 59c018a8 59c018e0 5f149ff8 5f149ff8 ...Y...Y..._..._ 
09-30 20:45:28.393: I/DEBUG(1976):  59c01580 5f14a000 00000020 5f14a128 59c01590 ..._ ...(.._...Y 
09-30 20:45:28.393: I/DEBUG(1976):  59c01590 5c46105c 5c461070 00001008 00000000 \.F\p.F\........ 
09-30 20:45:28.393: I/DEBUG(1976):  59c015a0 00000000 00000000 00000000 00000006 ................ 
09-30 20:45:28.393: I/DEBUG(1976):  59c015b0 00000000 59c01890 00000000 00000000 .......Y........ 
09-30 20:45:28.393: I/DEBUG(1976): memory near r5: 
09-30 20:45:28.393: I/DEBUG(1976):  59c01570 59c018a8 59c018e0 5f149ff8 5f149ff8 ...Y...Y..._..._ 
09-30 20:45:28.393: I/DEBUG(1976):  59c01580 5f14a000 00000020 5f14a128 59c01590 ..._ ...(.._...Y 
09-30 20:45:28.393: I/DEBUG(1976):  59c01590 5c46105c 5c461070 00001008 00000000 \.F\p.F\........ 
09-30 20:45:28.393: I/DEBUG(1976):  59c015a0 00000000 00000000 00000000 00000006 ................ 
09-30 20:45:28.393: I/DEBUG(1976):  59c015b0 00000000 59c01890 00000000 00000000 .......Y........ 
09-30 20:45:28.393: I/DEBUG(1976): memory near r8: 
09-30 20:45:28.393: I/DEBUG(1976):  5a04ff74 5c44c0fc 00000005 00000009 76677261 ..D\........argv 
09-30 20:45:28.393: I/DEBUG(1976):  5a04ff84 005d315b 00000000 5c4536b4 42494000 [1]......6E\[email protected] 
09-30 20:45:28.393: I/DEBUG(1976):  5a04ff94 5e0119a8 5e011968 5d26d630 00000000 ...^h..^0.&].... 
09-30 20:45:28.393: I/DEBUG(1976):  5a04ffa4 00000000 00000000 5c422048 5e0119a8 ........H B\...^ 
09-30 20:45:28.393: I/DEBUG(1976):  5a04ffb4 00000000 5e0119a8 5d2335e9 5d26d630 .......^.5#]0.&] 
09-30 20:45:28.393: I/DEBUG(1976): memory near sl: 
09-30 20:45:28.393: I/DEBUG(1976):  59c01574 59c018e0 5f149ff8 5f149ff8 5f14a000 ...Y..._..._..._ 
09-30 20:45:28.393: I/DEBUG(1976):  59c01584 00000020 5f14a128 59c01590 5c46105c ...(.._...Y\.F\ 
09-30 20:45:28.393: I/DEBUG(1976):  59c01594 5c461070 00001008 00000000 00000000 p.F\............ 
09-30 20:45:28.393: I/DEBUG(1976):  59c015a4 00000000 00000000 00000006 00000000 ................ 
09-30 20:45:28.393: I/DEBUG(1976):  59c015b4 59c01890 00000000 00000000 00000000 ...Y............ 
09-30 20:45:28.393: I/DEBUG(1976): memory near sp: 
09-30 20:45:28.393: I/DEBUG(1976):  5a04fd88 5a04fd98 5d23340b 5a04fd98 5d232aa8 ...Z.4#]...Z.*#] 
09-30 20:45:28.393: I/DEBUG(1976):  5a04fd98 59c014f8 5a04ff00 df0027ad 00000000 ...Y...Z.'...... 
09-30 20:45:28.393: I/DEBUG(1976):  5a04fda8 00000001 5a04ff00 5a04fe00 5a04ff80 .......Z...Z...Z 
09-30 20:45:28.393: I/DEBUG(1976):  5a04fdb8 5a04ff94 00000000 00000000 5c4237fc ...Z.........7B\ 
09-30 20:45:28.393: I/DEBUG(1976):  5a04fdc8 00000000 5c423058 00000000 00000001 ....X0B\........ 
09-30 20:45:28.393: I/DEBUG(1976): code around pc: 
09-30 20:45:28.393: I/DEBUG(1976):  5c4566cc 11a01006 11a02005 1bfffa7d e1a00004 ..... ..}....... 
09-30 20:45:28.393: I/DEBUG(1976):  5c4566dc e8bd4070 e12fff1e e1a03000 e1e00000 [email protected]/..0...... 
09-30 20:45:28.393: I/DEBUG(1976):  5c4566ec e4d32001 e3520000 1afffffc e0800003 . ....R......... 
09-30 20:45:28.393: I/DEBUG(1976):  5c4566fc e12fff1e e92d0030 e1a03000 ea000000 ../.0.-..0...... 
09-30 20:45:28.403: I/DEBUG(1976):  5c45670c e2833001 e5d3c000 e35c0000 1afffffb .0........\..... 
09-30 20:45:28.403: I/DEBUG(1976): code around lr: 
09-30 20:45:28.403: I/DEBUG(1976):  5c423544 e513900c e085a009 e59a1008 e1a0300a .............0.. 
09-30 20:45:28.403: I/DEBUG(1976):  5c423554 e3510000 1a000029 e1a00007 eb00cc5f ..Q.)......._... 
09-30 20:45:28.403: I/DEBUG(1976):  5c423564 e59a801c e1500008 e1a06000 aa00003b ......P..`..;... 
09-30 20:45:28.403: I/DEBUG(1976):  5c423574 e0588000 0a000039 e59a2004 e59a0058 ..X.9.... ..X... 
09-30 20:45:28.403: I/DEBUG(1976):  5c423584 e202c007 e35c0001 0a000060 e5902000 ......\.`.... .. 
09-30 20:45:28.403: I/DEBUG(1976): memory map around fault addr f400001d: 
09-30 20:45:28.403: I/DEBUG(1976):  bec60000-bec81000 [stack] 
09-30 20:45:28.403: I/DEBUG(1976):  (no map for address) 
09-30 20:45:28.403: I/DEBUG(1976):  ffff0000-ffff1000 [vectors] 
09-30 20:45:28.534: I/BootReceiver(2474): Copying /data/tombstones/tombstone_05 to DropBox (SYSTEM_TOMBSTONE) 
09-30 20:45:28.564: I/WindowState(2474): WIN DEATH: Window{420feed8 SurfaceView paused=false} 
09-30 20:45:28.574: I/ActivityManager(2474): Process com.creator.test (pid 2662) has died. 
09-30 20:45:28.574: W/ActivityManager(2474): Force removing ActivityRecord{42067fb8 com.creator.test/.Main}: app died, no saved state 

답변

0

. 나는 그들이 JNI에 내장되어 있다고 생각했다. 다음 코드 줄을 추가하면됩니다. -

static char* g_RetStr; 
static int g_RetStrLen = 16384; 

struct JavaString 
{ 
    jstring _Ref; 

    JavaString (const char *Buffer) 
    { 
     JNIEnv *env = s3eEdkJNIGetEnv(); 
     _Ref = env->NewStringUTF (Buffer); 
    } 

    JavaString (jstring Ref) 
    { 
     _Ref = Ref; 
    } 

    ~JavaString() 
    { 
     JNIEnv *env = s3eEdkJNIGetEnv(); 
     env->DeleteLocalRef (_Ref); 
    } 

    operator jstring() 
    { 
     return _Ref; 
    } 
}; 

const char* getCString(jstring str) 
{ 
    JNIEnv* env = s3eEdkJNIGetEnv(); 
    if (!str) 
     return NULL; 

    jboolean free; 
    const char* res = env->GetStringUTFChars(str, &free); 
    g_RetStrLen = strlen(res) + 1; 
    g_RetStr = (char *)s3eEdkReallocOS(g_RetStr, g_RetStrLen); 
    strcpy(g_RetStr, res); 
    env->ReleaseStringUTFChars(str, res); 
    return g_RetStr; 
} 

//In Init 
g_RetStr = (char*)s3eEdkMallocOS(g_RetStrLen); 
관련 문제