[Lldb-commits] [lldb] r233569 - Work around lack of %zd printf format specifier in MSVC libs.

Adrian McCarthy amccarth at google.com
Mon Mar 30 10:46:36 PDT 2015


Author: amccarth
Date: Mon Mar 30 12:46:36 2015
New Revision: 233569

URL: http://llvm.org/viewvc/llvm-project?rev=233569&view=rev
Log:
Work around lack of %zd printf format specifier in MSVC libs.

Modified:
    lldb/trunk/source/Breakpoint/Breakpoint.cpp
    lldb/trunk/source/Core/SearchFilter.cpp
    lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
    lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
    lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
    lldb/trunk/tools/driver/Driver.cpp

Modified: lldb/trunk/source/Breakpoint/Breakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Breakpoint.cpp?rev=233569&r1=233568&r2=233569&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/Breakpoint.cpp (original)
+++ lldb/trunk/source/Breakpoint/Breakpoint.cpp Mon Mar 30 12:46:36 2015
@@ -876,25 +876,18 @@ Breakpoint::GetDescription (Stream *s, l
         {
             s->Printf ("no locations (pending).");
         }
-        else if (num_locations == 1)
+        else if (num_locations == 1 && show_locations == false)
         {
-            // If there is one location only, we'll just print that location information.  But don't do this if
-            // show locations is true, then that will be handled below.
-            if (show_locations == false)
-            {
-                GetLocationAtIndex(0)->GetDescription(s, level);
-            }
-            else
-            {
-                s->Printf ("%zd locations.", num_locations);
-            }
+            // There is only one location, so we'll just print that location information.
+            GetLocationAtIndex(0)->GetDescription(s, level);
         }
         else
         {
-            s->Printf ("%zd locations.", num_locations);
+            s->Printf ("%" PRIu64 " locations.", static_cast<uint64_t>(num_locations));
         }
         s->EOL();
         break;
+
     case lldb::eDescriptionLevelVerbose:
         // Verbose mode does a debug dump of the breakpoint
         Dump (s);

Modified: lldb/trunk/source/Core/SearchFilter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/SearchFilter.cpp?rev=233569&r1=233568&r2=233569&view=diff
==============================================================================
--- lldb/trunk/source/Core/SearchFilter.cpp (original)
+++ lldb/trunk/source/Core/SearchFilter.cpp Mon Mar 30 12:46:36 2015
@@ -816,7 +816,7 @@ SearchFilterByModuleListAndCU::GetDescri
     }
     else if (num_modules > 0)
     {
-        s->Printf (", modules(%zd) = ", num_modules);
+        s->Printf (", modules(%" PRIu64 ") = ", static_cast<uint64_t>(num_modules));
         for (size_t i = 0; i < num_modules; i++)
         {
             if (s->GetVerbose())

Modified: lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp?rev=233569&r1=233568&r2=233569&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp Mon Mar 30 12:46:36 2015
@@ -250,7 +250,7 @@ ABISysV_ppc::PrepareTrivialCall (Thread
                     (uint64_t)return_addr);
 
         for (size_t i = 0; i < args.size(); ++i)
-            s.Printf (", arg%zd = 0x%" PRIx64, i + 1, args[i]);
+            s.Printf (", arg%" PRIu64 " = 0x%" PRIx64, static_cast<uint64_t>(i + 1), args[i]);
         s.PutCString (")");
         log->PutCString(s.GetString().c_str());
     }
@@ -268,7 +268,7 @@ ABISysV_ppc::PrepareTrivialCall (Thread
     {
         reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG1 + i);
         if (log)
-            log->Printf("About to write arg%zd (0x%" PRIx64 ") into %s", i + 1, args[i], reg_info->name);
+            log->Printf("About to write arg%" PRIu64 " (0x%" PRIx64 ") into %s", static_cast<uint64_t>(i + 1), args[i], reg_info->name);
         if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, args[i]))
             return false;
     }

Modified: lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp?rev=233569&r1=233568&r2=233569&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp Mon Mar 30 12:46:36 2015
@@ -250,7 +250,7 @@ ABISysV_ppc64::PrepareTrivialCall (Threa
                     (uint64_t)return_addr);
 
         for (size_t i = 0; i < args.size(); ++i)
-            s.Printf (", arg%zd = 0x%" PRIx64, i + 1, args[i]);
+            s.Printf (", arg%" PRIu64 " = 0x%" PRIx64, static_cast<uint64_t>(i + 1), args[i]);
         s.PutCString (")");
         log->PutCString(s.GetString().c_str());
     }
@@ -268,7 +268,7 @@ ABISysV_ppc64::PrepareTrivialCall (Threa
     {
         reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG1 + i);
         if (log)
-            log->Printf("About to write arg%zd (0x%" PRIx64 ") into %s", i + 1, args[i], reg_info->name);
+            log->Printf("About to write arg%" PRIu64 " (0x%" PRIx64 ") into %s", static_cast<uint64_t>(i + 1), args[i], reg_info->name);
         if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, args[i]))
             return false;
     }

Modified: lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp?rev=233569&r1=233568&r2=233569&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp Mon Mar 30 12:46:36 2015
@@ -318,7 +318,7 @@ ABISysV_x86_64::PrepareTrivialCall (Thre
                     (uint64_t)return_addr);
 
         for (size_t i = 0; i < args.size(); ++i)
-            s.Printf (", arg%zd = 0x%" PRIx64, i + 1, args[i]);
+            s.Printf (", arg%" PRIu64 " = 0x%" PRIx64, static_cast<uint64_t>(i + 1), args[i]);
         s.PutCString (")");
         log->PutCString(s.GetString().c_str());
     }
@@ -336,7 +336,7 @@ ABISysV_x86_64::PrepareTrivialCall (Thre
     {
         reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG1 + i);
         if (log)
-            log->Printf("About to write arg%zd (0x%" PRIx64 ") into %s", i + 1, args[i], reg_info->name);
+            log->Printf("About to write arg%" PRIu64 " (0x%" PRIx64 ") into %s", static_cast<uint64_t>(i + 1), args[i], reg_info->name);
         if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, args[i]))
             return false;
     }

Modified: lldb/trunk/tools/driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=233569&r1=233568&r2=233569&view=diff
==============================================================================
--- lldb/trunk/tools/driver/Driver.cpp (original)
+++ lldb/trunk/tools/driver/Driver.cpp Mon Mar 30 12:46:36 2015
@@ -882,9 +882,9 @@ PrepareCommandsForSourcing (const char *
         ssize_t nrwr = write(fds[WRITE], commands_data, commands_size);
         if (nrwr < 0)
         {
-            fprintf(stderr, "error: write(%i, %p, %zd) failed (errno = %i) "
+            fprintf(stderr, "error: write(%i, %p, %" PRIu64 ") failed (errno = %i) "
                             "when trying to open LLDB commands pipe\n",
-                    fds[WRITE], commands_data, commands_size, errno);
+                    fds[WRITE], commands_data, static_cast<uint64_t>(commands_size), errno);
             success = false;
         }
         else if (static_cast<size_t>(nrwr) == commands_size)





More information about the lldb-commits mailing list