On Js side, I just print the stacktrace. ```js global.QuickApp.unhandledrejection = (type, promise, reason) => { if (reason.stack) { console.warn(`Unhandled promise rejection: ${reason.stack}`) } } ``` On Sunday, June 14, 2020 at 9:26:28 PM UTC+8 Jiawen Geng wrote:
> full debug stacktrace > > ```console > 2020-06-14 21:14:13.495 28667-28667/? A/DEBUG: #00 pc > 000000000029e4e8 > /data/app/org.hapjs.mockup-p8e0E5lxR7_KO_oGkm6tOw==/lib/arm64/libjsenv.so > 2020-06-14 21:14:13.495 28667-28667/? A/DEBUG: #01 pc > 0000000000297040 > /data/app/org.hapjs.mockup-p8e0E5lxR7_KO_oGkm6tOw==/lib/arm64/libjsenv.so > 2020-06-14 21:14:13.495 28667-28667/? A/DEBUG: #02 pc > 0000000000296aec > /data/app/org.hapjs.mockup-p8e0E5lxR7_KO_oGkm6tOw==/lib/arm64/libjsenv.so > 2020-06-14 21:14:13.495 28667-28667/? A/DEBUG: #03 pc > 0000000000463c40 > /data/app/org.hapjs.mockup-p8e0E5lxR7_KO_oGkm6tOw==/lib/arm64/libjsenv.so > (v8::internal::Debug::StopSideEffectCheckMode()+824) > 2020-06-14 21:14:13.495 28667-28667/? A/DEBUG: #04 pc > 0000000000445f78 > /data/app/org.hapjs.mockup-p8e0E5lxR7_KO_oGkm6tOw==/lib/arm64/libjsenv.so > 2020-06-14 21:14:13.495 28667-28667/? A/DEBUG: #05 pc > 000000000031bb38 > /data/app/org.hapjs.mockup-p8e0E5lxR7_KO_oGkm6tOw==/lib/arm64/libjsenv.so > (v8::debug::EvaluateGlobal(v8::Isolate*, v8::Local<v8::String>, > v8::debug::EvaluateGlobalMode, bool)+260) > 2020-06-14 21:14:13.495 28667-28667/? A/DEBUG: #06 pc > 0000000000d4ddc8 > /data/app/org.hapjs.mockup-p8e0E5lxR7_KO_oGkm6tOw==/lib/arm64/libjsenv.so > 2020-06-14 21:14:13.495 28667-28667/? A/DEBUG: #07 pc > 0000000000d03490 > /data/app/org.hapjs.mockup-p8e0E5lxR7_KO_oGkm6tOw==/lib/arm64/libjsenv.so > 2020-06-14 21:14:13.495 28667-28667/? A/DEBUG: #08 pc > 0000000000d0803c > /data/app/org.hapjs.mockup-p8e0E5lxR7_KO_oGkm6tOw==/lib/arm64/libjsenv.so > 2020-06-14 21:14:13.495 28667-28667/? A/DEBUG: #09 pc > 0000000000d69640 > /data/app/org.hapjs.mockup-p8e0E5lxR7_KO_oGkm6tOw==/lib/arm64/libjsenv.so > 2020-06-14 21:14:13.495 28667-28667/? A/DEBUG: #10 pc > 0000000000d47ce8 > /data/app/org.hapjs.mockup-p8e0E5lxR7_KO_oGkm6tOw==/lib/arm64/libjsenv.so > 2020-06-14 21:14:13.495 28667-28667/? A/DEBUG: #11 pc > 000000000026d79c > /data/app/org.hapjs.mockup-p8e0E5lxR7_KO_oGkm6tOw==/lib/arm64/libjsenv.so > 2020-06-14 21:14:13.495 28667-28667/? A/DEBUG: #12 pc > 0000000000003d30 > /data/app/org.hapjs.mockup-p8e0E5lxR7_KO_oGkm6tOw==/lib/arm64/libinspector.so > (inspector::HybridInspector::nativeHandleMessage(_JNIEnv*, _jobject*, long, > int, _jstring*)+224) > 2020-06-14 21:14:13.495 28667-28667/? A/DEBUG: #13 pc > 0000000000053b58 > /data/app/org.hapjs.mockup-p8e0E5lxR7_KO_oGkm6tOw==/oat/arm64/base.odex > (offset 0x33000) > ``` > > On Sunday, June 14, 2020 at 9:23:55 PM UTC+8 techni...@gmail.com wrote: > >> This is debug build, on release build, I am getting null pointer >> reference on `(void)f->Call(context, Undefined(isolate), 3, args);` this >> line, but f is not nullpointer as I debug. >> >> On Sunday, June 14, 2020 at 9:20:36 PM UTC+8 techni...@gmail.com wrote: >> >>> I am implementing a PromiseRejection hook for android. But when I >>> upgrade to v8 8.3. It crashes. >>> >>> logcat >>> >>> ```console >>> 2020-06-14 21:14:12.690 28467-28517/org.hapjs.mockup E/v8: # >>> # Fatal error in ../../src/debug/debug.cc, line 2204 >>> # >>> 2020-06-14 21:14:12.690 28467-28517/org.hapjs.mockup E/v8: Debug check >>> failed: isolate_->has_pending_exception(). >>> ``` >>> >>> ```cpp >>> void handle(PromiseRejectMessage message) { >>> auto promise = message.GetPromise(); >>> auto event = message.GetEvent(); >>> auto value = message.GetValue(); >>> >>> Isolate* isolate = promise->GetIsolate(); >>> Local<Context> context = isolate->GetCurrentContext(); >>> Local<String> quickApp = >>> String::NewFromUtf8(isolate, "QuickApp", NewStringType::kNormal) >>> .ToLocalChecked(); >>> Local<String> p = >>> String::NewFromUtf8(isolate, "unhandledrejection", >>> NewStringType::kNormal) >>> .ToLocalChecked(); >>> v8::Local<v8::Object> global = >>> context->Global()->GetPrototype().As<v8::Object>(); >>> >>> v8::Local<v8::Value> quickAppGlobalMaybe; >>> (void)global->Get(context, quickApp).ToLocal(&quickAppGlobalMaybe); >>> if (quickAppGlobalMaybe.IsEmpty() || !quickAppGlobalMaybe->IsObject()) { >>> return; >>> } >>> >>> Local<v8::Object> quickAppGlobal = quickAppGlobalMaybe.As<Object>(); >>> >>> v8::Local<v8::Value> rejectFunc; >>> (void)quickAppGlobal->Get(context, p).ToLocal(&rejectFunc); >>> >>> if (rejectFunc->IsFunction()) { >>> Local<Function> f = rejectFunc.As<Function>(); >>> Local<Value> type = Number::New(isolate, event); >>> Local<Value> args[] = {type, promise, value}; >>> >>> // See https://github.com/nodejs/node/pull/29513 >>> if(value.IsEmpty()){ >>> value = v8::Undefined(isolate); >>> } >>> v8::TryCatch try_catch(isolate); >>> (void)f->Call(context, Undefined(isolate), 3, args); >>> if (try_catch.HasCaught() && !try_catch.HasTerminated()) { >>> fprintf(stderr, "Exception in PromiseRejectCallback:\n"); >>> } >>> } >>> } >>> ``` >>> >>> Anyone can help me on this one, thanks. >>> >>> -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/v8-users/b3c957ee-821a-4bb7-be8c-d7b4906ec982n%40googlegroups.com.