Issue 177570
Summary "help breakpoint set" crashes lldb if the terminal is exactly 105 columns wide
Labels lldb
Assignees
Reporter DavidSpickett
    LLDB built from main 4e51f9044f17a00f5c6c0f5b2abf1fdb9b8d9eeb. Using Ubuntu Ubuntu 22.04.5 LTS's default terminal.

When the width is exactly 105 columns, this crashes:
```
$ ./bin/lldb -o "help breakpoint set"
(lldb) help breakpoint set
lldb: /home/davspi01/llvm-project/lldb/source/Interpreter/Options.cpp:320: void lldb_private::Options::Ou
tputFormattedUsageText(lldb_private::Stream &, const lldb_private::OptionDefinition &, uint32_t, bool): A
ssertion `start < final_end' failed.
LLDB diagnostics will be written to /tmp/diagnostics-afa476
Please include the directory content when filing a bug report
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrac
e.
Stack dump:
0.	Program arguments: ./bin/lldb -o "help breakpoint set"
 #0 0x0000bc5c233e43ac llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (./bin/lldb+0x743ac)
 #1 0x0000bc5c233e21fc llvm::sys::RunSignalHandlers() (./bin/lldb+0x721fc)
 #2 0x0000bc5c233e5170 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x0000f47b7d49f8f8 (linux-vdso.so.1+0x8f8)
 #4 0x0000f47b71405b68 syscall ./misc/../sysdeps/unix/sysv/linux/aarch64/syscall.S:39:0
 #5 0x0000f47b77e373ec SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #6 0x0000f47b7d49f8f8 (linux-vdso.so.1+0x8f8)
 #7 0x0000f47b713a2008 __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #8 0x0000f47b7135a83c gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #9 0x0000f47b71347134 abort ./stdlib/abort.c:81:7
#10 0x0000f47b71354114 __assert_fail_base ./assert/assert.c:91:7
#11 0x0000f47b7135418c (/lib/aarch64-linux-gnu/libc.so.6+0x3418c)
#12 0x0000f47b777450e8 lldb_private::Options::OutputFormattedUsageText(lldb_private::Stream&, lldb_privat
e::OptionDefinition const&, unsigned int, bool) Options.cpp:0:0
#13 0x0000f47b77745a24 lldb_private::Options::GenerateOptionUsage(lldb_private::Stream&, lldb_private::Co
mmandObject&, unsigned int, bool) Options.cpp:0:0
#14 0x0000f47b7772bb5c lldb_private::CommandObject::GenerateHelpText(lldb_private::Stream&) CommandObject
.cpp:0:0
#15 0x0000f47b7772b8ec lldb_private::CommandObject::GenerateHelpText(lldb_private::CommandReturnObject&) 
CommandObject.cpp:0:0
#16 0x0000f47b7ab11e0c lldb_private::CommandObjectHelp::DoExecute(lldb_private::Args&, lldb_private::Comm
andReturnObject&) CommandObjectHelp.cpp:0:0
#17 0x0000f47b7772c468 lldb_private::CommandObjectParsed::Execute(char const*, lldb_private::CommandRetur
nObject&) CommandObject.cpp:0:0
#18 0x0000f47b7771af58 lldb_private::CommandInterpreter::HandleCommand(char const*, lldb_private::LazyBoo
l, lldb_private::CommandReturnObject&, bool) CommandInterpreter.cpp:0:0
#19 0x0000f47b7771fdb4 lldb_private::CommandInterpreter::IOHandlerInputComplete(lldb_private::IOHandler&,
 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) CommandInterpreter.cpp:
0:0
#20 0x0000f47b7763a608 lldb_private::IOHandlerEditline::Run() IOHandler.cpp:0:0
#21 0x0000f47b7760c42c lldb_private::Debugger::RunIOHandlers() Debugger.cpp:0:0
#22 0x0000f47b77721a30 lldb_private::CommandInterpreter::RunCommandInterpreter(lldb_private::CommandInter
preterRunOptions&) CommandInterpreter.cpp:0:0
#23 0x0000f47b773ddfac lldb::SBDebugger::RunCommandInterpreter(lldb::SBCommandInterpreterRunOptions const
&) (/home/davspi01/build-llvm-aarch64/bin/../lib/liblldb.so.23.0git+0x595dfac)
#24 0x0000bc5c233b2efc Driver::MainLoop() (./bin/lldb+0x42efc)
#25 0x0000bc5c233b3d98 main (./bin/lldb+0x43d98)
#26 0x0000f47b71347400 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#27 0x0000f47b713474d8 call_init ./csu/../csu/libc-start.c:128:20
#28 0x0000f47b713474d8 __libc_start_main ./csu/../csu/libc-start.c:379:5
#29 0x0000bc5c233b03b0 _start (./bin/lldb+0x403b0)
Aborted (core dumped)
```
When the width is not 105, it works.
```
$ tput cols
106
davspi01@AWS-ARMVM:~/build-llvm-aarch64$ ./bin/lldb -o "help breakpoint set"
Sets a breakpoint or set of breakpoints in the executable.

Syntax: breakpoint set <cmd-options>
<...>
```
The height of the console does not seem to matter. Which makes sense as the failing assert is in code that tries to break the output into multiple lines.

I wonder if the addition of ANSI codes to underline the shortcut characters has thrown off the width calculations.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to