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

Kevin Frei via lldb-commits lldb-commits at lists.llvm.org
Wed Dec 13 16:33:48 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,
----------------
kevinfrei wrote:

Just realized I didn't point you at the code to answer your simple question: At the top of EditLine.cpp, all the el_w* functions are #defined to el_* functions if you're build without LLDB_EDITLINE_USE_WCHAR

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


More information about the lldb-commits mailing list