diff --git a/lldb.spec b/lldb.spec index 227568f..0cff096 100644 --- a/lldb.spec +++ b/lldb.spec @@ -1,6 +1,6 @@ Name: lldb Version: 4.0.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Next generation high-performance debugger License: NCSA @@ -10,6 +10,8 @@ Source0: http://llvm.org/releases/%{version}/%{name}-%{version}.src.tar.xz ExclusiveArch: %{arm} aarch64 %{ix86} x86_64 # Patch to remove use of private llvm headers Patch0: 0001-Fix-build-with-gcc-7.patch +# lldb: libedit produces garbled, unusable input on Linux +Patch1: r303907-libedit.patch BuildRequires: cmake BuildRequires: llvm-devel = %{version} @@ -20,6 +22,7 @@ BuildRequires: llvm-static = %{version} BuildRequires: libffi-devel BuildRequires: zlib-devel BuildRequires: libxml2-devel +BuildRequires: libedit-devel Requires: llvm-libs = %{version} Requires: clang-libs = %{version} @@ -49,6 +52,7 @@ The package contains the LLDB Python module. %setup -q -n %{name}-%{version}.src %patch0 -p1 +%patch1 -p1 # HACK so that lldb can find its custom readline.so, because we move it # after install. @@ -75,7 +79,7 @@ CXXFLAGS="%{optflags} -Wno-error=format-security" -DLLDB_PATH_TO_CLANG_BUILD=%{_prefix} \ \ -DLLDB_DISABLE_CURSES:BOOL=OFF \ - -DLLDB_DISABLE_LIBEDIT:BOOL=ON \ + -DLLDB_DISABLE_LIBEDIT:BOOL=OFF \ -DLLDB_DISABLE_PYTHON:BOOL=OFF \ %if 0%{?__isa_bits} == 64 -DLLVM_LIBDIR_SUFFIX=64 \ @@ -119,6 +123,10 @@ rm -f %{buildroot}%{python_sitearch}/six.* %{python_sitearch}/lldb %changelog +* Mon Jul 31 2017 Jan Kratochvil - 4.0.1-3 +- Backport lldb r303907 + Resolves rhbz #1356140 + * Wed Jul 26 2017 Fedora Release Engineering - 4.0.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild diff --git a/r303907-libedit.patch b/r303907-libedit.patch new file mode 100644 index 0000000..942c425 --- /dev/null +++ b/r303907-libedit.patch @@ -0,0 +1,92 @@ +commit 9ad9480c3a380a04b3dbe869c0675d6bba37247b +Author: Kamil Rytarowski +Date: Thu May 25 20:12:30 2017 +0000 + + Fix bug #28898 + lldb: libedit produces garbled, unusable input on Linux + + Apply patch from Christos Zoulas, upstream libedit developer. + It has been tested on NetBSD/amd64. + + New code supports combination of wide libedit and disabled + LLDB_EDITLINE_USE_WCHAR, which was the popular case on Linux + systems. + + + git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@303907 91177308-0d34-0410-b5e6-96231b3b80d8 + +diff --git a/include/lldb/Host/Editline.h b/include/lldb/Host/Editline.h +index 2b1a8e0..0b75e9c 100644 +--- a/include/lldb/Host/Editline.h ++++ b/include/lldb/Host/Editline.h +@@ -82,8 +82,14 @@ using EditLineStringStreamType = std::stringstream; + using EditLineCharType = char; + #endif + ++#ifdef EL_CLIENTDATA /* editline with wide support + wide char read function */ ++using EditLineGetCharType = wchar_t; ++#else ++using EditLineGetCharType = char; ++#endif ++ + typedef int (*EditlineGetCharCallbackType)(::EditLine *editline, +- EditLineCharType *c); ++ EditLineGetCharType *c); + typedef unsigned char (*EditlineCommandCallbackType)(::EditLine *editline, + int ch); + typedef const char *(*EditlinePromptCallbackType)(::EditLine *editline); +@@ -270,7 +276,7 @@ private: + + /// Character reading implementation for EditLine that supports our multi-line + /// editing trickery. +- int GetCharacter(EditLineCharType *c); ++ int GetCharacter(EditLineGetCharType *c); + + /// Prompt implementation for EditLine. + const char *Prompt(); +@@ -323,7 +329,7 @@ private: + /// single or multi-line editing. + void ConfigureEditor(bool multiline); + +- bool CompleteCharacter(char ch, EditLineCharType &out); ++ bool CompleteCharacter(char ch, EditLineGetCharType &out); + + private: + #if LLDB_EDITLINE_USE_WCHAR +diff --git a/source/Host/common/Editline.cpp b/source/Host/common/Editline.cpp +index 7d4b398..7b580dd 100644 +--- a/source/Host/common/Editline.cpp ++++ b/source/Host/common/Editline.cpp +@@ -474,7 +474,7 @@ unsigned char Editline::RecallHistory(bool earlier) { + return CC_NEWLINE; + } + +-int Editline::GetCharacter(EditLineCharType *c) { ++int Editline::GetCharacter(EditLineGetCharType *c) { + const LineInfoW *info = el_wline(m_editline); + + // Paint a faint version of the desired prompt over the version libedit draws +@@ -969,7 +969,7 @@ void Editline::ConfigureEditor(bool multiline) { + })); + + el_wset(m_editline, EL_GETCFN, (EditlineGetCharCallbackType)([]( +- EditLine *editline, EditLineCharType *c) { ++ EditLine *editline, EditLineGetCharType *c) { + return Editline::InstanceFor(editline)->GetCharacter(c); + })); + +@@ -1360,12 +1360,12 @@ void Editline::PrintAsync(Stream *stream, const char *s, size_t len) { + } + } + +-bool Editline::CompleteCharacter(char ch, EditLineCharType &out) { ++bool Editline::CompleteCharacter(char ch, EditLineGetCharType &out) { + #if !LLDB_EDITLINE_USE_WCHAR + if (ch == (char)EOF) + return false; + +- out = ch; ++ out = (unsigned char)ch; + return true; + #else + std::codecvt_utf8 cvt;