<rdar://problem/13069948>

Major fixed to allow reading files that are over 4GB. The main problems were that the DataExtractor was using 32 bit offsets as a data cursor, and since we mmap all of our object files we could run into cases where if we had a very large core file that was over 4GB, we were running into the 4GB boundary.

So I defined a new "lldb::offset_t" which should be used for all file offsets.

After making this change, I enabled warnings for data loss and for enexpected implicit conversions temporarily and found a ton of things that I fixed.

Any functions that take an index internally, should use "size_t" for any indexes and also should return "size_t" for any sizes of collections.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@173463 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandCompletions.cpp b/source/Commands/CommandCompletions.cpp
index 175c91d..e6f2323 100644
--- a/source/Commands/CommandCompletions.cpp
+++ b/source/Commands/CommandCompletions.cpp
@@ -131,7 +131,7 @@
     // I'm going to  use the "glob" function with GLOB_TILDE for user directory expansion.  
     // If it is not defined on your host system, you'll need to implement it yourself...
     
-    int partial_name_len = strlen(partial_file_name);
+    size_t partial_name_len = strlen(partial_file_name);
     
     if (partial_name_len >= PATH_MAX)
         return matches.GetSize();
diff --git a/source/Commands/CommandObjectApropos.cpp b/source/Commands/CommandObjectApropos.cpp
index c493d4f..2eeec78 100644
--- a/source/Commands/CommandObjectApropos.cpp
+++ b/source/Commands/CommandObjectApropos.cpp
@@ -56,7 +56,7 @@
 bool
 CommandObjectApropos::DoExecute (Args& args, CommandReturnObject &result)
 {
-    const int argc = args.GetArgumentCount ();
+    const size_t argc = args.GetArgumentCount ();
 
     if (argc == 1)
     {
diff --git a/source/Commands/CommandObjectArgs.cpp b/source/Commands/CommandObjectArgs.cpp
index 891c368..a8f64a2 100644
--- a/source/Commands/CommandObjectArgs.cpp
+++ b/source/Commands/CommandObjectArgs.cpp
@@ -120,7 +120,7 @@
         return false;
     }
     
-    int num_args = args.GetArgumentCount ();
+    const size_t num_args = args.GetArgumentCount ();
     int arg_index;
     
     if (!num_args)
diff --git a/source/Commands/CommandObjectBreakpoint.cpp b/source/Commands/CommandObjectBreakpoint.cpp
index 831b693..b43cf86 100644
--- a/source/Commands/CommandObjectBreakpoint.cpp
+++ b/source/Commands/CommandObjectBreakpoint.cpp
@@ -396,7 +396,7 @@
             case eSetTypeFileAndLine: // Breakpoint by source position
                 {
                     FileSpec file;
-                    uint32_t num_files = m_options.m_filenames.GetSize();
+                    const size_t num_files = m_options.m_filenames.GetSize();
                     if (num_files == 0)
                     {
                         if (!GetDefaultFile (target, file, result))
@@ -469,7 +469,7 @@
                 break;
             case eSetTypeSourceRegexp: // Breakpoint by regexp on source text.
                 {
-                    int num_files = m_options.m_filenames.GetSize();
+                    const size_t num_files = m_options.m_filenames.GetSize();
                     
                     if (num_files == 0)
                     {
@@ -1794,7 +1794,7 @@
             Breakpoint *breakpoint = target->GetBreakpointByID (cur_bp_id.GetBreakpointID()).get();
             if (breakpoint != NULL)
             {
-                int num_locations = breakpoint->GetNumLocations();
+                const size_t num_locations = breakpoint->GetNumLocations();
                 if (cur_bp_id.GetLocationID() > num_locations)
                 {
                     StreamString id_str;
diff --git a/source/Commands/CommandObjectCommands.cpp b/source/Commands/CommandObjectCommands.cpp
index e8937ea..7448a87 100644
--- a/source/Commands/CommandObjectCommands.cpp
+++ b/source/Commands/CommandObjectCommands.cpp
@@ -188,7 +188,7 @@
         return "";
     }
     
-    int
+    virtual int
     HandleArgumentCompletion (Args &input,
                               int &cursor_index,
                               int &cursor_char_position,
@@ -285,7 +285,7 @@
     bool
     DoExecute(Args& command, CommandReturnObject &result)
     {
-        const int argc = command.GetArgumentCount();
+        const size_t argc = command.GetArgumentCount();
         if (argc == 1)
         {
             const char *filename = command.GetArgumentAtIndex(0);
@@ -1289,7 +1289,7 @@
     {
     }
     
-    int
+    virtual int
     HandleArgumentCompletion (Args &input,
                               int &cursor_index,
                               int &cursor_char_position,
diff --git a/source/Commands/CommandObjectExpression.cpp b/source/Commands/CommandObjectExpression.cpp
index abaf4c6..703e135 100644
--- a/source/Commands/CommandObjectExpression.cpp
+++ b/source/Commands/CommandObjectExpression.cpp
@@ -424,7 +424,7 @@
                     const char *error_cstr = result_valobj_sp->GetError().AsCString();
                     if (error_cstr && error_cstr[0])
                     {
-                        int error_cstr_len = strlen (error_cstr);
+                        const size_t error_cstr_len = strlen (error_cstr);
                         const bool ends_with_newline = error_cstr[error_cstr_len - 1] == '\n';
                         if (strstr(error_cstr, "error:") != error_cstr)
                             error_stream->PutCString ("error: ");
diff --git a/source/Commands/CommandObjectFrame.cpp b/source/Commands/CommandObjectFrame.cpp
index f2ff3cf..266753b 100644
--- a/source/Commands/CommandObjectFrame.cpp
+++ b/source/Commands/CommandObjectFrame.cpp
@@ -419,7 +419,7 @@
                 {
                     if (m_option_variable.use_regex)
                     {
-                        const uint32_t regex_start_index = regex_var_list.GetSize();
+                        const size_t regex_start_index = regex_var_list.GetSize();
                         RegularExpression regex (name_cstr);
                         if (regex.Compile(name_cstr))
                         {
@@ -429,7 +429,7 @@
                                                                                                      num_matches);
                             if (num_new_regex_vars > 0)
                             {
-                                for (uint32_t regex_idx = regex_start_index, end_index = regex_var_list.GetSize(); 
+                                for (size_t regex_idx = regex_start_index, end_index = regex_var_list.GetSize();
                                      regex_idx < end_index;
                                      ++regex_idx)
                                 {
@@ -512,10 +512,10 @@
             }
             else // No command arg specified.  Use variable_list, instead.
             {
-                const uint32_t num_variables = variable_list->GetSize();
+                const size_t num_variables = variable_list->GetSize();
                 if (num_variables > 0)
                 {
-                    for (uint32_t i=0; i<num_variables; i++)
+                    for (size_t i=0; i<num_variables; i++)
                     {
                         var_sp = variable_list->GetVariableAtIndex(i);
                         bool dump_variable = true;
diff --git a/source/Commands/CommandObjectHelp.cpp b/source/Commands/CommandObjectHelp.cpp
index 9a50e5c..00e2551 100644
--- a/source/Commands/CommandObjectHelp.cpp
+++ b/source/Commands/CommandObjectHelp.cpp
@@ -64,7 +64,7 @@
 {
     CommandObject::CommandMap::iterator pos;
     CommandObject *cmd_obj;
-    const int argc = command.GetArgumentCount ();
+    const size_t argc = command.GetArgumentCount ();
     
     // 'help' doesn't take any arguments, other than command names.  If argc is 0, we show the user
     // all commands (aliases and user commands if asked for).  Otherwise every argument must be the name of a command or a sub-command.
@@ -224,8 +224,8 @@
         {
             Stream &output_strm = result.GetOutputStream();
             output_strm.Printf("Help requested with ambiguous command name, possible completions:\n");
-            const uint32_t match_count = matches.GetSize();
-            for (uint32_t i = 0; i < match_count; i++)
+            const size_t match_count = matches.GetSize();
+            for (size_t i = 0; i < match_count; i++)
             {
                 output_strm.Printf("\t%s\n", matches.GetStringAtIndex(i));
             }
diff --git a/source/Commands/CommandObjectMemory.cpp b/source/Commands/CommandObjectMemory.cpp
index cbff45c..e77dc11 100644
--- a/source/Commands/CommandObjectMemory.cpp
+++ b/source/Commands/CommandObjectMemory.cpp
@@ -742,10 +742,10 @@
             {
                 if (m_memory_options.m_output_as_binary)
                 {
-                    int bytes_written = outfile_stream.Write (data_sp->GetBytes(), bytes_read);
+                    const size_t bytes_written = outfile_stream.Write (data_sp->GetBytes(), bytes_read);
                     if (bytes_written > 0)
                     {
-                        result.GetOutputStream().Printf ("%i bytes %s to '%s'\n", 
+                        result.GetOutputStream().Printf ("%zi bytes %s to '%s'\n", 
                                                          bytes_written, 
                                                          append ? "appended" : "written", 
                                                          path);
@@ -835,16 +835,16 @@
 
 
         assert (output_stream);
-        uint32_t bytes_dumped = data.Dump (output_stream,
-                                           0,
-                                           m_format_options.GetFormat(),
-                                           item_byte_size,
-                                           item_count,
-                                           num_per_line,
-                                           addr,
-                                           0,
-                                           0,
-                                           exe_scope);
+        size_t bytes_dumped = data.Dump (output_stream,
+                                         0,
+                                         m_format_options.GetFormat(),
+                                         item_byte_size,
+                                         item_count,
+                                         num_per_line,
+                                         addr,
+                                         0,
+                                         0,
+                                         exe_scope);
         m_next_addr = addr + bytes_dumped;
         output_stream->EOL();
         return true;
@@ -1129,9 +1129,8 @@
         uint64_t uval64;
         int64_t sval64;
         bool success = false;
-        const uint32_t num_value_args = command.GetArgumentCount();
-        uint32_t i;
-        for (i=0; i<num_value_args; ++i)
+        const size_t num_value_args = command.GetArgumentCount();
+        for (size_t i=0; i<num_value_args; ++i)
         {
             const char *value_str = command.GetArgumentAtIndex(i);
 
diff --git a/source/Commands/CommandObjectMultiword.cpp b/source/Commands/CommandObjectMultiword.cpp
index d2e2811..aa3a8eb 100644
--- a/source/Commands/CommandObjectMultiword.cpp
+++ b/source/Commands/CommandObjectMultiword.cpp
@@ -143,7 +143,7 @@
                 else
                 {
                     std::string error_msg;
-                    int num_subcmd_matches = matches.GetSize();
+                    const size_t num_subcmd_matches = matches.GetSize();
                     if (num_subcmd_matches > 0)
                         error_msg.assign ("ambiguous command ");
                     else
@@ -158,14 +158,14 @@
                     if (num_subcmd_matches > 0)
                     {
                         error_msg.append (" Possible completions:");
-                        for (int i = 0; i < num_subcmd_matches; i++)
+                        for (size_t i = 0; i < num_subcmd_matches; i++)
                         {
                             error_msg.append ("\n\t");
                             error_msg.append (matches.GetStringAtIndex (i));
                         }
                     }
                     error_msg.append ("\n");
-                    result.AppendRawError (error_msg.c_str(), error_msg.size());
+                    result.AppendRawError (error_msg.c_str());
                     result.SetStatus (eReturnStatusFailed);
                 }
             }
diff --git a/source/Commands/CommandObjectPlatform.cpp b/source/Commands/CommandObjectPlatform.cpp
index cd6a9e2..6bf9c60 100644
--- a/source/Commands/CommandObjectPlatform.cpp
+++ b/source/Commands/CommandObjectPlatform.cpp
@@ -386,7 +386,7 @@
         if (platform_sp)
         {
             Error error;
-            const uint32_t argc = args.GetArgumentCount();
+            const size_t argc = args.GetArgumentCount();
             Target *target = m_exe_ctx.GetTargetPtr();
             Module *exe_module = target->GetExecutableModulePointer();
             if (exe_module)
diff --git a/source/Commands/CommandObjectProcess.cpp b/source/Commands/CommandObjectProcess.cpp
index b63089e..df5d8ff 100644
--- a/source/Commands/CommandObjectProcess.cpp
+++ b/source/Commands/CommandObjectProcess.cpp
@@ -69,7 +69,7 @@
     {
     }
 
-    int
+    virtual int
     HandleArgumentCompletion (Args &input,
                               int &cursor_index,
                               int &cursor_char_position,
@@ -446,10 +446,10 @@
                         match_info.SetNameMatchType(eNameMatchStartsWith);
                     }
                     platform_sp->FindProcesses (match_info, process_infos);
-                    const uint32_t num_matches = process_infos.GetSize();
+                    const size_t num_matches = process_infos.GetSize();
                     if (num_matches > 0)
                     {
-                        for (uint32_t i=0; i<num_matches; ++i)
+                        for (size_t i=0; i<num_matches; ++i)
                         {
                             matches.AppendString (process_infos.GetProcessNameAtIndex(i), 
                                                   process_infos.GetProcessNameLengthAtIndex(i));
@@ -773,12 +773,12 @@
                     StopInfoSP stop_info_sp = sel_thread_sp->GetStopInfo();
                     if (stop_info_sp && stop_info_sp->GetStopReason() == eStopReasonBreakpoint)
                     {
-                        uint64_t bp_site_id = stop_info_sp->GetValue();
+                        lldb::break_id_t bp_site_id = (lldb::break_id_t)stop_info_sp->GetValue();
                         BreakpointSiteSP bp_site_sp(process->GetBreakpointSiteList().FindByID(bp_site_id));
                         if (bp_site_sp)
                         {
-                            uint32_t num_owners = bp_site_sp->GetNumberOfOwners();
-                            for (uint32_t i = 0; i < num_owners; i++)
+                            const size_t num_owners = bp_site_sp->GetNumberOfOwners();
+                            for (size_t i = 0; i < num_owners; i++)
                             {
                                 Breakpoint &bp_ref = bp_site_sp->GetOwnerAtIndex(i)->GetBreakpoint();
                                 if (!bp_ref.IsInternal())
@@ -1134,7 +1134,7 @@
     {
         Process *process = m_exe_ctx.GetProcessPtr();
 
-        const uint32_t argc = command.GetArgumentCount();
+        const size_t argc = command.GetArgumentCount();
         
         for (uint32_t i=0; i<argc; ++i)
         {
@@ -1191,7 +1191,7 @@
     {
         Process *process = m_exe_ctx.GetProcessPtr();
 
-        const uint32_t argc = command.GetArgumentCount();
+        const size_t argc = command.GetArgumentCount();
         
         for (uint32_t i=0; i<argc; ++i)
         {
diff --git a/source/Commands/CommandObjectRegister.cpp b/source/Commands/CommandObjectRegister.cpp
index db1c3af..79a76fb 100644
--- a/source/Commands/CommandObjectRegister.cpp
+++ b/source/Commands/CommandObjectRegister.cpp
@@ -129,7 +129,7 @@
     DumpRegisterSet (const ExecutionContext &exe_ctx,
                      Stream &strm,
                      RegisterContext *reg_ctx,
-                     uint32_t set_idx,
+                     size_t set_idx,
                      bool primitive_only=false)
     {
         uint32_t unavailable_count = 0;
@@ -139,8 +139,8 @@
         {
             strm.Printf ("%s:\n", reg_set->name);
             strm.IndentMore ();
-            const uint32_t num_registers = reg_set->num_registers;
-            for (uint32_t reg_idx = 0; reg_idx < num_registers; ++reg_idx)
+            const size_t num_registers = reg_set->num_registers;
+            for (size_t reg_idx = 0; reg_idx < num_registers; ++reg_idx)
             {
                 const uint32_t reg = reg_set->registers[reg_idx];
                 const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoAtIndex(reg);
@@ -173,20 +173,20 @@
         const RegisterInfo *reg_info = NULL;
         if (command.GetArgumentCount() == 0)
         {
-            uint32_t set_idx;
+            size_t set_idx;
             
-            uint32_t num_register_sets = 1;
-            const uint32_t set_array_size = m_command_options.set_indexes.GetSize();
+            size_t num_register_sets = 1;
+            const size_t set_array_size = m_command_options.set_indexes.GetSize();
             if (set_array_size > 0)
             {
-                for (uint32_t i=0; i<set_array_size; ++i)
+                for (size_t i=0; i<set_array_size; ++i)
                 {
                     set_idx = m_command_options.set_indexes[i]->GetUInt64Value (UINT32_MAX, NULL);
                     if (set_idx != UINT32_MAX)
                     {
                         if (!DumpRegisterSet (m_exe_ctx, strm, reg_ctx, set_idx))
                         {
-                            result.AppendErrorWithFormat ("invalid register set index: %u\n", set_idx);
+                            result.AppendErrorWithFormat ("invalid register set index: %zu\n", set_idx);
                             result.SetStatus (eReturnStatusFailed);
                             break;
                         }
diff --git a/source/Commands/CommandObjectSource.cpp b/source/Commands/CommandObjectSource.cpp
index 576519a..f2a2488 100644
--- a/source/Commands/CommandObjectSource.cpp
+++ b/source/Commands/CommandObjectSource.cpp
@@ -299,7 +299,7 @@
     bool
     DoExecute (Args& command, CommandReturnObject &result)
     {
-        const int argc = command.GetArgumentCount();
+        const size_t argc = command.GetArgumentCount();
 
         if (argc != 0)
         {
@@ -320,10 +320,11 @@
             bool append = true;
             size_t num_matches = 0;
             
-            if (m_options.modules.size() > 0)
+            const size_t num_modules = m_options.modules.size();
+            if (num_modules > 0)
             {
                 ModuleList matching_modules;
-                for (unsigned i = 0, e = m_options.modules.size(); i != e; i++)
+                for (size_t i = 0; i < num_modules; ++i)
                 {
                     FileSpec module_file_spec(m_options.modules[i].c_str(), false);
                     if (module_file_spec)
@@ -423,7 +424,7 @@
             // This is a little hacky, but the first line table entry for a function points to the "{" that 
             // starts the function block.  It would be nice to actually get the function
             // declaration in there too.  So back up a bit, but not further than what you're going to display.
-            size_t lines_to_back_up = m_options.num_lines >= 10 ? 5 : m_options.num_lines/2;
+            uint32_t lines_to_back_up = m_options.num_lines >= 10 ? 5 : m_options.num_lines/2;
             uint32_t line_no;
             if (start_line <= lines_to_back_up)
                 line_no = 1;
@@ -475,8 +476,8 @@
                 // The target isn't loaded yet, we need to lookup the file address
                 // in all modules
                 const ModuleList &module_list = target->GetImages();
-                const uint32_t num_modules = module_list.GetSize();
-                for (uint32_t i=0; i<num_modules; ++i)
+                const size_t num_modules = module_list.GetSize();
+                for (size_t i=0; i<num_modules; ++i)
                 {
                     ModuleSP module_sp (module_list.GetModuleAtIndex(i));
                     if (module_sp && module_sp->ResolveFileAddress(m_options.address, so_addr))
@@ -621,7 +622,7 @@
             if (m_options.modules.size() > 0)
             {
                 ModuleList matching_modules;
-                for (unsigned i = 0, e = m_options.modules.size(); i != e; i++)
+                for (size_t i = 0, e = m_options.modules.size(); i < e; ++i)
                 {
                     FileSpec module_file_spec(m_options.modules[i].c_str(), false);
                     if (module_file_spec)
diff --git a/source/Commands/CommandObjectSyntax.cpp b/source/Commands/CommandObjectSyntax.cpp
index ca1fad2..e08e86f 100644
--- a/source/Commands/CommandObjectSyntax.cpp
+++ b/source/Commands/CommandObjectSyntax.cpp
@@ -59,7 +59,7 @@
 {
     CommandObject::CommandMap::iterator pos;
     CommandObject *cmd_obj;
-    const int argc = command.GetArgumentCount();
+    const size_t argc = command.GetArgumentCount();
 
     if (argc > 0)
     {
diff --git a/source/Commands/CommandObjectTarget.cpp b/source/Commands/CommandObjectTarget.cpp
index badea45..55168ca 100644
--- a/source/Commands/CommandObjectTarget.cpp
+++ b/source/Commands/CommandObjectTarget.cpp
@@ -192,7 +192,7 @@
         return &m_option_group;
     }
 
-    int
+    virtual int
     HandleArgumentCompletion (Args &input,
                               int &cursor_index,
                               int &cursor_char_position,
@@ -220,7 +220,7 @@
     bool
     DoExecute (Args& command, CommandReturnObject &result)
     {
-        const int argc = command.GetArgumentCount();
+        const size_t argc = command.GetArgumentCount();
         FileSpec core_file (m_core_file.GetOptionValue().GetCurrentValue());
 
         if (argc == 1 || core_file)
@@ -697,9 +697,9 @@
     }
     
     
-    static uint32_t GetVariableCallback (void *baton, 
-                                         const char *name,
-                                         VariableList &variable_list)
+    static size_t GetVariableCallback (void *baton,
+                                       const char *name,
+                                       VariableList &variable_list)
     {
         Target *target = static_cast<Target *>(baton);
         if (target)
@@ -782,7 +782,7 @@
                 ValueObjectList valobj_list;
 
                 const char *arg = args.GetArgumentAtIndex(idx);
-                uint32_t matches = 0;
+                size_t matches = 0;
                 bool use_var_name = false;
                 if (m_option_variable.use_regex)
                 {
@@ -1019,7 +1019,7 @@
         Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
         if (target)
         {
-            uint32_t argc = command.GetArgumentCount();
+            const size_t argc = command.GetArgumentCount();
             if (argc & 1)
             {
                 result.AppendError ("add requires an even number of arguments\n");
@@ -1027,7 +1027,7 @@
             }
             else
             {
-                for (uint32_t i=0; i<argc; i+=2)
+                for (size_t i=0; i<argc; i+=2)
                 {
                     const char *from = command.GetArgumentAtIndex(i);
                     const char *to = command.GetArgumentAtIndex(i+1);
@@ -1156,7 +1156,7 @@
         Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
         if (target)
         {
-            uint32_t argc = command.GetArgumentCount();
+            size_t argc = command.GetArgumentCount();
             // check for at least 3 arguments and an odd nubmer of parameters
             if (argc >= 3 && argc & 1)
             {
@@ -1670,7 +1670,7 @@
     strm.IndentLess ();
 }
 
-static uint32_t
+static size_t
 LookupFunctionInModule (CommandInterpreter &interpreter,
                         Stream &strm,
                         Module *module,
@@ -1684,7 +1684,7 @@
     {
         SymbolContextList sc_list;
         const bool append = true;
-        uint32_t num_matches = 0;
+        size_t num_matches = 0;
         if (name_is_regex)
         {
             RegularExpression function_name_regex (name);
@@ -1709,7 +1709,7 @@
         if (num_matches)
         {
             strm.Indent ();
-            strm.Printf("%u match%s found in ", num_matches, num_matches > 1 ? "es" : "");
+            strm.Printf("%zu match%s found in ", num_matches, num_matches > 1 ? "es" : "");
             DumpFullpath (strm, &module->GetFileSpec(), 0);
             strm.PutCString(":\n");
             DumpSymbolContextList (interpreter.GetExecutionContext().GetBestExecutionContextScope(), strm, sc_list, verbose);
@@ -1719,7 +1719,7 @@
     return 0;
 }
 
-static uint32_t
+static size_t
 LookupTypeInModule (CommandInterpreter &interpreter,
                     Stream &strm, 
                     Module *module, 
@@ -1730,7 +1730,7 @@
     {
         TypeList type_list;
         const uint32_t max_num_matches = UINT32_MAX;
-        uint32_t num_matches = 0;
+        size_t num_matches = 0;
         bool name_is_fully_qualified = false;
         SymbolContext sc;
 
@@ -1740,7 +1740,7 @@
         if (num_matches)
         {
             strm.Indent ();
-            strm.Printf("%u match%s found in ", num_matches, num_matches > 1 ? "es" : "");
+            strm.Printf("%zu match%s found in ", num_matches, num_matches > 1 ? "es" : "");
             DumpFullpath (strm, &module->GetFileSpec(), 0);
             strm.PutCString(":\n");
             const uint32_t num_types = type_list.GetSize();
@@ -1774,7 +1774,7 @@
     return 0;
 }
 
-static uint32_t
+static size_t
 LookupTypeHere (CommandInterpreter &interpreter,
                 Stream &strm,
                 const SymbolContext &sym_ctx,
@@ -1786,7 +1786,7 @@
     
     TypeList type_list;
     const uint32_t max_num_matches = UINT32_MAX;
-    uint32_t num_matches = 1;
+    size_t num_matches = 1;
     bool name_is_fully_qualified = false;
     
     ConstString name(name_cstr);
@@ -1873,9 +1873,9 @@
     {
         // Check the global list
         Mutex::Locker locker(Module::GetAllocationModuleCollectionMutex());
-        const uint32_t num_modules = Module::GetNumberAllocatedModules();
+        const size_t num_modules = Module::GetNumberAllocatedModules();
         ModuleSP module_sp;
-        for (uint32_t image_idx = 0; image_idx<num_modules; ++image_idx)
+        for (size_t image_idx = 0; image_idx<num_modules; ++image_idx)
         {
             Module *module = Module::GetAllocatedModuleAtIndex(image_idx);
             
@@ -2145,11 +2145,11 @@
             {
                 // Dump all sections for all modules images
                 Mutex::Locker modules_locker(target->GetImages().GetMutex());
-                const uint32_t num_modules = target->GetImages().GetSize();
+                const size_t num_modules = target->GetImages().GetSize();
                 if (num_modules > 0)
                 {
-                    result.GetOutputStream().Printf("Dumping symbol table for %u modules.\n", num_modules);
-                    for (uint32_t image_idx = 0;  image_idx<num_modules; ++image_idx)
+                    result.GetOutputStream().Printf("Dumping symbol table for %zu modules.\n", num_modules);
+                    for (size_t image_idx = 0; image_idx<num_modules; ++image_idx)
                     {
                         if (num_dumped > 0)
                         {
@@ -2278,11 +2278,11 @@
             if (command.GetArgumentCount() == 0)
             {
                 // Dump all sections for all modules images
-                const uint32_t num_modules = target->GetImages().GetSize();
+                const size_t num_modules = target->GetImages().GetSize();
                 if (num_modules > 0)
                 {
-                    result.GetOutputStream().Printf("Dumping sections for %u modules.\n", num_modules);
-                    for (uint32_t image_idx = 0;  image_idx<num_modules; ++image_idx)
+                    result.GetOutputStream().Printf("Dumping sections for %zu modules.\n", num_modules);
+                    for (size_t image_idx = 0;  image_idx<num_modules; ++image_idx)
                     {
                         num_dumped++;
                         DumpModuleSections (m_interpreter, result.GetOutputStream(), target->GetImages().GetModulePointerAtIndex(image_idx));
@@ -2386,10 +2386,10 @@
                 // Dump all sections for all modules images
                 const ModuleList &target_modules = target->GetImages();
                 Mutex::Locker modules_locker (target_modules.GetMutex());
-                const uint32_t num_modules = target_modules.GetSize();
+                const size_t num_modules = target_modules.GetSize();
                 if (num_modules > 0)
                 {
-                    result.GetOutputStream().Printf("Dumping debug symbols for %u modules.\n", num_modules);
+                    result.GetOutputStream().Printf("Dumping debug symbols for %zu modules.\n", num_modules);
                     for (uint32_t image_idx = 0;  image_idx<num_modules; ++image_idx)
                     {
                         if (DumpModuleSymbolVendor (result.GetOutputStream(), target_modules.GetModulePointerAtIndexUnlocked(image_idx)))
@@ -2491,7 +2491,7 @@
                 
                 const ModuleList &target_modules = target->GetImages();
                 Mutex::Locker modules_locker(target_modules.GetMutex());
-                const uint32_t num_modules = target_modules.GetSize();
+                const size_t num_modules = target_modules.GetSize();
                 if (num_modules > 0)
                 {
                     uint32_t num_dumped = 0;
@@ -2582,7 +2582,7 @@
         return &m_option_group;
     }
     
-    int
+    virtual int
     HandleArgumentCompletion (Args &input,
                               int &cursor_index,
                               int &cursor_char_position,
@@ -3037,7 +3037,7 @@
             }
             else
             {
-                uint32_t width = 0;
+                unsigned long width = 0;
                 if (option_arg)
                     width = strtoul (option_arg, NULL, 0);
                 m_format_array.push_back(std::make_pair(short_option, width));
@@ -3129,7 +3129,7 @@
                         ModuleSP module_sp (module_address.GetModule());
                         if (module_sp)
                         {
-                            PrintModule (target, module_sp.get(), UINT32_MAX, 0, strm);
+                            PrintModule (target, module_sp.get(), 0, strm);
                             result.SetStatus (eReturnStatusSuccessFinishResult);
                         }
                         else
@@ -3152,7 +3152,7 @@
                 return result.Succeeded();
             }
             
-            uint32_t num_modules = 0;
+            size_t num_modules = 0;
             Mutex::Locker locker;      // This locker will be locked on the mutex in module_list_ptr if it is non-NULL.
                                        // Otherwise it will lock the AllocationModuleCollectionMutex when accessing
                                        // the global module list directly.
@@ -3214,8 +3214,8 @@
                         module_sp = module->shared_from_this();
                     }
                     
-                    int indent = strm.Printf("[%3u] ", image_idx);
-                    PrintModule (target, module, image_idx, indent, strm);
+                    const size_t indent = strm.Printf("[%3u] ", image_idx);
+                    PrintModule (target, module, indent, strm);
 
                 }
                 result.SetStatus (eReturnStatusSuccessFinishResult);
@@ -3244,7 +3244,7 @@
     }
 
     void
-    PrintModule (Target *target, Module *module, uint32_t idx, int indent, Stream &strm)
+    PrintModule (Target *target, Module *module, int indent, Stream &strm)
     {
 
         if (module == NULL)
@@ -3338,7 +3338,7 @@
                     break;
                 case 'r':
                     {
-                        uint32_t ref_count = 0;
+                        size_t ref_count = 0;
                         ModuleSP module_sp (module->shared_from_this());
                         if (module_sp)
                         {
@@ -3346,9 +3346,9 @@
                             ref_count = module_sp.use_count() - 1;
                         }
                         if (width)
-                            strm.Printf("{%*u}", width, ref_count);
+                            strm.Printf("{%*zu}", width, ref_count);
                         else
-                            strm.Printf("{%u}", ref_count);
+                            strm.Printf("{%zu}", ref_count);
                     }
                     break;
 
@@ -3581,7 +3581,7 @@
         if (m_options.m_type == eLookupTypeFunctionOrSymbol)
         {
             SymbolContextList sc_list;
-            uint32_t num_matches;
+            size_t num_matches;
             ConstString function_name (m_options.m_str.c_str());
             num_matches = target->GetImages().FindFunctions (function_name, eFunctionNameTypeAuto, true, false, true, sc_list);
             for (uint32_t idx = 0; idx < num_matches; idx++)
@@ -4038,7 +4038,7 @@
                 
                 const ModuleList &target_modules = target->GetImages();
                 Mutex::Locker modules_locker(target_modules.GetMutex());
-                const uint32_t num_modules = target_modules.GetSize();
+                const size_t num_modules = target_modules.GetSize();
                 if (num_modules > 0)
                 {
                     for (i = 0; i<num_modules && syntax_error == false; ++i)
@@ -4217,7 +4217,7 @@
     {
     }
     
-    int
+    virtual int
     HandleArgumentCompletion (Args &input,
                               int &cursor_index,
                               int &cursor_char_position,
diff --git a/source/Commands/CommandObjectThread.cpp b/source/Commands/CommandObjectThread.cpp
index 8a978d3..9b48e16 100644
--- a/source/Commands/CommandObjectThread.cpp
+++ b/source/Commands/CommandObjectThread.cpp
@@ -205,12 +205,12 @@
         }
         else
         {
-            uint32_t num_args = command.GetArgumentCount();
+            const size_t num_args = command.GetArgumentCount();
             Process *process = m_exe_ctx.GetProcessPtr();
             Mutex::Locker locker (process->GetThreadList().GetMutex());
             std::vector<ThreadSP> thread_sps;
 
-            for (uint32_t i = 0; i < num_args; i++)
+            for (size_t i = 0; i < num_args; i++)
             {
                 bool success;
                 
diff --git a/source/Commands/CommandObjectWatchpoint.cpp b/source/Commands/CommandObjectWatchpoint.cpp
index f4d3c13..f7b8c4f 100644
--- a/source/Commands/CommandObjectWatchpoint.cpp
+++ b/source/Commands/CommandObjectWatchpoint.cpp
@@ -975,9 +975,9 @@
     }
 
 protected:
-    static uint32_t GetVariableCallback (void *baton,
-                                         const char *name,
-                                         VariableList &variable_list)
+    static size_t GetVariableCallback (void *baton,
+                                       const char *name,
+                                       VariableList &variable_list)
     {
         Target *target = static_cast<Target *>(baton);
         if (target)