[Lldb-commits] [lldb] r202738 - "size_t" isn't always 64 bit, it is 32 bit on 32 bit systems. All printf style statements that were assuming size_t were 64 bit were changed, and they were also changed to display them as unsigned values as "size_t" isn't signed.

Greg Clayton gclayton at apple.com
Mon Mar 3 11:15:21 PST 2014


Author: gclayton
Date: Mon Mar  3 13:15:20 2014
New Revision: 202738

URL: http://llvm.org/viewvc/llvm-project?rev=202738&view=rev
Log:
"size_t" isn't always 64 bit, it is 32 bit on 32 bit systems. All printf style statements that were assuming size_t were 64 bit were changed, and they were also changed to display them as unsigned values as "size_t" isn't signed.

If you print anything with 'size_t', please cast it to "uint64_t" in the printf and use PRIu64 or PRIx64.


Modified:
    lldb/trunk/include/lldb/Target/Process.h
    lldb/trunk/source/API/SBData.cpp
    lldb/trunk/source/API/SBProcess.cpp
    lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
    lldb/trunk/source/Commands/CommandObjectMemory.cpp
    lldb/trunk/source/Commands/CommandObjectTarget.cpp
    lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp
    lldb/trunk/source/Core/Debugger.cpp
    lldb/trunk/source/Core/Module.cpp
    lldb/trunk/source/Expression/ClangFunction.cpp
    lldb/trunk/source/Expression/DWARFExpression.cpp
    lldb/trunk/source/Expression/IRForTarget.cpp
    lldb/trunk/source/Interpreter/CommandHistory.cpp
    lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
    lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
    lldb/trunk/source/Symbol/SymbolContext.cpp
    lldb/trunk/source/Symbol/Symtab.cpp
    lldb/trunk/source/Target/Process.cpp
    lldb/trunk/source/Target/Target.cpp

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=202738&r1=202737&r2=202738&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Mon Mar  3 13:15:20 2014
@@ -1419,7 +1419,7 @@ class Process :
     public PluginInterface
 {
     friend class ClangFunction;     // For WaitForStateChangeEventsPrivate
-    friend class Debugger;          // For PopProcessIOHandler
+    friend class Debugger;          // For PopProcessIOHandler and ProcessIOHandlerIsActive
     friend class ProcessEventData;
     friend class StopInfo;
     friend class Target;
@@ -3875,6 +3875,9 @@ protected:
     bool
     PopProcessIOHandler ();
     
+    bool
+    ProcessIOHandlerIsActive ();
+    
     Error
     HaltForDestroyOrDetach(lldb::EventSP &exit_event_sp);
     

Modified: lldb/trunk/source/API/SBData.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBData.cpp?rev=202738&r1=202737&r2=202738&view=diff
==============================================================================
--- lldb/trunk/source/API/SBData.cpp (original)
+++ lldb/trunk/source/API/SBData.cpp Mon Mar  3 13:15:20 2014
@@ -122,7 +122,7 @@ SBData::GetByteSize ()
         value = m_opaque_sp->GetByteSize();
     if (log)
         log->Printf ("SBData::GetByteSize () => "
-                     "( %" PRId64 " )", value);
+                     "( %" PRIu64 " )", (uint64_t)value);
     return value;
 }
 
@@ -479,8 +479,8 @@ SBData::ReadRawData (lldb::SBError& erro
             error.SetErrorString("unable to read data");
     }
     if (log)
-        log->Printf("SBData::ReadRawData (error=%p,offset=%" PRIu64 ",buf=%p,size=%" PRId64 ") => "
-                     "(%p)", error.get(), offset, buf, size, ok);
+        log->Printf("SBData::ReadRawData (error=%p,offset=%" PRIu64 ",buf=%p,size=%" PRIu64 ") => "
+                     "(%p)", error.get(), offset, buf, (uint64_t)size, ok);
     return ok ? size : 0;
 }
 
@@ -497,8 +497,8 @@ SBData::SetData (lldb::SBError& error,
     else
         m_opaque_sp->SetData(buf, size, endian);
     if (log)
-        log->Printf("SBData::SetData (error=%p,buf=%p,size=%" PRId64 ",endian=%d,addr_size=%c) => "
-                     "(%p)", error.get(), buf, size, endian, addr_size, m_opaque_sp.get());
+        log->Printf("SBData::SetData (error=%p,buf=%p,size=%" PRIu64 ",endian=%d,addr_size=%c) => "
+                     "(%p)", error.get(), buf, (uint64_t)size, endian, addr_size, m_opaque_sp.get());
 }
 
 bool
