[Lldb-commits] [lldb] r155684 - in /lldb/branches/lldb-platform-work: ./ include/lldb/Core/Debugger.h source/Core/Debugger.cpp source/Expression/IRForTarget.cpp source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp source/Target/Target.cpp tools/driver/Driver.cpp

Enrico Granata egranata at apple.com
Thu Apr 26 18:10:57 PDT 2012


Author: enrico
Date: Thu Apr 26 20:10:56 2012
New Revision: 155684

URL: http://llvm.org/viewvc/llvm-project?rev=155684&view=rev
Log:
Merging goodies from ToT

Modified:
    lldb/branches/lldb-platform-work/   (props changed)
    lldb/branches/lldb-platform-work/include/lldb/Core/Debugger.h
    lldb/branches/lldb-platform-work/source/Core/Debugger.cpp
    lldb/branches/lldb-platform-work/source/Expression/IRForTarget.cpp
    lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
    lldb/branches/lldb-platform-work/source/Target/Target.cpp
    lldb/branches/lldb-platform-work/tools/driver/Driver.cpp

Propchange: lldb/branches/lldb-platform-work/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr 26 20:10:56 2012
@@ -1 +1 @@
-/lldb/trunk:154224-155644
+/lldb/trunk:154223-155683

Modified: lldb/branches/lldb-platform-work/include/lldb/Core/Debugger.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/Debugger.h?rev=155684&r1=155683&r2=155684&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/Debugger.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/Debugger.h Thu Apr 26 20:10:56 2012
@@ -88,7 +88,9 @@
     void
     SetTerminalWidth (uint32_t term_width)
     {
-        m_term_width = term_width;
+        Error err;
+        if (ValidTermWidthValue(term_width, err))
+            m_term_width = term_width;
     }
 
     uint32_t
@@ -229,6 +231,9 @@
     bool
     ValidTermWidthValue (const char *value, Error err);
 
+    bool
+    ValidTermWidthValue (uint32_t value, Error err);
+
     const ConstString
     CreateInstanceName ();
 

Modified: lldb/branches/lldb-platform-work/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/Debugger.cpp?rev=155684&r1=155683&r2=155684&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/Debugger.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/Debugger.cpp Thu Apr 26 20:10:56 2012
@@ -2523,10 +2523,7 @@
         
         if (end && end[0] == '\0')
         {
-            if (width >= 10 && width <= 1024)
-                valid = true;
-            else
-                err.SetErrorString ("invalid term-width value; value must be between 10 and 1024");
+            return ValidTermWidthValue (width, err);
         }
         else
             err.SetErrorStringWithFormat ("'%s' is not a valid unsigned integer string", value);
@@ -2535,6 +2532,17 @@
     return valid;
 }
 
+bool
+DebuggerInstanceSettings::ValidTermWidthValue (uint32_t value, Error err)
+{
+    if (value >= 10 && value <= 1024)
+        return true;
+    else
+    {
+        err.SetErrorString ("invalid term-width value; value must be between 10 and 1024");
+        return false;
+    }
+}
 
 void
 DebuggerInstanceSettings::UpdateInstanceSettingsVariable (const ConstString &var_name,

Modified: lldb/branches/lldb-platform-work/source/Expression/IRForTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Expression/IRForTarget.cpp?rev=155684&r1=155683&r2=155684&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Expression/IRForTarget.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Expression/IRForTarget.cpp Thu Apr 26 20:10:56 2012
@@ -2041,7 +2041,7 @@
             
             ConstantFP *operand_constant_fp = dyn_cast<ConstantFP>(operand_val);
             
-            if (operand_constant_fp && operand_constant_fp->getType()->isX86_FP80Ty())
+            if (operand_constant_fp/* && operand_constant_fp->getType()->isX86_FP80Ty()*/)
             {
                 static_constants.push_back(operand_val);
                 static_users.push_back(ii);

Modified: lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp?rev=155684&r1=155683&r2=155684&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp Thu Apr 26 20:10:56 2012
@@ -232,7 +232,23 @@
     if (module_spec.GetFileSpec().Exists() && !module_sp)
     {
         module_sp.reset(new Module(module_spec));
-        return Error();
+        if (module_spec.GetUUID() == module_sp->GetUUID())
+        {
+            printf("[%s] module %s/%s was found\n",
+                   (IsHost() ? "host" : "remote"),
+                   module_spec.GetFileSpec().GetDirectory().AsCString(),
+                   module_spec.GetFileSpec().GetFilename().AsCString());
+            return Error();
+        }
+        else
+        {
+            printf("[%s] module %s/%s had UUID mismatch\n",
+                   (IsHost() ? "host" : "remote"),
+                   module_spec.GetFileSpec().GetDirectory().AsCString(),
+                   module_spec.GetFileSpec().GetFilename().AsCString());
+            return Error();
+            module_sp.reset();
+        }
     }
     // try to find the module in the cache
     std::string cache_path(GetLocalCacheDirectory());
@@ -245,9 +261,17 @@
         ModuleSpec local_spec(module_cache_spec, module_spec.GetArchitecture());
         module_sp.reset(new Module(local_spec));
         module_sp->SetPlatformFileSpec(module_spec.GetFileSpec());
+        printf("[%s] module %s/%s was found in the cache\n",
+               (IsHost() ? "host" : "remote"),
+               module_spec.GetFileSpec().GetDirectory().AsCString(),
+               module_spec.GetFileSpec().GetFilename().AsCString());
         return Error();
     }
     // bring in the remote module file
+    printf("[%s] module %s/%s needs to come in remotely\n",
+           (IsHost() ? "host" : "remote"),
+           module_spec.GetFileSpec().GetDirectory().AsCString(),
+           module_spec.GetFileSpec().GetFilename().AsCString());
     FileSpec module_cache_folder = module_cache_spec.CopyByRemovingLastPathComponent();
     StreamString mkdir_folder_cmd;
     // try to make the local directory first
@@ -263,6 +287,10 @@
         return err;
     if (module_cache_spec.Exists())
     {
+        printf("[%s] module %s/%s is now cached and fine\n",
+               (IsHost() ? "host" : "remote"),
+               module_spec.GetFileSpec().GetDirectory().AsCString(),
+               module_spec.GetFileSpec().GetFilename().AsCString());
         ModuleSpec local_spec(module_cache_spec, module_spec.GetArchitecture());
         module_sp.reset(new Module(local_spec));
         module_sp->SetPlatformFileSpec(module_spec.GetFileSpec());

Modified: lldb/branches/lldb-platform-work/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/Target.cpp?rev=155684&r1=155683&r2=155684&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/Target.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/Target.cpp Thu Apr 26 20:10:56 2012
@@ -1318,21 +1318,45 @@
                                                  &did_create_module);
         }
     }
-
-    // The platform is responsible for finding and caching an appropriate
-    // module in the shared module cache.
-    if (m_platform_sp)
-    {
-        FileSpec platform_file_spec;        
-        error = m_platform_sp->GetSharedModule (module_spec, 
-                                                module_sp, 
-                                                &GetExecutableSearchPaths(),
-                                                &old_module_sp, 
-                                                &did_create_module);
-    }
-    else
+    
+    if (!module_sp)
     {
-        error.SetErrorString("no platform is currently set");
+        // If we have a UUID, we can check our global shared module list in case
+        // we already have it. If we don't have a valid UUID, then we can't since
+        // the path in "module_spec" will be a platform path, and we will need to
+        // let the platform find that file. For example, we could be asking for
+        // "/usr/lib/dyld" and if we do not have a UUID, we don't want to pick
+        // the local copy of "/usr/lib/dyld" since our platform could be a remote
+        // platform that has its own "/usr/lib/dyld" in an SDK or in a local file
+        // cache.
+        if (module_spec.GetUUID().IsValid())
+        {
+            // We have a UUID, it is OK to check the global module list...
+            error = ModuleList::GetSharedModule (module_spec,
+                                                 module_sp, 
+                                                 &GetExecutableSearchPaths(),
+                                                 &old_module_sp, 
+                                                 &did_create_module);
+        }
+
+        if (!module_sp)
+        {
+            // The platform is responsible for finding and caching an appropriate
+            // module in the shared module cache.
+            if (m_platform_sp)
+            {
+                FileSpec platform_file_spec;        
+                error = m_platform_sp->GetSharedModule (module_spec, 
+                                                        module_sp, 
+                                                        &GetExecutableSearchPaths(),
+                                                        &old_module_sp, 
+                                                        &did_create_module);
+            }
+            else
+            {
+                error.SetErrorString("no platform is currently set");
+            }
+        }
     }
 
     // If a module hasn't been found yet, use the unmodified path.

Modified: lldb/branches/lldb-platform-work/tools/driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/driver/Driver.cpp?rev=155684&r1=155683&r2=155684&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/driver/Driver.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/driver/Driver.cpp Thu Apr 26 20:10:56 2012
@@ -1484,11 +1484,9 @@
     if (isatty (STDIN_FILENO)
         && ::ioctl (STDIN_FILENO, TIOCGWINSZ, &window_size) == 0)
     {
-        if ((window_size.ws_col > 0) && (strlen (g_debugger_name) > 0))
+        if ((window_size.ws_col > 0) && g_driver != NULL)
         {
-            char width_str_buffer[25];
-            ::sprintf (width_str_buffer, "%d", window_size.ws_col);
-            SBDebugger::SetInternalVariable ("term-width", width_str_buffer, g_debugger_name);
+            g_driver->GetDebugger().SetTerminalWidth (window_size.ws_col);
         }
     }
 }





More information about the lldb-commits mailing list