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

2019-11-28 Thread Alexandre Ganea via Phabricator via lldb-commits
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


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
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2019-11-22 Thread Reid Kleckner via Phabricator via lldb-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70442



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2019-11-19 Thread Alexandre Ganea via Phabricator via lldb-commits
aganea created this revision.
aganea added reviewers: asmith, aleksandr.urakov.
aganea added a project: LLDB.
Herald added a subscriber: lldb-commits.

This is a follow-up on D53092 , and fixes the 
test below on non-English locales (below, on a French locale):

  [ RUN  ] StatusTest.ErrorWin32
  F:\llvm-project\lldb\unittests\Utility\StatusTest.cpp(67): error:   
Expected: "Access is denied. "
  To be equal to: s.AsCString()
Which is: "Acc\xE8s refus\xE9. "
  F:\llvm-project\lldb\unittests\Utility\StatusTest.cpp(70): error:   
Expected: "Negotiation timed out "
  To be equal to: s.AsCString()
Which is: "Le d\xE9lai d\x92" "attente a expir\xE9 pour la 
n\xE9gociation "
  [  FAILED  ] StatusTest.ErrorWin32 (2 ms)


Repository:
  rG LLVM Github Monorepo

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


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
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits