mirror of
https://github.com/openharmony/ability_ability_runtime.git
synced 2026-08-24 12:43:16 -04:00
[Bug]: 修复release应用录制heapProfiler期间创建worker,不会waitForDebugger的问题
desc: 修复release应用录制heapProfiler期间创建worker,不会waitForDebugger的问题 solu: 调整waitForDebugger的判断 && 去掉多余参数 issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I8QDCY Signed-off-by: wanghuan2022 <wanghuan80@huawei.com> Change-Id: I575bb8a89f1f2ca3d06371b28da0909efa4b7526
This commit is contained in:
@@ -363,7 +363,7 @@ void JsRuntime::StartProfiler(
|
||||
}
|
||||
|
||||
HILOG_DEBUG("profiler:%{public}d interval:%{public}d.", profiler, interval);
|
||||
jsEnv_->StartProfiler(ARK_DEBUGGER_LIB_PATH, instanceId_, profiler, interval, gettid());
|
||||
jsEnv_->StartProfiler(ARK_DEBUGGER_LIB_PATH, instanceId_, profiler, interval, gettid(), isDebugApp);
|
||||
}
|
||||
|
||||
bool JsRuntime::GetFileBuffer(const std::string& filePath, std::string& fileFullName, std::vector<uint8_t>& buffer)
|
||||
|
||||
@@ -97,8 +97,7 @@ void InitWorkerFunc(NativeEngine* nativeEngine)
|
||||
};
|
||||
panda::JSNApi::DebugOption debugOption = {ARK_DEBUGGER_LIB_PATH, needBreakPoint};
|
||||
auto vm = const_cast<EcmaVM*>(arkNativeEngine->GetEcmaVm());
|
||||
panda::JSNApi::NotifyDebugMode(
|
||||
instanceId, vm, ARK_DEBUGGER_LIB_PATH, debugOption, instanceId, workerPostTask, g_debugApp, needBreakPoint);
|
||||
panda::JSNApi::NotifyDebugMode(instanceId, vm, debugOption, instanceId, workerPostTask, g_debugApp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -178,17 +178,7 @@ bool JsEnvironment::StartDebugger(
|
||||
JSENV_LOG_E("Abnormal parsing of tid results.");
|
||||
return false;
|
||||
}
|
||||
panda::JSNApi::DebugOption debugOption = {libraryPath, needBreakPoint};
|
||||
auto debuggerPostTask = [weak = weak_from_this()](std::function<void()>&& task) {
|
||||
auto jsEnv = weak.lock();
|
||||
if (jsEnv == nullptr) {
|
||||
JSENV_LOG_E("JsEnv is invalid.");
|
||||
return;
|
||||
}
|
||||
jsEnv->PostTask(task, "JsEnvironment:StartDebugger");
|
||||
};
|
||||
debugMode_ = panda::JSNApi::StartDebuggerForSocketPair(
|
||||
static_cast<uint32_t>(identifierId), debugOption, socketFd, debuggerPostTask);
|
||||
debugMode_ = panda::JSNApi::StartDebuggerForSocketPair(static_cast<uint32_t>(identifierId), socketFd);
|
||||
return debugMode_;
|
||||
}
|
||||
|
||||
@@ -260,7 +250,7 @@ bool JsEnvironment::LoadScript(const std::string& path, uint8_t* buffer, size_t
|
||||
}
|
||||
|
||||
void JsEnvironment::StartProfiler(const char* libraryPath, uint32_t instanceId, PROFILERTYPE profiler,
|
||||
int32_t interval, uint32_t tid)
|
||||
int32_t interval, uint32_t tid, bool isDebugApp)
|
||||
{
|
||||
if (vm_ == nullptr) {
|
||||
JSENV_LOG_E("Invalid vm.");
|
||||
@@ -281,7 +271,7 @@ void JsEnvironment::StartProfiler(const char* libraryPath, uint32_t instanceId,
|
||||
option.profilerType = ConvertProfilerType(profiler);
|
||||
option.interval = interval;
|
||||
|
||||
panda::DFXJSNApi::StartProfiler(vm_, option, tid, instanceId, debuggerPostTask);
|
||||
panda::DFXJSNApi::StartProfiler(vm_, option, tid, instanceId, debuggerPostTask, isDebugApp);
|
||||
}
|
||||
|
||||
void JsEnvironment::DestroyHeapProfiler()
|
||||
@@ -331,7 +321,7 @@ void JsEnvironment::NotifyDebugMode(
|
||||
JSENV_LOG_E("Invalid vm.");
|
||||
return;
|
||||
}
|
||||
panda::JSNApi::DebugOption debugOption = {libraryPath, debugMode};
|
||||
panda::JSNApi::DebugOption debugOption = {libraryPath, debug ? debugMode : false};
|
||||
auto debuggerPostTask = [weak = weak_from_this()](std::function<void()>&& task) {
|
||||
auto jsEnv = weak.lock();
|
||||
if (jsEnv == nullptr) {
|
||||
@@ -340,7 +330,7 @@ void JsEnvironment::NotifyDebugMode(
|
||||
}
|
||||
jsEnv->PostTask(task, "JsEnvironment:NotifyDebugMode");
|
||||
};
|
||||
panda::JSNApi::NotifyDebugMode(tid, vm_, libraryPath, debugOption, instanceId, debuggerPostTask, debug, debugMode);
|
||||
panda::JSNApi::NotifyDebugMode(tid, vm_, debugOption, instanceId, debuggerPostTask, debug);
|
||||
}
|
||||
|
||||
int32_t JsEnvironment::ParseHdcRegisterOption(std::string& option)
|
||||
|
||||
@@ -85,8 +85,8 @@ public:
|
||||
|
||||
bool LoadScript(const std::string& path, uint8_t* buffer, size_t len, bool isBundle);
|
||||
|
||||
void StartProfiler(
|
||||
const char* libraryPath, uint32_t instanceId, PROFILERTYPE profiler, int32_t interval, uint32_t tid);
|
||||
void StartProfiler(const char* libraryPath,
|
||||
uint32_t instanceId, PROFILERTYPE profiler, int32_t interval, uint32_t tid, bool isDebugApp);
|
||||
|
||||
void DestroyHeapProfiler();
|
||||
|
||||
|
||||
@@ -311,7 +311,7 @@ HWTEST_F(JsEnvironmentTest, StartProfiler_0100, TestSize.Level1)
|
||||
ASSERT_NE(jsEnv, nullptr);
|
||||
|
||||
const char* libraryPath = "LIBRARYPATH";
|
||||
jsEnv->StartProfiler(libraryPath, 0, JsEnvironment::PROFILERTYPE::PROFILERTYPE_CPU, 0, 0);
|
||||
jsEnv->StartProfiler(libraryPath, 0, JsEnvironment::PROFILERTYPE::PROFILERTYPE_CPU, 0, 0, true);
|
||||
ASSERT_EQ(jsEnv->GetVM(), nullptr);
|
||||
}
|
||||
|
||||
@@ -330,7 +330,7 @@ HWTEST_F(JsEnvironmentTest, StartProfiler_0200, TestSize.Level1)
|
||||
ASSERT_EQ(ret, true);
|
||||
|
||||
const char* libraryPath = "LIBRARYPATH";
|
||||
jsEnv->StartProfiler(libraryPath, 0, JsEnvironment::PROFILERTYPE::PROFILERTYPE_HEAP, 0, 0);
|
||||
jsEnv->StartProfiler(libraryPath, 0, JsEnvironment::PROFILERTYPE::PROFILERTYPE_HEAP, 0, 0, true);
|
||||
ASSERT_NE(jsEnv->GetVM(), nullptr);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user