31
31
#include " Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h"
32
32
#include " lldb/Host/ConnectionFileDescriptor.h"
33
33
#include " lldb/Host/HostGetOpt.h"
34
+ #include " lldb/Host/HostInfo.h"
34
35
#include " lldb/Host/MainLoop.h"
35
36
#include " lldb/Host/OptionParser.h"
36
37
#include " lldb/Host/Socket.h"
@@ -256,8 +257,9 @@ static void client_handle(GDBRemoteCommunicationServerPlatform &platform,
256
257
printf (" Disconnected.\n " );
257
258
}
258
259
259
- static Status spawn_process (const char *progname, const Socket *conn_socket,
260
- uint16_t gdb_port, const lldb_private::Args &args,
260
+ static Status spawn_process (const char *progname, const FileSpec &prog,
261
+ const Socket *conn_socket, uint16_t gdb_port,
262
+ const lldb_private::Args &args,
261
263
const std::string &log_file,
262
264
const StringRef log_channels, MainLoop &main_loop) {
263
265
Status error;
@@ -267,9 +269,10 @@ static Status spawn_process(const char *progname, const Socket *conn_socket,
267
269
268
270
ProcessLaunchInfo launch_info;
269
271
270
- FileSpec self_spec (progname, FileSpec:: Style ::native );
271
- launch_info.SetExecutableFile (self_spec, true );
272
+ launch_info. SetExecutableFile (prog, false );
273
+ launch_info.SetArg0 (progname );
272
274
Args &self_args = launch_info.GetArguments ();
275
+ self_args.AppendArgument (progname);
273
276
self_args.AppendArgument (llvm::StringRef (" platform" ));
274
277
self_args.AppendArgument (llvm::StringRef (" --child-platform-fd" ));
275
278
self_args.AppendArgument (llvm::to_string (shared_socket.GetSendableFD ()));
@@ -551,9 +554,10 @@ int main_platform(int argc, char *argv[]) {
551
554
log_channels, &main_loop,
552
555
&platform_handles](std::unique_ptr<Socket> sock_up) {
553
556
printf (" Connection established.\n " );
554
- Status error = spawn_process (progname, sock_up.get (),
555
- gdbserver_port, inferior_arguments,
556
- log_file, log_channels, main_loop);
557
+ Status error = spawn_process (
558
+ progname, HostInfo::GetProgramFileSpec (), sock_up.get (),
559
+ gdbserver_port, inferior_arguments, log_file, log_channels,
560
+ main_loop);
557
561
if (error.Fail ()) {
558
562
Log *log = GetLog (LLDBLog::Platform);
559
563
LLDB_LOGF (log , " spawn_process failed: %s" , error.AsCString ());
0 commit comments