Fix passing wrong arguments 80/308780/3
authorHwankyu Jhun <h.jhun@samsung.com>
Mon, 1 Apr 2024 04:09:48 +0000 (13:09 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Mon, 1 Apr 2024 04:46:57 +0000 (13:46 +0900)
When the application is executed using gdbserver, the export tag of the bundle
is deleted unintentionally. To pass arguments properly, the launchpad encloses
the string with a ''.

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

index 5584e9c..3c7d325 100644 (file)
@@ -320,12 +320,17 @@ std::vector<std::string> AppExecutor::CreateAppArgv(const std::string& app_path,
   if (inst.ShouldAttach())
     return argv;
 
+  bool debug_mode = !argv.empty() ? true : false;
   auto launcher_argv = GetLauncherArgv(app_type);
   if (!launcher_argv.empty())
     argv.insert(argv.end(), launcher_argv.begin(), launcher_argv.end());
 
   auto exported_argv = b.Export();
   exported_argv[LoaderArg::Path] = app_path;
+  if (debug_mode &&
+      exported_argv.size() > static_cast<size_t>(LoaderArg::Type))
+    exported_argv[LoaderArg::Type] = "'" + exported_argv[LoaderArg::Type] + "'";
+
   if (!exported_argv.empty())
     argv.insert(argv.end(), exported_argv.begin(), exported_argv.end());