From f333e200ddb48fd13abba9d2a94f6032c44f0659 Mon Sep 17 00:00:00 2001 From: Igor Kotrasinski Date: Thu, 21 Jun 2018 11:21:03 +0200 Subject: [PATCH] Add shell env var to gdbserver invocation Change-Id: I5506244a2c3e77561fa5a26d3c92d79d75191ee1 Signed-off-by: Igor Kotrasinski --- simulatordaemon/src/TAFactory.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/simulatordaemon/src/TAFactory.cpp b/simulatordaemon/src/TAFactory.cpp index 8111728..6101e36 100644 --- a/simulatordaemon/src/TAFactory.cpp +++ b/simulatordaemon/src/TAFactory.cpp @@ -447,8 +447,10 @@ bool TAFactory::launchTAInDebugMode(uint32_t port, string image_path, string argument, pthread_mutex_t &lock, pid_t &pid) { char *argv[5]; + char *env[2]; string gdbserver = "/usr/bin/gdbserver"; string io_str = "-"; + string shell = "SHELL=/bin/sh"; argv[0] = &gdbserver[0]; argv[1] = &io_str[0]; @@ -456,6 +458,9 @@ bool TAFactory::launchTAInDebugMode(uint32_t port, string image_path, argv[3] = &argument[0]; argv[4] = NULL; + env[0] = &shell[0]; + env[1] = NULL; + // fork TA with GDB pid = fork(); if (0 == pid) { @@ -480,7 +485,7 @@ bool TAFactory::launchTAInDebugMode(uint32_t port, string image_path, if (dup2(sock, 0) == -1 || dup2(sock, 1) == -1) goto clean_socket; - execv(argv[0], argv); + execve(argv[0], argv, env); clean_socket: err = errno; close(sock); -- 2.7.4