Fix debug mode launch 95/315595/3
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 3 Dec 2024 09:10:39 +0000 (18:10 +0900)
committerHwanKyu Jhun <h.jhun@samsung.com>
Tue, 3 Dec 2024 11:28:22 +0000 (11:28 +0000)
If the launch request is for debugging, the launchpad-process-pool
should not send the launch request to the process-pool.
And, if the extra env list is empty, the launchpad-process-pool should
not set the data to the bundle object.

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

index e76d168e07f91a9a32eef98f0577a32269a7edbd..ec90b6a7ef0305383e73692a4a299f87e310a8ab 100644 (file)
@@ -114,9 +114,8 @@ AppExecutor::AppExecutor() : Executor(this) {
 
 pid_t AppExecutor::Execute(const AppInfo* app_info) {
   auto& b = const_cast<tizen_base::Bundle&>(app_info->GetBundle());
-  Debug::GetInst().PrepareDebugger(b);
-  AddAulEnvKeys(&b);
-  if (process_pool_->IsPrepared()) {
+  if (!Debug::GetInst().PrepareDebugger(b) && process_pool_->IsPrepared()) {
+    AddAulEnvKeys(&b);
     tizen_base::Parcel parcel;
     parcel.WriteParcelable(*app_info);
     pid_t pid = process_pool_->Execute(parcel);
@@ -136,7 +135,6 @@ void AppExecutor::HandleSigchld(pid_t pid) {
   process_pool_->HandleSigchld(pid);
 }
 
-
 void AppExecutor::OnExecution() {
   UserTracer::Print(std::to_string(getpid()) + "|after calling fork(). " +
       app_info_->GetAppId());
index 7493fce4fcf6971055e22490d07d16c929a325bb..f9e3a316f929a7857d7f26f5afad6700f6cf9bc6 100644 (file)
@@ -155,25 +155,28 @@ bool Debug::Load() {
   return true;
 }
 
-void Debug::PrepareDebugger(const tizen_base::Bundle& b) {
+bool Debug::PrepareDebugger(const tizen_base::Bundle& b) {
   debugger_info_.reset();
   debug_argv_.clear();
 
   auto debugger = b.GetString(kAulSdk);
-  if (debugger.empty()) return;
+  if (debugger.empty()) return false;
 
   _D("[DEBUG] Debugger: %s", debugger.c_str());
   auto found = debugger_infos_.find(debugger);
   if (found == debugger_infos_.end()) {
     _W("Failed to find debugger(%s)", debugger.c_str());
-    return;
+    return false;
   }
 
   debugger_info_ = found->second;
   RemoveFiles(debugger_info_->GetUnlinkList());
 
-  const_cast<tizen_base::Bundle&>(b).Add(kAulDebugExtraEnvList,
-                                         debugger_info_->GetExtraEnvList());
+  if (!debugger_info_->GetExtraEnvList().empty()) {
+    const_cast<tizen_base::Bundle&>(b).Add(kAulDebugExtraEnvList,
+                                           debugger_info_->GetExtraEnvList());
+  }
+
   auto appid = b.GetString(kAulAppId);
   if (CheckAsanApp(appid))
     const_cast<tizen_base::Bundle&>(b).Add(kAulTizenAsanActivation, "true");
@@ -187,6 +190,8 @@ void Debug::PrepareDebugger(const tizen_base::Bundle& b) {
 
   for (const auto& last_extra_key : debugger_info_->GetLastExtraKeyList())
     ParseAndAddExtraArgv(b, last_extra_key);
+
+  return true;
 }
 
 bool Debug::CheckAsanApp(const std::string& appid) {
index 072dc975fbe0b54f08c11d5a51efdcc2cc040edc..fdf431815f6d88afa4bfebf6fe658795f7cc5cdf 100644 (file)
@@ -42,7 +42,7 @@ class Debug : public FileMonitor::IEvent {
   void Init();
   void Dispose();
   bool Load();
-  void PrepareDebugger(const tizen_base::Bundle& b);
+  bool PrepareDebugger(const tizen_base::Bundle& b);
   std::vector<std::string> GetExtraArgv() const;
   std::vector<std::string> GetArgv() const;
   bool ShouldAttach() const;