[Lldb-commits] [lldb] r192693 - Patch to add PlatformWindows, based on Carlo Kok's version from the Windows branch.

Deepak Panickal deepak at codeplay.com
Tue Oct 15 05:32:13 PDT 2013


Author: panickal
Date: Tue Oct 15 07:32:12 2013
New Revision: 192693

URL: http://llvm.org/viewvc/llvm-project?rev=192693&view=rev
Log:
Patch to add PlatformWindows, based on Carlo Kok's version from the Windows branch.

Added:
    lldb/trunk/source/Plugins/Platform/Windows/
    lldb/trunk/source/Plugins/Platform/Windows/CMakeLists.txt
    lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp
    lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.h
Modified:
    lldb/trunk/source/CMakeLists.txt
    lldb/trunk/source/Plugins/Platform/CMakeLists.txt
    lldb/trunk/source/lldb.cpp

Modified: lldb/trunk/source/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/CMakeLists.txt?rev=192693&r1=192692&r2=192693&view=diff
==============================================================================
--- lldb/trunk/source/CMakeLists.txt (original)
+++ lldb/trunk/source/CMakeLists.txt Tue Oct 15 07:32:12 2013
@@ -59,6 +59,7 @@ set( LLDB_USED_LIBS
   lldbPluginPlatformFreeBSD
   lldbPluginPlatformLinux
   lldbPluginPlatformPOSIX
+  lldbPluginPlatformWindows
   lldbPluginObjectFileMachO
   lldbPluginObjectContainerMachOArchive
   lldbPluginObjectContainerBSDArchive
@@ -80,7 +81,6 @@ set( LLDB_USED_LIBS
 if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
   list(APPEND LLDB_USED_LIBS
     lldbHostWindows
-    #lldbPluginPlatformWindows
     Ws2_32
     )
 endif ()
@@ -165,7 +165,10 @@ set( LLVM_LINK_COMPONENTS
   )
 
 set_source_files_properties(${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp PROPERTIES GENERATED 1)
-set(SHARED_LIBRARY 1)
+
+if(NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
+  set(SHARED_LIBRARY 1)
+endif()
 
 if(NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
   set(LLDB_WRAP_PYTHON ${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp)
@@ -219,4 +222,5 @@ endif ()
 
 install(TARGETS liblldb
   RUNTIME DESTINATION bin
-  LIBRARY DESTINATION lib)
+  LIBRARY DESTINATION lib
+  ARCHIVE DESTINATION lib)

Modified: lldb/trunk/source/Plugins/Platform/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/CMakeLists.txt?rev=192693&r1=192692&r2=192693&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/Platform/CMakeLists.txt Tue Oct 15 07:32:12 2013
@@ -5,7 +5,7 @@
 #elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
   add_subdirectory(MacOSX)
 #elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
-#  add_subdirectory(Windows)
+  add_subdirectory(Windows)
 #endif()
 
 add_subdirectory(POSIX)

Added: lldb/trunk/source/Plugins/Platform/Windows/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Windows/CMakeLists.txt?rev=192693&view=auto
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Windows/CMakeLists.txt (added)
+++ lldb/trunk/source/Plugins/Platform/Windows/CMakeLists.txt Tue Oct 15 07:32:12 2013
@@ -0,0 +1,5 @@
+set(LLVM_NO_RTTI 1)
+
+add_lldb_library(lldbPluginPlatformWindows
+  PlatformWindows.cpp
+  )

Added: lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp?rev=192693&view=auto
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp (added)
+++ lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp Tue Oct 15 07:32:12 2013
@@ -0,0 +1,644 @@
+//===-- PlatformWindows.cpp ---------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "PlatformWindows.h"
+
+// C Includes
+#include <stdio.h>
+#if defined (_WIN32)
+#include "lldb/Host/windows/Windows.h"
+#include <winsock2.h>
+#endif
+
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Core/Error.h"
+#include "lldb/Core/Debugger.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Host/Host.h"
+#include "lldb/Core/ModuleSpec.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Breakpoint/BreakpointLocation.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+static uint32_t g_initialize_count = 0;
+
+Platform *
+PlatformWindows::CreateInstance (bool force, const lldb_private::ArchSpec *arch)
+{
+    // The only time we create an instance is when we are creating a remote
+    // windows platform
+    const bool is_host = false;
+
+    bool create = force;
+    if (create == false && arch && arch->IsValid())
+    {
+        const llvm::Triple &triple = arch->GetTriple();
+        switch (triple.getVendor())
+        {
+        case llvm::Triple::PC:
+            create = true;
+            break;
+
+        case llvm::Triple::UnknownArch:
+            create = !arch->TripleVendorWasSpecified();
+            break;
+
+        default:
+            break;
+        }
+
+        if (create)
+        {
+            switch (triple.getOS())
+            {
+            case llvm::Triple::Win32:
+            case llvm::Triple::MinGW32:
+                break;
+
+            case llvm::Triple::UnknownOS:
+                create = arch->TripleOSWasSpecified();
+                break;
+
+            default:
+                create = false;
+                break;
+            }
+        }
+    }
+    if (create)
+        return new PlatformWindows (is_host);
+    return NULL;
+
+}
+
+lldb_private::ConstString
+PlatformWindows::GetPluginNameStatic(bool is_host)
+{
+    if (is_host)
+    {
+        static ConstString g_host_name(Platform::GetHostPlatformName ());
+        return g_host_name;
+    }
+    else
+    {
+        static ConstString g_remote_name("remote-windows");
+        return g_remote_name;
+    }
+}
+
+const char *
+PlatformWindows::GetPluginDescriptionStatic(bool is_host)
+{
+    return is_host ?
+        "Local Windows user platform plug-in." :
+        "Remote Windows user platform plug-in.";
+}
+
+lldb_private::ConstString
+PlatformWindows::GetPluginName(void)
+{
+    return GetPluginNameStatic(IsHost());
+}
+
+void
+PlatformWindows::Initialize(void)
+{
+    if (g_initialize_count++ == 0)
+    {
+#if defined (_WIN32)
+        WSADATA dummy;
+        WSAStartup(MAKEWORD(2,2), &dummy);
+        // Force a host flag to true for the default platform object.
+        PlatformSP default_platform_sp (new PlatformWindows(true));
+        default_platform_sp->SetSystemArchitecture (Host::GetArchitecture());
+        Platform::SetDefaultPlatform (default_platform_sp);
+#endif
+        PluginManager::RegisterPlugin(PlatformWindows::GetPluginNameStatic(false),
+                                      PlatformWindows::GetPluginDescriptionStatic(false),
+                                      PlatformWindows::CreateInstance);
+    }
+}
+
+void
+PlatformWindows::Terminate( void )
+{
+    if (g_initialize_count > 0)
+    {
+        if (--g_initialize_count == 0)
+        {
+#ifdef _WIN32
+            WSACleanup();
+#endif
+            PluginManager::UnregisterPlugin (PlatformWindows::CreateInstance);
+        }
+    }
+}
+
+//------------------------------------------------------------------
+/// Default Constructor
+//------------------------------------------------------------------
+PlatformWindows::PlatformWindows (bool is_host) :
+    Platform(is_host)
+{
+}
+
+//------------------------------------------------------------------
+/// Destructor.
+///
+/// The destructor is virtual since this class is designed to be
+/// inherited from by the plug-in instance.
+//------------------------------------------------------------------
+PlatformWindows::~PlatformWindows()
+{
+}
+
+Error
+PlatformWindows::ResolveExecutable (const FileSpec &exe_file,
+                                    const ArchSpec &exe_arch,
+                                    lldb::ModuleSP &exe_module_sp,
+                                    const FileSpecList *module_search_paths_ptr)
+{
+    Error error;
+    // Nothing special to do here, just use the actual file and architecture
+
+    char exe_path[PATH_MAX];
+    FileSpec resolved_exe_file (exe_file);
+
+    if (IsHost())
+    {
+        // if we cant resolve the executable loation based on the current path variables
+        if (!resolved_exe_file.Exists())
+        {
+            exe_file.GetPath(exe_path, sizeof(exe_path));
+            resolved_exe_file.SetFile(exe_path, true);
+        }
+
+        if (!resolved_exe_file.Exists())
+            resolved_exe_file.ResolveExecutableLocation ();
+
+        if (resolved_exe_file.Exists())
+            error.Clear();
+        else
+        {
+            exe_file.GetPath(exe_path, sizeof(exe_path));
+            error.SetErrorStringWithFormat("unable to find executable for '%s'", exe_path);
+        }
+    }
+    else
+    {
+        if (m_remote_platform_sp)
+        {
+            error = m_remote_platform_sp->ResolveExecutable (exe_file,
+                                                             exe_arch,
+                                                             exe_module_sp,
+                                                             NULL);
+        }
+        else
+        {
+            // We may connect to a process and use the provided executable (Don't use local $PATH).
+            if (resolved_exe_file.Exists())
+                error.Clear();
+            else
+                error.SetErrorStringWithFormat("the platform is not currently connected, and '%s' doesn't exist in the system root.", exe_path);
+        }
+    }
+
+    if (error.Success())
+    {
+        ModuleSpec module_spec (resolved_exe_file, exe_arch);
+        if (exe_arch.IsValid())
+        {
+            error = ModuleList::GetSharedModule (module_spec,
+                                                 exe_module_sp,
+                                                 NULL,
+                                                 NULL,
+                                                 NULL);
+
+            if (!exe_module_sp && exe_module_sp->GetObjectFile() == NULL)
+            {
+                exe_module_sp.reset();
+                error.SetErrorStringWithFormat ("'%s' doesn't contain the architecture %s",
+                                                exe_file.GetPath().c_str(),
+                                                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;
+            for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, module_spec.GetArchitecture()); ++idx)
+            {
+                error = ModuleList::GetSharedModule (module_spec,
+                                                     exe_module_sp,
+                                                     NULL,
+                                                     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 (module_spec.GetArchitecture().GetArchitectureName());
+            }
+
+            if (error.Fail() || !exe_module_sp)
+            {
+                error.SetErrorStringWithFormat ("'%s' doesn't contain any '%s' platform architectures: %s",
+                                                exe_file.GetPath().c_str(),
+                                                GetPluginName().GetCString(),
+                                                arch_names.GetString().c_str());
+            }
+        }
+    }
+
+    return error;
+}
+
+size_t
+PlatformWindows::GetSoftwareBreakpointTrapOpcode (Target &target, BreakpointSite *bp_site)
+{
+    ArchSpec arch = target.GetArchitecture();
+    const uint8_t *trap_opcode = NULL;
+    size_t trap_opcode_size = 0;
+
+    switch (arch.GetCore())
+    {
+    case ArchSpec::eCore_x86_32_i386:
+    case ArchSpec::eCore_x86_64_x86_64:
+        {
+            static const uint8_t g_i386_opcode[] = { 0xCC };
+            trap_opcode = g_i386_opcode;
+            trap_opcode_size = sizeof(g_i386_opcode);
+        }
+        break;
+
+    default:
+        llvm_unreachable("Unhandled architecture in PlatformWindows::GetSoftwareBreakpointTrapOpcode()");
+        break;
+    }
+
+    if (bp_site->SetTrapOpcode(trap_opcode, trap_opcode_size))
+        return trap_opcode_size;
+
+    return 0;
+}
+
+bool
+PlatformWindows::GetRemoteOSVersion ()
+{
+    if (m_remote_platform_sp)
+        return m_remote_platform_sp->GetOSVersion (m_major_os_version,
+                                                   m_minor_os_version,
+                                                   m_update_os_version);
+    return false;
+}
+
+bool
+PlatformWindows::GetRemoteOSBuildString (std::string &s)
+{
+    if (m_remote_platform_sp)
+        return m_remote_platform_sp->GetRemoteOSBuildString (s);
+    s.clear();
+    return false;
+}
+
+bool
+PlatformWindows::GetRemoteOSKernelDescription (std::string &s)
+{
+    if (m_remote_platform_sp)
+        return m_remote_platform_sp->GetRemoteOSKernelDescription (s);
+    s.clear();
+    return false;
+}
+
+// Remote Platform subclasses need to override this function
+ArchSpec
+PlatformWindows::GetRemoteSystemArchitecture ()
+{
+    if (m_remote_platform_sp)
+        return m_remote_platform_sp->GetRemoteSystemArchitecture ();
+    return ArchSpec();
+}
+
+const char *
+PlatformWindows::GetHostname ()
+{
+    if (IsHost())
+        return Platform::GetHostname();
+
+    if (m_remote_platform_sp)
+        return m_remote_platform_sp->GetHostname ();
+    return NULL;
+}
+
+bool
+PlatformWindows::IsConnected () const
+{
+    if (IsHost())
+        return true;
+    else if (m_remote_platform_sp)
+        return m_remote_platform_sp->IsConnected();
+    return false;
+}
+
+Error
+PlatformWindows::ConnectRemote (Args& args)
+{
+    Error error;
+    if (IsHost())
+    {
+        error.SetErrorStringWithFormat ("can't connect to the host platform '%s', always connected", GetPluginName().AsCString() );
+    }
+    else
+    {
+        if (!m_remote_platform_sp)
+            m_remote_platform_sp = Platform::Create ("remote-gdb-server", error);
+
+        if (m_remote_platform_sp)
+        {
+            if (error.Success())
+            {
+                if (m_remote_platform_sp)
+                {
+                    error = m_remote_platform_sp->ConnectRemote (args);
+                }
+                else
+                {
+                    error.SetErrorString ("\"platform connect\" takes a single argument: <connect-url>");
+                }
+            }
+        }
+        else
+            error.SetErrorString ("failed to create a 'remote-gdb-server' platform");
+
+        if (error.Fail())
+            m_remote_platform_sp.reset();
+    }
+
+    return error;
+}
+
+Error
+PlatformWindows::DisconnectRemote ()
+{
+    Error error;
+
+    if (IsHost())
+    {
+        error.SetErrorStringWithFormat ("can't disconnect from the host platform '%s', always connected", GetPluginName().AsCString() );
+    }
+    else
+    {
+        if (m_remote_platform_sp)
+            error = m_remote_platform_sp->DisconnectRemote ();
+        else
+            error.SetErrorString ("the platform is not currently connected");
+    }
+    return error;
+}
+
+bool
+PlatformWindows::GetProcessInfo (lldb::pid_t pid, ProcessInstanceInfo &process_info)
+{
+    bool success = false;
+    if (IsHost())
+    {
+        success = Platform::GetProcessInfo (pid, process_info);
+    }
+    else if (m_remote_platform_sp)
+    {
+        success = m_remote_platform_sp->GetProcessInfo (pid, process_info);
+    }
+    return success;
+}
+
+uint32_t
+PlatformWindows::FindProcesses (const ProcessInstanceInfoMatch &match_info,
+                               ProcessInstanceInfoList &process_infos)
+{
+    uint32_t match_count = 0;
+    if (IsHost())
+    {
+        // Let the base class figure out the host details
+        match_count = Platform::FindProcesses (match_info, process_infos);
+    }
+    else
+    {
+        // If we are remote, we can only return results if we are connected
+        if (m_remote_platform_sp)
+            match_count = m_remote_platform_sp->FindProcesses (match_info, process_infos);
+    }
+    return match_count;
+}
+
+Error
+PlatformWindows::LaunchProcess (ProcessLaunchInfo &launch_info)
+{
+    Error error;
+    if (IsHost())
+    {
+        error = Platform::LaunchProcess (launch_info);
+    }
+    else
+    {
+        if (m_remote_platform_sp)
+            error = m_remote_platform_sp->LaunchProcess (launch_info);
+        else
+            error.SetErrorString ("the platform is not currently connected");
+    }
+    return error;
+}
+
+lldb::ProcessSP
+PlatformWindows::Attach(ProcessAttachInfo &attach_info,
+                        Debugger &debugger,
+                        Target *target,
+                        Listener &listener,
+                        Error &error)
+{
+    lldb::ProcessSP process_sp;
+    if (IsHost())
+    {
+        if (target == NULL)
+        {
+            TargetSP new_target_sp;
+            FileSpec emptyFileSpec;
+            ArchSpec emptyArchSpec;
+
+            error = debugger.GetTargetList().CreateTarget (debugger,
+                                                           NULL,
+                                                           NULL,
+                                                           false,
+                                                           NULL,
+                                                           new_target_sp);
+            target = new_target_sp.get();
+        }
+        else
+            error.Clear();
+
+        if (target && error.Success())
+        {
+            debugger.GetTargetList().SetSelectedTarget(target);
+            // The Windows platform always currently uses the GDB remote debugger plug-in
+            // so even when debugging locally we are debugging remotely!
+            // Just like the darwin plugin.
+            process_sp = target->CreateProcess (listener, "gdb-remote", NULL);
+
+            if (process_sp)
+                error = process_sp->Attach (attach_info);
+        }
+    }
+    else
+    {
+        if (m_remote_platform_sp)
+            process_sp = m_remote_platform_sp->Attach (attach_info, debugger, target, listener, error);
+        else
+            error.SetErrorString ("the platform is not currently connected");
+    }
+    return process_sp;
+}
+
+const char *
+PlatformWindows::GetUserName (uint32_t uid)
+{
+    // Check the cache in Platform in case we have already looked this uid up
+    const char *user_name = Platform::GetUserName(uid);
+    if (user_name)
+        return user_name;
+
+    if (IsRemote() && m_remote_platform_sp)
+        return m_remote_platform_sp->GetUserName(uid);
+    return NULL;
+}
+
+const char *
+PlatformWindows::GetGroupName (uint32_t gid)
+{
+    const char *group_name = Platform::GetGroupName(gid);
+    if (group_name)
+        return group_name;
+
+    if (IsRemote() && m_remote_platform_sp)
+        return m_remote_platform_sp->GetGroupName(gid);
+    return NULL;
+}
+
+Error
+PlatformWindows::GetFile (const FileSpec &platform_file,
+                          const UUID *uuid_ptr,
+                          FileSpec &local_file)
+{
+    if (IsRemote())
+    {
+        if (m_remote_platform_sp)
+            return m_remote_platform_sp->GetFile (platform_file, uuid_ptr, local_file);
+    }
+
+    // Default to the local case
+    local_file = platform_file;
+    return Error();
+}
+
+Error
+PlatformWindows::GetSharedModule (const ModuleSpec &module_spec,
+                                  ModuleSP &module_sp,
+                                  const FileSpecList *module_search_paths_ptr,
+                                  ModuleSP *old_module_sp_ptr,
+                                  bool *did_create_ptr)
+{
+    Error error;
+    module_sp.reset();
+
+    if (IsRemote())
+    {
+        // If we have a remote platform always, let it try and locate
+        // the shared module first.
+        if (m_remote_platform_sp)
+        {
+            error = m_remote_platform_sp->GetSharedModule (module_spec,
+                                                           module_sp,
+                                                           module_search_paths_ptr,
+                                                           old_module_sp_ptr,
+                                                           did_create_ptr);
+        }
+    }
+
+    if (!module_sp)
+    {
+        // Fall back to the local platform and find the file locally
+        error = Platform::GetSharedModule (module_spec,
+                                           module_sp,
+                                           module_search_paths_ptr,
+                                           old_module_sp_ptr,
+                                           did_create_ptr);
+    }
+    if (module_sp)
+        module_sp->SetPlatformFileSpec(module_spec.GetFileSpec());
+    return error;
+}
+
+bool
+PlatformWindows::GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch)
+{
+    // From macosx;s plugin code. For FreeBSD we may want to support more archs.
+    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.IsExactMatch(platform_arch64))
+        {
+            // This freebsd 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;
+}
+
+void
+PlatformWindows::GetStatus (Stream &strm)
+{
+    Platform::GetStatus(strm);
+
+#ifdef _WIN32
+    OSVERSIONINFO info;
+
+    ZeroMemory(&info, sizeof(OSVERSIONINFO));
+    info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+
+    if (GetVersionEx(&info) == 0)
+    {
+        strm << "Windows";
+        return;
+    }
+
+    strm << "Host: Windows " << (int) info.dwMajorVersion
+        << '.' << (int) info.dwMinorVersion
+        << " Build: " << (int) info.dwBuildNumber << '\n';
+#endif
+}

Added: lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.h?rev=192693&view=auto
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.h (added)
+++ lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.h Tue Oct 15 07:32:12 2013
@@ -0,0 +1,160 @@
+//===-- PlatformWindows.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_PlatformWindows_h_
+#define liblldb_PlatformWindows_h_
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Target/Platform.h"
+
+namespace lldb_private
+{
+
+class PlatformWindows : public Platform
+{
+public:
+
+    static void
+    Initialize(void);
+
+    static void
+    Terminate(void);
+
+    PlatformWindows(bool is_host);
+
+    virtual
+    ~PlatformWindows(void);
+
+    //------------------------------------------------------------
+    // lldb_private::PluginInterface functions
+    //------------------------------------------------------------
+    static lldb_private::Platform*
+    CreateInstance (bool force, const lldb_private::ArchSpec *arch);
+
+
+    static lldb_private::ConstString
+    GetPluginNameStatic(bool is_host);
+
+    static const char *
+    GetPluginDescriptionStatic(bool is_host);
+
+    virtual lldb_private::ConstString
+    GetPluginName(void);
+
+    virtual uint32_t
+    GetPluginVersion(void)
+    {
+        return 1;
+    }
+
+    //------------------------------------------------------------
+    // lldb_private::Platform functions
+    //------------------------------------------------------------
+    virtual Error
+    ResolveExecutable(const FileSpec &exe_file,
+                      const ArchSpec &arch,
+                      lldb::ModuleSP &module_sp,
+                      const FileSpecList *module_search_paths_ptr);
+
+    virtual const char *
+    GetDescription(void)
+    {
+        return GetPluginDescriptionStatic(IsHost());
+    }
+
+    virtual size_t
+    GetSoftwareBreakpointTrapOpcode(lldb_private::Target &target,
+                                    lldb_private::BreakpointSite *bp_site);
+
+    virtual bool
+    GetRemoteOSVersion(void);
+
+    virtual bool
+    GetRemoteOSBuildString(std::string &s);
+
+    virtual bool
+    GetRemoteOSKernelDescription(std::string &s);
+
+    // Remote Platform subclasses need to override this function
+    virtual lldb_private::ArchSpec
+    GetRemoteSystemArchitecture(void);
+
+    virtual bool
+    IsConnected(void) const;
+
+    virtual lldb_private::Error
+    ConnectRemote(lldb_private::Args& args);
+
+    virtual lldb_private::Error
+    DisconnectRemote( void );
+
+    virtual const char *
+    GetHostname( void );
+
+    virtual const char *
+    GetUserName(uint32_t uid);
+
+    virtual const char *
+    GetGroupName(uint32_t gid);
+
+    virtual bool
+    GetProcessInfo(lldb::pid_t pid,
+                   lldb_private::ProcessInstanceInfo &proc_info);
+
+    virtual uint32_t
+    FindProcesses(const lldb_private::ProcessInstanceInfoMatch &match_info,
+                  lldb_private::ProcessInstanceInfoList &process_infos);
+
+    virtual lldb_private::Error
+    LaunchProcess(lldb_private::ProcessLaunchInfo &launch_info);
+
+    virtual lldb::ProcessSP
+    Attach(lldb_private::ProcessAttachInfo &attach_info,
+           lldb_private::Debugger &debugger,
+           lldb_private::Target *target,
+           lldb_private::Listener &listener,
+           lldb_private::Error &error);
+
+    virtual lldb_private::Error
+    GetFile(const lldb_private::FileSpec &platform_file,
+            const lldb_private::UUID* uuid, lldb_private::FileSpec &local_file);
+
+    lldb_private::Error
+    GetSharedModule(const lldb_private::ModuleSpec &module_spec,
+                    lldb::ModuleSP &module_sp,
+                    const lldb_private::FileSpecList *module_search_paths_ptr,
+                    lldb::ModuleSP *old_module_sp_ptr,
+                    bool *did_create_ptr);
+
+    virtual bool
+    GetSupportedArchitectureAtIndex(uint32_t idx, lldb_private::ArchSpec &arch);
+
+    virtual void
+    GetStatus(lldb_private::Stream &strm);
+
+    // Local debugging not yet supported
+    virtual bool
+    CanDebugProcess(void)
+    {
+        return false;
+    }
+
+protected:
+    lldb::PlatformSP m_remote_platform_sp;
+
+private:
+    DISALLOW_COPY_AND_ASSIGN (PlatformWindows);
+};
+
+}
+
+#endif  // liblldb_PlatformWindows_h_

Modified: lldb/trunk/source/lldb.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb.cpp?rev=192693&r1=192692&r2=192693&view=diff
==============================================================================
--- lldb/trunk/source/lldb.cpp (original)
+++ lldb/trunk/source/lldb.cpp Tue Oct 15 07:32:12 2013
@@ -43,6 +43,7 @@
 #include "Plugins/Platform/FreeBSD/PlatformFreeBSD.h"
 #include "Plugins/Platform/Linux/PlatformLinux.h"
 #include "Plugins/Platform/POSIX/PlatformPOSIX.h"
+#include "Plugins/Platform/Windows/PlatformWindows.h"
 #include "Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h"
 #ifndef LLDB_DISABLE_PYTHON
 #include "Plugins/OperatingSystem/Python/OperatingSystemPython.h"
@@ -63,7 +64,7 @@
 
 #include "Plugins/Process/mach-core/ProcessMachCore.h"
 
-#if defined(__linux__) or defined(__FreeBSD__)
+#if defined(__linux__) || defined(__FreeBSD__)
 #include "Plugins/Process/elf-core/ProcessElfCore.h"
 #endif
 
@@ -114,6 +115,7 @@ lldb_private::Initialize ()
         DynamicLoaderPOSIXDYLD::Initialize ();
         PlatformFreeBSD::Initialize();
         PlatformLinux::Initialize();
+        PlatformWindows::Initialize();
         SymbolFileDWARFDebugMap::Initialize();
         ItaniumABILanguageRuntime::Initialize();
 #ifndef LLDB_DISABLE_PYTHON
@@ -148,7 +150,7 @@ lldb_private::Initialize ()
         ProcessFreeBSD::Initialize();
 #endif
 
-#if defined(__linux__) or defined(__FreeBSD__)
+#if defined(__linux__) || defined(__FreeBSD__)
         ProcessElfCore::Initialize();
 #endif
         //----------------------------------------------------------------------
@@ -181,7 +183,6 @@ lldb_private::Terminate ()
     
     // Terminate and unload and loaded system or user LLDB plug-ins
     PluginManager::Terminate();
-
     ABIMacOSX_i386::Terminate();
     ABIMacOSX_arm::Terminate();
     ABISysV_x86_64::Terminate();
@@ -198,6 +199,7 @@ lldb_private::Terminate ()
     DynamicLoaderPOSIXDYLD::Terminate ();
     PlatformFreeBSD::Terminate();
     PlatformLinux::Terminate();
+    PlatformWindows::Terminate();
     SymbolFileDWARFDebugMap::Terminate();
     ItaniumABILanguageRuntime::Terminate();
 #ifndef LLDB_DISABLE_PYTHON
@@ -230,7 +232,7 @@ lldb_private::Terminate ()
     ProcessFreeBSD::Terminate();
 #endif
 
-#if defined(__linux__) or defined(__FreeBSD__)
+#if defined(__linux__) || defined(__FreeBSD__)
     ProcessElfCore::Terminate();
 #endif
     ProcessGDBRemote::Terminate();





More information about the lldb-commits mailing list