@@ -879,19 +879,11 @@ lldb::thread_result_t GDBRemoteCommunication::ListenThread() {
879
879
return {};
880
880
}
881
881
882
- Status GDBRemoteCommunication::StartDebugserverProcess (
883
- const char *url, Platform *platform, ProcessLaunchInfo &launch_info,
884
- uint16_t *port, const Args *inferior_args, int pass_comm_fd) {
882
+ FileSpec GDBRemoteCommunication::GetDebugserverPath (Platform *platform) {
885
883
Log *log = GetLog (GDBRLog::Process);
886
- LLDB_LOGF (log, " GDBRemoteCommunication::%s(url=%s, port=%" PRIu16 " )" ,
887
- __FUNCTION__, url ? url : " <empty>" , port ? *port : uint16_t (0 ));
888
-
889
- Status error;
890
884
// If we locate debugserver, keep that located version around
891
885
static FileSpec g_debugserver_file_spec;
892
-
893
- char debugserver_path[PATH_MAX];
894
- FileSpec &debugserver_file_spec = launch_info.GetExecutableFile ();
886
+ FileSpec debugserver_file_spec;
895
887
896
888
Environment host_env = Host::GetEnvironment ();
897
889
@@ -943,9 +935,20 @@ Status GDBRemoteCommunication::StartDebugserverProcess(
943
935
}
944
936
}
945
937
}
938
+ return debugserver_file_spec;
939
+ }
946
940
947
- if (debugserver_exists) {
948
- debugserver_file_spec.GetPath (debugserver_path, sizeof (debugserver_path));
941
+ Status GDBRemoteCommunication::StartDebugserverProcess (
942
+ const char *url, Platform *platform, ProcessLaunchInfo &launch_info,
943
+ uint16_t *port, const Args *inferior_args, shared_fd_t pass_comm_fd) {
944
+ Log *log = GetLog (GDBRLog::Process);
945
+ LLDB_LOGF (log, " GDBRemoteCommunication::%s(url=%s, port=%" PRIu16 " )" ,
946
+ __FUNCTION__, url ? url : " <empty>" , port ? *port : uint16_t (0 ));
947
+
948
+ Status error;
949
+ FileSpec &debugserver_file_spec = launch_info.GetExecutableFile ();
950
+ if (debugserver_file_spec = GetDebugserverPath (platform)) {
951
+ std::string debugserver_path = debugserver_file_spec.GetPath ();
949
952
950
953
Args &debugserver_args = launch_info.GetArguments ();
951
954
debugserver_args.Clear ();
@@ -1059,6 +1062,8 @@ Status GDBRemoteCommunication::StartDebugserverProcess(
1059
1062
}
1060
1063
}
1061
1064
}
1065
+
1066
+ Environment host_env = Host::GetEnvironment ();
1062
1067
std::string env_debugserver_log_file =
1063
1068
host_env.lookup (" LLDB_DEBUGSERVER_LOG_FILE" );
1064
1069
if (!env_debugserver_log_file.empty ()) {
0 commit comments