[Lldb-commits] [PATCH] D70442: [LLDB] Force message formatting to English

Alexandre Ganea via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 28 11:24:39 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rGbdad3ec75ab3: [LLDB] On Windows, force error message formatting to English (authored by aganea).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70442/new/

https://reviews.llvm.org/D70442

Files:
  lldb/source/Utility/Status.cpp


Index: lldb/source/Utility/Status.cpp
===================================================================
--- lldb/source/Utility/Status.cpp
+++ lldb/source/Utility/Status.cpp
@@ -100,14 +100,23 @@
   char *buffer = nullptr;
   std::string message;
   // Retrieve win32 system error.
+  // First, attempt to load a en-US message
   if (::FormatMessageA(
           FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
               FORMAT_MESSAGE_MAX_WIDTH_MASK,
-          NULL, error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+          NULL, error_code, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
           (LPSTR)&buffer, 0, NULL)) {
     message.assign(buffer);
     ::LocalFree(buffer);
   }
+  // If the previous didn't work, use the default OS language
+  else if (::FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+                                FORMAT_MESSAGE_FROM_SYSTEM |
+                                FORMAT_MESSAGE_MAX_WIDTH_MASK,
+                            NULL, error_code, 0, (LPSTR)&buffer, 0, NULL)) {
+    message.assign(buffer);
+    ::LocalFree(buffer);
+  }
   return message;
 }
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70442.231459.patch
Type: text/x-patch
Size: 1138 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191128/027ebc2c/attachment-0001.bin>


More information about the lldb-commits mailing list