teemperor created this revision.
teemperor added a reviewer: shafik.
Herald added subscribers: lldb-commits, abidh.
Herald added a project: LLDB.
teemperor added a comment.

> I don't see any way to test this as the *multiline* expression completion is 
> completely untested at the moment and I don't think we have any existing code 
> for testing infrastructure for it.

Correct me if I'm wrong with this. I know we never test this functionality (as 
the whole IOHandler business is tricky to test), but I'm not sure if we maybe 
have some funky way around it.

Otherwise I would say we merge this as-is, as I don't want to have an obvious 
bug around until we find a method to test the interactive IO code.


Tab completing inside the multiline expression command can cause LLDB to crash. 
The easiest way
to do this is to go inside a frame with at least one local variable and then 
try to complete:

  (lldb) expr
  1. a[tab]

Reason for this was some mixup when we calculate the cursor position. Obviously 
we should calculate
the offset inside the string by doing 'end - start', but we are doing 'start - 
end' (which causes the offset to
become -1 which will lead to some out-of-bounds reading).

Fixes rdar://51754005

I don't see any way to test this as the *multiline* expression completion is 
completely untested at the moment
and I don't think we have any existing code for testing infrastructure for it.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D64995

Files:
  lldb/source/Core/IOHandler.cpp


Index: lldb/source/Core/IOHandler.cpp
===================================================================
--- lldb/source/Core/IOHandler.cpp
+++ lldb/source/Core/IOHandler.cpp
@@ -233,7 +233,7 @@
         matches, descriptions);
   case Completion::Expression: {
     CompletionResult result;
-    CompletionRequest request(current_line, current_line - cursor,
+    CompletionRequest request(current_line, cursor - current_line,
                               skip_first_n_matches, max_matches, result);
     CommandCompletions::InvokeCommonCompletionCallbacks(
         io_handler.GetDebugger().GetCommandInterpreter(),


Index: lldb/source/Core/IOHandler.cpp
===================================================================
--- lldb/source/Core/IOHandler.cpp
+++ lldb/source/Core/IOHandler.cpp
@@ -233,7 +233,7 @@
         matches, descriptions);
   case Completion::Expression: {
     CompletionResult result;
-    CompletionRequest request(current_line, current_line - cursor,
+    CompletionRequest request(current_line, cursor - current_line,
                               skip_first_n_matches, max_matches, result);
     CommandCompletions::InvokeCommonCompletionCallbacks(
         io_handler.GetDebugger().GetCommandInterpreter(),
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to