@@ -647,8 +647,8 @@ SBData::SetDataFromUInt64Array (uint64_t
     if (!array || array_len == 0)
     {
         if (log)
-            log->Printf("SBData::SetDataFromUInt64Array (array=%p, array_len = %" PRId64 ") => "
-                         "false", array, array_len);
+            log->Printf("SBData::SetDataFromUInt64Array (array=%p, array_len = %" PRIu64 ") => "
+                         "false", array, (uint64_t)array_len);
         return false;
     }
 
@@ -662,8 +662,8 @@ SBData::SetDataFromUInt64Array (uint64_t
         m_opaque_sp->SetData(buffer_sp);
     
     if (log)
-        log->Printf("SBData::SetDataFromUInt64Array (array=%p, array_len = %" PRId64 ") => "
-                     "true", array, array_len);
+        log->Printf("SBData::SetDataFromUInt64Array (array=%p, array_len = %" PRIu64 ") => "
+                     "true", array, (uint64_t)array_len);
     
     return true;
 }
@@ -676,8 +676,8 @@ SBData::SetDataFromUInt32Array (uint32_t
     if (!array || array_len == 0)
     {
         if (log)
-            log->Printf("SBData::SetDataFromUInt32Array (array=%p, array_len = %" PRId64 ") => "
-                         "false", array, array_len);
+            log->Printf("SBData::SetDataFromUInt32Array (array=%p, array_len = %" PRIu64 ") => "
+                         "false", array, (uint64_t)array_len);
         return false;
     }
     
@@ -691,8 +691,8 @@ SBData::SetDataFromUInt32Array (uint32_t
         m_opaque_sp->SetData(buffer_sp);
     
     if (log)
-        log->Printf("SBData::SetDataFromUInt32Array (array=%p, array_len = %" PRId64 ") => "
-                     "true", array, array_len);
+        log->Printf("SBData::SetDataFromUInt32Array (array=%p, array_len = %" PRIu64 ") => "
+                     "true", array, (uint64_t)array_len);
     
     return true;
 }
@@ -705,8 +705,8 @@ SBData::SetDataFromSInt64Array (int64_t*
     if (!array || array_len == 0)
     {
         if (log)
-            log->Printf("SBData::SetDataFromSInt64Array (array=%p, array_len = %" PRId64 ") => "
-                         "false", array, array_len);
+            log->Printf("SBData::SetDataFromSInt64Array (array=%p, array_len = %" PRIu64 ") => "
+                         "false", array, (uint64_t)array_len);
         return false;
     }
     
@@ -720,8 +720,8 @@ SBData::SetDataFromSInt64Array (int64_t*
         m_opaque_sp->SetData(buffer_sp);
     
     if (log)
-        log->Printf("SBData::SetDataFromSInt64Array (array=%p, array_len = %" PRId64 ") => "
-                     "true", array, array_len);
+        log->Printf("SBData::SetDataFromSInt64Array (array=%p, array_len = %" PRIu64 ") => "
+                     "true", array, (uint64_t)array_len);
     
     return true;
 }
@@ -734,8 +734,8 @@ SBData::SetDataFromSInt32Array (int32_t*
     if (!array || array_len == 0)
     {
         if (log)
-            log->Printf("SBData::SetDataFromSInt32Array (array=%p, array_len = %" PRId64 ") => "
-                         "false", array, array_len);
+            log->Printf("SBData::SetDataFromSInt32Array (array=%p, array_len = %" PRIu64 ") => "
+                         "false", array, (uint64_t)array_len);
         return false;
     }
     
@@ -749,8 +749,8 @@ SBData::SetDataFromSInt32Array (int32_t*
         m_opaque_sp->SetData(buffer_sp);
     
     if (log)
-        log->Printf("SBData::SetDataFromSInt32Array (array=%p, array_len = %" PRId64 ") => "
-                     "true", array, array_len);
+        log->Printf("SBData::SetDataFromSInt32Array (array=%p, array_len = %" PRIu64 ") => "
+                     "true", array, (uint64_t)array_len);
     
     return true;
 }
@@ -763,8 +763,8 @@ SBData::SetDataFromDoubleArray (double*
     if (!array || array_len == 0)
     {
         if (log)
-            log->Printf("SBData::SetDataFromDoubleArray (array=%p, array_len = %" PRId64 ") => "
-                         "false", array, array_len);
+            log->Printf("SBData::SetDataFromDoubleArray (array=%p, array_len = %" PRIu64 ") => "
+                         "false", array, (uint64_t)array_len);
         return false;
     }
     
@@ -778,8 +778,8 @@ SBData::SetDataFromDoubleArray (double*
         m_opaque_sp->SetData(buffer_sp);
     
     if (log)
-        log->Printf("SBData::SetDataFromDoubleArray (array=%p, array_len = %" PRId64 ") => "
-                     "true", array, array_len);
+        log->Printf("SBData::SetDataFromDoubleArray (array=%p, array_len = %" PRIu64 ") => "
+                     "true", array, (uint64_t)array_len);
     
     return true;
 }

Modified: lldb/trunk/source/API/SBProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBProcess.cpp?rev=202738&r1=202737&r2=202738&view=diff
==============================================================================
--- lldb/trunk/source/API/SBProcess.cpp (original)
+++ lldb/trunk/source/API/SBProcess.cpp Mon Mar  3 13:15:20 2014
@@ -338,11 +338,11 @@ SBProcess::PutSTDIN (const char *src, si
     }
     
     if (log)
-        log->Printf("SBProcess(%p)::PutSTDIN (src=\"%s\", src_len=%d) => %" PRId64,
+        log->Printf("SBProcess(%p)::PutSTDIN (src=\"%s\", src_len=%" PRIu64 ") => %" PRIu64,
                      process_sp.get(), 
                      src, 
-                     (uint32_t) src_len, 
-                     ret_val);
+                     (uint64_t) src_len,
+                     (uint64_t) ret_val);
 
     return ret_val;
 }

Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=202738&r1=202737&r2=202738&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Mon Mar  3 13:15:20 2014
@@ -1078,7 +1078,7 @@ protected:
         {
             // No breakpoint selected; enable all currently set breakpoints.
             target->EnableAllBreakpoints ();
-            result.AppendMessageWithFormat ("All breakpoints enabled. (%" PRId64 " breakpoints)\n", num_breakpoints);
+            result.AppendMessageWithFormat ("All breakpoints enabled. (%" PRIu64 " breakpoints)\n", (uint64_t)num_breakpoints);
             result.SetStatus (eReturnStatusSuccessFinishNoResult);
         }
         else
@@ -1197,7 +1197,7 @@ protected:
         {
             // No breakpoint selected; disable all currently set breakpoints.
             target->DisableAllBreakpoints ();
-            result.AppendMessageWithFormat ("All breakpoints disabled. (%" PRId64 " breakpoints)\n", num_breakpoints);
+            result.AppendMessageWithFormat ("All breakpoints disabled. (%" PRIu64 " breakpoints)\n", (uint64_t)num_breakpoints);
             result.SetStatus (eReturnStatusSuccessFinishNoResult);
         }
         else
@@ -1699,7 +1699,7 @@ protected:
             else
             {
                 target->RemoveAllBreakpoints ();
-                result.AppendMessageWithFormat ("All breakpoints removed. (%" PRId64 " %s)\n", num_breakpoints, num_breakpoints > 1 ? "breakpoints" : "breakpoint");
+                result.AppendMessageWithFormat ("All breakpoints removed. (%" PRIu64 " breakpoint%s)\n", (uint64_t)num_breakpoints, num_breakpoints > 1 ? "s" : "");
             }
             result.SetStatus (eReturnStatusSuccessFinishNoResult);
         }

Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=202738&r1=202737&r2=202738&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Mon Mar  3 13:15:20 2014
@@ -651,7 +651,7 @@ protected:
             }
             else if (m_format_options.GetCountValue().OptionWasSet())
             {
-                result.AppendErrorWithFormat("specify either the end address (0x%" PRIx64 ") or the count (--count %" PRId64 "), not both.\n", end_addr, item_count);
+                result.AppendErrorWithFormat("specify either the end address (0x%" PRIx64 ") or the count (--count %" PRIu64 "), not both.\n", end_addr, (uint64_t)item_count);
                 result.SetStatus(eReturnStatusFailed);
                 return false;
             }
@@ -708,7 +708,7 @@ protected:
             }
             
             if (bytes_read < total_byte_size)
-                result.AppendWarningWithFormat("Not all bytes (%" PRId64 "/%" PRId64 ") were able to be read from 0x%" PRIx64 ".\n", bytes_read, total_byte_size, addr);
+                result.AppendWarningWithFormat("Not all bytes (%" PRIu64 "/%" PRIu64 ") were able to be read from 0x%" PRIx64 ".\n", (uint64_t)bytes_read, (uint64_t)total_byte_size, addr);
         }
         else
         {
@@ -878,7 +878,7 @@ protected:
                 // here we passed a count, and it was not 1
                 // so we have a byte_size and a count
                 // we could well multiply those, but instead let's just fail
-                result.AppendErrorWithFormat("reading memory as characters of size %" PRId64 " is not supported", item_byte_size);
+                result.AppendErrorWithFormat("reading memory as characters of size %" PRIu64 " is not supported", (uint64_t)item_byte_size);
                 result.SetStatus(eReturnStatusFailed);
                 return false;
             }
