ted added a comment.

@jasonmolenda I discovered the same issue in another way - create a python 
command and load it with "command script import".  Here is test.py:

  def __lldb_init_module(debugger, dict):
      debugger.HandleCommand(
          'command script add -f test.test test')
      print("test command loaded")
  
  def test(debugger, register, result, dict):
      result.Clear()
      res = lldb.SBCommandReturnObject()
      command = 'target create /bin/ls'
      debugger.GetCommandInterpreter().HandleCommand(command, res)
      command = 'target modules search-paths add . ' + '/tmp'
      debugger.GetCommandInterpreter().HandleCommand(command, res)
      output = res.GetOutput()
      print(output)
  
      print('test done')

The 2nd HandleCommand uses the execution context of the original command, which 
doesn't have a target, so the search-paths add fails with no target.

(lldb) command script import test
test command loaded
(lldb) test
Current executable set to '/bin/ls' (x86_64).

test command called
error: error: invalid target, create a target using the 'target create' command

That should be fairly easy to turn into a Shell test, with "REQUIRES: python", 
because the error happens before the search-path is parsed, so it doesn't have 
to be valid.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111209

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to