[Lldb-commits] [lldb] Fix a crash from character type confusion interaction with libedit (PR #75388)

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Wed Dec 13 14:17:36 PST 2023


================
@@ -978,8 +978,14 @@ void Editline::DisplayCompletions(
       break;
 
     fprintf(editline.m_output_file, "More (Y/n/a): ");
-    char reply = 'n';
-    int got_char = el_getc(editline.m_editline, &reply);
+    // The type for the output and the type for the parameter are different,
+    // to allow interoperability with older versions of libedit. The container
+    // for the reply must be as wide as what our implementation is using,
+    // but libedit may use a narrower type depending on the build
+    // configuration.
+    EditLineGetCharType reply = L'n';
+    int got_char = el_wgetc(editline.m_editline,
----------------
bulbazord wrote:

Why does this use `el_wgetc` instead of us switching based on `LLDB_EDITLINE_USE_WCHAR`? I'm not too familiar with editline, but it seems strange to me that we would use `el_wgetc` even if there's no `wchar_t` support.

https://github.com/llvm/llvm-project/pull/75388


More information about the lldb-commits mailing list