Changeset View
Changeset View
Standalone View
Standalone View
lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp
Show All 27 Lines | |||||
#include "Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h" | #include "Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h" | ||||
#include "lldb/Core/PluginManager.h" | #include "lldb/Core/PluginManager.h" | ||||
#include "lldb/Host/ConnectionFileDescriptor.h" | #include "lldb/Host/ConnectionFileDescriptor.h" | ||||
#include "lldb/Host/HostGetOpt.h" | #include "lldb/Host/HostGetOpt.h" | ||||
#include "lldb/Host/OptionParser.h" | #include "lldb/Host/OptionParser.h" | ||||
#include "lldb/Host/Pipe.h" | #include "lldb/Host/Pipe.h" | ||||
#include "lldb/Host/Socket.h" | #include "lldb/Host/Socket.h" | ||||
#include "lldb/Host/StringConvert.h" | #include "lldb/Host/StringConvert.h" | ||||
#include "lldb/Host/common/NativeProcessProtocol.h" | |||||
#include "lldb/Utility/Status.h" | #include "lldb/Utility/Status.h" | ||||
#include "llvm/ADT/StringRef.h" | #include "llvm/ADT/StringRef.h" | ||||
#include "llvm/Support/Errno.h" | #include "llvm/Support/Errno.h" | ||||
#if defined(__linux__) | |||||
#include "Plugins/Process/Linux/NativeProcessLinux.h" | |||||
#elif defined(__NetBSD__) | |||||
#include "Plugins/Process/NetBSD/NativeProcessNetBSD.h" | |||||
#endif | |||||
#ifndef LLGS_PROGRAM_NAME | #ifndef LLGS_PROGRAM_NAME | ||||
#define LLGS_PROGRAM_NAME "lldb-server" | #define LLGS_PROGRAM_NAME "lldb-server" | ||||
#endif | #endif | ||||
#ifndef LLGS_VERSION_STR | #ifndef LLGS_VERSION_STR | ||||
#define LLGS_VERSION_STR "local_build" | #define LLGS_VERSION_STR "local_build" | ||||
#endif | #endif | ||||
using namespace llvm; | using namespace llvm; | ||||
using namespace lldb; | using namespace lldb; | ||||
using namespace lldb_private; | using namespace lldb_private; | ||||
using namespace lldb_private::lldb_server; | using namespace lldb_private::lldb_server; | ||||
using namespace lldb_private::process_gdb_remote; | using namespace lldb_private::process_gdb_remote; | ||||
namespace { | |||||
#if defined(__linux__) | |||||
typedef process_linux::NativeProcessLinux::Factory NativeProcessFactory; | |||||
#elif defined(__NetBSD__) | |||||
typedef process_netbsd::NativeProcessNetBSD::Factory NativeProcessFactory; | |||||
#else | |||||
// Dummy implementation to make sure the code compiles | |||||
class NativeProcessFactory : public NativeProcessProtocol::Factory { | |||||
public: | |||||
llvm::Expected<NativeProcessProtocolSP> | |||||
Launch(ProcessLaunchInfo &launch_info, | |||||
NativeProcessProtocol::NativeDelegate &delegate, | |||||
MainLoop &mainloop) const override { | |||||
llvm_unreachable("Not implemented"); | |||||
} | |||||
llvm::Expected<NativeProcessProtocolSP> | |||||
Attach(lldb::pid_t pid, NativeProcessProtocol::NativeDelegate &delegate, | |||||
MainLoop &mainloop) const override { | |||||
llvm_unreachable("Not implemented"); | |||||
} | |||||
}; | |||||
#endif | |||||
} | |||||
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- | ||||
// option descriptors for getopt_long_only() | // option descriptors for getopt_long_only() | ||||
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- | ||||
static int g_debug = 0; | static int g_debug = 0; | ||||
static int g_verbose = 0; | static int g_verbose = 0; | ||||
static struct option g_long_options[] = { | static struct option g_long_options[] = { | ||||
▲ Show 20 Lines • Show All 379 Lines • ▼ Show 20 Lines | #endif | ||||
argc -= optind; | argc -= optind; | ||||
argv += optind; | argv += optind; | ||||
if (argc == 0) { | if (argc == 0) { | ||||
display_usage(progname, subcommand); | display_usage(progname, subcommand); | ||||
exit(255); | exit(255); | ||||
} | } | ||||
GDBRemoteCommunicationServerLLGS gdb_server(mainloop); | NativeProcessFactory factory; | ||||
GDBRemoteCommunicationServerLLGS gdb_server(mainloop, factory); | |||||
const char *const host_and_port = argv[0]; | const char *const host_and_port = argv[0]; | ||||
argc -= 1; | argc -= 1; | ||||
argv += 1; | argv += 1; | ||||
// Any arguments left over are for the program that we need to launch. If | // Any arguments left over are for the program that we need to launch. If | ||||
// there | // there | ||||
// are no arguments, then the GDB server will start up and wait for an 'A' | // are no arguments, then the GDB server will start up and wait for an 'A' | ||||
Show All 27 Lines |