Fix a bug about debugging application 30/293030/1
authorHwankyu Jhun <h.jhun@samsung.com>
Thu, 18 May 2023 08:19:27 +0000 (08:19 +0000)
committerHwankyu Jhun <h.jhun@samsung.com>
Thu, 18 May 2023 08:19:27 +0000 (08:19 +0000)
When the debugger info is loaded first, the candidate process of
the process pool could not load the debugger info properly.
This patch modifies that the launchpad behavior after loading
the debugger info. To debug application properly, the launchpad
terminates the candidate process to make not using it.

Change-Id: I483d32b8712712b5f80f9f5579808b1ac493139a
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/launchpad-process-pool/app_executor.cc
src/launchpad-process-pool/app_executor.hh
src/launchpad-process-pool/debug.cc
src/launchpad-process-pool/debug.hh
src/launchpad-process-pool/launchpad.cc

index 3bc2525124ae0b7ad47233fae6f9c0c5bc2a873a..86accb12f6bb290ebb630782a87ef73da985cdf3 100644 (file)
@@ -105,6 +105,11 @@ pid_t AppExecutor::Execute(const AppInfo* app_info) {
   return Executor::Execute();
 }
 
+void AppExecutor::DisposeCandidateProcess() {
+  process_pool_->Dispose();
+  process_pool_->SetTimer();
+}
+
 void AppExecutor::OnExecution() {
   UserTracer::Print(std::to_string(getpid()) + "|after calling fork(). " +
       app_info_->GetAppId());
index 7d1f8d613d532ccd2bda7ddd77f6fabeaf525ca0..5d1327ee7f4f2ca5f5fe1b5def390737d7056034 100644 (file)
@@ -39,6 +39,7 @@ class AppExecutor : public Executor::Delegator,
   AppExecutor();
 
   pid_t Execute(const AppInfo* app_info);
+  void DisposeCandidateProcess();
 
  private:
   void OnExecution() override;
index 47fb2de1148129c662721ee4bd12f56f4e7b8dd0..53f37cca3206dc112c81edb73f38ac9c0990d89d 100644 (file)
@@ -71,12 +71,13 @@ void Debug::Dispose() {
   disposed_ = true;
 }
 
-void Debug::Load() {
+bool Debug::Load() {
   if (!debugger_infos_.empty())
-    return;
+    return false;
 
   DebuggerInfoInflator inflator;
   debugger_infos_ = inflator.Inflate(kDebuggerInfoPath);
+  return true;
 }
 
 void Debug::PrepareDebugger(const tizen_base::Bundle& b) {
index 68ed63db3e8426a62ad8bf72fad5c41b51b91fda..28e21b77758325e0cefb47329d80d3943b5ea37c 100644 (file)
@@ -41,7 +41,7 @@ class Debug : public FileMonitor::IEvent {
   static Debug& GetInst();
   void Init();
   void Dispose();
-  void Load();
+  bool Load();
   void PrepareDebugger(const tizen_base::Bundle& b);
   std::vector<std::string> GetExtraArgv() const;
   std::vector<std::string> GetArgv() const;
index d4f0ba42482b03ad623a8d585644f16ccd436d50..bd5517c67fba878fa9a8b2c6d47febc48e8c775a 100644 (file)
@@ -444,8 +444,10 @@ Launchpad::LaunchResult Launchpad::LaunchRequestPrepare(
 
 Launchpad::LaunchResult Launchpad::ForkProcessing(
     std::shared_ptr<Request> request) {
-  if (request->GetBundle().GetType(kAulSdk) != BUNDLE_TYPE_NONE)
-    Debug::GetInst().Load();
+  if (request->GetBundle().GetType(kAulSdk) != BUNDLE_TYPE_NONE) {
+    if (Debug::GetInst().Load())
+      app_executor_->DisposeCandidateProcess();
+  }
 
   _W("appid: %s", request->GetAppInfo()->GetAppId().c_str());
   request->SetPid(app_executor_->Execute(request->GetAppInfo()));