diff --git a/1.diff b/1.diff new file mode 100644 index 0000000000000000000000000000000000000000..4b6be275d3216604edaeca032a50136aad1f8cad --- /dev/null +++ b/1.diff @@ -0,0 +1,137 @@ +diff --git a/inspector/inspector.cpp b/inspector/inspector.cpp +index 6e68cca..fb05f60 100644 +--- a/inspector/inspector.cpp ++++ b/inspector/inspector.cpp +@@ -47,6 +47,7 @@ enum DispatchStatus : int32_t { + DISPATCHED + }; + ++using SetDebugApp = void(*)(void*, bool); + using InitializeDebugger = void(*)(void*, const std::function&); + using UninitializeDebugger = void(*)(void*); + using WaitForDebugger = void(*)(void*); +@@ -55,6 +56,7 @@ using ProcessMessage = void(*)(void*); + using GetDispatchStatus = int32_t(*)(void*); + using GetCallFrames = char*(*)(void*); + ++SetDebugApp g_setDebugApp = nullptr; + OnMessage g_onMessage = nullptr; + InitializeDebugger g_initializeDebugger = nullptr; + UninitializeDebugger g_uninitializeDebugger = nullptr; +@@ -264,12 +266,19 @@ bool InitializeArkFunctionsOthers() + ResetServiceLocked(g_vm, true); + return false; + } ++ g_setDebugApp = reinterpret_cast( ++ GetArkDynFunction("SetDebugApp")); ++ if (g_setDebugApp == nullptr) { ++ ResetServiceLocked(g_vm, true); ++ return false; ++ } + return true; + } + #else + bool InitializeArkFunctionsIOS() + { + using namespace panda::ecmascript; ++ g_setDebugApp = reinterpret_cast(&tooling::SetDebugApp); + g_initializeDebugger = reinterpret_cast(&tooling::InitializeDebugger); + g_uninitializeDebugger = reinterpret_cast(&tooling::UninitializeDebugger); + g_waitForDebugger = reinterpret_cast(&tooling::WaitForDebugger); +@@ -410,6 +419,7 @@ bool InitializeDebuggerForSocketpair(void* vm, bool isHybrid) + }; + } + g_initializeDebugger(vm, std::bind(&SendReply, vm, std::placeholders::_2)); ++ g_setDebugApp(vm, true); + return true; + } + +diff --git a/tooling/dynamic/agent/debugger_impl.cpp b/tooling/dynamic/agent/debugger_impl.cpp +index 5a45708..fe9e2d0 100755 +--- a/tooling/dynamic/agent/debugger_impl.cpp ++++ b/tooling/dynamic/agent/debugger_impl.cpp +@@ -66,10 +66,11 @@ DebuggerImpl::~DebuggerImpl() + + bool DebuggerImpl::NotifyScriptParsed(const std::string &fileName, std::string_view entryPoint) + { ++ LOG_DEBUGGER(ERROR) << "FTDBG NotifyScriptParsed: 1"; + if (!CheckScriptParsed(fileName)) { + return false; + } +- ++ LOG_DEBUGGER(ERROR) << "FTDBG NotifyScriptParsed: 2"; + const JSPandaFile *jsPandaFile = JSPandaFileManager::GetInstance()->FindJSPandaFile(fileName.c_str()).get(); + if (jsPandaFile == nullptr) { + LOG_DEBUGGER(ERROR) << "NotifyScriptParsed: unknown file: " << fileName; +@@ -98,7 +99,7 @@ bool DebuggerImpl::NotifyScriptParsed(const std::string &fileName, std::string_v + << "url: " << url << " fileName: " << fileName; + return false; + } +- ++ LOG_DEBUGGER(ERROR) << "FTDBG NotifyScriptParsed: 3"; + SaveParsedScriptsAndUrl(fileName, url, recordName, source); + return true; + } +@@ -139,9 +140,9 @@ bool DebuggerImpl::CheckScriptParsed([[maybe_unused]] const std::string &fileNam + #endif + + // check if Debugable flag is true in module.json +- if (!vm_->GetJsDebuggerManager()->IsDebugApp()) { +- return false; +- } ++ // if (!vm_->GetJsDebuggerManager()->IsDebugApp()) { ++ // return false; ++ // } + + return true; + } +@@ -149,6 +150,7 @@ bool DebuggerImpl::CheckScriptParsed([[maybe_unused]] const std::string &fileNam + void DebuggerImpl::SaveParsedScriptsAndUrl(const std::string &fileName, const std::string &url, + const std::string &recordName, const std::string &source) + { ++ LOG_DEBUGGER(ERROR) << "FTDBG SaveParsedScriptsAndUrl: 1"; + // Save recordName to its corresponding url + recordNames_[url].insert(recordName); + recordNameSet_.insert(recordName); +@@ -161,6 +163,7 @@ void DebuggerImpl::SaveParsedScriptsAndUrl(const std::string &fileName, const st + if (IsLaunchAccelerateMode() && NeedToSetBreakpointsWhenParsingScript(url)) { + script->SetLocations(SetBreakpointsWhenParsingScript(url)); + } ++ LOG_DEBUGGER(ERROR) << "FTDBG SaveParsedScriptsAndUrl: 2"; + // Notify frontend ScriptParsed event + frontend_.ScriptParsed(vm_, *script); + } +diff --git a/tooling/dynamic/debugger_service.cpp b/tooling/dynamic/debugger_service.cpp +index 15488e3..d3f8174 100644 +--- a/tooling/dynamic/debugger_service.cpp ++++ b/tooling/dynamic/debugger_service.cpp +@@ -35,6 +35,15 @@ void InitializeDebugger(::panda::ecmascript::EcmaVM *vm, + vm->GetJsDebuggerManager()->SetDebuggerHandler(new ProtocolHandler(onResponse, vm)); + } + ++void SetDebugApp(::panda::ecmascript::EcmaVM *vm, bool isDebugApp) ++{ ++ if (vm == nullptr || vm->GetJsDebuggerManager() == nullptr) { ++ LOG_DEBUGGER(DEBUG) << "VM has already been destroyed"; ++ return; ++ } ++ vm->GetJsDebuggerManager()->SetIsDebugApp(isDebugApp); ++} ++ + void UninitializeDebugger(::panda::ecmascript::EcmaVM *vm) + { + if (vm == nullptr || vm->GetJsDebuggerManager() == nullptr) { +diff --git a/tooling/dynamic/debugger_service.h b/tooling/dynamic/debugger_service.h +index c5bfa5a..49f5335 100644 +--- a/tooling/dynamic/debugger_service.h ++++ b/tooling/dynamic/debugger_service.h +@@ -48,6 +48,9 @@ TOOLCHAIN_EXPORT int32_t GetDispatchStatus(const ::panda::ecmascript::EcmaVM *vm + TOOLCHAIN_EXPORT const char* GetCallFrames(const ::panda::ecmascript::EcmaVM *vm); + + TOOLCHAIN_EXPORT const char* OperateDebugMessage(const ::panda::ecmascript::EcmaVM *vm, const char* message); ++ ++TOOLCHAIN_EXPORT void SetDebugApp(::panda::ecmascript::EcmaVM *vm, bool isDebugApp); ++ + #ifdef __cplusplus + #if __cplusplus + }