[Lldb-commits] [PATCH] D93926: [lldb] Don't remove the lldb.debugger var after exiting the interpreter

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 7 21:51:24 PST 2021


JDevlieghere added a comment.

In D93926#2486038 <https://reviews.llvm.org/D93926#2486038>, @lanza wrote:

> I guess if the intention of that is maintain the debugger instance around it should work, but at the moment it segfaults pretty quick with Xcode's lldb using:

Hmm, the debugger somehow gets borked when it's passed into the `background` method. If I call `GetID()` on it, it returns a totally bogus value. I need to read up on how these objects are passed to new threads. The following script works as expected:

  import threading
  import lldb
  import time
  
  def background(debugger_id: int):
      debugger = lldb.SBDebugger.FindDebuggerWithID(debugger_id)
      while True:
          time.sleep(1)
          print(debugger)
  
  def __lldb_init_module(
    debugger: lldb.SBDebugger,
    internal_dict: dict
  ):
      threading.Thread()
      threading.Thread(target=background, args=(debugger.GetID(),)).start()


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93926



More information about the lldb-commits mailing list