mirror of
https://github.com/openharmony/ark_js_runtime.git
synced 2026-08-27 02:31:17 -04:00
fix cppcrash when exit
Signed-off-by: h00611971 <huangfeijie@huawei.com>
This commit is contained in:
@@ -866,6 +866,7 @@ public:
|
||||
static void EnableUserUncaughtErrorHandler(EcmaVM *vm);
|
||||
|
||||
static bool StartDebugger(const char *library_path, EcmaVM *vm, bool isDebugMode);
|
||||
static bool StopDebugger(const char *library_path);
|
||||
// Serialize & Deserialize.
|
||||
static void* SerializeValue(const EcmaVM *vm, Local<JSValueRef> data, Local<JSValueRef> transfer);
|
||||
static Local<JSValueRef> DeserializeValue(const EcmaVM *vm, void* recoder);
|
||||
|
||||
@@ -239,6 +239,27 @@ bool JSNApi::StartDebugger(const char *library_path, EcmaVM *vm, bool isDebugMod
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool JSNApi::StopDebugger(const char *library_path)
|
||||
{
|
||||
auto handle = panda::os::library_loader::Load(std::string(library_path));
|
||||
if (!handle) {
|
||||
return false;
|
||||
}
|
||||
|
||||
using StopDebug = void (*)(const std::string &);
|
||||
|
||||
auto sym = panda::os::library_loader::ResolveSymbol(handle.Value(), "StopDebug");
|
||||
if (!sym) {
|
||||
LOG(ERROR, RUNTIME) << sym.Error().ToString();
|
||||
return false;
|
||||
}
|
||||
|
||||
reinterpret_cast<StopDebug>(sym.Value())("PandaDebugger");
|
||||
auto runtime = Runtime::GetCurrent();
|
||||
runtime->SetDebugMode(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool JSNApi::Execute(EcmaVM *vm, Local<StringRef> fileName, Local<StringRef> entry)
|
||||
{
|
||||
std::string file = fileName->ToString();
|
||||
|
||||
Reference in New Issue
Block a user