[Bug 49845] New: LLDB crash when hitting up arrow in expression evaluator

Bug ID 49845
Summary LLDB crash when hitting up arrow in expression evaluator
Product lldb
Version unspecified
Hardware PC
OS Linux
Status NEW
Severity enhancement
Priority P
Component All Bugs
Assignee lldb-dev@lists.llvm.org
Reporter rupprecht@google.com
CC jdevlieghere@apple.com, llvm-bugs@lists.llvm.org

This is at trunk. When you are prompted to enter expressions:

$ lldb
(lldb) e
Enter expressions, then terminate with an empty line to evaluate:
  1:  

... and then you hit the up arrow, it crashes (usually*):

$ lldb
(lldb) e
Enter expressions, then terminate with an empty line to evaluate:
PLEASE submit a bug report to [https://bugs.llvm.org/](https://bugs.llvm.org/) and include the crash
backtrace.
Stack dump:
0.      Program arguments: lldb
 #0 0x00000000003b337a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
/home/rupprecht/src/llvm-project/llvm/lib/Support/Unix/Signals.inc:565:11
 #1 0x00000000003b354b PrintStackTraceSignalHandler(void*)
/home/rupprecht/src/llvm-project/llvm/lib/Support/Unix/Signals.inc:632:1
 #2 0x00000000003b1b5b llvm::sys::RunSignalHandlers()
/home/rupprecht/src/llvm-project/llvm/lib/Support/Signals.cpp:70:5
 #3 0x00000000003b3ca1 SignalHandler(int)
/home/rupprecht/src/llvm-project/llvm/lib/Support/Unix/Signals.inc:407:1
 #4 0x00007fba26d9d140 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x14140)
 #5 0x00007fba178fd6f0 std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >::length() const
(/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0x1496f0)
 #6 0x00007fba1e3dc9ff
lldb_private::Editline::CountRowsForLine(std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> > const&)
/home/rupprecht/src/llvm-project/lldb/source/Host/common/Editline.cpp:434:53
 #7 0x00007fba1e3dc90c
lldb_private::Editline::GetLineIndexForLocation(lldb_private::line_editor::CursorLocation,
int)
/home/rupprecht/src/llvm-project/lldb/source/Host/common/Editline.cpp:370:12
 #8 0x00007fba1e3dcab7
lldb_private::Editline::MoveCursor(lldb_private::line_editor::CursorLocation,
lldb_private::line_editor::CursorLocation)
/home/rupprecht/src/llvm-project/lldb/source/Host/common/Editline.cpp:392:7
 #9 0x00007fba1e3dd3ac
lldb_private::Editline::RecallHistory(lldb_private::line_editor::HistoryOperation)
/home/rupprecht/src/llvm-project/lldb/source/Host/common/Editline.cpp:528:3
#10 0x00007fba1e3de5fe lldb_private::Editline::PreviousLineCommand(int)
/home/rupprecht/src/llvm-project/lldb/source/Host/common/Editline.cpp:779:5
#11 0x00007fba1e3e2237
lldb_private::Editline::ConfigureEditor(bool)::$_7::operator()(editline*, int)
const
/home/rupprecht/src/llvm-project/lldb/source/Host/common/Editline.cpp:1162:13
#12 0x00007fba1e3e21fb
lldb_private::Editline::ConfigureEditor(bool)::$_7::__invoke(editline*, int)
/home/rupprecht/src/llvm-project/lldb/source/Host/common/Editline.cpp:1161:41
#13 0x00007fba16e47fc4 el_wgets
(/usr/lib/x86_64-linux-gnu/libedit.so.2+0x10fc4)
#14 0x00007fba1e3e1a78 lldb_private::Editline::GetLines(int,
lldb_private::StringList&, bool&)
/home/rupprecht/src/llvm-project/lldb/source/Host/common/Editline.cpp:1514:3
#15 0x00007fba1e2e05a9
lldb_private::IOHandlerEditline::GetLines(lldb_private::StringList&, bool&)
/home/rupprecht/src/llvm-project/lldb/source/Core/IOHandler.cpp:520:5
#16 0x00007fba1e2e07dd lldb_private::IOHandlerEditline::Run()
/home/rupprecht/src/llvm-project/lldb/source/Core/IOHandler.cpp:562:11
#17 0x00007fba1e2a071d lldb_private::Debugger::RunIOHandlers()
/home/rupprecht/src/llvm-project/lldb/source/Core/Debugger.cpp:868:16
#18 0x00007fba1e424985
lldb_private::CommandInterpreter::RunCommandInterpreter(lldb_private::CommandInterpreterRunOptions&)
/home/rupprecht/src/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp:3089:9
#19 0x00007fba1dbf629d lldb::SBDebugger::RunCommandInterpreter(bool, bool)
/home/rupprecht/src/llvm-project/lldb/source/API/SBDebugger.cpp:1214:42
#20 0x0000000000295ada Driver::MainLoop()
/home/rupprecht/src/llvm-project/lldb/tools/driver/Driver.cpp:677:3
#21 0x0000000000296d1e main
/home/rupprecht/src/llvm-project/lldb/tools/driver/Driver.cpp:940:17

(note the "1:" prompt line got eaten)

* The first time I tried to run it, it didn't crash, but it gave me bogus
history results. I guess it happened to venture into junk memory without
triggering a segfault.

Jordan Rupprecht changed bug 49845

What | Removed | Added |

  • | - | - |
    Status | CONFIRMED | RESOLVED |
    Resolution | — | FIXED |
    Fixed By Commit(s) | | f49a4440d38a4123b01ded6493a02b4cbf038928 |

Comment # 3 on bug 49845 from Jordan Rupprecht

Forgot to close this. And thanks for suggesting the fix!