Bug 1235475 - Crash at the exception source when an exception is in native code; r=snorp
When we have a Java exception in native code, the Java stack in the exception will not be very useful because the top frame is the native entry point. In this case, the native stack is more useful. However, currently we don't get a good native stack in this situation because we go through Java when handling the exception, and the native stack we get will have a lot of unknown frames inside libdvm or libart. This patch makes us stay in native code when handling an uncaught exception from native code, so that we get a good native stack.
This commit is contained in:
@@ -2148,20 +2148,20 @@ Object::LocalRef AndroidBridge::ChannelCreate(Object::Param stream) {
|
||||
JNIEnv* const env = GetEnvForThread();
|
||||
auto rv = Object::LocalRef::Adopt(env, env->CallStaticObjectMethod(
|
||||
sBridge->jChannels, sBridge->jChannelCreate, stream.Get()));
|
||||
HandleUncaughtException(env);
|
||||
MOZ_CATCH_JNI_EXCEPTION(env);
|
||||
return rv;
|
||||
}
|
||||
|
||||
void AndroidBridge::InputStreamClose(Object::Param obj) {
|
||||
JNIEnv* const env = GetEnvForThread();
|
||||
env->CallVoidMethod(obj.Get(), sBridge->jClose);
|
||||
HandleUncaughtException(env);
|
||||
MOZ_CATCH_JNI_EXCEPTION(env);
|
||||
}
|
||||
|
||||
uint32_t AndroidBridge::InputStreamAvailable(Object::Param obj) {
|
||||
JNIEnv* const env = GetEnvForThread();
|
||||
auto rv = env->CallIntMethod(obj.Get(), sBridge->jAvailable);
|
||||
HandleUncaughtException(env);
|
||||
MOZ_CATCH_JNI_EXCEPTION(env);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user