[Lldb-commits] [PATCH] D75597: Update the current execution context at the beginning of tab completions

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 6 11:03:26 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGec31255c0080: [lldb] Update the current execution context at the beginning of tab completions (authored by Gongyu Deng <gy_deng at icloud.com>, committed by teemperor).
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75597/new/

https://reviews.llvm.org/D75597

Files:
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/source/Interpreter/CommandObject.cpp
  lldb/test/API/functionalities/completion/TestCompletion.py


Index: lldb/test/API/functionalities/completion/TestCompletion.py
===================================================================
--- lldb/test/API/functionalities/completion/TestCompletion.py
+++ lldb/test/API/functionalities/completion/TestCompletion.py
@@ -43,9 +43,10 @@
         (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self,
                                           '// Break here', self.main_source_spec)
         self.assertEquals(process.GetState(), lldb.eStateStopped)
-        # FIXME: This pulls in the debug information to make the completions work,
-        # but the completions should also work without.
-        self.runCmd("frame variable fooo")
+        
+        # Since CommandInterpreter has been corrected to update the current execution 
+        # context at the beginning of HandleCompletion, we're here explicitly testing  
+        # the scenario where "frame var" is completed without any preceding commands.
 
         self.complete_from_to('frame variable fo',
                               'frame variable fooo')
Index: lldb/source/Interpreter/CommandObject.cpp
===================================================================
--- lldb/source/Interpreter/CommandObject.cpp
+++ lldb/source/Interpreter/CommandObject.cpp
@@ -267,6 +267,9 @@
 }
 
 void CommandObject::HandleCompletion(CompletionRequest &request) {
+
+  m_exe_ctx = m_interpreter.GetExecutionContext();
+
   // Default implementation of WantsCompletion() is !WantsRawCommandString().
   // Subclasses who want raw command string but desire, for example, argument
   // completion should override WantsCompletion() to return true, instead.
@@ -293,6 +296,8 @@
     // If we got here, the last word is not an option or an option argument.
     HandleArgumentCompletion(request, opt_element_vector);
   }
+
+  m_exe_ctx.Clear();
 }
 
 bool CommandObject::HelpTextContainsWord(llvm::StringRef search_word,
Index: lldb/source/Interpreter/CommandInterpreter.cpp
===================================================================
--- lldb/source/Interpreter/CommandInterpreter.cpp
+++ lldb/source/Interpreter/CommandInterpreter.cpp
@@ -1837,6 +1837,8 @@
 
 void CommandInterpreter::HandleCompletion(CompletionRequest &request) {
 
+  UpdateExecutionContext(nullptr);
+
   // Don't complete comments, and if the line we are completing is just the
   // history repeat character, substitute the appropriate history line.
   llvm::StringRef first_arg = request.GetParsedLine().GetArgumentAtIndex(0);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75597.248795.patch
Type: text/x-patch
Size: 2523 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200306/78dcc9ca/attachment.bin>


More information about the lldb-commits mailing list