summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Core/AddressResolver.h1
-rw-r--r--lldb/include/lldb/Core/AddressResolverName.h1
-rw-r--r--lldb/include/lldb/Core/Error.h2
-rw-r--r--lldb/include/lldb/Core/PluginInterface.h8
-rw-r--r--lldb/include/lldb/Core/PluginManager.h31
-rw-r--r--lldb/include/lldb/Host/Host.h11
-rw-r--r--lldb/include/lldb/Symbol/SymbolVendor.h9
-rw-r--r--lldb/include/lldb/Target/Platform.h352
-rw-r--r--lldb/include/lldb/Target/Process.h173
-rw-r--r--lldb/include/lldb/Target/TargetList.h1
-rw-r--r--lldb/include/lldb/lldb-enumerations.h23
-rw-r--r--lldb/include/lldb/lldb-forward-rtti.h1
-rw-r--r--lldb/include/lldb/lldb-forward.h3
-rw-r--r--lldb/include/lldb/lldb-private-interfaces.h1
-rw-r--r--lldb/include/lldb/lldb-private.h3
-rw-r--r--lldb/lldb.xcodeproj/project.pbxproj36
-rw-r--r--lldb/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme14
-rw-r--r--lldb/source/API/SBDebugger.cpp34
-rw-r--r--lldb/source/Commands/CommandObjectFile.cpp3
-rw-r--r--lldb/source/Commands/CommandObjectProcess.cpp64
-rw-r--r--lldb/source/Core/ArchSpec.cpp30
-rw-r--r--lldb/source/Core/Error.cpp2
-rw-r--r--lldb/source/Core/PluginManager.cpp210
-rw-r--r--lldb/source/Host/common/Host.cpp124
-rw-r--r--lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp18
-rw-r--r--lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h8
-rw-r--r--lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp18
-rw-r--r--lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h8
-rw-r--r--lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp19
-rw-r--r--lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.h9
-rw-r--r--lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp20
-rw-r--r--lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h11
-rw-r--r--lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp20
-rw-r--r--lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h9
-rw-r--r--lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h19
-rw-r--r--lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp19
-rw-r--r--lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h9
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp22
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h10
-rw-r--r--lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp21
-rw-r--r--lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h10
-rw-r--r--lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp20
-rw-r--r--lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h10
-rw-r--r--lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp20
-rw-r--r--lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h11
-rw-r--r--lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp22
-rw-r--r--lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h9
-rw-r--r--lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp186
-rw-r--r--lldb/source/Plugins/Platform/Linux/PlatformLinux.h89
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp199
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h89
-rw-r--r--lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp44
-rw-r--r--lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h13
-rw-r--r--lldb/source/Plugins/Process/Utility/ArchDefaultUnwindPlan-x86.cpp39
-rw-r--r--lldb/source/Plugins/Process/Utility/ArchDefaultUnwindPlan-x86.h18
-rw-r--r--lldb/source/Plugins/Process/Utility/ArchVolatileRegs-x86.cpp19
-rw-r--r--lldb/source/Plugins/Process/Utility/ArchVolatileRegs-x86.h9
-rw-r--r--lldb/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp19
-rw-r--r--lldb/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.h9
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp54
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h13
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp22
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h9
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp19
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h9
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp20
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h9
-rw-r--r--lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp20
-rw-r--r--lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h11
-rw-r--r--lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp19
-rw-r--r--lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h10
-rw-r--r--lldb/source/Symbol/SymbolVendor.cpp20
-rw-r--r--lldb/source/Target/Platform.cpp230
-rw-r--r--lldb/source/Target/Process.cpp142
-rw-r--r--lldb/source/Target/Target.cpp35
-rw-r--r--lldb/source/Target/TargetList.cpp75
-rw-r--r--lldb/source/lldb.cpp59
-rw-r--r--lldb/tools/driver/Driver.cpp127
78 files changed, 1876 insertions, 1239 deletions
diff --git a/lldb/include/lldb/Core/AddressResolver.h b/lldb/include/lldb/Core/AddressResolver.h
index 0a9bdf51feb..e5fe276e3fb 100644
--- a/lldb/include/lldb/Core/AddressResolver.h
+++ b/lldb/include/lldb/Core/AddressResolver.h
@@ -20,7 +20,6 @@
#include "lldb/Core/Address.h"
#include "lldb/Core/AddressRange.h"
#include "lldb/Host/FileSpec.h"
-#include "lldb/Core/RegularExpression.h"
#include "lldb/Core/SearchFilter.h"
#include "lldb/Core/ConstString.h"
diff --git a/lldb/include/lldb/Core/AddressResolverName.h b/lldb/include/lldb/Core/AddressResolverName.h
index 4ab352939ea..afde675a89b 100644
--- a/lldb/include/lldb/Core/AddressResolverName.h
+++ b/lldb/include/lldb/Core/AddressResolverName.h
@@ -13,6 +13,7 @@
// Project includes
#include "lldb/Core/AddressResolver.h"
+#include "lldb/Core/RegularExpression.h"
namespace lldb_private {
diff --git a/lldb/include/lldb/Core/Error.h b/lldb/include/lldb/Core/Error.h
index f226ffc81b8..a36d842224e 100644
--- a/lldb/include/lldb/Core/Error.h
+++ b/lldb/include/lldb/Core/Error.h
@@ -11,7 +11,7 @@
#define __DCError_h__
#if defined(__cplusplus)
-#ifdef __APPLE__
+#if defined (__APPLE__)
#include <mach/mach.h>
#endif
#include <stdint.h>
diff --git a/lldb/include/lldb/Core/PluginInterface.h b/lldb/include/lldb/Core/PluginInterface.h
index e2466f3978a..97f6a37556e 100644
--- a/lldb/include/lldb/Core/PluginInterface.h
+++ b/lldb/include/lldb/Core/PluginInterface.h
@@ -33,14 +33,6 @@ public:
virtual uint32_t
GetPluginVersion() = 0;
- virtual void
- GetPluginCommandHelp (const char *command, Stream *strm) = 0;
-
- virtual Error
- ExecutePluginCommand (Args &command, Stream *strm) = 0;
-
- virtual Log *
- EnablePluginLogging (Stream *strm, Args &command) = 0;
};
} // namespace lldb_private
diff --git a/lldb/include/lldb/Core/PluginManager.h b/lldb/include/lldb/Core/PluginManager.h
index d89fa7a3aa2..ca1f2888d1b 100644
--- a/lldb/include/lldb/Core/PluginManager.h
+++ b/lldb/include/lldb/Core/PluginManager.h
@@ -170,25 +170,48 @@ public:
GetLogChannelCreateNameAtIndex (uint32_t idx);
//------------------------------------------------------------------
+ // Platform
+ //------------------------------------------------------------------
+ static bool
+ RegisterPlugin (const char *name,
+ const char *description,
+ PlatformCreateInstance create_callback);
+
+ static bool
+ UnregisterPlugin (PlatformCreateInstance create_callback);
+
+ static PlatformCreateInstance
+ GetPlatformCreateCallbackAtIndex (uint32_t idx);
+
+ static PlatformCreateInstance
+ GetPlatformCreateCallbackForPluginName (const char *name);
+
+ static const char *
+ GetPlatformPluginNameAtIndex (uint32_t idx);
+
+ static const char *
+ GetPlatformPluginDescriptionAtIndex (uint32_t idx);
+
+ //------------------------------------------------------------------
// Process
//------------------------------------------------------------------
static bool
RegisterPlugin (const char *name,
const char *description,
ProcessCreateInstance create_callback);
-
+
static bool
UnregisterPlugin (ProcessCreateInstance create_callback);
-
+
static ProcessCreateInstance
GetProcessCreateCallbackAtIndex (uint32_t idx);
-
+
static ProcessCreateInstance
GetProcessCreateCallbackForPluginName (const char *name);
static const char *
GetProcessPluginNameAtIndex (uint32_t idx);
-
+
static const char *
GetProcessPluginDescriptionAtIndex (uint32_t idx);
diff --git a/lldb/include/lldb/Host/Host.h b/lldb/include/lldb/Host/Host.h
index 50a709ff540..a1c85fe4250 100644
--- a/lldb/include/lldb/Host/Host.h
+++ b/lldb/include/lldb/Host/Host.h
@@ -323,13 +323,12 @@ public:
SetCrashDescription (const char *description);
static uint32_t
- ListProcessesMatchingName (const char *name, StringList &matches, std::vector<lldb::pid_t> &pids);
+ FindProcessesByName (const char *name,
+ lldb::NameMatchType name_match_type,
+ ProcessInfoList &proc_infos);
- static ArchSpec
- GetArchSpecForExistingProcess (lldb::pid_t pid);
-
- static ArchSpec
- GetArchSpecForExistingProcess (const char *process_name);
+ static bool
+ GetProcessInfo (lldb::pid_t pid, ProcessInfo &proc_info);
static lldb::pid_t
LaunchApplication (const FileSpec &app_file_spec);
diff --git a/lldb/include/lldb/Symbol/SymbolVendor.h b/lldb/include/lldb/Symbol/SymbolVendor.h
index fee93e09398..4b8dc5d0ae8 100644
--- a/lldb/include/lldb/Symbol/SymbolVendor.h
+++ b/lldb/include/lldb/Symbol/SymbolVendor.h
@@ -171,15 +171,6 @@ public:
virtual uint32_t
GetPluginVersion();
- virtual void
- GetPluginCommandHelp (const char *command, Stream *strm);
-
- virtual Error
- ExecutePluginCommand (Args &command, Stream *strm);
-
- virtual Log *
- EnablePluginLogging (Stream *strm, Args &command);
-
protected:
//------------------------------------------------------------------
// Classes that inherit from SymbolVendor can see and modify these
diff --git a/lldb/include/lldb/Target/Platform.h b/lldb/include/lldb/Target/Platform.h
new file mode 100644
index 00000000000..f878666a887
--- /dev/null
+++ b/lldb/include/lldb/Target/Platform.h
@@ -0,0 +1,352 @@
+//===-- Platform.h ----------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Platform_h_
+#define liblldb_Platform_h_
+
+// C Includes
+// C++ Includes
+#include <string>
+#include <vector>
+
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-include.h"
+#include "lldb/Core/ArchSpec.h"
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/Host/Mutex.h"
+
+namespace lldb_private {
+
+ //----------------------------------------------------------------------
+ /// @class Platform Platform.h "lldb/Target/Platform.h"
+ /// @brief A plug-in interface definition class for debug platform that
+ /// includes many platform abilities such as:
+ /// @li getting platform information such as supported architectures,
+ /// supported binary file formats and more
+ /// @li launching new processes
+ /// @li attaching to existing processes
+ /// @li download/upload files
+ /// @li execute shell commands
+ /// @li listing and getting info for existing processes
+ /// @li attaching and possibly debugging the platform's kernel
+ //----------------------------------------------------------------------
+ class Platform : public PluginInterface
+ {
+ public:
+
+ //------------------------------------------------------------------
+ /// Get the native host platform plug-in.
+ ///
+ /// There should only be one of these for each host that LLDB runs
+ /// upon that should be statically compiled in and registered using
+ /// preprocessor macros or other similar build mechanisms in a
+ /// PlatformSubclass::Initialize() function.
+ ///
+ /// This platform will be used as the default platform when launching
+ /// or attaching to processes unless another platform is specified.
+ //------------------------------------------------------------------
+ static lldb::PlatformSP
+ GetDefaultPlatform ();
+
+ static void
+ SetDefaultPlatform (const lldb::PlatformSP &platform_sp);
+
+ //------------------------------------------------------------------
+ /// Select the active platform.
+ ///
+ /// In order to debug remotely, other platform's can be remotely
+ /// connected to and set as the selected platform for any subsequent
+ /// debugging. This allows connection to remote targets and allows
+ /// the ability to discover process info, launch and attach to remote
+ /// processes.
+ //------------------------------------------------------------------
+ static lldb::PlatformSP
+ GetSelectedPlatform ();
+
+ static void
+ SetSelectedPlatform (const lldb::PlatformSP &platform_sp);
+
+ //------------------------------------------------------------------
+ /// Connect to a remote platform
+ ///
+ /// When connecting to a remote platform, the name of that platform
+ /// (the short plug-in name) is required, along with a URL that the
+ /// platform plug-in can use to remotely attach.
+ //------------------------------------------------------------------
+ static lldb::PlatformSP
+ ConnectRemote (const char *platform_name,
+ const char *remote_connect_url,
+ Error &error);
+
+ static uint32_t
+ GetNumConnectedRemotePlatforms ();
+
+ static lldb::PlatformSP
+ GetConnectedRemotePlatformAtIndex (uint32_t idx);
+
+
+ //------------------------------------------------------------------
+ /// Default Constructor
+ //------------------------------------------------------------------
+ Platform ();
+
+ //------------------------------------------------------------------
+ /// Destructor.
+ ///
+ /// The destructor is virtual since this class is designed to be
+ /// inherited from by the plug-in instance.
+ //------------------------------------------------------------------
+ virtual
+ ~Platform();
+
+ //------------------------------------------------------------------
+ /// Set the target's executable based off of the existing
+ /// architecture information in \a target given a path to an
+ /// executable \a exe_file.
+ ///
+ /// Each platform knows the architectures that it supports and can
+ /// select the correct architecture slice within \a exe_file by
+ /// inspecting the architecture in \a target. If the target had an
+ /// architecture specified, then in can try and obey that request
+ /// and optionally fail if the architecture doesn't match up.
+ /// If no architecture is specified, the platform should select the
+ /// default architecture from \a exe_file. Any application bundles
+ /// or executable wrappers can also be inspected for the actual
+ /// application binary within the bundle that should be used.
+ ///
+ /// @return
+ /// Returns \b true if this Platform plug-in was able to find
+ /// a suitable executable, \b false otherwise.
+ //------------------------------------------------------------------
+ virtual Error
+ ResolveExecutable (const FileSpec &exe_file,
+ const ArchSpec &arch,
+ lldb::ModuleSP &module_sp);
+
+ //------------------------------------------------------------------
+ /// Locate a file for a platform.
+ ///
+ /// The default implementation of this function will return the same
+ /// file patch in \a local_file as was in \a platform_file.
+ ///
+ /// @param[in] platform_file
+ /// The platform file path to locate and cache locally.
+ ///
+ /// @param[out] local_file
+ /// A locally cached version of the platform file. For platforms
+ /// that describe the current host computer, this will just be
+ /// the same file. For remote platforms, this file might come from
+ /// and SDK directory, or might need to be sync'ed over to the
+ /// current machine for efficient debugging access.
+ ///
+ /// @return
+ /// An error object.
+ //------------------------------------------------------------------
+ virtual Error
+ GetFile (const FileSpec &platform_file, FileSpec &local_file);
+
+ virtual Error
+ ConnectRemote (const char *remote_url);
+
+ virtual Error
+ DisconnectRemote (const lldb::PlatformSP &platform_sp);
+
+ //------------------------------------------------------------------
+ /// Get the platform's supported architectures in the order in which
+ /// they should be searched.
+ ///
+ /// @param[in] idx
+ /// A zero based architecture index
+ ///
+ /// @param[out] arch
+ /// A copy of the archgitecture at index if the return value is
+ /// \b true.
+ ///
+ /// @return
+ /// \b true if \a arch was filled in and is valid, \b false
+ /// otherwise.
+ //------------------------------------------------------------------
+ virtual bool
+ GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch) = 0;
+
+ //------------------------------------------------------------------
+ /// Launch a new process.
+ ///
+ /// Launch a new process by spawning a new process using the
+ /// target object's executable module's file as the file to launch.
+ /// Arguments are given in \a argv, and the environment variables
+ /// are in \a envp. Standard input and output files can be
+ /// optionally re-directed to \a stdin_path, \a stdout_path, and
+ /// \a stderr_path.
+ ///
+ /// This function is not meant to be overridden by Process
+ /// subclasses. It will first call Process::WillLaunch (Module *)
+ /// and if that returns \b true, Process::DoLaunch (Module*,
+ /// char const *[],char const *[],const char *,const char *,
+ /// const char *) will be called to actually do the launching. If
+ /// DoLaunch returns \b true, then Process::DidLaunch() will be
+ /// called.
+ ///
+ /// @param[in] argv
+ /// The argument array.
+ ///
+ /// @param[in] envp
+ /// The environment array.
+ ///
+ /// @param[in] launch_flags
+ /// Flags to modify the launch (@see lldb::LaunchFlags)
+ ///
+ /// @param[in] stdin_path
+ /// The path to use when re-directing the STDIN of the new
+ /// process. If all stdXX_path arguments are NULL, a pseudo
+ /// terminal will be used.
+ ///
+ /// @param[in] stdout_path
+ /// The path to use when re-directing the STDOUT of the new
+ /// process. If all stdXX_path arguments are NULL, a pseudo
+ /// terminal will be used.
+ ///
+ /// @param[in] stderr_path
+ /// The path to use when re-directing the STDERR of the new
+ /// process. If all stdXX_path arguments are NULL, a pseudo
+ /// terminal will be used.
+ ///
+ /// @param[in] working_directory
+ /// The working directory to have the child process run in
+ ///
+ /// @return
+ /// An error object. Call GetID() to get the process ID if
+ /// the error object is success.
+ //------------------------------------------------------------------
+// virtual lldb::ProcessSP
+// Launch (char const *argv[],
+// char const *envp[],
+// uint32_t launch_flags,
+// const char *stdin_path,
+// const char *stdout_path,
+// const char *stderr_path,
+// const char *working_directory,
+// Error &error) = 0;
+
+ //------------------------------------------------------------------
+ /// Attach to an existing process using a process ID.
+ ///
+ /// This function is not meant to be overridden by Process
+ /// subclasses. It will first call Process::WillAttach (lldb::pid_t)
+ /// and if that returns \b true, Process::DoAttach (lldb::pid_t) will
+ /// be called to actually do the attach. If DoAttach returns \b
+ /// true, then Process::DidAttach() will be called.
+ ///
+ /// @param[in] pid
+ /// The process ID that we should attempt to attach to.
+ ///
+ /// @return
+ /// Returns \a pid if attaching was successful, or
+ /// LLDB_INVALID_PROCESS_ID if attaching fails.
+ //------------------------------------------------------------------
+// virtual lldb::ProcessSP
+// Attach (lldb::pid_t pid,
+// Error &error) = 0;
+
+ //------------------------------------------------------------------
+ /// Attach to an existing process by process name.
+ ///
+ /// This function is not meant to be overridden by Process
+ /// subclasses. It will first call
+ /// Process::WillAttach (const char *) and if that returns \b
+ /// true, Process::DoAttach (const char *) will be called to
+ /// actually do the attach. If DoAttach returns \b true, then
+ /// Process::DidAttach() will be called.
+ ///
+ /// @param[in] process_name
+ /// A process name to match against the current process list.
+ ///
+ /// @return
+ /// Returns \a pid if attaching was successful, or
+ /// LLDB_INVALID_PROCESS_ID if attaching fails.
+ //------------------------------------------------------------------
+// virtual lldb::ProcessSP
+// Attach (const char *process_name,
+// bool wait_for_launch,
+// Error &error) = 0;
+
+ virtual uint32_t
+ FindProcessesByName (const char *name,
+ lldb::NameMatchType name_match_type,
+ ProcessInfoList &proc_infos) = 0;
+
+ virtual bool
+ GetProcessInfo (lldb::pid_t pid, ProcessInfo &proc_info) = 0;
+
+ const std::string &
+ GetRemoteURL () const
+ {
+ return m_remote_url;
+ }
+
+ protected:
+
+ std::string m_remote_url;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN (Platform);
+ };
+
+
+ class PlatformList
+ {
+ public:
+ PlatformList() :
+ m_mutex (Mutex::eMutexTypeRecursive),
+ m_platforms ()
+ {
+ }
+
+ ~PlatformList()
+ {
+ }
+
+ void
+ Append (const lldb::PlatformSP &platform_sp)
+ {
+ Mutex::Locker locker (m_mutex);
+ m_platforms.push_back (platform_sp);
+ }
+
+ size_t
+ GetSize()
+ {
+ Mutex::Locker locker (m_mutex);
+ return m_platforms.size();
+ }
+
+ lldb::PlatformSP
+ GetAtIndex (uint32_t idx)
+ {
+ lldb::PlatformSP platform_sp;
+ {
+ Mutex::Locker locker (m_mutex);
+ if (idx < m_platforms.size())
+ platform_sp = m_platforms[idx];
+ }
+ return platform_sp;
+ }
+
+ protected:
+ typedef std::vector<lldb::PlatformSP> collection;
+ mutable Mutex m_mutex;
+ collection m_platforms;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN (PlatformList);
+ };
+} // namespace lldb_private
+
+#endif // liblldb_Platform_h_
diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h
index 916ff23a9d3..9ca63ed834f 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -17,8 +17,7 @@
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
-#include "lldb/Interpreter/Args.h"
-#include "lldb/Interpreter/Options.h"
+#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Broadcaster.h"
#include "lldb/Core/Communication.h"
#include "lldb/Core/Error.h"
@@ -30,6 +29,8 @@
#include "lldb/Breakpoint/BreakpointSiteList.h"
#include "lldb/Expression/ClangPersistentVariables.h"
#include "lldb/Expression/IRDynamicChecks.h"
+#include "lldb/Interpreter/Args.h"
+#include "lldb/Interpreter/Options.h"
#include "lldb/Target/ExecutionContextScope.h"
#include "lldb/Target/ThreadList.h"
#include "lldb/Target/UnixSignals.h"
@@ -37,13 +38,6 @@
namespace lldb_private {
-typedef enum ProcessPlugins
-{
- eMacosx,
- eRemoteDebugger
-} ProcessPlugins;
-
-
class ProcessInstanceSettings : public InstanceSettings
{
public:
@@ -209,9 +203,6 @@ protected:
ErrorPathVarName ();
static const ConstString &
- PluginVarName ();
-
- static const ConstString &
DisableASLRVarName();
static const ConstString &
@@ -225,13 +216,157 @@ private:
std::string m_input_path;
std::string m_output_path;
std::string m_error_path;
- ProcessPlugins m_plugin;
bool m_disable_aslr;
bool m_disable_stdio;
bool m_inherit_host_env;
bool m_got_host_env;
};
+
+class ProcessInfo
+{
+public:
+ ProcessInfo () :
+ m_name (),
+ m_arch(),
+ m_pid (LLDB_INVALID_PROCESS_ID)
+ {
+ }
+
+ ProcessInfo (const char *name,
+ const ArchSpec &arch,
+ lldb::pid_t pid) :
+ m_name (name),
+ m_arch (arch),
+ m_pid (pid)
+ {
+ }
+
+ void
+ Clear ()
+ {
+ m_name.clear();
+ m_arch.Clear();
+ m_pid = LLDB_INVALID_PROCESS_ID;
+ }
+
+ const char *
+ GetName() const
+ {
+ return m_name.c_str();
+ }
+
+ size_t
+ GetNameLength() const
+ {
+ return m_name.size();
+ }
+
+ void
+ SetName (const char *name)
+ {
+ if (name)
+ m_name.assign (name);
+ else
+ m_name.clear();
+ }
+
+ ArchSpec &
+ GetArchitecture ()
+ {
+ return m_arch;
+ }
+
+ const ArchSpec &
+ GetArchitecture () const
+ {
+ return m_arch;
+ }
+
+ lldb::pid_t
+ GetProcessID () const
+ {
+ return m_pid;
+ }
+
+ void
+ SetProcessID (lldb::pid_t pid)
+ {
+ m_pid = pid;
+ }
+
+protected:
+ std::string m_name;
+ ArchSpec m_arch;
+ pid_t m_pid;
+};
+
+class ProcessInfoList
+{
+public:
+ ProcessInfoList () :
+ m_infos()
+ {
+ }
+
+ void
+ Clear()
+ {
+ m_infos.clear();
+ }
+
+ uint32_t
+ GetSize()
+ {
+ return m_infos.size();
+ }
+
+ void
+ Append (const ProcessInfo &info)
+ {
+ m_infos.push_back (info);
+ }
+
+ const char *
+ GetProcessNameAtIndex (uint32_t idx)
+ {
+ if (idx < m_infos.size())
+ return m_infos[idx].GetName();
+ return NULL;
+ }
+
+ size_t
+ GetProcessNameLengthAtIndex (uint32_t idx)
+ {
+ if (idx < m_infos.size())
+ return m_infos[idx].GetNameLength();
+ return 0;
+ }
+
+ lldb::pid_t
+ GetProcessIDAtIndex (uint32_t idx)
+ {
+ if (idx < m_infos.size())
+ return m_infos[idx].GetProcessID();
+ return NULL;
+ }
+
+ bool
+ GetInfoAtIndex (uint32_t idx, ProcessInfo &info)
+ {
+ if (idx < m_infos.size())
+ {
+ info = m_infos[idx];
+ return true;
+ }
+ return false;
+ }
+
+protected:
+ typedef std::vector<ProcessInfo> collection;
+ collection m_infos;
+};
+
//----------------------------------------------------------------------
/// @class Process Process.h "lldb/Target/Process.h"
@@ -626,8 +761,8 @@ public:
/// Returns the number of matching processes.
//------------------------------------------------------------------
- virtual uint32_t
- ListProcessesMatchingName (const char *name, StringList &matches, std::vector<lldb::pid_t> &pids);
+// virtual uint32_t
+// ListProcessesMatchingName (const char *name, StringList &matches, std::vector<lldb::pid_t> &pids);
//------------------------------------------------------------------
/// Find the architecture of a process by pid.
@@ -640,8 +775,8 @@ public:
/// @return
/// Returns the architecture of the process or an invalid architecture if the process can't be found.
//------------------------------------------------------------------
- virtual ArchSpec
- GetArchSpecForExistingProcess (lldb::pid_t pid);
+// virtual ArchSpec
+// GetArchSpecForExistingProcess (lldb::pid_t pid);
//------------------------------------------------------------------
/// Find the architecture of a process by name.
@@ -654,8 +789,8 @@ public:
/// @return
/// Returns the architecture of the process or an invalid architecture if the process can't be found.
//------------------------------------------------------------------
- virtual ArchSpec
- GetArchSpecForExistingProcess (const char *process_name);
+// virtual ArchSpec
+// GetArchSpecForExistingProcess (const char *process_name);
//------------------------------------------------------------------
/// Get the image information address for the current process.
diff --git a/lldb/include/lldb/Target/TargetList.h b/lldb/include/lldb/Target/TargetList.h
index 3e4532c93e8..6c21177ab8b 100644
--- a/lldb/include/lldb/Target/TargetList.h
+++ b/lldb/include/lldb/Target/TargetList.h
@@ -82,7 +82,6 @@ public:
CreateTarget (Debugger &debugger,
const FileSpec& file_spec,
const ArchSpec& arch,
- const lldb_private::UUID *uuid_ptr,
bool get_dependent_files,
lldb::TargetSP &target_sp);
diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h
index eb8f68cefe2..b931b713ea2 100644
--- a/lldb/include/lldb/lldb-enumerations.h
+++ b/lldb/include/lldb/lldb-enumerations.h
@@ -654,24 +654,39 @@ typedef enum ExecutionOSType
{
// Automatically detect the execution operating system
eExecutionOSTypeAuto,
-
+
// There is no operating system (no processes or threads).
eExecutionOSTypeNone,
-
+
// There is an OS, but when we execution stops, the entire OS is halted
// (common when debugging in eExecutionLevelKernel modes). Processes and
// threads can be queried, selected and switched between using memory
// reads/writes using a ProcessHelper plug-in (which has yet to be
// designed).
eExecutionOSTypeHalted,
-
+
// There is live OS with debug services that we can talk to for process,
// thread, and other OS queries.
eExecutionOSTypeLive
-
+
} ExecutionOSType;
+//------------------------------------------------------------------
+/// Name matching
+//------------------------------------------------------------------
+typedef enum NameMatchType
+{
+ eNameMatchIgnore,
+ eNameMatchEquals,
+ eNameMatchContains,
+ eNameMatchStartsWith,
+ eNameMatchEndsWith,
+ eNameMatchRegularExpression
+
+} NameMatchType;
+
+
} // namespace lldb
diff --git a/lldb/include/lldb/lldb-forward-rtti.h b/lldb/include/lldb/lldb-forward-rtti.h
index b2d4e158987..146409346d7 100644
--- a/lldb/include/lldb/lldb-forward-rtti.h
+++ b/lldb/include/lldb/lldb-forward-rtti.h
@@ -50,6 +50,7 @@ namespace lldb {
typedef SharedPtr<lldb_private::Log>::Type LogSP;
typedef SharedPtr<lldb_private::LogChannel>::Type LogChannelSP;
typedef SharedPtr<lldb_private::Module>::Type ModuleSP;
+ typedef SharedPtr<lldb_private::Platform>::Type PlatformSP;
typedef SharedPtr<lldb_private::Process>::Type ProcessSP;
typedef SharedPtr<lldb_private::RegisterContext>::Type RegisterContextSP;
typedef SharedPtr<lldb_private::Section>::Type SectionSP;
diff --git a/lldb/include/lldb/lldb-forward.h b/lldb/include/lldb/lldb-forward.h
index f7f3092e15b..726d61a586b 100644
--- a/lldb/include/lldb/lldb-forward.h
+++ b/lldb/include/lldb/lldb-forward.h
@@ -100,7 +100,10 @@ class ObjectContainer;
class ObjectFile;
class Options;
class PathMappingList;
+class Platform;
class Process;
+class ProcessInfo;
+class ProcessInfoList;
class RegisterContext;
class RegisterLocation;
class RegisterLocationList;
diff --git a/lldb/include/lldb/lldb-private-interfaces.h b/lldb/include/lldb/lldb-private-interfaces.h
index 64d0bace27c..c50fa0b9fdd 100644
--- a/lldb/include/lldb/lldb-private-interfaces.h
+++ b/lldb/include/lldb/lldb-private-interfaces.h
@@ -24,6 +24,7 @@ namespace lldb_private
typedef LogChannel* (*LogChannelCreateInstance) ();
typedef EmulateInstruction * (*EmulateInstructionCreateInstance) (const ArchSpec &arch);
typedef LanguageRuntime *(*LanguageRuntimeCreateInstance) (Process *process, lldb::LanguageType language);
+ typedef Platform* (*PlatformCreateInstance) ();
typedef Process* (*ProcessCreateInstance) (Target &target, Listener &listener);
typedef SymbolFile* (*SymbolFileCreateInstance) (ObjectFile* obj_file);
typedef SymbolVendor* (*SymbolVendorCreateInstance) (Module *module); // Module can be NULL for default system symbol vendor
diff --git a/lldb/include/lldb/lldb-private.h b/lldb/include/lldb/lldb-private.h
index 9ace5372e5c..1a4dfcbd708 100644
--- a/lldb/include/lldb/lldb-private.h
+++ b/lldb/include/lldb/lldb-private.h
@@ -69,6 +69,9 @@ GetVoteAsCString (lldb::Vote vote);
const char *
GetSectionTypeAsCString (lldb::SectionType sect_type);
+
+bool
+NameMatches (const char *name, lldb::NameMatchType match_type, const char *match);
} // namespace lldb_private
diff --git a/lldb/lldb.xcodeproj/project.pbxproj b/lldb/lldb.xcodeproj/project.pbxproj
index 3fe63bdaf0c..d6c3e6a2f23 100644
--- a/lldb/lldb.xcodeproj/project.pbxproj
+++ b/lldb/lldb.xcodeproj/project.pbxproj
@@ -32,6 +32,8 @@
26368A3C126B697600E8659F /* darwin-debug.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26368A3B126B697600E8659F /* darwin-debug.cpp */; };
26368AF7126B960500E8659F /* darwin-debug in Resources */ = {isa = PBXBuildFile; fileRef = 26579F68126A25920007C5CB /* darwin-debug */; };
26424E3D125986CB0016D82C /* ValueObjectConstResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26424E3C125986CB0016D82C /* ValueObjectConstResult.cpp */; };
+ 264A43BC1320B3B4005B4096 /* Platform.h in Headers */ = {isa = PBXBuildFile; fileRef = 264A43BB1320B3B4005B4096 /* Platform.h */; };
+ 264A43BE1320BCEB005B4096 /* Platform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 264A43BD1320BCEB005B4096 /* Platform.cpp */; };
265ABF6310F42EE900531910 /* DebugSymbols.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 265ABF6210F42EE900531910 /* DebugSymbols.framework */; };
2668020E115FD12C008E1FE4 /* lldb-defines.h in Headers */ = {isa = PBXBuildFile; fileRef = 26BC7C2510F1B3BC00F91463 /* lldb-defines.h */; settings = {ATTRIBUTES = (Public, ); }; };
2668020F115FD12C008E1FE4 /* lldb-enumerations.h in Headers */ = {isa = PBXBuildFile; fileRef = 26BC7C2610F1B3BC00F91463 /* lldb-enumerations.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -87,6 +89,8 @@
26B42B1F1187A92B0079C8C8 /* lldb-include.h in Headers */ = {isa = PBXBuildFile; fileRef = 26B42B1E1187A92B0079C8C8 /* lldb-include.h */; settings = {ATTRIBUTES = (Public, ); }; };
26B42C4D1187ABA50079C8C8 /* LLDB.h in Headers */ = {isa = PBXBuildFile; fileRef = 26B42C4C1187ABA50079C8C8 /* LLDB.h */; settings = {ATTRIBUTES = (Public, ); }; };
26B8B42512EEC52A00A831B2 /* UniqueDWARFASTType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26B8B42312EEC52A00A831B2 /* UniqueDWARFASTType.cpp */; };
+ 26C557801325781A008FD8FE /* PlatformMacOSX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26C5577B132575AD008FD8FE /* PlatformMacOSX.cpp */; };
+ 26C557811325781D008FD8FE /* PlatformMacOSX.h in Headers */ = {isa = PBXBuildFile; fileRef = 26C5577C132575AD008FD8FE /* PlatformMacOSX.h */; };
26C72C94124322890068DC16 /* SBStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 26C72C93124322890068DC16 /* SBStream.h */; settings = {ATTRIBUTES = (Public, ); }; };
26C72C961243229A0068DC16 /* SBStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26C72C951243229A0068DC16 /* SBStream.cpp */; };
26D27C9F11ED3A4E0024D721 /* ELFHeader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26D27C9D11ED3A4E0024D721 /* ELFHeader.cpp */; };
@@ -581,6 +585,8 @@
264334381110F63100CDB6C6 /* ValueObjectRegister.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ValueObjectRegister.cpp; path = source/Core/ValueObjectRegister.cpp; sourceTree = "<group>"; };
2643343A1110F63C00CDB6C6 /* ValueObjectRegister.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ValueObjectRegister.h; path = include/lldb/Core/ValueObjectRegister.h; sourceTree = "<group>"; };
264723A511FA076E00DE380C /* CleanUp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CleanUp.h; path = include/lldb/Utility/CleanUp.h; sourceTree = "<group>"; };
+ 264A43BB1320B3B4005B4096 /* Platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Platform.h; path = include/lldb/Target/Platform.h; sourceTree = "<group>"; };
+ 264A43BD1320BCEB005B4096 /* Platform.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Platform.cpp; path = source/Target/Platform.cpp; sourceTree = "<group>"; };
264AD83711095BA600E0B039 /* CommandObjectLog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectLog.cpp; path = source/Commands/CommandObjectLog.cpp; sourceTree = "<group>"; };
264AD83911095BBD00E0B039 /* CommandObjectLog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectLog.h; path = source/Commands/CommandObjectLog.h; sourceTree = "<group>"; };
26579F68126A25920007C5CB /* darwin-debug */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "darwin-debug"; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -890,6 +896,8 @@
26BC7F3E10F1B90C00F91463 /* ThreadList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadList.cpp; path = source/Target/ThreadList.cpp; sourceTree = "<group>"; };
26BC7F3F10F1B90C00F91463 /* ThreadPlan.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlan.cpp; path = source/Target/ThreadPlan.cpp; sourceTree = "<group>"; };
26BC7F4C10F1BC1A00F91463 /* ObjectFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ObjectFile.cpp; path = source/Symbol/ObjectFile.cpp; sourceTree = "<group>"; };
+ 26C5577B132575AD008FD8FE /* PlatformMacOSX.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformMacOSX.cpp; sourceTree = "<group>"; };
+ 26C5577C132575AD008FD8FE /* PlatformMacOSX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformMacOSX.h; sourceTree = "<group>"; };
26C72C93124322890068DC16 /* SBStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBStream.h; path = include/lldb/API/SBStream.h; sourceTree = "<group>"; };
26C72C951243229A0068DC16 /* SBStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBStream.cpp; path = source/API/SBStream.cpp; sourceTree = "<group>"; };
26C81CA411335651004BDC5A /* UUID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UUID.h; path = include/lldb/Core/UUID.h; sourceTree = "<group>"; };
@@ -1224,6 +1232,7 @@
4CB443651249446F00C13DC2 /* LanguageRuntime */,
260C897E10F57C5600BB2B04 /* ObjectContainer */,
260C898210F57C5600BB2B04 /* ObjectFile */,
+ 26C5577E132575B6008FD8FE /* Platform */,
260C898A10F57C5600BB2B04 /* Process */,
260C89B110F57C5600BB2B04 /* SymbolFile */,
260C89E010F57C5600BB2B04 /* SymbolVendor */,
@@ -2060,6 +2069,8 @@
4CB443F212499B5000C13DC2 /* ObjCLanguageRuntime.cpp */,
495BBACF119A0DE700418BEA /* PathMappingList.h */,
495BBACB119A0DBE00418BEA /* PathMappingList.cpp */,
+ 264A43BB1320B3B4005B4096 /* Platform.h */,
+ 264A43BD1320BCEB005B4096 /* Platform.cpp */,
26BC7DF310F1B81A00F91463 /* Process.h */,
26BC7F3610F1B90C00F91463 /* Process.cpp */,
26BC7DF410F1B81A00F91463 /* RegisterContext.h */,
@@ -2145,6 +2156,23 @@
name = MacOSX;
sourceTree = "<group>";
};
+ 26C5577E132575B6008FD8FE /* Platform */ = {
+ isa = PBXGroup;
+ children = (
+ 26C5577F132575C8008FD8FE /* MacOSX */,
+ );
+ path = Platform;
+ sourceTree = "<group>";
+ };
+ 26C5577F132575C8008FD8FE /* MacOSX */ = {
+ isa = PBXGroup;
+ children = (
+ 26C5577B132575AD008FD8FE /* PlatformMacOSX.cpp */,
+ 26C5577C132575AD008FD8FE /* PlatformMacOSX.h */,
+ );
+ path = MacOSX;
+ sourceTree = "<group>";
+ };
26D9FDCA12F785120003F2EE /* Instruction */ = {
isa = PBXGroup;
children = (
@@ -2384,7 +2412,9 @@
2618EE6A1315B29C001D6D71 /* ProcessGDBRemote.h in Headers */,
2618EE6C1315B29C001D6D71 /* ProcessGDBRemoteLog.h in Headers */,
2618EE6E1315B29C001D6D71 /* ThreadGDBRemote.h in Headers */,
+ 264A43BC1320B3B4005B4096 /* Platform.h in Headers */,
268A68401321B53B000E3FB8 /* DynamicLoaderStatic.h in Headers */,
+ 26C557811325781D008FD8FE /* PlatformMacOSX.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2891,7 +2921,9 @@
2618EE691315B29C001D6D71 /* ProcessGDBRemote.cpp in Sources */,
2618EE6B1315B29C001D6D71 /* ProcessGDBRemoteLog.cpp in Sources */,
2618EE6D1315B29C001D6D71 /* ThreadGDBRemote.cpp in Sources */,
+ 264A43BE1320BCEB005B4096 /* Platform.cpp in Sources */,
268A683F1321B53B000E3FB8 /* DynamicLoaderStatic.cpp in Sources */,
+ 26C557801325781A008FD8FE /* PlatformMacOSX.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2997,6 +3029,7 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
@@ -3028,6 +3061,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
INSTALL_PATH = /Developer/usr/bin;
@@ -3043,6 +3077,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 46;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 46;
EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
@@ -3281,6 +3316,7 @@
CODE_SIGN_IDENTITY = lldb_codesign;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 46;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
diff --git a/lldb/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme b/lldb/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme
index 455e6093aa7..338a8758f9a 100644
--- a/lldb/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme
+++ b/lldb/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme
@@ -88,20 +88,6 @@
ReferencedContainer = "container:lldb.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
- <CommandLineArguments>
- <CommandLineArgument
- argument = "/Volumes/work/gclayton/Documents/src/attach/a.out"
- isEnabled = "YES">
- </CommandLineArgument>
- <CommandLineArgument
- argument = "/Volumes/work/gclayton/Documents/src/lldb/test/abbreviation_tests/a.out"
- isEnabled = "NO">
- </CommandLineArgument>
- <CommandLineArgument
- argument = "/Volumes/work/gclayton/Documents/src/lldb/test/alias_tests/a.out"
- isEnabled = "NO">
- </CommandLineArgument>
- </CommandLineArguments>
<EnvironmentVariables>
<EnvironmentVariable
key = "LLDB_LAUNCH_FLAG_DISABLE_ASLR"
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp
index 2adf7963357..f871524dd06 100644
--- a/lldb/source/API/SBDebugger.cpp
+++ b/lldb/source/API/SBDebugger.cpp
@@ -425,7 +425,7 @@ SBDebugger::CreateTargetWithFileAndTargetTriple (const char *filename,
FileSpec file_spec (filename, true);
arch.SetTriple (target_triple);
TargetSP target_sp;
- Error error (m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file_spec, arch, NULL, true, target_sp));
+ Error error (m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file_spec, arch, true, target_sp));
target.reset (target_sp);
}
@@ -454,23 +454,8 @@ SBDebugger::CreateTargetWithFileAndArch (const char *filename, const char *arch_
if (arch_cstr)
arch.SetTriple (arch_cstr);
- else
- arch = lldb_private::Target::GetDefaultArchitecture ();
- if (!arch.IsValid())
- arch.SetTriple (LLDB_ARCH_DEFAULT);
-
- error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch, NULL, true, target_sp);
-
- if (error.Fail())
- {
- if (strcmp (LLDB_ARCH_DEFAULT, LLDB_ARCH_DEFAULT_32BIT) == 0)
- arch.SetTriple (LLDB_ARCH_DEFAULT_64BIT);
- else
- arch.SetTriple (LLDB_ARCH_DEFAULT_32BIT);
-
- error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch, NULL, true, target_sp);
- }
+ error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch, true, target_sp);
if (error.Success())
{
@@ -499,20 +484,7 @@ SBDebugger::CreateTarget (const char *filename)
TargetSP target_sp;
Error error;
- if (!arch.IsValid())
- arch.SetTriple (LLDB_ARCH_DEFAULT);
-
- error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch, NULL, true, target_sp);
-
- if (error.Fail())
- {
- if (strcmp (LLDB_ARCH_DEFAULT, LLDB_ARCH_DEFAULT_32BIT) == 0)
- arch.SetTriple (LLDB_ARCH_DEFAULT_64BIT);
- else
- arch.SetTriple (LLDB_ARCH_DEFAULT_32BIT);
-
- error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch, NULL, true, target_sp);
- }
+ error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch, true, target_sp);
if (error.Success())
{
diff --git a/lldb/source/Commands/CommandObjectFile.cpp b/lldb/source/Commands/CommandObjectFile.cpp
index 50f33940a38..fa62bad6ac2 100644
--- a/lldb/source/Commands/CommandObjectFile.cpp
+++ b/lldb/source/Commands/CommandObjectFile.cpp
@@ -138,9 +138,8 @@ CommandObjectFile::Execute
TargetSP target_sp;
- ArchSpec arch = m_options.m_arch;
Debugger &debugger = m_interpreter.GetDebugger();
- Error error = debugger.GetTargetList().CreateTarget (debugger, file_spec, m_options.m_arch, NULL, true, target_sp);
+ Error error = debugger.GetTargetList().CreateTarget (debugger, file_spec, m_options.m_arch, true, target_sp);
if (target_sp)
{
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp
index 9b2b2a4246d..0dbc9b82873 100644
--- a/lldb/source/Commands/CommandObjectProcess.cpp
+++ b/lldb/source/Commands/CommandObjectProcess.cpp
@@ -18,8 +18,9 @@
#include "lldb/Core/State.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
-#include "./CommandObjectThread.h"
+#include "CommandObjectThread.h"
#include "lldb/Host/Host.h"
+#include "lldb/Target/Platform.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
@@ -518,38 +519,24 @@ public:
// Look to see if there is a -P argument provided, and if so use that plugin, otherwise
// use the default plugin.
- Process *process = interpeter.GetDebugger().GetExecutionContext().process;
- bool need_to_delete_process = false;
const char *partial_name = NULL;
partial_name = input.GetArgumentAtIndex(opt_arg_pos);
-
- if (process && process->IsAlive())
- return true;
-
- Target *target = interpeter.GetDebugger().GetSelectedTarget().get();
- if (target == NULL)
- {
- // No target has been set yet, for now do host completion. Otherwise I don't know how we would
- // figure out what the right target to use is...
- std::vector<lldb::pid_t> pids;
- Host::ListProcessesMatchingName (partial_name, matches, pids);
- return true;
- }
- if (!process)
- {
- process = target->CreateProcess (interpeter.GetDebugger().GetListener(), partial_name).get();
- need_to_delete_process = true;
- }
-
- if (process)
+
+ PlatformSP platform_sp (Platform::GetSelectedPlatform ());
+ if (platform_sp)
{
- matches.Clear();
- std::vector<lldb::pid_t> pids;
- process->ListProcessesMatchingName (NULL, matches, pids);
- if (need_to_delete_process)
- target->DeleteCurrentProcess();
- return true;
+ ProcessInfoList process_infos;
+ platform_sp->FindProcessesByName (partial_name, partial_name ? lldb::eNameMatchStartsWith : lldb::eNameMatchIgnore, process_infos);
+ const uint32_t num_matches = process_infos.GetSize();
+ if (num_matches > 0)
+ {
+ for (uint32_t i=0; i<num_matches; ++i)
+ {
+ matches.AppendString (process_infos.GetProcessNameAtIndex(i),
+ process_infos.GetProcessNameLengthAtIndex(i));
+ }
+ }
}
}
@@ -612,7 +599,6 @@ public:
error = m_interpreter.GetDebugger().GetTargetList().CreateTarget (m_interpreter.GetDebugger(),
emptyFileSpec,
emptyArchSpec,
- NULL,
false,
new_target_sp);
target = new_target_sp.get();
@@ -716,17 +702,19 @@ public:
if (attach_pid == LLDB_INVALID_PROCESS_ID && wait_name != NULL)
{
- std::vector<lldb::pid_t> pids;
- StringList matches;
-
- process->ListProcessesMatchingName(wait_name, matches, pids);
- if (matches.GetSize() > 1)
+ ProcessInfoList process_infos;
+ PlatformSP platform_sp (Platform::GetSelectedPlatform ());
+ if (platform_sp)
+ {
+ platform_sp->FindProcessesByName (wait_name, eNameMatchEquals, process_infos);
+ }
+ if (process_infos.GetSize() > 1)
{
result.AppendErrorWithFormat("More than one process named %s\n", wait_name);
result.SetStatus (eReturnStatusFailed);
return false;
}
- else if (matches.GetSize() == 0)
+ else if (process_infos.GetSize() == 0)
{
result.AppendErrorWithFormat("Could not find a process named %s\n", wait_name);
result.SetStatus (eReturnStatusFailed);
@@ -734,9 +722,8 @@ public:
}
else
{
- attach_pid = pids[0];
+ attach_pid = process_infos.GetProcessIDAtIndex (0);
}
-
}
if (attach_pid != LLDB_INVALID_PROCESS_ID)
@@ -1085,7 +1072,6 @@ public:
error = m_interpreter.GetDebugger().GetTargetList().CreateTarget (m_interpreter.GetDebugger(),
emptyFileSpec,
emptyArchSpec,
- NULL,
false,
target_sp);
if (!target_sp || error.Fail())
diff --git a/lldb/source/Core/ArchSpec.cpp b/lldb/source/Core/ArchSpec.cpp
index 3d59d28a332..f15f02a2ad6 100644
--- a/lldb/source/Core/ArchSpec.cpp
+++ b/lldb/source/Core/ArchSpec.cpp
@@ -456,36 +456,6 @@ ArchSpec::SetTriple (const char *triple_cstr)
return IsValid();
}
-//bool
-//ArchSpec::SetArchitecture (const char *arch_name)
-//{
-// return SetArchitecture(llvm::StringRef (arch_name));
-//}
-//
-//bool
-//ArchSpec::SetArchitecture (const llvm::StringRef& arch_name)
-//{
-// // All default architecture names start with LLDB_ARCH_DEFAULT.
-// if (arch_name.startswith (LLDB_ARCH_DEFAULT))
-// {
-// // Special case for the current host default architectures...
-// if (arch_name.equals (LLDB_ARCH_DEFAULT_32BIT))
-// *this = Host::GetArchitecture (Host::eSystemDefaultArchitecture32);
-// else if (arch_name.equals (LLDB_ARCH_DEFAULT_64BIT))
-// *this = Host::GetArchitecture (Host::eSystemDefaultArchitecture64);
-// else
-// *this = Host::GetArchitecture (Host::eSystemDefaultArchitecture);
-// }
-// else
-// {
-// const CoreDefinition *core_def = FindCoreDefinition (arch_name);
-// if (core_def)
-// m_core = core_def->core;
-// CoreUpdated(true);
-// }
-// return IsValid();
-//}
-//
bool
ArchSpec::SetArchitecture (lldb::ArchitectureType arch_type, uint32_t cpu, uint32_t sub)
{
diff --git a/lldb/source/Core/Error.cpp b/lldb/source/Core/Error.cpp
index da137174bce..6614769f8a0 100644
--- a/lldb/source/Core/Error.cpp
+++ b/lldb/source/Core/Error.cpp
@@ -100,7 +100,7 @@ Error::AsCString(const char *default_error_str) const
switch (m_type)
{
case eErrorTypeMachKernel:
-#ifdef __APPLE__
+#if defined (__APPLE__)
s = ::mach_error_string (m_code);
#endif
break;
diff --git a/lldb/source/Core/PluginManager.cpp b/lldb/source/Core/PluginManager.cpp
index 3c2907ed239..12bb4868652 100644
--- a/lldb/source/Core/PluginManager.cpp
+++ b/lldb/source/Core/PluginManager.cpp
@@ -1194,17 +1194,153 @@ PluginManager::GetLogChannelCreateCallbackForPluginName (const char *name)
return NULL;
}
-#pragma mark Process
+#pragma mark Platform
-struct ProcessInstance
+struct PlatformInstance
{
- ProcessInstance() :
+ PlatformInstance() :
name(),
description(),
create_callback(NULL)
{
}
+
+ std::string name;
+ std::string description;
+ PlatformCreateInstance create_callback;
+};
+
+typedef std::vector<PlatformInstance> PlatformInstances;
+static bool
+AccessPlatformInstances (PluginAction action, PlatformInstance &instance, uint32_t index)
+{
+ static PlatformInstances g_plugin_instances;
+
+ switch (action)
+ {
+ case ePluginRegisterInstance:
+ if (instance.create_callback)
+ {
+ g_plugin_instances.push_back (instance);
+ return true;
+ }
+ break;
+
+ case ePluginUnregisterInstance:
+ if (instance.create_callback)
+ {
+ PlatformInstances::iterator pos, end = g_plugin_instances.end();
+ for (pos = g_plugin_instances.begin(); pos != end; ++ pos)
+ {
+ if (pos->create_callback == instance.create_callback)
+ {
+ g_plugin_instances.erase(pos);
+ return true;
+ }
+ }
+ }
+ break;
+
+ case ePluginGetInstanceAtIndex:
+ if (index < g_plugin_instances.size())
+ {
+ instance = g_plugin_instances[index];
+ return true;
+ }
+ break;
+
+ default:
+ break;
+ }
+ return false;
+}
+
+
+bool
+PluginManager::RegisterPlugin (const char *name,
+ const char *description,
+ PlatformCreateInstance create_callback)
+{
+ if (create_callback)
+ {
+ PlatformInstance instance;
+ assert (name && name[0]);
+ instance.name = name;
+ if (description && description[0])
+ instance.description = description;
+ instance.create_callback = create_callback;
+ return AccessPlatformInstances (ePluginRegisterInstance, instance, 0);
+ }
+ return false;
+}
+
+const char *
+PluginManager::GetPlatformPluginNameAtIndex (uint32_t idx)
+{
+ PlatformInstance instance;
+ if (AccessPlatformInstances (ePluginGetInstanceAtIndex, instance, idx))
+ return instance.name.c_str();
+ return NULL;
+}
+
+const char *
+PluginManager::GetPlatformPluginDescriptionAtIndex (uint32_t idx)
+{
+ PlatformInstance instance;
+ if (AccessPlatformInstances (ePluginGetInstanceAtIndex, instance, idx))
+ return instance.description.c_str();
+ return NULL;
+}
+
+bool
+PluginManager::UnregisterPlugin (PlatformCreateInstance create_callback)
+{
+ if (create_callback)
+ {
+ PlatformInstance instance;
+ instance.create_callback = create_callback;
+ return AccessPlatformInstances (ePluginUnregisterInstance, instance, 0);
+ }
+ return false;
+}
+
+PlatformCreateInstance
+PluginManager::GetPlatformCreateCallbackAtIndex (uint32_t idx)
+{
+ PlatformInstance instance;
+ if (AccessPlatformInstances (ePluginGetInstanceAtIndex, instance, idx))
+ return instance.create_callback;
+ return NULL;
+}
+
+PlatformCreateInstance
+PluginManager::GetPlatformCreateCallbackForPluginName (const char *name)
+{
+ if (name && name[0])
+ {
+ PlatformInstance instance;
+ std::string ss_name(name);
+ for (uint32_t idx = 0; AccessPlatformInstances (ePluginGetInstanceAtIndex, instance, idx); ++idx)
+ {
+ if (instance.name == ss_name)
+ return instance.create_callback;
+ }
+ }
+ return NULL;
+}
+
+#pragma mark Process
+
+struct ProcessInstance
+{
+ ProcessInstance() :
+ name(),
+ description(),
+ create_callback(NULL)
+ {
+ }
+
std::string name;
std::string description;
ProcessCreateInstance create_callback;
@@ -1216,42 +1352,42 @@ static bool
AccessProcessInstances (PluginAction action, ProcessInstance &instance, uint32_t index)
{
static ProcessInstances g_plugin_instances;
-
+
switch (action)
{
- case ePluginRegisterInstance:
- if (instance.create_callback)
- {
- g_plugin_instances.push_back (instance);
- return true;
- }
- break;
-
- case ePluginUnregisterInstance:
- if (instance.create_callback)
- {
- ProcessInstances::iterator pos, end = g_plugin_instances.end();
- for (pos = g_plugin_instances.begin(); pos != end; ++ pos)
+ case ePluginRegisterInstance:
+ if (instance.create_callback)
{
- if (pos->create_callback == instance.create_callback)
+ g_plugin_instances.push_back (instance);
+ return true;
+ }
+ break;
+
+ case ePluginUnregisterInstance:
+ if (instance.create_callback)
+ {
+ ProcessInstances::iterator pos, end = g_plugin_instances.end();
+ for (pos = g_plugin_instances.begin(); pos != end; ++ pos)
{
- g_plugin_instances.erase(pos);
- return true;
+ if (pos->create_callback == instance.create_callback)
+ {
+ g_plugin_instances.erase(pos);
+ return true;
+ }
}
}
- }
- break;
-
- case ePluginGetInstanceAtIndex:
- if (index < g_plugin_instances.size())
- {
- instance = g_plugin_instances[index];
- return true;
- }
- break;
-
- default:
- break;
+ break;
+
+ case ePluginGetInstanceAtIndex:
+ if (index < g_plugin_instances.size())
+ {
+ instance = g_plugin_instances[index];
+ return true;
+ }
+ break;
+
+ default:
+ break;
}
return false;
}
@@ -1260,10 +1396,10 @@ AccessProcessInstances (PluginAction action, ProcessInstance &instance, uint32_t
bool
PluginManager::RegisterPlugin
(
- const char *name,
- const char *description,
- ProcessCreateInstance create_callback
-)
+ const char *name,
+ const char *description,
+ ProcessCreateInstance create_callback
+ )
{
if (create_callback)
{
diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp
index cb6a3cf97f1..37516ba840d 100644
--- a/lldb/source/Host/common/Host.cpp
+++ b/lldb/source/Host/common/Host.cpp
@@ -11,14 +11,16 @@
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/Error.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/StreamString.h"
#include "lldb/Host/Config.h"
#include "lldb/Host/Endian.h"
+#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Mutex.h"
+#include "lldb/Target/Process.h"
#include "llvm/Support/Host.h"
+#include "llvm/Support/MachO.h"
#include <dlfcn.h>
#include <errno.h>
@@ -1027,11 +1029,66 @@ Host::GetLLDBPath (PathType path_type, FileSpec &file_spec)
return false;
}
-uint32_t
-Host::ListProcessesMatchingName (const char *name, StringList &matches, std::vector<lldb::pid_t> &pids)
+#if defined (__APPLE__)
+
+static bool
+GetMacOSXProcessName (lldb::pid_t pid,
+ NameMatchType name_match_type,
+ const char *name_match,
+ ProcessInfo &proc_info)
{
- uint32_t num_matches = 0;
+ char process_name[MAXCOMLEN * 2 + 1];
+ int name_len = ::proc_name(pid, process_name, MAXCOMLEN * 2);
+ if (name_len == 0)
+ return false;
+
+ if (NameMatches(process_name, name_match_type, name_match))
+ {
+ proc_info.SetName (process_name);
+ return true;
+ }
+ else
+ {
+ proc_info.SetName (NULL);
+ return false;
+ }
+}
+
+static bool
+GetMacOSXProcessCPUType (lldb::pid_t pid, ProcessInfo &proc_info)
+{
+ // Make a new mib to stay thread safe
+ int mib[CTL_MAXNAME]={0,};
+ size_t mib_len = CTL_MAXNAME;
+ if (::sysctlnametomib("sysctl.proc_cputype", mib, &mib_len))
+ return false;
+
+ mib[mib_len] = pid;
+ mib_len++;
+
+ cpu_type_t cpu, sub;
+ size_t cpu_len = sizeof(cpu);
+ if (::sysctl (mib, mib_len, &cpu, &cpu_len, 0, 0) == 0)
+ {
+ switch (cpu)
+ {
+ case llvm::MachO::CPUTypeI386: sub = llvm::MachO::CPUSubType_I386_ALL; break;
+ case llvm::MachO::CPUTypeX86_64: sub = llvm::MachO::CPUSubType_X86_64_ALL; break;
+ default: break;
+ }
+ proc_info.GetArchitecture ().SetArchitecture (lldb::eArchTypeMachO, cpu, sub);
+ return true;
+ }
+ return false;
+}
+
+#endif
+
+uint32_t
+Host::FindProcessesByName (const char *name, NameMatchType name_match_type, ProcessInfoList &process_infos)
+{
+ process_infos.Clear();
#if defined (__APPLE__)
int num_pids;
int size_of_pids;
@@ -1064,56 +1121,35 @@ Host::ListProcessesMatchingName (const char *name, StringList &matches, std::vec
|| (bsd_info.pbi_status == SZOMB)
|| (bsd_info.pbi_pid == our_pid))
continue;
- char pid_name[MAXCOMLEN * 2 + 1];
- int name_len;
- name_len = proc_name(bsd_info.pbi_pid, pid_name, MAXCOMLEN * 2);
- if (name_len == 0)
- continue;
- if (strstr(pid_name, name) != pid_name)
- continue;
- matches.AppendString (pid_name);
- pids.push_back (bsd_info.pbi_pid);
- num_matches++;
+ ProcessInfo process_info;
+ if (GetMacOSXProcessName (bsd_info.pbi_pid, name_match_type, name, process_info))
+ {
+ process_info.SetProcessID (bsd_info.pbi_pid);
+ GetMacOSXProcessCPUType (bsd_info.pbi_pid, process_info);
+ process_infos.Append (process_info);
+ }
}
#endif
- return num_matches;
+ return process_infos.GetSize();
}
-ArchSpec
-Host::GetArchSpecForExistingProcess (lldb::pid_t pid)
+bool
+Host::GetProcessInfo (lldb::pid_t pid, ProcessInfo &process_info)
{
- ArchSpec return_spec;
-
#if defined (__APPLE__)
- struct proc_bsdinfo bsd_info;
- int error = proc_pidinfo (pid, PROC_PIDTBSDINFO, (uint64_t) 0, &bsd_info, PROC_PIDTBSDINFO_SIZE);
- if (error == 0)
- return return_spec;
- if (bsd_info.pbi_flags & PROC_FLAG_LP64)
- return_spec.SetTriple (LLDB_ARCH_DEFAULT_64BIT);
- else
- return_spec.SetTriple (LLDB_ARCH_DEFAULT_32BIT);
-#endif
-
- return return_spec;
-}
-ArchSpec
-Host::GetArchSpecForExistingProcess (const char *process_name)
-{
- ArchSpec returnSpec;
- StringList matches;
- std::vector<lldb::pid_t> pids;
- if (ListProcessesMatchingName(process_name, matches, pids))
+ if (GetMacOSXProcessName (pid, eNameMatchIgnore, NULL, process_info))
{
- if (matches.GetSize() == 1)
- {
- return GetArchSpecForExistingProcess(pids[0]);
- }
- }
- return returnSpec;
+ process_info.SetProcessID (pid);
+ if (GetMacOSXProcessCPUType (pid, process_info) == false)
+ process_info.GetArchitecture().Clear();
+ return true;
+ }
+#endif
+ process_info.Clear();
+ return false;
}
#if !defined (__APPLE__) // see macosx/Host.mm
diff --git a/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp b/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
index 4fb96ce85b9..a65a2efa78f 100644
--- a/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
+++ b/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
@@ -595,21 +595,3 @@ ABIMacOSX_i386::GetPluginVersion()
return 1;
}
-void
-ABIMacOSX_i386::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-ABIMacOSX_i386::ExecutePluginCommand (Args &command, Stream *strm)
-{
- Error error;
- error.SetErrorString("No plug-in command are currently supported.");
- return error;
-}
-
-Log *
-ABIMacOSX_i386::EnablePluginLogging (Stream *strm, Args &command)
-{
- return NULL;
-}
diff --git a/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h b/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h
index 140b8af8f2c..20dbc4af5ec 100644
--- a/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h
+++ b/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h
@@ -77,14 +77,6 @@ namespace lldb_private {
virtual uint32_t
GetPluginVersion();
- virtual void
- GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
- virtual lldb_private::Error
- ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
- virtual lldb_private::Log *
- EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
protected:
private:
ABIMacOSX_i386() : lldb_private::ABI() { } // Call CreateInstance instead.
diff --git a/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp b/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
index 93537cf1d3a..5c2cd7403ec 100644
--- a/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
+++ b/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
@@ -481,21 +481,3 @@ ABISysV_x86_64::GetPluginVersion()
return 1;
}
-void
-ABISysV_x86_64::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-ABISysV_x86_64::ExecutePluginCommand (Args &command, Stream *strm)
-{
- Error error;
- error.SetErrorString("No plug-in command are currently supported.");
- return error;
-}
-
-Log *
-ABISysV_x86_64::EnablePluginLogging (Stream *strm, Args &command)
-{
- return NULL;
-}
diff --git a/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h b/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h
index fa2e92420db..beb617891c2 100644
--- a/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h
+++ b/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h
@@ -76,14 +76,6 @@ public:
virtual uint32_t
GetPluginVersion();
- virtual void
- GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
- virtual lldb_private::Error
- ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
- virtual lldb_private::Log *
- EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
protected:
private:
ABISysV_x86_64() : lldb_private::ABI() { } // Call CreateInstance instead.
diff --git a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
index edecaa17486..dd3491c933e 100644
--- a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
+++ b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
@@ -469,22 +469,3 @@ DisassemblerLLVM::GetPluginVersion()
return 1;
}
-void
-DisassemblerLLVM::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-DisassemblerLLVM::ExecutePluginCommand (Args &command, Stream *strm)
-{
- Error error;
- error.SetErrorString("No plug-in command are currently supported.");
- return error;
-}
-
-Log *
-DisassemblerLLVM::EnablePluginLogging (Stream *strm, Args &command)
-{
- return NULL;
-}
-
diff --git a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.h b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.h
index 515814da881..69ac743fcf2 100644
--- a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.h
+++ b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.h
@@ -92,15 +92,6 @@ public:
virtual uint32_t
GetPluginVersion();
- virtual void
- GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
- virtual lldb_private::Error
- ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
- virtual lldb_private::Log *
- EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
protected:
bool
IsValid() const
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
index 67958c97d79..74936678083 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
@@ -1298,23 +1298,3 @@ DynamicLoaderMacOSXDYLD::GetPluginVersion()
return 1;
}
-void
-DynamicLoaderMacOSXDYLD::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-DynamicLoaderMacOSXDYLD::ExecutePluginCommand (Args &command, Stream *strm)
-{
- Error error;
- error.SetErrorString("No plug-in command are currently supported.");
- return error;
-}
-
-Log *
-DynamicLoaderMacOSXDYLD::EnablePluginLogging (Stream *strm, Args &command)
-{
- return NULL;
-}
-
-
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h
index d5575101496..9655b4beb2a 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h
@@ -81,17 +81,6 @@ public:
virtual uint32_t
GetPluginVersion();
- virtual void
- GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
- virtual lldb_private::Error
- ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
- virtual lldb_private::Log *
- EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
-
-
protected:
void
PrivateInitialize (lldb_private::Process *process);
diff --git a/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp b/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp
index 75482a811cc..290619e4549 100644
--- a/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp
+++ b/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp
@@ -194,23 +194,3 @@ DynamicLoaderStatic::GetPluginVersion()
return 1;
}
-void
-DynamicLoaderStatic::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-DynamicLoaderStatic::ExecutePluginCommand (Args &command, Stream *strm)
-{
- Error error;
- error.SetErrorString("No plug-in command are currently supported.");
- return error;
-}
-
-Log *
-DynamicLoaderStatic::EnablePluginLogging (Stream *strm, Args &command)
-{
- return NULL;
-}
-
-
diff --git a/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h b/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h
index 66c0971b296..3bdb016f22c 100644
--- a/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h
+++ b/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h
@@ -81,15 +81,6 @@ public:
virtual uint32_t
GetPluginVersion();
- virtual void
- GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
- virtual lldb_private::Error
- ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
- virtual lldb_private::Log *
- EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
private:
void
LoadAllImagesAtFileAddresses ();
diff --git a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h
index e420d0c27e6..97299742951 100644
--- a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h
+++ b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h
@@ -85,25 +85,6 @@ public:
return 1;
}
- virtual void
- GetPluginCommandHelp (const char *command, Stream *strm)
- {
- }
-
- virtual lldb_private::Error
- ExecutePluginCommand (Args &command, Stream *strm)
- {
- Error error;
- error.SetErrorString("no plug-in commands are supported");
- return error;
- }
-
- virtual Log *
- EnablePluginLogging (Stream *strm, Args &command)
- {
- return NULL;
- }
-
enum Mode
{
eModeInvalid,
diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
index 8a7cfc2c1f2..4f6c129687c 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
@@ -101,25 +101,6 @@ ItaniumABILanguageRuntime::GetPluginVersion()
}
void
-ItaniumABILanguageRuntime::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-ItaniumABILanguageRuntime::ExecutePluginCommand (Args &command, Stream *strm)
-{
- Error error;
- error.SetErrorString("No plug-in command are currently supported.");
- return error;
-}
-
-Log *
-ItaniumABILanguageRuntime::EnablePluginLogging (Stream *strm, Args &command)
-{
- return NULL;
-}
-
-void
ItaniumABILanguageRuntime::SetExceptionBreakpoints ()
{
if (!m_process)
diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
index 113ed51fbea..580d2d6f00f 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
@@ -58,15 +58,6 @@ namespace lldb_private {
GetPluginVersion();
virtual void
- GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
- virtual lldb_private::Error
- ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
- virtual lldb_private::Log *
- EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
- virtual void
SetExceptionBreakpoints ();
virtual void
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
index 892b4bd7f1d..75eb468799c 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
@@ -274,28 +274,6 @@ AppleObjCRuntime::GetObjCVersion (Process *process, ModuleSP &objc_module_sp)
return lldb::eObjC_VersionUnknown;
}
-//------------------------------------------------------------------
-// PluginInterface protocol
-//------------------------------------------------------------------
-void
-AppleObjCRuntime::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-AppleObjCRuntime::ExecutePluginCommand (Args &command, Stream *strm)
-{
- Error error;
- error.SetErrorString("No plug-in command are currently supported.");
- return error;
-}
-
-Log *
-AppleObjCRuntime::EnablePluginLogging (Stream *strm, Args &command)
-{
- return NULL;
-}
-
void
AppleObjCRuntime::ClearExceptionBreakpoints ()
{
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
index baf735da2a0..157743427fb 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
@@ -74,15 +74,7 @@ protected:
// PluginInterface protocol
//------------------------------------------------------------------
public:
- virtual void
- GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
- virtual lldb_private::Error
- ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
- virtual lldb_private::Log *
- EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
+
virtual void
ClearExceptionBreakpoints ();
diff --git a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
index 7ff54c7ed8e..757d0d13535 100644
--- a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
+++ b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
@@ -405,24 +405,3 @@ ObjectContainerBSDArchive::GetPluginVersion()
return 1;
}
-void
-ObjectContainerBSDArchive::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-ObjectContainerBSDArchive::ExecutePluginCommand (Args &command, Stream *strm)
-{
- Error error;
- error.SetErrorString("No plug-in command are currently supported.");
- return error;
-}
-
-Log *
-ObjectContainerBSDArchive::EnablePluginLogging (Stream *strm, Args &command)
-{
- return NULL;
-}
-
-
-
diff --git a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
index 81730293cc1..2b45a13d111 100644
--- a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
+++ b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
@@ -81,16 +81,6 @@ public:
virtual uint32_t
GetPluginVersion();
- virtual void
- GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
- virtual lldb_private::Error
- ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
- virtual lldb_private::Log *
- EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
-
protected:
struct Object
diff --git a/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp
index 7ff1943532c..4fe64898e32 100644
--- a/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp
+++ b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp
@@ -248,24 +248,4 @@ ObjectContainerUniversalMachO::GetPluginVersion()
return 1;
}
-void
-ObjectContainerUniversalMachO::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-ObjectContainerUniversalMachO::ExecutePluginCommand (Args &command, Stream *strm)
-{
- Error error;
- error.SetErrorString("No plug-in command are currently supported.");
- return error;
-}
-
-Log *
-ObjectContainerUniversalMachO::EnablePluginLogging (Stream *strm, Args &command)
-{
- return NULL;
-}
-
-
diff --git a/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h
index 8f0b231a882..8cc0fbd1e35 100644
--- a/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h
+++ b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h
@@ -83,16 +83,6 @@ public:
virtual uint32_t
GetPluginVersion();
- virtual void
- GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
- virtual lldb_private::Error
- ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
- virtual lldb_private::Log *
- EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
-
protected:
llvm::MachO::fat_header m_header;
std::vector<llvm::MachO::fat_arch> m_fat_archs;
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 2d5471d3a7f..67b6a5ed449 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -107,26 +107,6 @@ ObjectFileELF::GetPluginVersion()
{
return m_plugin_version;
}
-
-void
-ObjectFileELF::GetPluginCommandHelp(const char *command, Stream *strm)
-{
-}
-
-Error
-ObjectFileELF::ExecutePluginCommand(Args &command, Stream *strm)
-{
- Error error;
- error.SetErrorString("No plug-in commands are currently supported.");
- return error;
-}
-
-Log *
-ObjectFileELF::EnablePluginLogging(Stream *strm, Args &command)
-{
- return NULL;
-}
-
//------------------------------------------------------------------
// ObjectFile protocol
//------------------------------------------------------------------
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
index ebfde8965a5..2ac4a63cbea 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
@@ -63,17 +63,6 @@ public:
virtual uint32_t
GetPluginVersion();
- virtual void
- GetPluginCommandHelp(const char *command, lldb_private::Stream *strm);
-
- virtual lldb_private::Error
- ExecutePluginCommand(lldb_private::Args &command,
- lldb_private::Stream *strm);
-
- virtual lldb_private::Log *
- EnablePluginLogging(lldb_private::Stream *strm,
- lldb_private::Args &command);
-
//------------------------------------------------------------------
// ObjectFile Protocol.
//------------------------------------------------------------------
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index fa88b184a31..56d3daf6d5e 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -1598,25 +1598,3 @@ ObjectFileMachO::GetPluginVersion()
return 1;
}
-void
-ObjectFileMachO::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-ObjectFileMachO::ExecutePluginCommand (Args &command, Stream *strm)
-{
- Error error;
- error.SetErrorString("No plug-in command are currently supported.");
- return error;
-}
-
-Log *
-ObjectFileMachO::EnablePluginLogging (Stream *strm, Args &command)
-{
- return NULL;
-}
-
-
-
-
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
index 1289b9d3e28..c079fe419de 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
@@ -104,15 +104,6 @@ public:
virtual uint32_t
GetPluginVersion();
- virtual void
- GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
- virtual lldb_private::Error
- ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
- virtual lldb_private::Log *
- EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
virtual lldb_private::Address
GetEntryPointAddress ();
diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
new file mode 100644
index 00000000000..a118a2b031d
--- /dev/null
+++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
@@ -0,0 +1,186 @@
+//===-- PlatformLinux.cpp ---------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "PlatformLinux.h"
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Core/Error.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Core/ModuleList.h"
+#include "lldb/Core/StreamString.h"
+#include "lldb/Host/FileSpec.h"
+#include "lldb/Host/Host.h"
+#include "lldb/Target/Process.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+void
+PlatformLinux::Initialize ()
+{
+#if defined (__linux__)
+ PlatformSP default_platform_sp (new PlatformLinux());
+ Platform::SetDefaultPlatform (default_platform_sp);
+#endif
+}
+
+void
+PlatformLinux::Terminate ()
+{
+}
+
+
+Error
+PlatformLinux::ResolveExecutable (const FileSpec &exe_file,
+ const ArchSpec &exe_arch,
+ lldb::ModuleSP &exe_module_sp)
+{
+ Error error;
+ // Nothing special to do here, just use the actual file and architecture
+
+ FileSpec resolved_exe_file (exe_file);
+
+ // If we have "ls" as the exe_file, resolve the executable loation based on
+ // the current path variables
+ if (!resolved_exe_file.Exists())
+ resolved_exe_file.ResolveExecutableLocation ();
+
+ // Resolve any executable within a bundle on MacOSX
+ Host::ResolveExecutableInBundle (resolved_exe_file);
+
+ if (resolved_exe_file.Exists())
+ {
+ if (exe_arch.IsValid())
+ {
+ error = ModuleList::GetSharedModule (resolved_exe_file,
+ exe_arch,
+ NULL,
+ NULL,
+ 0,
+ exe_module_sp,
+ NULL,
+ NULL);
+
+ if (exe_module_sp->GetObjectFile() == NULL)
+ {
+ exe_module_sp.reset();
+ error.SetErrorStringWithFormat ("'%s%s%s' doesn't contain the architecture %s",
+ exe_file.GetDirectory().AsCString(""),
+ exe_file.GetDirectory() ? "/" : "",
+ exe_file.GetFilename().AsCString(""),
+ exe_arch.GetArchitectureName());
+ }
+ }
+ else
+ {
+ // No valid architecture was specified, ask the platform for
+ // the architectures that we should be using (in the correct order)
+ // and see if we can find a match that way
+ StreamString arch_names;
+ ArchSpec platform_arch;
+ for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, platform_arch); ++idx)
+ {
+ error = ModuleList::GetSharedModule (resolved_exe_file,
+ platform_arch,
+ NULL,
+ NULL,
+ 0,
+ exe_module_sp,
+ NULL,
+ NULL);
+ // Did we find an executable using one of the
+ if (error.Success())
+ {
+ if (exe_module_sp && exe_module_sp->GetObjectFile())
+ break;
+ else
+ error.SetErrorToGenericError();
+ }
+
+ if (idx > 0)
+ arch_names.PutCString (", ");
+ arch_names.PutCString (platform_arch.GetArchitectureName());
+ }
+
+ if (error.Fail() || !exe_module_sp)
+ {
+ error.SetErrorStringWithFormat ("'%s%s%s' doesn't contain any '%s' platform architectures: %s",
+ exe_file.GetDirectory().AsCString(""),
+ exe_file.GetDirectory() ? "/" : "",
+ exe_file.GetFilename().AsCString(""),
+ GetShortPluginName(),
+ arch_names.GetString().c_str());
+ }
+ }
+ }
+ else
+ {
+ error.SetErrorStringWithFormat ("'%s%s%s' does not exist",
+ exe_file.GetDirectory().AsCString(""),
+ exe_file.GetDirectory() ? "/" : "",
+ exe_file.GetFilename().AsCString(""));
+ }
+
+ return error;
+}
+
+Error
+PlatformLinux::GetFile (const FileSpec &platform_file, FileSpec &local_file)
+{
+ // Default to the local case
+ local_file = platform_file;
+ return Error();
+}
+
+
+//------------------------------------------------------------------
+/// Default Constructor
+//------------------------------------------------------------------
+PlatformLinux::PlatformLinux () :
+ Platform()
+{
+}
+
+//------------------------------------------------------------------
+/// Destructor.
+///
+/// The destructor is virtual since this class is designed to be
+/// inherited from by the plug-in instance.
+//------------------------------------------------------------------
+PlatformLinux::~PlatformLinux()
+{
+}
+
+uint32_t
+PlatformLinux::FindProcessesByName (const char *name_match,
+ lldb::NameMatchType name_match_type,
+ ProcessInfoList &process_infos)
+{
+ return Host::FindProcessesByName (name_match, name_match_type, process_infos);
+}
+
+bool
+PlatformLinux::GetProcessInfo (lldb::pid_t pid, ProcessInfo &process_info)
+{
+ return Host::GetProcessInfo (pid, process_info);
+}
+
+bool
+PlatformLinux::GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch)
+{
+ if (idx == 0)
+ {
+ arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture);
+ return arch.IsValid();
+ }
+ return false;
+}
diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.h b/lldb/source/Plugins/Platform/Linux/PlatformLinux.h
new file mode 100644
index 00000000000..c6ede767d5f
--- /dev/null
+++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.h
@@ -0,0 +1,89 @@
+//===-- PlatformLinux.h -----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_PlatformLinux_h_
+#define liblldb_PlatformLinux_h_
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Target/Platform.h"
+
+namespace lldb_private {
+
+ class PlatformLinux : public Platform
+ {
+ public:
+
+ static void
+ Initialize ();
+
+ static void
+ Terminate ();
+
+ PlatformLinux ();
+
+ virtual
+ ~PlatformLinux();
+
+ //------------------------------------------------------------
+ // lldb_private::PluginInterface functions
+ //------------------------------------------------------------
+ virtual const char *
+ GetPluginName()
+ {
+ return "PlatformLinux";
+ }
+
+ virtual const char *
+ GetShortPluginName()
+ {
+ return "platform.linux";
+ }
+
+ virtual uint32_t
+ GetPluginVersion()
+ {
+ return 1;
+ }
+
+
+ //------------------------------------------------------------
+ // lldb_private::Platform functions
+ //------------------------------------------------------------
+ virtual Error
+ ResolveExecutable (const FileSpec &exe_file,
+ const ArchSpec &arch,
+ lldb::ModuleSP &module_sp);
+
+ virtual Error
+ GetFile (const FileSpec &platform_file, FileSpec &local_file);
+
+ virtual uint32_t
+ FindProcessesByName (const char *name_match,
+ lldb::NameMatchType name_match_type,
+ ProcessInfoList &process_infos);
+
+ virtual bool
+ GetProcessInfo (lldb::pid_t pid, ProcessInfo &proc_info);
+
+ virtual bool
+ GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch);
+
+ protected:
+
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN (PlatformLinux);
+
+ };
+} // namespace lldb_private
+
+#endif // liblldb_PlatformLinux_h_
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
new file mode 100644
index 00000000000..b1df7ba6bb8
--- /dev/null
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
@@ -0,0 +1,199 @@
+//===-- Platform.cpp --------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "PlatformMacOSX.h"
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Core/Error.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Core/ModuleList.h"
+#include "lldb/Core/StreamString.h"
+#include "lldb/Host/FileSpec.h"
+#include "lldb/Host/Host.h"
+#include "lldb/Target/Process.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+void
+PlatformMacOSX::Initialize ()
+{
+#if defined (__APPLE__)
+ PlatformSP default_platform_sp (new PlatformMacOSX());
+ Platform::SetDefaultPlatform (default_platform_sp);
+#endif
+}
+
+void
+PlatformMacOSX::Terminate ()
+{
+}
+
+
+Error
+PlatformMacOSX::ResolveExecutable (const FileSpec &exe_file,
+ const ArchSpec &exe_arch,
+ lldb::ModuleSP &exe_module_sp)
+{
+ Error error;
+ // Nothing special to do here, just use the actual file and architecture
+
+ FileSpec resolved_exe_file (exe_file);
+
+ // If we have "ls" as the exe_file, resolve the executable loation based on
+ // the current path variables
+ if (!resolved_exe_file.Exists())
+ resolved_exe_file.ResolveExecutableLocation ();
+
+ // Resolve any executable within a bundle on MacOSX
+ Host::ResolveExecutableInBundle (resolved_exe_file);
+
+ if (resolved_exe_file.Exists())
+ {
+ if (exe_arch.IsValid())
+ {
+ error = ModuleList::GetSharedModule (resolved_exe_file,
+ exe_arch,
+ NULL,
+ NULL,
+ 0,
+ exe_module_sp,
+ NULL,
+ NULL);
+
+ if (exe_module_sp->GetObjectFile() == NULL)
+ {
+ exe_module_sp.reset();
+ error.SetErrorStringWithFormat ("'%s%s%s' doesn't contain the architecture %s",
+ exe_file.GetDirectory().AsCString(""),
+ exe_file.GetDirectory() ? "/" : "",
+ exe_file.GetFilename().AsCString(""),
+ exe_arch.GetArchitectureName());
+ }
+ }
+ else
+ {
+ // No valid architecture was specified, ask the platform for
+ // the architectures that we should be using (in the correct order)
+ // and see if we can find a match that way
+ StreamString arch_names;
+ ArchSpec platform_arch;
+ for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, platform_arch); ++idx)
+ {
+ error = ModuleList::GetSharedModule (resolved_exe_file,
+ platform_arch,
+ NULL,
+ NULL,
+ 0,
+ exe_module_sp,
+ NULL,
+ NULL);
+ // Did we find an executable using one of the
+ if (error.Success())
+ {
+ if (exe_module_sp && exe_module_sp->GetObjectFile())
+ break;
+ else
+ error.SetErrorToGenericError();
+ }
+
+ if (idx > 0)
+ arch_names.PutCString (", ");
+ arch_names.PutCString (platform_arch.GetArchitectureName());
+ }
+
+ if (error.Fail() || !exe_module_sp)
+ {
+ error.SetErrorStringWithFormat ("'%s%s%s' doesn't contain any '%s' platform architectures: %s",
+ exe_file.GetDirectory().AsCString(""),
+ exe_file.GetDirectory() ? "/" : "",
+ exe_file.GetFilename().AsCString(""),
+ GetShortPluginName(),
+ arch_names.GetString().c_str());
+ }
+ }
+ }
+ else
+ {
+ error.SetErrorStringWithFormat ("'%s%s%s' does not exist",
+ exe_file.GetDirectory().AsCString(""),
+ exe_file.GetDirectory() ? "/" : "",
+ exe_file.GetFilename().AsCString(""));
+ }
+
+ return error;
+}
+
+Error
+PlatformMacOSX::GetFile (const FileSpec &platform_file, FileSpec &local_file)
+{
+ // Default to the local case
+ local_file = platform_file;
+ return Error();
+}
+
+
+//------------------------------------------------------------------
+/// Default Constructor
+//------------------------------------------------------------------
+PlatformMacOSX::PlatformMacOSX () :
+ Platform()
+{
+}
+
+//------------------------------------------------------------------
+/// Destructor.
+///
+/// The destructor is virtual since this class is designed to be
+/// inherited from by the plug-in instance.
+//------------------------------------------------------------------
+PlatformMacOSX::~PlatformMacOSX()
+{
+}
+
+uint32_t
+PlatformMacOSX::FindProcessesByName (const char *name_match,
+ lldb::NameMatchType name_match_type,
+ ProcessInfoList &process_infos)
+{
+ return Host::FindProcessesByName (name_match, name_match_type, process_infos);
+}
+
+bool
+PlatformMacOSX::GetProcessInfo (lldb::pid_t pid, ProcessInfo &process_info)
+{
+ return Host::GetProcessInfo (pid, process_info);
+}
+
+bool
+PlatformMacOSX::GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch)
+{
+ if (idx == 0)
+ {
+ arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture);
+ return arch.IsValid();
+ }
+ else if (idx == 1)
+ {
+ ArchSpec platform_arch (Host::GetArchitecture (Host::eSystemDefaultArchitecture));
+ ArchSpec platform_arch64 (Host::GetArchitecture (Host::eSystemDefaultArchitecture64));
+ if (platform_arch == platform_arch64)
+ {
+ // This macosx platform supports both 32 and 64 bit. Since we already
+ // returned the 64 bit arch for idx == 0, return the 32 bit arch
+ // for idx == 1
+ arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture32);
+ return arch.IsValid();
+ }
+ }
+ return false;
+}
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
new file mode 100644
index 00000000000..037cac28e74
--- /dev/null
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
@@ -0,0 +1,89 @@
+//===-- PlatformMacOSX.h ----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_PlatformMacOSX_h_
+#define liblldb_PlatformMacOSX_h_
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Target/Platform.h"
+
+namespace lldb_private {
+
+ class PlatformMacOSX : public Platform
+ {
+ public:
+
+ static void
+ Initialize ();
+
+ static void
+ Terminate ();
+
+ PlatformMacOSX ();
+
+ virtual
+ ~PlatformMacOSX();
+
+ //------------------------------------------------------------
+ // lldb_private::PluginInterface functions
+ //------------------------------------------------------------
+ virtual const char *
+ GetPluginName()
+ {
+ return "PlatformMacOSX";
+ }
+
+ virtual const char *
+ GetShortPluginName()
+ {
+ return "platform.macosx";
+ }
+
+ virtual uint32_t
+ GetPluginVersion()
+ {
+ return 1;
+ }
+
+
+ //------------------------------------------------------------
+ // lldb_private::Platform functions
+ //------------------------------------------------------------
+ virtual Error
+ ResolveExecutable (const FileSpec &exe_file,
+ const ArchSpec &arch,
+ lldb::ModuleSP &module_sp);
+
+ virtual Error
+ GetFile (const FileSpec &platform_file, FileSpec &local_file);
+
+ virtual uint32_t
+ FindProcessesByName (const char *name_match,
+ lldb::NameMatchType name_match_type,
+ ProcessInfoList &process_infos);
+
+ virtual bool
+ GetProcessInfo (lldb::pid_t pid, ProcessInfo &proc_info);
+
+ virtual bool
+ GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch);
+
+ protected:
+
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN (PlatformMacOSX);
+
+ };
+} // namespace lldb_private
+
+#endif // liblldb_Platform_h_
diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
index 464500cf6b3..3106e34565c 100644
--- a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
@@ -269,40 +269,6 @@ ProcessMacOSX::GetPluginVersion()
return 1;
}
-void
-ProcessMacOSX::GetPluginCommandHelp (const char *command, Stream *strm)
-{
- strm->Printf("The following arguments can be supplied to the 'log %s' command:\n", GetShortPluginName());
- strm->PutCString("\tverbose - enable verbose logging\n");
- strm->PutCString("\tprocess - enable process logging\n");
- strm->PutCString("\tthread - enable thread logging\n");
- strm->PutCString("\texceptions - enable exception logging\n");
- strm->PutCString("\tdynamic - enable DynamicLoader logging\n");
- strm->PutCString("\tmemory-calls - enable memory read and write call logging\n");
- strm->PutCString("\tmemory-data-short - log short memory read and write byte data\n");
- strm->PutCString("\tmemory-data-long - log all memory read and write byte data\n");
- strm->PutCString("\tmemory-protections - log memory protection calls\n");
- strm->PutCString("\tbreakpoints - log breakpoint calls\n");
- strm->PutCString("\twatchpoints - log watchpoint calls\n");
- strm->PutCString("\tevents - log event and event queue status\n");
- strm->PutCString("\tstep - log step related activity\n");
- strm->PutCString("\ttask - log task functions\n");
-}
-
-Error
-ProcessMacOSX::ExecutePluginCommand (Args &command, Stream *strm)
-{
- Error error;
- error.SetErrorString("No plug-in command are currently supported.");
- return error;
-}
-
-Log *
-ProcessMacOSX::EnablePluginLogging (Stream *strm, Args &command)
-{
- return NULL;
-}
-
//----------------------------------------------------------------------
// Process Control
//----------------------------------------------------------------------
@@ -2178,10 +2144,10 @@ ProcessMacOSX::Initialize()
}
}
-uint32_t
-ProcessMacOSX::ListProcessesMatchingName (const char *name, lldb_private::StringList &matches, std::vector<lldb::pid_t> &pids)
-{
- return Host::ListProcessesMatchingName (name, matches, pids);
-}
+//uint32_t
+//ProcessMacOSX::ListProcessesMatchingName (const char *name, lldb_private::StringList &matches, std::vector<lldb::pid_t> &pids)
+//{
+// return Host::ListProcessesMatchingName (name, matches, pids);
+//}
diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h
index f2ab6cfcdd9..85ce15104b6 100644
--- a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h
+++ b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h
@@ -114,8 +114,8 @@ public:
virtual void
DidAttach ();
- virtual uint32_t
- ListProcessesMatchingName (const char *name, lldb_private::StringList &matches, std::vector<lldb::pid_t> &pids);
+// virtual uint32_t
+// ListProcessesMatchingName (const char *name, lldb_private::StringList &matches, std::vector<lldb::pid_t> &pids);
//------------------------------------------------------------------
// PluginInterface protocol
@@ -129,15 +129,6 @@ public:
virtual uint32_t
GetPluginVersion();
- virtual void
- GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
- virtual lldb_private::Error
- ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
- virtual lldb_private::Log *
- EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
//------------------------------------------------------------------
// Process Control
//------------------------------------------------------------------
diff --git a/lldb/source/Plugins/Process/Utility/ArchDefaultUnwindPlan-x86.cpp b/lldb/source/Plugins/Process/Utility/ArchDefaultUnwindPlan-x86.cpp
index 20e3ef76021..f73bdde7850 100644
--- a/lldb/source/Plugins/Process/Utility/ArchDefaultUnwindPlan-x86.cpp
+++ b/lldb/source/Plugins/Process/Utility/ArchDefaultUnwindPlan-x86.cpp
@@ -68,26 +68,6 @@ ArchDefaultUnwindPlan_x86_64::GetPluginVersion()
{
return 1;
}
-
-void
-ArchDefaultUnwindPlan_x86_64::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-ArchDefaultUnwindPlan_x86_64::ExecutePluginCommand (Args &command, Stream *strm)
-{
- Error error;
- error.SetErrorString("No plug-in command are currently supported.");
- return error;
-}
-
-Log *
-ArchDefaultUnwindPlan_x86_64::EnablePluginLogging (Stream *strm, Args &command)
-{
- return NULL;
-}
-
void
ArchDefaultUnwindPlan_x86_64::Initialize()
{
@@ -178,25 +158,6 @@ ArchDefaultUnwindPlan_i386::GetPluginVersion()
}
void
-ArchDefaultUnwindPlan_i386::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-ArchDefaultUnwindPlan_i386::ExecutePluginCommand (Args &command, Stream *strm)
-{
- Error error;
- error.SetErrorString("No plug-in command are currently supported.");
- return error;
-}
-
-Log *
-ArchDefaultUnwindPlan_i386::EnablePluginLogging (Stream *strm, Args &command)
-{
- return NULL;
-}
-
-void
ArchDefaultUnwindPlan_i386::Initialize()
{
PluginManager::RegisterPlugin (GetPluginNameStatic(),
diff --git a/lldb/source/Plugins/Process/Utility/ArchDefaultUnwindPlan-x86.h b/lldb/source/Plugins/Process/Utility/ArchDefaultUnwindPlan-x86.h
index d3f4b26ee2f..a0d315c62c8 100644
--- a/lldb/source/Plugins/Process/Utility/ArchDefaultUnwindPlan-x86.h
+++ b/lldb/source/Plugins/Process/Utility/ArchDefaultUnwindPlan-x86.h
@@ -53,15 +53,6 @@ public:
virtual uint32_t
GetPluginVersion();
- virtual void
- GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
- virtual lldb_private::Error
- ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
- virtual lldb_private::Log *
- EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
private:
ArchDefaultUnwindPlan_x86_64(); // Call CreateInstance instead.
@@ -104,15 +95,6 @@ public:
virtual uint32_t
GetPluginVersion();
- virtual void
- GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
- virtual lldb_private::Error
- ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
- virtual lldb_private::Log *
- EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
private:
ArchDefaultUnwindPlan_i386(); // Call CreateInstance instead.
diff --git a/lldb/source/Plugins/Process/Utility/ArchVolatileRegs-x86.cpp b/lldb/source/Plugins/Process/Utility/ArchVolatileRegs-x86.cpp
index 19eda664db1..b47f54ad529 100644
--- a/lldb/source/Plugins/Process/Utility/ArchVolatileRegs-x86.cpp
+++ b/lldb/source/Plugins/Process/Utility/ArchVolatileRegs-x86.cpp
@@ -121,25 +121,6 @@ ArchVolatileRegs_x86::GetPluginVersion()
}
void
-ArchVolatileRegs_x86::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-ArchVolatileRegs_x86::ExecutePluginCommand (Args &command, Stream *strm)
-{
- Error error;
- error.SetErrorString("No plug-in command are currently supported.");
- return error;
-}
-
-Log *
-ArchVolatileRegs_x86::EnablePluginLogging (Stream *strm, Args &command)
-{
- return NULL;
-}
-
-void
ArchVolatileRegs_x86::Initialize()
{
PluginManager::RegisterPlugin (GetPluginNameStatic(),
diff --git a/lldb/source/Plugins/Process/Utility/ArchVolatileRegs-x86.h b/lldb/source/Plugins/Process/Utility/ArchVolatileRegs-x86.h
index 516f126e91b..4aa5828784c 100644
--- a/lldb/source/Plugins/Process/Utility/ArchVolatileRegs-x86.h
+++ b/lldb/source/Plugins/Process/Utility/ArchVolatileRegs-x86.h
@@ -53,15 +53,6 @@ public:
virtual uint32_t
GetPluginVersion();
- virtual void
- GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
- virtual lldb_private::Error
- ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
- virtual lldb_private::Log *
- EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
private:
ArchVolatileRegs_x86(llvm::Triple::ArchType cpu); // Call CreateInstance instead.
diff --git a/lldb/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp b/lldb/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp
index 8f0f7d47578..83255e282ac 100644
--- a/lldb/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp
+++ b/lldb/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp
@@ -880,25 +880,6 @@ UnwindAssemblyProfiler_x86::GetPluginVersion()
}
void
-UnwindAssemblyProfiler_x86::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-UnwindAssemblyProfiler_x86::ExecutePluginCommand (Args &command, Stream *strm)
-{
- Error error;
- error.SetErrorString("No plug-in command are currently supported.");
- return error;
-}
-
-Log *
-UnwindAssemblyProfiler_x86::EnablePluginLogging (Stream *strm, Args &command)
-{
- return NULL;
-}
-
-void
UnwindAssemblyProfiler_x86::Initialize()
{
PluginManager::RegisterPlugin (GetPluginNameStatic(),
diff --git a/lldb/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.h b/lldb/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.h
index 2e99ebd9090..637c504d4f9 100644
--- a/lldb/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.h
+++ b/lldb/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.h
@@ -60,15 +60,6 @@ public:
virtual uint32_t
GetPluginVersion();
- virtual void
- GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
- virtual lldb_private::Error
- ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
- virtual lldb_private::Log *
- EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
private:
UnwindAssemblyProfiler_x86(int cpu) :
lldb_private::UnwindAssemblyProfiler(), m_cpu(cpu) { } // Call CreateInstance instead.
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index df09bf37d95..ab6c9150b97 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -164,26 +164,6 @@ ProcessGDBRemote::GetPluginVersion()
}
void
-ProcessGDBRemote::GetPluginCommandHelp (const char *command, Stream *strm)
-{
- strm->Printf("TODO: fill this in\n");
-}
-
-Error
-ProcessGDBRemote::ExecutePluginCommand (Args &command, Stream *strm)
-{
- Error error;
- error.SetErrorString("No plug-in commands are currently supported.");
- return error;
-}
-
-Log *
-ProcessGDBRemote::EnablePluginLogging (Stream *strm, Args &command)
-{
- return NULL;
-}
-
-void
ProcessGDBRemote::BuildDynamicRegisterInfo (bool force)
{
if (!force && m_register_info.GetNumRegisters() > 0)
@@ -2456,23 +2436,23 @@ ProcessGDBRemote::GetDispatchQueueNameForThread
return dispatch_queue_name.c_str();
}
-uint32_t
-ProcessGDBRemote::ListProcessesMatchingName (const char *name, StringList &matches, std::vector<lldb::pid_t> &pids)
-{
- // If we are planning to launch the debugserver remotely, then we need to fire up a debugserver
- // process and ask it for the list of processes. But if we are local, we can let the Host do it.
- if (m_local_debugserver)
- {
- return Host::ListProcessesMatchingName (name, matches, pids);
- }
- else
- {
- // FIXME: Implement talking to the remote debugserver.
- return 0;
- }
-
-}
-
+//uint32_t
+//ProcessGDBRemote::ListProcessesMatchingName (const char *name, StringList &matches, std::vector<lldb::pid_t> &pids)
+//{
+// // If we are planning to launch the debugserver remotely, then we need to fire up a debugserver
+// // process and ask it for the list of processes. But if we are local, we can let the Host do it.
+// if (m_local_debugserver)
+// {
+// return Host::ListProcessesMatchingName (name, matches, pids);
+// }
+// else
+// {
+// // FIXME: Implement talking to the remote debugserver.
+// return 0;
+// }
+//
+//}
+//
bool
ProcessGDBRemote::NewThreadNotifyBreakpointHit (void *baton,
lldb_private::StoppointCallbackContext *context,
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
index bd61ed24868..c8fb6fccedf 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -68,8 +68,8 @@ public:
virtual bool
CanDebug (lldb_private::Target &target);
- virtual uint32_t
- ListProcessesMatchingName (const char *name, lldb_private::StringList &matches, std::vector<lldb::pid_t> &pids);
+// virtual uint32_t
+// ListProcessesMatchingName (const char *name, lldb_private::StringList &matches, std::vector<lldb::pid_t> &pids);
//------------------------------------------------------------------
// Creating a new process, or attaching to an existing one
@@ -123,15 +123,6 @@ public:
virtual uint32_t
GetPluginVersion();
- virtual void
- GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
- virtual lldb_private::Error
- ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
- virtual lldb_private::Log *
- EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
//------------------------------------------------------------------
// Process Control
//------------------------------------------------------------------
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp
index d053def0013..9e9f6442071 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp
@@ -90,28 +90,6 @@ LogChannelDWARF::GetPluginVersion()
void
-LogChannelDWARF::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-
-Error
-LogChannelDWARF::ExecutePluginCommand (Args &command, Stream *strm)
-{
- Error error;
- error.SetErrorStringWithFormat("No commands are supported.\n");
- return error;
-}
-
-
-Log *
-LogChannelDWARF::EnablePluginLogging (Stream *strm, Args &command)
-{
- return NULL;
-}
-
-
-void
LogChannelDWARF::Delete ()
{
g_log_channel = NULL;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
index 6105651f348..b1d8597953a 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
@@ -58,15 +58,6 @@ public:
GetPluginVersion();
virtual void
- GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
- virtual lldb_private::Error
- ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
- virtual lldb_private::Log *
- EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
- virtual void
Disable (lldb_private::Args &args, lldb_private::Stream *feedback_strm);
void
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 83dd42f12b7..54b627feeb3 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -4271,25 +4271,6 @@ SymbolFileDWARF::GetPluginVersion()
}
void
-SymbolFileDWARF::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-SymbolFileDWARF::ExecutePluginCommand (Args &command, Stream *strm)
-{
- Error error;
- error.SetErrorString("No plug-in command are currently supported.");
- return error;
-}
-
-Log *
-SymbolFileDWARF::EnablePluginLogging (Stream *strm, Args &command)
-{
- return NULL;
-}
-
-void
SymbolFileDWARF::CompleteTagDecl (void *baton, clang::TagDecl *decl)
{
SymbolFileDWARF *symbol_file_dwarf = (SymbolFileDWARF *)baton;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index f2acbf73923..8585d0112a8 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -140,15 +140,6 @@ public:
virtual uint32_t
GetPluginVersion();
- virtual void
- GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
- virtual lldb_private::Error
- ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
- virtual lldb_private::Log *
- EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
// Approach 2 - count + accessor
// Index compile units would scan the initial compile units and register
// them with the module. This would only be done on demand if and only if
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index 2a2dd638d96..59b0feb0fd9 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -1087,26 +1087,6 @@ SymbolFileDWARFDebugMap::GetPluginVersion()
}
void
-SymbolFileDWARFDebugMap::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-SymbolFileDWARFDebugMap::ExecutePluginCommand (Args &command, Stream *strm)
-{
- Error error;
- error.SetErrorString("No plug-in command are currently supported.");
- return error;
-}
-
-Log *
-SymbolFileDWARFDebugMap::EnablePluginLogging (Stream *strm, Args &command)
-{
- return NULL;
-}
-
-
-void
SymbolFileDWARFDebugMap::SetCompileUnit (SymbolFileDWARF *oso_dwarf, const CompUnitSP &cu_sp)
{
const uint32_t cu_count = GetNumCompileUnits();
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
index 742fb0697e2..9a95ac8b170 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
@@ -100,15 +100,6 @@ public:
virtual uint32_t
GetPluginVersion();
- virtual void
- GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
- virtual lldb_private::Error
- ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
- virtual lldb_private::Log *
- EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
protected:
enum
{
diff --git a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
index f524a516d61..d0550622092 100644
--- a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
+++ b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
@@ -381,23 +381,3 @@ SymbolFileSymtab::GetPluginVersion()
{
return 1;
}
-
-void
-SymbolFileSymtab::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-SymbolFileSymtab::ExecutePluginCommand (Args &command, Stream *strm)
-{
- Error error;
- error.SetErrorString("No plug-in command are currently supported.");
- return error;
-}
-
-Log *
-SymbolFileSymtab::EnablePluginLogging (Stream *strm, Args &command)
-{
- return NULL;
-}
-
diff --git a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
index fc6a52c216a..f95e0ce24c3 100644
--- a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
+++ b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
@@ -117,17 +117,6 @@ public:
virtual uint32_t
GetPluginVersion();
- virtual void
- GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
- virtual lldb_private::Error
- ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
- virtual lldb_private::Log *
- EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
-
-
protected:
std::vector<uint32_t> m_source_indexes;
std::vector<uint32_t> m_func_indexes;
diff --git a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
index 516093b2817..3dd4a4d34bc 100644
--- a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
+++ b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
@@ -316,22 +316,3 @@ SymbolVendorMacOSX::GetPluginVersion()
return 1;
}
-void
-SymbolVendorMacOSX::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-SymbolVendorMacOSX::ExecutePluginCommand (Args &command, Stream *strm)
-{
- Error error;
- error.SetErrorString("No plug-in command are currently supported.");
- return error;
-}
-
-Log *
-SymbolVendorMacOSX::EnablePluginLogging (Stream *strm, Args &command)
-{
- return NULL;
-}
-
diff --git a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h
index adbf6489e27..66509c73f95 100644
--- a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h
+++ b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h
@@ -54,16 +54,6 @@ public:
virtual uint32_t
GetPluginVersion();
- virtual void
- GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
- virtual lldb_private::Error
- ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
- virtual lldb_private::Log *
- EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
-
private:
DISALLOW_COPY_AND_ASSIGN (SymbolVendorMacOSX);
};
diff --git a/lldb/source/Symbol/SymbolVendor.cpp b/lldb/source/Symbol/SymbolVendor.cpp
index 361a2765e5d..391d22529b0 100644
--- a/lldb/source/Symbol/SymbolVendor.cpp
+++ b/lldb/source/Symbol/SymbolVendor.cpp
@@ -346,23 +346,3 @@ SymbolVendor::GetPluginVersion()
return 1;
}
-void
-SymbolVendor::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-SymbolVendor::ExecutePluginCommand (Args &command, Stream *strm)
-{
- Error error;
- error.SetErrorString("No plug-in command are currently supported.");
- return error;
-}
-
-Log *
-SymbolVendor::EnablePluginLogging (Stream *strm, Args &command)
-{
- return NULL;
-}
-
-
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
new file mode 100644
index 00000000000..497df2478cc
--- /dev/null
+++ b/lldb/source/Target/Platform.cpp
@@ -0,0 +1,230 @@
+//===-- Platform.cpp --------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Target/Platform.h"
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Core/Error.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Host/FileSpec.h"
+#include "lldb/Target/Target.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+// Use a singleton function for g_local_platform_sp to avoid init
+// constructors since LLDB is often part of a shared library
+static PlatformSP&
+GetDefaultPlatformSP ()
+{
+ static PlatformSP g_default_platform_sp;
+ return g_default_platform_sp;
+}
+
+static PlatformSP&
+GetSelectedPlatformSP ()
+{
+ static PlatformSP g_selected_platform_sp;
+ return g_selected_platform_sp;
+}
+
+static Mutex &
+GetConnectedPlatformListMutex ()
+{
+ static Mutex g_remote_connected_platforms_mutex (Mutex::eMutexTypeRecursive);
+ return g_remote_connected_platforms_mutex;
+}
+static std::vector<PlatformSP> &
+GetConnectedPlatformList ()
+{
+ static std::vector<PlatformSP> g_remote_connected_platforms;
+ return g_remote_connected_platforms;
+}
+
+//------------------------------------------------------------------
+/// Get the native host platform plug-in.
+///
+/// There should only be one of these for each host that LLDB runs
+/// upon that should be statically compiled in and registered using
+/// preprocessor macros or other similar build mechanisms.
+///
+/// This platform will be used as the default platform when launching
+/// or attaching to processes unless another platform is specified.
+//------------------------------------------------------------------
+PlatformSP
+Platform::GetDefaultPlatform ()
+{
+ return GetDefaultPlatformSP ();
+}
+
+void
+Platform::SetDefaultPlatform (const lldb::PlatformSP &platform_sp)
+{
+ // The native platform should use its static void Platform::Initialize()
+ // function to register itself as the native platform.
+ GetDefaultPlatformSP () = platform_sp;
+}
+
+PlatformSP
+Platform::GetSelectedPlatform ()
+{
+ PlatformSP platform_sp (GetSelectedPlatformSP ());
+ if (!platform_sp)
+ platform_sp = GetDefaultPlatform ();
+ return platform_sp;
+}
+
+void
+Platform::SetSelectedPlatform (const lldb::PlatformSP &platform_sp)
+{
+ // The native platform should use its static void Platform::Initialize()
+ // function to register itself as the native platform.
+ GetSelectedPlatformSP () = platform_sp;
+}
+
+
+Error
+Platform::GetFile (const FileSpec &platform_file, FileSpec &local_file)
+{
+ // Default to the local case
+ local_file = platform_file;
+ return Error();
+}
+
+
+PlatformSP
+Platform::ConnectRemote (const char *platform_name, const char *remote_connect_url, Error &error)
+{
+ PlatformCreateInstance create_callback = NULL;
+ lldb::PlatformSP platform_sp;
+ if (platform_name)
+ {
+ create_callback = PluginManager::GetPlatformCreateCallbackForPluginName (platform_name);
+ if (create_callback)
+ {
+ platform_sp.reset(create_callback());
+ if (platform_sp)
+ error = platform_sp->ConnectRemote (remote_connect_url);
+ else
+ error.SetErrorStringWithFormat ("unable to create a platform instance of \"%s\"", platform_name);
+ }
+ else
+ error.SetErrorStringWithFormat ("invalid platform name \"%s\"", platform_name);
+ }
+ else
+ error.SetErrorString ("Empty platform name");
+ return platform_sp;
+}
+
+uint32_t
+Platform::GetNumConnectedRemotePlatforms ()
+{
+ Mutex::Locker locker (GetConnectedPlatformListMutex ());
+ return GetConnectedPlatformList().size();
+}
+
+PlatformSP
+Platform::GetConnectedRemotePlatformAtIndex (uint32_t idx)
+{
+ PlatformSP platform_sp;
+ {
+ Mutex::Locker locker (GetConnectedPlatformListMutex ());
+ if (idx < GetConnectedPlatformList().size())
+ platform_sp = GetConnectedPlatformList ()[idx];
+ }
+ return platform_sp;
+}
+
+//------------------------------------------------------------------
+/// Default Constructor
+//------------------------------------------------------------------
+Platform::Platform () :
+ m_remote_url ()
+{
+}
+
+//------------------------------------------------------------------
+/// Destructor.
+///
+/// The destructor is virtual since this class is designed to be
+/// inherited from by the plug-in instance.
+//------------------------------------------------------------------
+Platform::~Platform()
+{
+}
+
+Error
+Platform::ResolveExecutable (const FileSpec &exe_file,
+ const ArchSpec &exe_arch,
+ lldb::ModuleSP &exe_module_sp)
+{
+ Error error;
+ if (exe_file.Exists())
+ {
+ if (exe_arch.IsValid())
+ {
+ error = ModuleList::GetSharedModule (exe_file,
+ exe_arch,
+ NULL,
+ NULL,
+ 0,
+ exe_module_sp,
+ NULL,
+ NULL);
+ }
+ else
+ {
+ // No valid architecture was specified, ask the platform for
+ // the architectures that we should be using (in the correct order)
+ // and see if we can find a match that way
+ ArchSpec platform_arch;
+ for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, platform_arch); ++idx)
+ {
+ error = ModuleList::GetSharedModule (exe_file,
+ platform_arch,
+ NULL,
+ NULL,
+ 0,
+ exe_module_sp,
+ NULL,
+ NULL);
+ // Did we find an executable using one of the
+ if (error.Success() && exe_module_sp)
+ break;
+ }
+ }
+ }
+ else
+ {
+ error.SetErrorStringWithFormat ("'%s%s%s' does not exist",
+ exe_file.GetDirectory().AsCString(""),
+ exe_file.GetDirectory() ? "/" : "",
+ exe_file.GetFilename().AsCString(""));
+ }
+ return error;
+}
+
+Error
+Platform::ConnectRemote (const char *remote_url)
+{
+ Error error;
+ error.SetErrorStringWithFormat ("Platform::ConnectRemote() is not supported by %s", GetShortPluginName());
+ return error;
+}
+
+Error
+Platform::DisconnectRemote (const lldb::PlatformSP &platform_sp)
+{
+ Error error;
+ error.SetErrorStringWithFormat ("Platform::DisconnectRemote() is not supported by %s", GetShortPluginName());
+ return error;
+}
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 6d2861d3235..f1fb3bb4d10 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -27,6 +27,7 @@
#include "lldb/Target/LanguageRuntime.h"
#include "lldb/Target/CPPLanguageRuntime.h"
#include "lldb/Target/ObjCLanguageRuntime.h"
+#include "lldb/Target/Platform.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/StopInfo.h"
#include "lldb/Target/Target.h"
@@ -1659,11 +1660,16 @@ Process::Attach (lldb::pid_t attach_pid)
// Find the process and its architecture. Make sure it matches the architecture
// of the current Target, and if not adjust it.
- ArchSpec attach_spec = GetArchSpecForExistingProcess (attach_pid);
- if (attach_spec != GetTarget().GetArchitecture())
+ ProcessInfo process_info;
+ PlatformSP platform_sp (Platform::GetSelectedPlatform ());
+ if (platform_sp)
{
- // Set the architecture on the target.
- GetTarget().SetArchitecture(attach_spec);
+ if (platform_sp->GetProcessInfo (attach_pid, process_info))
+ {
+ const ArchSpec &process_arch = process_info.GetArchitecture();
+ if (process_arch.IsValid())
+ GetTarget().SetArchitecture(process_arch);
+ }
}
m_dyld_ap.reset();
@@ -1703,40 +1709,69 @@ Process::Attach (const char *process_name, bool wait_for_launch)
// Find the process and its architecture. Make sure it matches the architecture
// of the current Target, and if not adjust it.
+ Error error;
if (!wait_for_launch)
{
- ArchSpec attach_spec = GetArchSpecForExistingProcess (process_name);
- if (attach_spec.IsValid() && attach_spec != GetTarget().GetArchitecture())
+ ProcessInfoList process_infos;
+ PlatformSP platform_sp (Platform::GetSelectedPlatform ());
+ if (platform_sp)
{
- // Set the architecture on the target.
- GetTarget().SetArchitecture(attach_spec);
+ platform_sp->FindProcessesByName (process_name, eNameMatchEquals, process_infos);
+ if (process_infos.GetSize() > 1)
+ {
+ error.SetErrorStringWithFormat ("More than one process named %s\n", process_name);
+ }
+ else if (process_infos.GetSize() == 0)
+ {
+ error.SetErrorStringWithFormat ("Could not find a process named %s\n", process_name);
+ }
+ else
+ {
+ ProcessInfo process_info;
+ if (process_infos.GetInfoAtIndex (0, process_info))
+ {
+ const ArchSpec &process_arch = process_info.GetArchitecture();
+ if (process_arch.IsValid() && process_arch != GetTarget().GetArchitecture())
+ {
+ // Set the architecture on the target.
+ GetTarget().SetArchitecture (process_arch);
+ }
+ }
+ }
+ }
+ else
+ {
+ error.SetErrorString ("Invalid platform");
}
}
- m_dyld_ap.reset();
-
- Error error (WillAttachToProcessWithName(process_name, wait_for_launch));
if (error.Success())
{
- SetPublicState (eStateAttaching);
- error = DoAttachToProcessWithName (process_name, wait_for_launch);
- if (error.Fail())
+ m_dyld_ap.reset();
+
+ error = WillAttachToProcessWithName(process_name, wait_for_launch);
+ if (error.Success())
{
- if (GetID() != LLDB_INVALID_PROCESS_ID)
+ SetPublicState (eStateAttaching);
+ error = DoAttachToProcessWithName (process_name, wait_for_launch);
+ if (error.Fail())
{
- SetID (LLDB_INVALID_PROCESS_ID);
- const char *error_string = error.AsCString();
- if (error_string == NULL)
- error_string = "attach failed";
+ if (GetID() != LLDB_INVALID_PROCESS_ID)
+ {
+ SetID (LLDB_INVALID_PROCESS_ID);
+ const char *error_string = error.AsCString();
+ if (error_string == NULL)
+ error_string = "attach failed";
- SetExitStatus(-1, error_string);
+ SetExitStatus(-1, error_string);
+ }
+ }
+ else
+ {
+ SetNextEventAction(new Process::AttachCompletionHandler(this));
+ StartPrivateStateThread();
}
- }
- else
- {
- SetNextEventAction(new Process::AttachCompletionHandler(this));
- StartPrivateStateThread();
}
}
return error;
@@ -2503,24 +2538,24 @@ Process::GetSP ()
return GetTarget().GetProcessSP();
}
-uint32_t
-Process::ListProcessesMatchingName (const char *name, StringList &matches, std::vector<lldb::pid_t> &pids)
-{
- return 0;
-}
-
-ArchSpec
-Process::GetArchSpecForExistingProcess (lldb::pid_t pid)
-{
- return Host::GetArchSpecForExistingProcess (pid);
-}
-
-ArchSpec
-Process::GetArchSpecForExistingProcess (const char *process_name)
-{
- return Host::GetArchSpecForExistingProcess (process_name);
-}
-
+//uint32_t
+//Process::ListProcessesMatchingName (const char *name, StringList &matches, std::vector<lldb::pid_t> &pids)
+//{
+// return 0;
+//}
+//
+//ArchSpec
+//Process::GetArchSpecForExistingProcess (lldb::pid_t pid)
+//{
+// return Host::GetArchSpecForExistingProcess (pid);
+//}
+//
+//ArchSpec
+//Process::GetArchSpecForExistingProcess (const char *process_name)
+//{
+// return Host::GetArchSpecForExistingProcess (process_name);
+//}
+//
void
Process::AppendSTDOUT (const char * s, size_t len)
{
@@ -3281,7 +3316,6 @@ ProcessInstanceSettings::ProcessInstanceSettings
m_input_path (),
m_output_path (),
m_error_path (),
- m_plugin (),
m_disable_aslr (true),
m_disable_stdio (false),
m_inherit_host_env (true),
@@ -3313,7 +3347,6 @@ ProcessInstanceSettings::ProcessInstanceSettings (const ProcessInstanceSettings
m_input_path (rhs.m_input_path),
m_output_path (rhs.m_output_path),
m_error_path (rhs.m_error_path),
- m_plugin (rhs.m_plugin),
m_disable_aslr (rhs.m_disable_aslr),
m_disable_stdio (rhs.m_disable_stdio)
{
@@ -3339,7 +3372,6 @@ ProcessInstanceSettings::operator= (const ProcessInstanceSettings &rhs)
m_input_path = rhs.m_input_path;
m_output_path = rhs.m_output_path;
m_error_path = rhs.m_error_path;
- m_plugin = rhs.m_plugin;
m_disable_aslr = rhs.m_disable_aslr;
m_disable_stdio = rhs.m_disable_stdio;
m_inherit_host_env = rhs.m_inherit_host_env;
@@ -3372,10 +3404,6 @@ ProcessInstanceSettings::UpdateInstanceSettingsVariable (const ConstString &var_
UserSettingsController::UpdateStringVariable (op, m_output_path, value, err);
else if (var_name == ErrorPathVarName())
UserSettingsController::UpdateStringVariable (op, m_error_path, value, err);
- else if (var_name == PluginVarName())
- UserSettingsController::UpdateEnumVariable (entry.enum_values, (int *) &m_plugin, value, err);
- else if (var_name == InheritHostEnvVarName())
- UserSettingsController::UpdateBooleanVariable (op, m_inherit_host_env, value, err);
else if (var_name == DisableASLRVarName())
UserSettingsController::UpdateBooleanVariable (op, m_disable_aslr, value, err);
else if (var_name == DisableSTDIOVarName ())
@@ -3396,7 +3424,6 @@ ProcessInstanceSettings::CopyInstanceSettings (const lldb::InstanceSettingsSP &n
m_input_path = new_process_settings->m_input_path;
m_output_path = new_process_settings->m_output_path;
m_error_path = new_process_settings->m_error_path;
- m_plugin = new_process_settings->m_plugin;
m_disable_aslr = new_process_settings->m_disable_aslr;
m_disable_stdio = new_process_settings->m_disable_stdio;
}
@@ -3442,10 +3469,6 @@ ProcessInstanceSettings::GetInstanceSettingsValue (const SettingEntry &entry,
{
value.AppendString (m_error_path.c_str());
}
- else if (var_name == PluginVarName())
- {
- value.AppendString (UserSettingsController::EnumToString (entry.enum_values, (int) m_plugin));
- }
else if (var_name == InheritHostEnvVarName())
{
if (m_inherit_host_env)
@@ -3538,15 +3561,6 @@ ProcessInstanceSettings::ErrorPathVarName ()
}
const ConstString &
-ProcessInstanceSettings::PluginVarName ()
-{
- static ConstString plugin_var_name ("plugin");
-
- return plugin_var_name;
-}
-
-
-const ConstString &
ProcessInstanceSettings::DisableASLRVarName ()
{
static ConstString disable_aslr_var_name ("disable-aslr");
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index e1e73c24cab..ca400fc22bc 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -412,21 +412,26 @@ Target::SetExecutableModule (ModuleSP& executable_sp, bool get_dependent_files)
m_arch_spec = exe_arch;
FileSpecList dependent_files;
- ObjectFile * executable_objfile = executable_sp->GetObjectFile();
- if (executable_objfile == NULL)
- {
-
- FileSpec bundle_executable(executable_sp->GetFileSpec());
- if (Host::ResolveExecutableInBundle (bundle_executable))
- {
- ModuleSP bundle_exe_module_sp(GetSharedModule(bundle_executable,
- exe_arch));
- SetExecutableModule (bundle_exe_module_sp, get_dependent_files);
- if (bundle_exe_module_sp->GetObjectFile() != NULL)
- executable_sp = bundle_exe_module_sp;
- return;
- }
- }
+ ObjectFile *executable_objfile = executable_sp->GetObjectFile();
+ assert (executable_objfile);
+ // TODO: remote assertion above after verifying that it doesn't fire off
+ // after the platform changes. The platform is what should be selecting
+ // the right slice of an executable file, and it also should be the one
+ // to resolve any executables in their bundles.
+// if (executable_objfile == NULL)
+// {
+//
+// FileSpec bundle_executable(executable_sp->GetFileSpec());
+// if (Host::ResolveExecutableInBundle (bundle_executable))
+// {
+// ModuleSP bundle_exe_module_sp(GetSharedModule(bundle_executable,
+// exe_arch));
+// SetExecutableModule (bundle_exe_module_sp, get_dependent_files);
+// if (bundle_exe_module_sp->GetObjectFile() != NULL)
+// executable_sp = bundle_exe_module_sp;
+// return;
+// }
+// }
if (executable_objfile)
{
diff --git a/lldb/source/Target/TargetList.cpp b/lldb/source/Target/TargetList.cpp
index af681d22f45..25b768f2e51 100644
--- a/lldb/source/Target/TargetList.cpp
+++ b/lldb/source/Target/TargetList.cpp
@@ -16,6 +16,7 @@
#include "lldb/Core/State.h"
#include "lldb/Core/Timer.h"
#include "lldb/Host/Host.h"
+#include "lldb/Target/Platform.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/TargetList.h"
@@ -49,44 +50,28 @@ TargetList::CreateTarget
Debugger &debugger,
const FileSpec& file,
const ArchSpec& arch,
- const lldb_private::UUID *uuid_ptr,
bool get_dependent_files,
TargetSP &target_sp
)
{
Timer scoped_timer (__PRETTY_FUNCTION__,
- "TargetList::CreateTarget (file = '%s/%s', arch = '%s', uuid = %p)",
+ "TargetList::CreateTarget (file = '%s/%s', arch = '%s')",
file.GetDirectory().AsCString(),
file.GetFilename().AsCString(),
- arch.GetArchitectureName(),
- uuid_ptr);
+ arch.GetArchitectureName());
Error error;
- if (!file)
- {
- target_sp.reset(new Target(debugger));
- target_sp->SetArchitecture(arch);
- }
- else
+ if (file)
{
ModuleSP exe_module_sp;
FileSpec resolved_file(file);
+ ArchSpec platform_arch;
- if (!resolved_file.Exists())
- resolved_file.ResolveExecutableLocation ();
-
- if (!Host::ResolveExecutableInBundle (resolved_file))
- resolved_file = file;
+ PlatformSP platform_sp (Platform::GetSelectedPlatform ());
+ if (platform_sp)
+ error = platform_sp->ResolveExecutable (file, arch, exe_module_sp);
- error = ModuleList::GetSharedModule (resolved_file,
- arch,
- uuid_ptr,
- NULL,
- 0,
- exe_module_sp,
- NULL,
- NULL);
- if (exe_module_sp)
+ if (error.Success() && exe_module_sp)
{
if (exe_module_sp->GetObjectFile() == NULL)
{
@@ -111,44 +96,24 @@ TargetList::CreateTarget
target_sp->SetExecutableModule (exe_module_sp, get_dependent_files);
}
}
+ else
+ {
+ // No file was specified, just create an empty target with any arch
+ // if a valid arch was specified
+ target_sp.reset(new Target(debugger));
+ if (arch.IsValid())
+ target_sp->SetArchitecture(arch);
+ }
- if (target_sp.get())
- target_sp->UpdateInstanceName();
-
- if (target_sp.get())
+ if (target_sp)
{
+ target_sp->UpdateInstanceName();
+
Mutex::Locker locker(m_target_list_mutex);
m_selected_target_idx = m_target_list.size();
m_target_list.push_back(target_sp);
}
-// target_sp.reset(new Target);
-// // Let the target resolve any funky bundle paths before we try and get
-// // the object file...
-// target_sp->SetExecutableModule (exe_module_sp, get_dependent_files);
-// if (exe_module_sp->GetObjectFile() == NULL)
-// {
-// error.SetErrorStringWithFormat("%s%s%s: doesn't contain architecture %s",
-// file.GetDirectory().AsCString(),
-// file.GetDirectory() ? "/" : "",
-// file.GetFilename().AsCString(),
-// arch.AsCString());
-// }
-// else
-// {
-// if (target_sp.get())
-// {
-// error.Clear();
-// Mutex::Locker locker(m_target_list_mutex);
-// m_selected_target_idx = m_target_list.size();
-// m_target_list.push_back(target_sp);
-// }
-// }
- else
- {
- target_sp.reset();
- }
-
return error;
}
diff --git a/lldb/source/lldb.cpp b/lldb/source/lldb.cpp
index b78cc4d83d8..80961532929 100644
--- a/lldb/source/lldb.cpp
+++ b/lldb/source/lldb.cpp
@@ -12,6 +12,7 @@
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/RegularExpression.h"
#include "lldb/Core/Timer.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/Mutex.h"
@@ -19,6 +20,8 @@
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
+#include "llvm/ADT/StringRef.h"
+
#include "Plugins/Disassembler/llvm/DisassemblerLLVM.h"
#include "Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h"
#include "Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h"
@@ -30,7 +33,7 @@
#include "Plugins/Process/Utility/ArchDefaultUnwindPlan-x86.h"
#include "Plugins/Process/Utility/ArchVolatileRegs-x86.h"
-#ifdef __APPLE__
+#if defined (__APPLE__)
#include "Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h"
#include "Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h"
#include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h"
@@ -41,11 +44,13 @@
#include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h"
#include "Plugins/Process/MacOSX-User/source/ProcessMacOSX.h"
#include "Plugins/Process/gdb-remote/ProcessGDBRemote.h"
+#include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
#endif
-#ifdef __linux__
-#include "Plugins/Process/Linux/ProcessLinux.h"
+#if defined (__linux__)
#include "Plugins/DynamicLoader/Linux-DYLD/DynamicLoaderLinuxDYLD.h"
+#include "Plugins/Platform/Linux/PlatformLinux.h"
+#include "Plugins/Process/Linux/ProcessLinux.h"
#endif
#include "Plugins/DynamicLoader/Static/DynamicLoaderStatic.h"
@@ -83,7 +88,7 @@ lldb_private::Initialize ()
ArchVolatileRegs_x86::Initialize();
ScriptInterpreter::Initialize ();
-#ifdef __APPLE__
+#if defined (__APPLE__)
ABIMacOSX_i386::Initialize();
ABISysV_x86_64::Initialize();
DynamicLoaderMacOSXDYLD::Initialize();
@@ -96,8 +101,10 @@ lldb_private::Initialize ()
ProcessGDBRemote::Initialize();
//ProcessMacOSX::Initialize();
SymbolVendorMacOSX::Initialize();
+ PlatformMacOSX::Initialize();
#endif
-#ifdef __linux__
+#if defined (__linux__)
+ ProcessLinux::Initialize();
ProcessLinux::Initialize();
DynamicLoaderLinuxDYLD::Initialize();
#endif
@@ -136,7 +143,7 @@ lldb_private::Terminate ()
ArchVolatileRegs_x86::Terminate();
ScriptInterpreter::Terminate ();
-#ifdef __APPLE__
+#if defined (__APPLE__)
DynamicLoaderMacOSXDYLD::Terminate();
SymbolFileDWARFDebugMap::Terminate();
ItaniumABILanguageRuntime::Terminate();
@@ -147,13 +154,15 @@ lldb_private::Terminate ()
ProcessGDBRemote::Terminate();
//ProcessMacOSX::Terminate();
SymbolVendorMacOSX::Terminate();
+ PlatformMacOSX::Terminate();
#endif
Thread::Terminate ();
Process::Terminate ();
Target::Terminate ();
-#ifdef __linux__
+#if defined (__linux__)
+ PlatformLinux::Terminate();
ProcessLinux::Terminate();
DynamicLoaderLinuxDYLD::Terminate();
#endif
@@ -227,3 +236,39 @@ lldb_private::GetSectionTypeAsCString (lldb::SectionType sect_type)
}
+bool
+lldb_private::NameMatches (const char *name,
+ lldb::NameMatchType match_type,
+ const char *match)
+{
+ if (match_type == eNameMatchIgnore)
+ return true;
+
+ if (name == match)
+ return true;
+
+ if (name && match)
+ {
+ llvm::StringRef name_sref(name);
+ llvm::StringRef match_sref(match);
+ switch (match_type)
+ {
+ case eNameMatchIgnore:
+ return true;
+ case eNameMatchEquals: return name_sref == match_sref;
+ case eNameMatchContains: return name_sref.find (match_sref) != llvm::StringRef::npos;
+ case eNameMatchStartsWith: return name_sref.startswith (match_sref);
+ case eNameMatchEndsWith: return name_sref.endswith (match_sref);
+ case eNameMatchRegularExpression:
+ {
+ RegularExpression regex (match);
+ return regex.Execute (name);
+ }
+ break;
+ default:
+ assert (!"unhandled NameMatchType in lldb_private::NameMatches()");
+ break;
+ }
+ }
+ return false;
+}
diff --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp
index 3ec2c2fd6d6..bfd706562af 100644
--- a/lldb/tools/driver/Driver.cpp
+++ b/lldb/tools/driver/Driver.cpp
@@ -901,133 +901,6 @@ Driver::HandleIOEvent (const SBEvent &event)
return quit;
}
-
-//struct CrashImageInfo
-//{
-// std::string path;
-// VMRange text_range;
-// lldb_private::UUID uuid;
-//};
-//
-//void
-//Driver::ParseCrashLog (const char *crash_log)
-//{
-// printf("Parsing crash log: %s\n", crash_log);
-//
-// char image_path[PATH_MAX];
-// std::vector<CrashImageInfo> crash_infos;
-// if (crash_log && crash_log[0])
-// {
-// FileSpec crash_log_file (crash_log);
-// STLStringArray crash_log_lines;
-// if (crash_log_file.ReadFileLines (crash_log_lines))
-// {
-// const size_t num_crash_log_lines = crash_log_lines.size();
-// size_t i;
-// for (i=0; i<num_crash_log_lines; ++i)
-// {
-// const char *line = crash_log_lines[i].c_str();
-// if (strstr (line, "Code Type:"))
-// {
-// char arch_string[256];
-// if (sscanf(line, "%s", arch_string))
-// {
-// if (strcmp(arch_string, "X86-64"))
-// lldb::GetDefaultArchitecture ().SetArch ("x86_64");
-// else if (strcmp(arch_string, "X86"))
-// lldb::GetDefaultArchitecture ().SetArch ("i386");
-// else
-// {
-// ArchSpec arch(arch_string);
-// if (arch.IsValid ())
-// lldb::GetDefaultArchitecture () = arch;
-// else
-// fprintf(stderr, "Unrecognized architecture: %s\n", arch_string);
-// }
-// }
-// }
-// else
-// if (strstr(line, "Path:"))
-// {
-// const char *p = line + strlen("Path:");
-// while (isspace(*p))
-// ++p;
-//
-// m_option_data.m_filename.assign (p);
-// }
-// else
-// if (strstr(line, "Binary Images:"))
-// {
-// while (++i < num_crash_log_lines)
-// {
-// if (crash_log_lines[i].empty())
-// break;
-//
-// line = crash_log_lines[i].c_str();
-// uint64_t text_start_addr;
-// uint64_t text_end_addr;
-// char uuid_cstr[64];
-// int bytes_consumed_before_uuid = 0;
-// int bytes_consumed_after_uuid = 0;
-//
-// int items_parsed = ::sscanf (line,
-// "%llx - %llx %*s %*s %*s %n%s %n",
-// &text_start_addr,
-// &text_end_addr,
-// &bytes_consumed_before_uuid,
-// uuid_cstr,
-// &bytes_consumed_after_uuid);
-//
-// if (items_parsed == 3)
-// {
-//
-// CrashImageInfo info;
-// info.text_range.SetBaseAddress(text_start_addr);
-// info.text_range.SetEndAddress(text_end_addr);
-//
-// if (uuid_cstr[0] == '<')
-// {
-// if (info.uuid.SetfromCString (&uuid_cstr[1]) == 0)
-// info.uuid.Clear();
-//
-// ::strncpy (image_path, line + bytes_consumed_after_uuid, sizeof(image_path));
-// }
-// else
-// {
-// ::strncpy (image_path, line + bytes_consumed_before_uuid, sizeof(image_path));
-// }
-//
-// info.path = image_path;
-//
-// crash_infos.push_back (info);
-//
-// info.uuid.GetAsCString(uuid_cstr, sizeof(uuid_cstr));
-//
-// printf("0x%16.16llx - 0x%16.16llx <%s> %s\n",
-// text_start_addr,
-// text_end_addr,
-// uuid_cstr,
-// image_path);
-// }
-// }
-// }
-// }
-// }
-//
-// if (crash_infos.size())
-// {
-// SBTarget target (m_debugger.CreateTarget (crash_infos.front().path.c_str(),
-// lldb::GetDefaultArchitecture().AsCString (),
-// false));
-// if (target.IsValid())
-// {
-//
-// }
-// }
-// }
-//}
-//
-
void
Driver::MasterThreadBytesReceived (void *baton, const void *src, size_t src_len)
{
OpenPOWER on IntegriCloud