[all-commits] [llvm/llvm-project] bbe3c4: [lldb] Fix a crash when tab-completion an empty li...

Raphael Isemann via All-commits all-commits at lists.llvm.org
Fri Aug 14 00:07:29 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: bbe3c479a6adf0abfe5d111e9ba206daa5a1eb2b
      https://github.com/llvm/llvm-project/commit/bbe3c479a6adf0abfe5d111e9ba206daa5a1eb2b
  Author: Raphael Isemann <teemperor at gmail.com>
  Date:   2020-08-14 (Fri, 14 Aug 2020)

  Changed paths:
    M lldb/source/Host/common/Editline.cpp
    M lldb/test/API/commands/expression/multiline-completion/TestMultilineCompletion.py
    M lldb/test/API/commands/expression/multiline-completion/main.c

  Log Message:
  -----------
  [lldb] Fix a crash when tab-completion an empty line in a function with only one local variable

When LLDB sees only one possible completion for an input, it will add a trailing
space to the completion to signal that to the user. If the current argument is
quoted, that also means LLDB needs to add the trailing quote to finish the
current argument first.

In case the user is in a function with only one local variable and is currently
editing an empty line in the multiline expression editor, then we are in the
unique situation where we can have a unique completion for an empty input line.
(In a normal LLDB session this would never occur as empty input would just list
all the possible commands).

In this special situation our check if the current argument needs to receive a
trailing quote will crash LLDB as there is no current argument and the
completion code just unconditionally tries to access the current argument. This
just adds the missing check if we even have a current argument before we check
if we need to add a terminating quote character.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D85903




More information about the All-commits mailing list