@@ -1536,7 +1536,7 @@ protected:
                 }
                 else if (!UIntValueIsValidForSize (uval64, item_byte_size))
                 {
-                    result.AppendErrorWithFormat("Value 0x%" PRIx64 " is too large to fit in a %" PRId64 " byte unsigned integer value.\n", uval64, item_byte_size);
+                    result.AppendErrorWithFormat("Value 0x%" PRIx64 " is too large to fit in a %" PRIu64 " byte unsigned integer value.\n", uval64, (uint64_t)item_byte_size);
                     result.SetStatus(eReturnStatusFailed);
                     return false;
                 }
@@ -1564,7 +1564,7 @@ protected:
                 }
                 else if (!UIntValueIsValidForSize (uval64, item_byte_size))
                 {
-                    result.AppendErrorWithFormat("Value 0x%" PRIx64 " is too large to fit in a %" PRId64 " byte unsigned integer value.\n", uval64, item_byte_size);
+                    result.AppendErrorWithFormat("Value 0x%" PRIx64 " is too large to fit in a %" PRIu64 " byte unsigned integer value.\n", uval64, (uint64_t)item_byte_size);
                     result.SetStatus(eReturnStatusFailed);
                     return false;
                 }
@@ -1604,7 +1604,7 @@ protected:
                 }
                 else if (!SIntValueIsValidForSize (sval64, item_byte_size))
                 {
-                    result.AppendErrorWithFormat ("Value %" PRIi64 " is too large or small to fit in a %" PRId64 " byte signed integer value.\n", sval64, item_byte_size);
+                    result.AppendErrorWithFormat ("Value %" PRIi64 " is too large or small to fit in a %" PRIu64 " byte signed integer value.\n", sval64, (uint64_t)item_byte_size);
                     result.SetStatus(eReturnStatusFailed);
                     return false;
                 }
