llgs: fixes to PTY/gdb-remote inferior stdout/stderr handling, logging addtions.
With this change, both local-process llgs and remote-target llgs stdout/stderr
handling from inferior work correctly.
Several log lines have been added around PTY and stdout/stderr redirection
logic on the lldb client side.
Regarding remote llgs execution, see the following:
With these changes, remote llgs with $O now works properly:
$ lldb
(lldb) platform select remote-linux
(lldb) target create ~/some/inferior/exe
(lldb) gdb-remote {some-target}:{port}
(lldb) run
The sequence above will correctly redirect stdout/stderr over gdb-remote $O,
as is needed for remote debugging. That sequence assumes there is a lldb-gdbserver
exe running on the target with {some-host}:{port}.
You can replace the gdb-remote command with a '(lldb) platform connect
connect://{target-ip}:{target-port}'. If you do this and have a
lldb-platform running on the remote end, it will go ahead and launch
llgs for lldb for each target instance that is run/attached.
For local debugging with llgs, the following sequence also works, and
uses local PTYs instead to avoid $O and extra gdb-remote messages:
$ lldb
(lldb) settings set platform.plugin.linux.use-llgs true
(lldb) target create ~/some/inferior/exe
(lldb) run
The above will run the inferior using llgs on the local host, and
will use PTYs rather than $O redirection.
This change also removes the logging that happened after the fork but
before the exec when llgs is launching a new inferior process. Some
aspect of the file handling during that portion of code would not do
the right thing with log handling. We might want to go back later
and have that communicate over a pipe from the child to parent to pass
along any messages that previously were logged in that section of code.
llvm-svn: 219578
diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h
index a13570f..dc1646e 100644
--- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h
+++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h
@@ -220,9 +220,9 @@
lldb_private::Module *module,
char const **argv,
char const **envp,
- const char *stdin_path,
- const char *stdout_path,
- const char *stderr_path,
+ const std::string &stdin_path,
+ const std::string &stdout_path,
+ const std::string &stderr_path,
const char *working_dir,
const lldb_private::ProcessLaunchInfo &launch_info);
@@ -231,9 +231,9 @@
lldb_private::Module *m_module; // The executable image to launch.
char const **m_argv; // Process arguments.
char const **m_envp; // Process environment.
- const char *m_stdin_path; // Redirect stdin or NULL.
- const char *m_stdout_path; // Redirect stdout or NULL.
- const char *m_stderr_path; // Redirect stderr or NULL.
+ const std::string &m_stdin_path; // Redirect stdin if not empty.
+ const std::string &m_stdout_path; // Redirect stdout if not empty.
+ const std::string &m_stderr_path; // Redirect stderr if not empty.
const char *m_working_dir; // Working directory or NULL.
const lldb_private::ProcessLaunchInfo &m_launch_info;
};
@@ -260,9 +260,9 @@
Module *module,
char const *argv[],
char const *envp[],
- const char *stdin_path,
- const char *stdout_path,
- const char *stderr_path,
+ const std::string &stdin_path,
+ const std::string &stdout_path,
+ const std::string &stderr_path,
const char *working_dir,
const lldb_private::ProcessLaunchInfo &launch_info,
Error &error);