[Lldb-commits] [lldb] r137307 - in /lldb/trunk: include/lldb/Target/Platform.h source/Commands/CommandObjectProcess.cpp source/Target/Platform.cpp

Greg Clayton gclayton at apple.com
Thu Aug 11 09:25:18 PDT 2011


Author: gclayton
Date: Thu Aug 11 11:25:18 2011
New Revision: 137307

URL: http://llvm.org/viewvc/llvm-project?rev=137307&view=rev
Log:
Patch for "process load" by Filipe Cabecinhas.

Filipe was attempting to do a:

(lldb) process load ~/path/foo.dylib

But the process load command wasn't resolving the path. We have to be careful
about resolving the path here because we want to do it in terms of the platform
we are using. the "~/" can mean a completely different path if you are remotely
debugging on another machine as another user. So to support this, platforms now
can resolve remote paths:

bool
Platform::ResolveRemotePath (const FileSpec &platform_path,
                             FileSpec &resolved_platform_path);

The host/local platform will just resolve the path.
                             


Modified:
    lldb/trunk/include/lldb/Target/Platform.h
    lldb/trunk/source/Commands/CommandObjectProcess.cpp
    lldb/trunk/source/Target/Platform.cpp

Modified: lldb/trunk/include/lldb/Target/Platform.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Platform.h?rev=137307&r1=137306&r2=137307&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Platform.h (original)
+++ lldb/trunk/include/lldb/Target/Platform.h Thu Aug 11 11:25:18 2011
@@ -110,6 +110,15 @@
                            const ArchSpec &arch,
                            lldb::ModuleSP &module_sp);
 
+        //------------------------------------------------------------------
+        /// Resolves the FileSpec to a (possibly) remote path. Remote
+        /// platforms must override this to resolve to a path on the remote
+        /// side.
+        //------------------------------------------------------------------
+        virtual bool
+        ResolveRemotePath (const FileSpec &platform_path,
+                           FileSpec &resolved_platform_path);
+
         bool
         GetOSVersion (uint32_t &major, 
                       uint32_t &minor, 

Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=137307&r1=137306&r2=137307&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Thu Aug 11 11:25:18 2011
@@ -1172,6 +1172,7 @@
             Error error;
             const char *image_path = command.GetArgumentAtIndex(i);
             FileSpec image_spec (image_path, false);
+            process->GetTarget().GetPlatform()->ResolveRemotePath(image_spec, image_spec);
             uint32_t image_token = process->LoadImage(image_spec, error);
             if (image_token != LLDB_INVALID_IMAGE_TOKEN)
             {

Modified: lldb/trunk/source/Target/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Platform.cpp?rev=137307&r1=137306&r2=137307&view=diff
==============================================================================
--- lldb/trunk/source/Target/Platform.cpp (original)
+++ lldb/trunk/source/Target/Platform.cpp Thu Aug 11 11:25:18 2011
@@ -451,6 +451,14 @@
     return error;
 }
 
+bool
+Platform::ResolveRemotePath (const FileSpec &platform_path,
+                             FileSpec &resolved_platform_path)
+{
+    resolved_platform_path = platform_path;
+    return resolved_platform_path.ResolvePath();
+}
+
 
 const ArchSpec &
 Platform::GetSystemArchitecture()





More information about the lldb-commits mailing list