@@ -1621,7 +1621,7 @@ protected:
                 }
                 else if (!UIntValueIsValidForSize (uval64, item_byte_size))
                 {
-                    result.AppendErrorWithFormat ("Value %" PRIu64 " is too large to fit in a %" PRId64 " byte unsigned integer value.\n", uval64, item_byte_size);
+                    result.AppendErrorWithFormat ("Value %" PRIu64 " is too large to fit in a %" PRIu64 " byte unsigned integer value.\n", uval64, (uint64_t)item_byte_size);
                     result.SetStatus(eReturnStatusFailed);
                     return false;
                 }
@@ -1638,7 +1638,7 @@ protected:
                 }
                 else if (!UIntValueIsValidForSize (uval64, item_byte_size))
                 {
-                    result.AppendErrorWithFormat ("Value %" PRIo64 " is too large to fit in a %" PRId64 " byte unsigned integer value.\n", uval64, item_byte_size);
+                    result.AppendErrorWithFormat ("Value %" PRIo64 " is too large to fit in a %" PRIu64 " byte unsigned integer value.\n", uval64, (uint64_t)item_byte_size);
                     result.SetStatus(eReturnStatusFailed);
                     return false;
                 }

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=202738&r1=202737&r2=202738&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Mon Mar  3 13:15:20 2014
@@ -3402,7 +3402,7 @@ protected:
                             ref_count = module_sp.use_count() - 1;
                         }
                         if (width)
-                            strm.Printf("{%*" PRIu64 "}", width, ref_count);
+                            strm.Printf("{%*" PRIu64 "}", width, (uint64_t)ref_count);
                         else
                             strm.Printf("{%" PRIu64 "}", (uint64_t)ref_count);
                     }

Modified: lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp?rev=202738&r1=202737&r2=202738&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp Mon Mar  3 13:15:20 2014
@@ -397,7 +397,7 @@ protected:
         {
             // No watchpoint selected; enable all currently set watchpoints.
             target->EnableAllWatchpoints();
-            result.AppendMessageWithFormat("All watchpoints enabled. (%" PRId64 " watchpoints)\n", num_watchpoints);
+            result.AppendMessageWithFormat("All watchpoints enabled. (%" PRIu64 " watchpoints)\n", (uint64_t)num_watchpoints);
             result.SetStatus(eReturnStatusSuccessFinishNoResult);
         }
         else
@@ -476,7 +476,7 @@ protected:
             // No watchpoint selected; disable all currently set watchpoints.
             if (target->DisableAllWatchpoints())
             {
-                result.AppendMessageWithFormat("All watchpoints disabled. (%" PRId64 " watchpoints)\n", num_watchpoints);
+                result.AppendMessageWithFormat("All watchpoints disabled. (%" PRIu64 " watchpoints)\n", (uint64_t)num_watchpoints);
                 result.SetStatus(eReturnStatusSuccessFinishNoResult);
             }
             else
@@ -564,7 +564,7 @@ protected:
             else
             {
                 target->RemoveAllWatchpoints();
-                result.AppendMessageWithFormat("All watchpoints removed. (%" PRId64 " watchpoints)\n", num_watchpoints);
+                result.AppendMessageWithFormat("All watchpoints removed. (%" PRIu64 " watchpoints)\n", (uint64_t)num_watchpoints);
             }
             result.SetStatus (eReturnStatusSuccessFinishNoResult);
         }
@@ -706,7 +706,7 @@ protected:
         if (command.GetArgumentCount() == 0)
         {
             target->IgnoreAllWatchpoints(m_options.m_ignore_count);
-            result.AppendMessageWithFormat("All watchpoints ignored. (%" PRId64 " watchpoints)\n", num_watchpoints);
+            result.AppendMessageWithFormat("All watchpoints ignored. (%" PRIu64 " watchpoints)\n", (uint64_t)num_watchpoints);
             result.SetStatus (eReturnStatusSuccessFinishNoResult);
         }
         else
