Try target.AttachToProcessWithID() instead of target.LaunchSimple(). 
LaunchSimple tells lldb to run, creating a new process, instead of attaching to 
an existing one. See the SBTarget Python documentation here: 
https://lldb.llvm.org/python_reference/lldb.SBTarget-class.html .

You should also be able to attach using the lldb command line, then go into the 
scripting interface and get the debugger object with lldb.debugger . Or attach 
using debugger.HandleCommand() to run an lldb command from the scripting 
interface.

Ted

From: lldb-dev <lldb-dev-boun...@lists.llvm.org> On Behalf Of Pi Pony via 
lldb-dev
Sent: Wednesday, November 3, 2021 10:20 AM
To: lldb-dev@lists.llvm.org
Subject: [lldb-dev] how to attach to process with python scripting on lldb?


WARNING: This email originated from outside of Qualcomm. Please be wary of any 
links or attachments, and do not enable macros.
Hello,

I have been trying for some days to resolve a symbol of address using lldb 
python api but I haven't found how to do that.
So I think that I need to attach to the PID using python but it's not working, 
I tried:

target = lldb.debugger.FindTargetWithProcessID(71321)
process = target.LaunchSimple(None, None, os.getcwd())
process.GetState() --> Returns 0  ... Why?

So I could use the ResolveSymbolAddress function because if I attach it outside 
of scripting then I do not own the self – debugger object.

I appreciate your help.
_______________________________________________
lldb-dev mailing list
lldb-dev@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev

Reply via email to