[Lldb-commits] [lldb] r181461 - Improvements to the package importing feature - test case will follow

Enrico Granata egranata at apple.com
Wed May 8 13:25:11 PDT 2013


Author: enrico
Date: Wed May  8 15:25:10 2013
New Revision: 181461

URL: http://llvm.org/viewvc/llvm-project?rev=181461&view=rev
Log:
Improvements to the package importing feature - test case will follow


Modified:
    lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp

Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=181461&r1=181460&r2=181461&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Wed May  8 15:25:10 2013
@@ -2602,13 +2602,23 @@ ScriptInterpreterPython::LoadScriptingMo
                         Locker::AcquireLock      | (init_session ? Locker::InitSession     : 0),
                         Locker::FreeAcquiredLock | (init_session ? Locker::TearDownSession : 0));
         
-        if (target_file.GetFileType() == FileSpec::eFileTypeInvalid ||
-            target_file.GetFileType() == FileSpec::eFileTypeUnknown ||
-            target_file.GetFileType() == FileSpec::eFileTypeDirectory )
+        if (target_file.GetFileType() == FileSpec::eFileTypeDirectory)
         {
-            // if not a filename, try to just plain import
+            // for directories, just import
             basename = pathname;
         }
+        else if (target_file.GetFileType() == FileSpec::eFileTypeInvalid ||
+                 target_file.GetFileType() == FileSpec::eFileTypeUnknown)
+        {
+            // if not a valid file of any sort, check if it might be a filename still
+            // dot can't be used but / and \ can, and if either is found, reject
+            if (strchr(pathname,'\\') || strchr(pathname,'/'))
+            {
+                error.SetErrorString("invalid pathname");
+                return false;
+            }
+            basename = pathname; // not a filename, probably a package of some sort, let it go through
+        }
         else
         {
             const char* directory = target_file.GetDirectory().GetCString();





More information about the lldb-commits mailing list