@@ -1099,8 +1099,8 @@ protected:
         }
         else
         {
-            result.AppendErrorWithFormat("Watchpoint creation failed (addr=0x%" PRIx64 ", size=%" PRId64 ", variable expression='%s').\n",
-                                         addr, size, command.GetArgumentAtIndex(0));
+            result.AppendErrorWithFormat("Watchpoint creation failed (addr=0x%" PRIx64 ", size=%" PRIu64 ", variable expression='%s').\n",
+                                         addr, (uint64_t)size, command.GetArgumentAtIndex(0));
             if (error.AsCString(NULL))
                 result.AppendError(error.AsCString());
             result.SetStatus(eReturnStatusFailed);
@@ -1308,8 +1308,8 @@ protected:
         }
         else
         {
-            result.AppendErrorWithFormat("Watchpoint creation failed (addr=0x%" PRIx64 ", size=%" PRId64 ").\n",
-                                         addr, size);
+            result.AppendErrorWithFormat("Watchpoint creation failed (addr=0x%" PRIx64 ", size=%" PRIu64 ").\n",
+                                         addr, (uint64_t)size);
             if (error.AsCString(NULL))
                 result.AppendError(error.AsCString());
             result.SetStatus(eReturnStatusFailed);

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=202738&r1=202737&r2=202738&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Mon Mar  3 13:15:20 2014
@@ -2959,7 +2959,10 @@ Debugger::HandleProcessEvent (const Even
         if (output_stream.GetSize() || error_stream.GetSize())
         {
             StreamFileSP error_stream_sp (GetOutputFile());
-            bool top_io_handler_hid = HideTopIOHandler();
+            bool top_io_handler_hid = false;
+            
+            if (process_sp->ProcessIOHandlerIsActive() == false)
+                top_io_handler_hid = HideTopIOHandler();
 
             if (output_stream.GetSize())
             {

Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=202738&r1=202737&r2=202738&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Mon Mar  3 13:15:20 2014
@@ -131,16 +131,16 @@ namespace lldb {
 
 Module::Module (const ModuleSpec &module_spec) :
     m_mutex (Mutex::eMutexTypeRecursive),
-    m_mod_time (module_spec.GetFileSpec().GetModificationTime()),
-    m_arch (module_spec.GetArchitecture()),
+    m_mod_time (),
+    m_arch (),
     m_uuid (),
-    m_file (module_spec.GetFileSpec()),
-    m_platform_file(module_spec.GetPlatformFileSpec()),
+    m_file (),
+    m_platform_file(),
     m_remote_install_file(),
-    m_symfile_spec (module_spec.GetSymbolFileSpec()),
-    m_object_name (module_spec.GetObjectName()),
-    m_object_offset (module_spec.GetObjectOffset()),
-    m_object_mod_time (module_spec.GetObjectModificationTime()),
+    m_symfile_spec (),
+    m_object_name (),
+    m_object_offset (),
+    m_object_mod_time (),
     m_objfile_sp (),
     m_symfile_ap (),
     m_ast (),
@@ -163,11 +163,40 @@ Module::Module (const ModuleSpec &module
     if (log)
         log->Printf ("%p Module::Module((%s) '%s%s%s%s')",
                      this,
-                     m_arch.GetArchitectureName(),
-                     m_file.GetPath().c_str(),
-                     m_object_name.IsEmpty() ? "" : "(",
-                     m_object_name.IsEmpty() ? "" : m_object_name.AsCString(""),
-                     m_object_name.IsEmpty() ? "" : ")");
+                     module_spec.GetArchitecture().GetArchitectureName(),
+                     module_spec.GetFileSpec().GetPath().c_str(),
+                     module_spec.GetObjectName().IsEmpty() ? "" : "(",
+                     module_spec.GetObjectName().IsEmpty() ? "" : module_spec.GetObjectName().AsCString(""),
+                     module_spec.GetObjectName().IsEmpty() ? "" : ")");
+    
+    // First extract all module specifications from the file using the local
+    // file path. If there are no specifications, then don't fill anything in
+    ModuleSpecList modules_specs;
+    if (ObjectFile::GetModuleSpecifications(module_spec.GetFileSpec(), 0, 0, modules_specs) == 0)
+        return;
+    
+    // Now make sure that one of the module specifications matches what we just
+    // extract. We might have a module specification that specifies a file "/usr/lib/dyld"
+    // with UUID XXX, but we might have a local version of "/usr/lib/dyld" that has
+    // UUID YYY and we don't want those to match. If they don't match, just don't
+    // fill any ivars in so we don't accidentally grab the wrong file later since
+    // they don't match...
+    ModuleSpec matching_module_spec;
+    if (modules_specs.FindMatchingModuleSpec(module_spec, matching_module_spec) == 0)
+        return;
+    m_mod_time = module_spec.GetFileSpec().GetModificationTime();
+    if (module_spec.GetArchitecture().IsValid())
+        m_arch = module_spec.GetArchitecture();
+    else
+        m_arch = matching_module_spec.GetArchitecture();
+    m_mod_time = module_spec.GetFileSpec().GetModificationTime();
+    m_file = module_spec.GetFileSpec();
+    m_platform_file = module_spec.GetPlatformFileSpec();
+    m_symfile_spec = module_spec.GetSymbolFileSpec();
+    m_object_name = module_spec.GetObjectName();
+    m_object_offset = module_spec.GetObjectOffset();
+    m_object_mod_time = module_spec.GetObjectModificationTime();
+    
 }
 
 Module::Module(const FileSpec& file_spec, 

Modified: lldb/trunk/source/Expression/ClangFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangFunction.cpp?rev=202738&r1=202737&r2=202738&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangFunction.cpp (original)
+++ lldb/trunk/source/Expression/ClangFunction.cpp Mon Mar  3 13:15:20 2014
@@ -173,7 +173,7 @@ ClangFunction::CompileFunction (Stream &
             }
             else
             {   
-                errors.Printf("Could not determine type of input value %" PRId64 ".", i);
+                errors.Printf("Could not determine type of input value %" PRIu64 ".", (uint64_t)i);
                 return 1;
             }
         }
@@ -344,7 +344,7 @@ ClangFunction::WriteFunctionArguments (E
     size_t num_args = arg_values.GetSize();
     if (num_args != m_arg_values.GetSize())
     {
-        errors.Printf ("Wrong number of arguments - was: %" PRId64 " should be: %" PRId64 "", num_args, m_arg_values.GetSize());
+        errors.Printf ("Wrong number of arguments - was: %" PRIu64 " should be: %" PRIu64 "", (uint64_t)num_args, (uint64_t)m_arg_values.GetSize());
         return false;
     }
     

Modified: lldb/trunk/source/Expression/DWARFExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/DWARFExpression.cpp?rev=202738&r1=202737&r2=202738&view=diff
==============================================================================
--- lldb/trunk/source/Expression/DWARFExpression.cpp (original)
+++ lldb/trunk/source/Expression/DWARFExpression.cpp Mon Mar  3 13:15:20 2014
@@ -1363,7 +1363,7 @@ DWARFExpression::Evaluate
         if (log && log->GetVerbose())
         {
             size_t count = stack.size();
-            log->Printf("Stack before operation has %" PRId64 " values:", count);
+            log->Printf("Stack before operation has %" PRIu64 " values:", (uint64_t)count);
             for (size_t i=0; i<count; ++i)
             {
                 StreamString new_value;
@@ -2832,7 +2832,7 @@ DWARFExpression::Evaluate
     else if (log && log->GetVerbose())
     {
         size_t count = stack.size();
-        log->Printf("Stack after operation has %" PRId64 " values:", count);
+        log->Printf("Stack after operation has %" PRIu64 " values:", (uint64_t)count);
         for (size_t i=0; i<count; ++i)
         {
             StreamString new_value;

Modified: lldb/trunk/source/Expression/IRForTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRForTarget.cpp?rev=202738&r1=202737&r2=202738&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRForTarget.cpp (original)
+++ lldb/trunk/source/Expression/IRForTarget.cpp Mon Mar  3 13:15:20 2014
@@ -2016,7 +2016,7 @@ IRForTarget::ReplaceStaticLiterals (llvm
                 }
                 ss.flush();
                 
-                log->Printf("Found ConstantFP with size %" PRId64 " and raw data %s", operand_data_size, s.c_str());
+                log->Printf("Found ConstantFP with size %" PRIu64 " and raw data %s", (uint64_t)operand_data_size, s.c_str());
             }
             
             lldb_private::DataBufferHeap data(operand_data_size, 0);
@@ -2479,7 +2479,7 @@ IRForTarget::ReplaceVariables (Function
     }
     
     if (log)
-        log->Printf("Total structure [align %" PRId64 ", size %" PRId64 "]", alignment, size);
+        log->Printf("Total structure [align %" PRId64 ", size %" PRIu64 "]", (int64_t)alignment, (uint64_t)size);
     
     return true;
 }

Modified: lldb/trunk/source/Interpreter/CommandHistory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandHistory.cpp?rev=202738&r1=202737&r2=202738&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandHistory.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandHistory.cpp Mon Mar  3 13:15:20 2014
@@ -137,7 +137,7 @@ CommandHistory::Dump (Stream& stream,
         if (!hist_item.empty())
         {
             stream.Indent();
-            stream.Printf("%4" PRId64 ": %s\n", counter, hist_item.c_str());
+            stream.Printf("%4" PRIu64 ": %s\n", (uint64_t)counter, hist_item.c_str());
         }
     }
 }

Modified: lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp?rev=202738&r1=202737&r2=202738&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp Mon Mar  3 13:15:20 2014
@@ -461,7 +461,7 @@ ObjectContainerBSDArchive::Dump (Stream
     s->Indent();
     const size_t num_archs = GetNumArchitectures();
     const size_t num_objects = GetNumObjects();
-    s->Printf("ObjectContainerBSDArchive, num_archs = %" PRId64 ", num_objects = %" PRId64 "", num_archs, num_objects);
+    s->Printf("ObjectContainerBSDArchive, num_archs = %" PRIu64 ", num_objects = %" PRIu64 "", (uint64_t)num_archs, (uint64_t)num_objects);
     uint32_t i;
     ArchSpec arch;
     s->IndentMore();

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=202738&r1=202737&r2=202738&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Mon Mar  3 13:15:20 2014
@@ -305,100 +305,100 @@ PlatformDarwin::GetSharedModuleWithLocal
                      module_spec.GetSymbolFileSpec().GetFilename().AsCString());
 
     std::string cache_path(GetLocalCacheDirectory());
-    std::string module_path (module_spec.GetFileSpec().GetPath());
-    cache_path.append(module_path);
-    FileSpec module_cache_spec(cache_path.c_str(),false);
-    
-    // if rsync is supported, always bring in the file - rsync will be very efficient
-    // when files are the same on the local and remote end of the connection
-    if (this->GetSupportsRSync())
+    // Only search for a locally cached file if we have a valid cache path
+    if (!cache_path.empty())
     {
-        Error err = BringInRemoteFile (this, module_spec, module_cache_spec);
-        if (err.Fail())
-            return err;
-        if (module_cache_spec.Exists())
-        {
-            Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
-            if (log)
-                log->Printf("[%s] module %s/%s was rsynced and is now there",
-                             (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());
-            return Error();
-        }
-    }
-
-    if (module_spec.GetFileSpec().Exists() && !module_sp)
-    {
-        module_sp.reset(new Module(module_spec));
-        return Error();
-    }
+        std::string module_path (module_spec.GetFileSpec().GetPath());
+        cache_path.append(module_path);
+        FileSpec module_cache_spec(cache_path.c_str(),false);
     
-    // try to find the module in the cache
-    if (module_cache_spec.Exists())
-    {
-        // get the local and remote MD5 and compare
-        if (m_remote_platform_sp)
+        // if rsync is supported, always bring in the file - rsync will be very efficient
+        // when files are the same on the local and remote end of the connection
+        if (this->GetSupportsRSync())
         {
-            // when going over the *slow* GDB remote transfer mechanism we first check
-            // the hashes of the files - and only do the actual transfer if they differ
-            uint64_t high_local,high_remote,low_local,low_remote;
-            Host::CalculateMD5 (module_cache_spec, low_local, high_local);
-            m_remote_platform_sp->CalculateMD5(module_spec.GetFileSpec(), low_remote, high_remote);
-            if (low_local != low_remote || high_local != high_remote)
+            Error err = BringInRemoteFile (this, module_spec, module_cache_spec);
+            if (err.Fail())
+                return err;
+            if (module_cache_spec.Exists())
             {
-                // bring in the remote file
                 Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
                 if (log)
-                    log->Printf("[%s] module %s/%s needs to be replaced from remote copy",
+                    log->Printf("[%s] module %s/%s was rsynced and is now there",
                                  (IsHost() ? "host" : "remote"),
                                  module_spec.GetFileSpec().GetDirectory().AsCString(),
                                  module_spec.GetFileSpec().GetFilename().AsCString());
-                Error err = BringInRemoteFile (this, module_spec, module_cache_spec);
-                if (err.Fail())
-                    return err;
+                ModuleSpec local_spec(module_cache_spec, module_spec.GetArchitecture());
+                module_sp.reset(new Module(local_spec));
+                module_sp->SetPlatformFileSpec(module_spec.GetFileSpec());
+                return Error();
             }
         }
         
-        ModuleSpec local_spec(module_cache_spec, module_spec.GetArchitecture());
-        module_sp.reset(new Module(local_spec));
-        module_sp->SetPlatformFileSpec(module_spec.GetFileSpec());
-        Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
-            if (log)
-                log->Printf("[%s] module %s/%s was found in the cache",
-                             (IsHost() ? "host" : "remote"),
-                             module_spec.GetFileSpec().GetDirectory().AsCString(),
-                             module_spec.GetFileSpec().GetFilename().AsCString());
-        return Error();
-    }
-    
-    // bring in the remote module file
-    if (log)
-        log->Printf("[%s] module %s/%s needs to come in remotely",
-                     (IsHost() ? "host" : "remote"),
-                     module_spec.GetFileSpec().GetDirectory().AsCString(),
-                     module_spec.GetFileSpec().GetFilename().AsCString());
-    Error err = BringInRemoteFile (this, module_spec, module_cache_spec);
-    if (err.Fail())
-        return err;
-    if (module_cache_spec.Exists())
-    {
-        Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
+        // try to find the module in the cache
+        if (module_cache_spec.Exists())
+        {
+            // get the local and remote MD5 and compare
+            if (m_remote_platform_sp)
+            {
+                // when going over the *slow* GDB remote transfer mechanism we first check
+                // the hashes of the files - and only do the actual transfer if they differ
+                uint64_t high_local,high_remote,low_local,low_remote;
+                Host::CalculateMD5 (module_cache_spec, low_local, high_local);
+                m_remote_platform_sp->CalculateMD5(module_spec.GetFileSpec(), low_remote, high_remote);
+                if (low_local != low_remote || high_local != high_remote)
+                {
+                    // bring in the remote file
+                    Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
+                    if (log)
+                        log->Printf("[%s] module %s/%s needs to be replaced from remote copy",
+                                     (IsHost() ? "host" : "remote"),
+                                     module_spec.GetFileSpec().GetDirectory().AsCString(),
+                                     module_spec.GetFileSpec().GetFilename().AsCString());
+                    Error err = BringInRemoteFile (this, module_spec, module_cache_spec);
+                    if (err.Fail())
+                        return err;
+                }
+            }
+            
+            ModuleSpec local_spec(module_cache_spec, module_spec.GetArchitecture());
+            module_sp.reset(new Module(local_spec));
+            module_sp->SetPlatformFileSpec(module_spec.GetFileSpec());
+            Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
+                if (log)
+                    log->Printf("[%s] module %s/%s was found in the cache",
+                                 (IsHost() ? "host" : "remote"),
+                                 module_spec.GetFileSpec().GetDirectory().AsCString(),
+                                 module_spec.GetFileSpec().GetFilename().AsCString());
+            return Error();
+        }
+        
+        // bring in the remote module file
         if (log)
-            log->Printf("[%s] module %s/%s is now cached and fine",
+            log->Printf("[%s] module %s/%s needs to come in remotely",
                          (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());
-        return Error();
+        Error err = BringInRemoteFile (this, module_spec, module_cache_spec);
+        if (err.Fail())
+            return err;
+        if (module_cache_spec.Exists())
+        {
+            Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
+            if (log)
+                log->Printf("[%s] module %s/%s is now cached and fine",
+                             (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());
+            return Error();
+        }
+        else
+            return Error("unable to obtain valid module file");
     }
     else
-        return Error("unable to obtain valid module file");
+        return Error("no cache path");
 }
 
 Error

Modified: lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp?rev=202738&r1=202737&r2=202738&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp Mon Mar  3 13:15:20 2014
@@ -635,7 +635,7 @@ DynamicRegisterInfo::Dump () const
     s.Printf("%p: DynamicRegisterInfo contains %" PRIu64 " registers:\n", this, (uint64_t)num_regs);
     for (size_t i=0; i<num_regs; ++i)
     {
-        s.Printf("[%3" PRId64 "] name = %-10s", i, m_regs[i].name);
+        s.Printf("[%3" PRIu64 "] name = %-10s", (uint64_t)i, m_regs[i].name);
         s.Printf(", size = %2u, offset = %4u, encoding = %u, format = %-10s",
                  m_regs[i].byte_size,
                  m_regs[i].byte_offset,

Modified: lldb/trunk/source/Symbol/SymbolContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolContext.cpp?rev=202738&r1=202737&r2=202738&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/SymbolContext.cpp (original)
+++ lldb/trunk/source/Symbol/SymbolContext.cpp Mon Mar  3 13:15:20 2014
@@ -910,15 +910,15 @@ SymbolContextSpecifier::GetDescription (
         s->Printf ("File: %s", path_str);
         if (m_type == eLineStartSpecified)
         {
-            s->Printf (" from line %" PRId64 "", m_start_line);
+            s->Printf (" from line %" PRIu64 "", (uint64_t)m_start_line);
             if (m_type == eLineEndSpecified)
-                s->Printf ("to line %" PRId64 "", m_end_line);
+                s->Printf ("to line %" PRIu64 "", (uint64_t)m_end_line);
             else
                 s->Printf ("to end");
         }
         else if (m_type == eLineEndSpecified)
         {
-            s->Printf (" from start to line %" PRId64 "", m_end_line);
+            s->Printf (" from start to line %" PRIu64 "", (uint64_t)m_end_line);
         }
         s->Printf (".\n");
     }
@@ -926,16 +926,16 @@ SymbolContextSpecifier::GetDescription (
     if (m_type == eLineStartSpecified)
     {
         s->Indent();
-        s->Printf ("From line %" PRId64 "", m_start_line);
+        s->Printf ("From line %" PRIu64 "", (uint64_t)m_start_line);
         if (m_type == eLineEndSpecified)
-            s->Printf ("to line %" PRId64 "", m_end_line);
+            s->Printf ("to line %" PRIu64 "", (uint64_t)m_end_line);
         else
             s->Printf ("to end");
         s->Printf (".\n");
     }
     else if (m_type == eLineEndSpecified)
     {
-        s->Printf ("From start to line %" PRId64 ".\n", m_end_line);
+        s->Printf ("From start to line %" PRIu64 ".\n", (uint64_t)m_end_line);
     }
     
     if (m_type == eFunctionSpecified)

Modified: lldb/trunk/source/Symbol/Symtab.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symtab.cpp?rev=202738&r1=202737&r2=202738&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Symtab.cpp (original)
+++ lldb/trunk/source/Symbol/Symtab.cpp Mon Mar  3 13:15:20 2014
@@ -90,14 +90,14 @@ Symtab::Dump (Stream *s, Target *target,
         object_name = m_objfile->GetModule()->GetObjectName().GetCString();
 
     if (file_spec)
-        s->Printf("Symtab, file = %s%s%s%s, num_symbols = %" PRId64 "",
+        s->Printf("Symtab, file = %s%s%s%s, num_symbols = %" PRIu64,
         file_spec.GetPath().c_str(),
         object_name ? "(" : "",
         object_name ? object_name : "",
         object_name ? ")" : "",
-        m_symbols.size());
+        (uint64_t)m_symbols.size());
     else
-        s->Printf("Symtab, num_symbols = %" PRId64 "", m_symbols.size());
+        s->Printf("Symtab, num_symbols = %" PRIu64 "", (uint64_t)m_symbols.size());
 
     if (!m_symbols.empty())
     {
@@ -166,7 +166,7 @@ Symtab::Dump(Stream *s, Target *target,
     const size_t num_symbols = GetNumSymbols();
     //s->Printf("%.*p: ", (int)sizeof(void*) * 2, this);
     s->Indent();
-    s->Printf("Symtab %" PRId64 " symbol indexes (%" PRId64 " symbols total):\n", indexes.size(), m_symbols.size());
+    s->Printf("Symtab %" PRIu64 " symbol indexes (%" PRIu64 " symbols total):\n", (uint64_t)indexes.size(), (uint64_t)m_symbols.size());
     s->IndentMore();
 
     if (!indexes.empty())

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=202738&r1=202737&r2=202738&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Mon Mar  3 13:15:20 2014
@@ -4934,6 +4934,14 @@ Process::SetSTDIOFileDescriptor (int fd)
 }
 
 bool
+Process::ProcessIOHandlerIsActive ()
+{
+    IOHandlerSP io_handler_sp (m_process_input_reader);
+    if (io_handler_sp)
+        return m_target.GetDebugger().IsTopIOHandler (io_handler_sp);
+    return false;
+}
+bool
 Process::PushProcessIOHandler ()
 {
     IOHandlerSP io_handler_sp (m_process_input_reader);

Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=202738&r1=202737&r2=202738&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Mon Mar  3 13:15:20 2014
@@ -635,7 +635,7 @@ Target::CreateWatchpoint(lldb::addr_t ad
         if (!CheckIfWatchpointsExhausted(this, error))
         {
             if (!OptionGroupWatchpoint::IsWatchSizeSupported(size))
-                error.SetErrorStringWithFormat("watch size of %" PRId64 " is not supported", size);
+                error.SetErrorStringWithFormat("watch size of %" PRIu64 " is not supported", (uint64_t)size);
         }
         wp_sp.reset();
     }





More information about the lldb-commits mailing list