mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-10-07 16:13:49 +00:00
!6998 fix cppcrash while teminate worker
Merge pull request !6998 from fangting/master
This commit is contained in:
commit
5a8303acb6
@ -36,4 +36,12 @@ namespace panda::ecmascript::tooling {
|
||||
}
|
||||
return jsDebuggerManagerMap_[tid];
|
||||
}
|
||||
void JsDebuggerManager::DeleteJsDebuggerManager(int tid)
|
||||
{
|
||||
std::unique_lock<std::shared_mutex> lock(mutex_);
|
||||
auto it = jsDebuggerManagerMap_.find(tid);
|
||||
if (it != jsDebuggerManagerMap_.end()) {
|
||||
jsDebuggerManagerMap_.erase(it);
|
||||
}
|
||||
}
|
||||
} // namespace panda::ecmascript::tooling
|
@ -212,6 +212,7 @@ public:
|
||||
|
||||
static void AddJsDebuggerManager(int tid, JsDebuggerManager *jsDebuggerManager);
|
||||
static JsDebuggerManager* GetJsDebuggerManager(int tid);
|
||||
static void DeleteJsDebuggerManager(int tid);
|
||||
|
||||
private:
|
||||
bool isDebugMode_ {false};
|
||||
|
@ -105,7 +105,7 @@ using DebuggerPostTask = std::function<void(std::function<void()> &&)>;
|
||||
extern "C" {
|
||||
bool StartDebug(const std::string& componentName, void* vm, bool isDebugMode, int32_t instanceId,
|
||||
const DebuggerPostTask& debuggerPostTask, int port);
|
||||
void StopDebug(const std::string& componentName);
|
||||
void StopDebug(void* vm);
|
||||
void WaitForDebugger(void* vm);
|
||||
}
|
||||
} // namespace OHOS::ArkCompiler::Toolchain
|
||||
|
@ -3610,7 +3610,7 @@ bool JSNApi::StopDebugger([[maybe_unused]] EcmaVM *vm)
|
||||
|
||||
const auto &handle = vm->GetJsDebuggerManager()->GetDebugLibraryHandle();
|
||||
|
||||
using StopDebug = void (*)(const std::string &);
|
||||
using StopDebug = void (*)(void *);
|
||||
|
||||
auto sym = panda::os::library_loader::ResolveSymbol(handle, "StopDebug");
|
||||
if (!sym) {
|
||||
@ -3618,9 +3618,11 @@ bool JSNApi::StopDebugger([[maybe_unused]] EcmaVM *vm)
|
||||
return false;
|
||||
}
|
||||
|
||||
reinterpret_cast<StopDebug>(sym.Value())("PandaDebugger");
|
||||
reinterpret_cast<StopDebug>(sym.Value())(vm);
|
||||
|
||||
vm->GetJsDebuggerManager()->SetDebugMode(false);
|
||||
int tid = vm->GetTid();
|
||||
JsDebuggerManager::DeleteJsDebuggerManager(tid);
|
||||
return true;
|
||||
#else
|
||||
if (vm == nullptr) {
|
||||
@ -3628,7 +3630,7 @@ bool JSNApi::StopDebugger([[maybe_unused]] EcmaVM *vm)
|
||||
}
|
||||
CROSS_THREAD_AND_EXCEPTION_CHECK_WITH_RETURN(vm, false);
|
||||
|
||||
OHOS::ArkCompiler::Toolchain::StopDebug(DEBUGGER_NAME);
|
||||
OHOS::ArkCompiler::Toolchain::StopDebug(vm);
|
||||
vm->GetJsDebuggerManager()->SetDebugMode(false);
|
||||
return true;
|
||||
#endif // PANDA_TARGET_IOS
|
||||
|
Loading…
Reference in New Issue
Block a user