[Lldb-commits] [PATCH] D82835: [lldb] Fix missing characters when autocompleting LLDB commands in REPL
Martin Svensson via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Jun 29 20:56:40 PDT 2020
poya created this revision.
poya added a reviewer: teemperor.
Herald added a project: LLDB.
poya added a comment.
Tests for the Swift REPL in https://github.com/apple/llvm-project/pull/1388
When tabbing to complete LLDB commands in REPL, characters would at best be missing but at worst cause the REPL to crash due to out of range string access.
This patch appends the command character to the completion results to fulfill the assumption that all matches are prefixed by the request's cursor argument prefix.
Bug report for the Swift REPL
https://bugs.swift.org/browse/SR-12867
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D82835
Files:
lldb/source/Expression/REPL.cpp
Index: lldb/source/Expression/REPL.cpp
===================================================================
--- lldb/source/Expression/REPL.cpp
+++ lldb/source/Expression/REPL.cpp
@@ -457,6 +457,12 @@
debugger.GetCommandInterpreter().HandleCompletion(sub_request);
StringList matches, descriptions;
sub_result.GetMatches(matches);
+ // Prepend command prefix that was excluded in the completion request
+ if (request.GetCursorIndex() == 0) {
+ for (auto &match : matches) {
+ match.insert(0, 1, ':');
+ }
+ }
sub_result.GetDescriptions(descriptions);
request.AddCompletions(matches, descriptions);
return;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82835.274322.patch
Type: text/x-patch
Size: 661 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200630/9ffb0c30/attachment.bin>
More information about the lldb-commits
mailing list