如何使用LLDB python API`debugger.CreateTarget指定dsym文件`

如何使用LLDB python API`debugger.CreateTarget指定dsym文件`,python,debugging,lldb,dsym,Python,Debugging,Lldb,Dsym,我可以在lldb命令行应用程序中指定myapp.dsym: target create --no-dependents -arch arm64 --symfile myapp.dsym myapp 但在使用pythonapi时,如何指定dsym文件呢 target = debugger.CreateTarget( "myapp", triple, platform_name, add_dependents, lldb.SBError()) 我已经搜索过了。但无法解决此问题。如果二

我可以在lldb命令行应用程序中指定myapp.dsym:

target create --no-dependents -arch arm64 --symfile myapp.dsym myapp
但在使用pythonapi时,如何指定dsym文件呢

target = debugger.CreateTarget(

    "myapp", triple, platform_name, add_dependents, lldb.SBError())


我已经搜索过了。但无法解决此问题。

如果二进制文件是
/tmp/a.out
,而dSYM是
/tmp/hide.noindex/a.out.dSYM
,则这是一种方法:

(lldb) scri
Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
>>> dbg = lldb.SBDebugger().Create()
>>> dbg.SetAsync(False)
>>> target = dbg.CreateTarget('')
>>> modspec = lldb.SBModuleSpec()
>>> modspec.SetFileSpec(lldb.SBFileSpec("/tmp/a.out"))
>>> modspec.SetSymbolFileSpec(lldb.SBFileSpec("/tmp/hide.noindex/a.out.dSYM"))
>>> target.AddModule(modspec)
<lldb.SBModule; proxy of <Swig Object of type 'lldb::SBModule *' at 0x1077e2ea0> >
>>> target.BreakpointCreateByName("main")
<lldb.SBBreakpoint; proxy of <Swig Object of type 'lldb::SBBreakpoint *' at 0x1077e2f60> >
>>> process = target.LaunchSimple(None, None, "/tmp/")
>>> print (process)
SBProcess: pid = 87848, state = stopped, threads = 1, executable = a.out
>>> print (process.GetThreadAtIndex(0))
thread #1: tid = 0xeacb2f, 0x000000010a548fb0 a.out`main, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
(lldb)scri
Python交互式解释器。要退出,请键入“退出()”、“退出()”或Ctrl-D。
>>>dbg=lldb.SBDebugger().Create()
>>>dbg.SetAsync(False)
>>>target=dbg.CreateTarget(“”)
>>>modspec=lldb.SBModuleSpec()
>>>modspec.SetFileSpec(lldb.SBFileSpec(“/tmp/a.out”))
>>>modspec.SetSymbolFileSpec(lldb.SBFileSpec(“/tmp/hide.noindex/a.out.dSYM”))
>>>target.AddModule(modspec)
>>>target.createByName(“main”)
>>>process=target.LaunchSimple(无,无,“/tmp/”)
>>>打印(过程)
SBProcess:pid=87848,state=stopped,threads=1,executable=a.out
>>>打印(process.GetThreadAtIndex(0))
线程#1:tid=0xeacb2f,0x000000010a548fb0 a.out`main,queue='com.apple.main thread',停止原因=断点1.1

如果二进制文件是
/tmp/a.out
,而dSYM是
/tmp/hide.noindex/a.out.dSYM
,这将是一种方法:

(lldb) scri
Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
>>> dbg = lldb.SBDebugger().Create()
>>> dbg.SetAsync(False)
>>> target = dbg.CreateTarget('')
>>> modspec = lldb.SBModuleSpec()
>>> modspec.SetFileSpec(lldb.SBFileSpec("/tmp/a.out"))
>>> modspec.SetSymbolFileSpec(lldb.SBFileSpec("/tmp/hide.noindex/a.out.dSYM"))
>>> target.AddModule(modspec)
<lldb.SBModule; proxy of <Swig Object of type 'lldb::SBModule *' at 0x1077e2ea0> >
>>> target.BreakpointCreateByName("main")
<lldb.SBBreakpoint; proxy of <Swig Object of type 'lldb::SBBreakpoint *' at 0x1077e2f60> >
>>> process = target.LaunchSimple(None, None, "/tmp/")
>>> print (process)
SBProcess: pid = 87848, state = stopped, threads = 1, executable = a.out
>>> print (process.GetThreadAtIndex(0))
thread #1: tid = 0xeacb2f, 0x000000010a548fb0 a.out`main, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
(lldb)scri
Python交互式解释器。要退出,请键入“退出()”、“退出()”或Ctrl-D。
>>>dbg=lldb.SBDebugger().Create()
>>>dbg.SetAsync(False)
>>>target=dbg.CreateTarget(“”)
>>>modspec=lldb.SBModuleSpec()
>>>modspec.SetFileSpec(lldb.SBFileSpec(“/tmp/a.out”))
>>>modspec.SetSymbolFileSpec(lldb.SBFileSpec(“/tmp/hide.noindex/a.out.dSYM”))
>>>target.AddModule(modspec)
>>>target.createByName(“main”)
>>>process=target.LaunchSimple(无,无,“/tmp/”)
>>>打印(过程)
SBProcess:pid=87848,state=stopped,threads=1,executable=a.out
>>>打印(process.GetThreadAtIndex(0))
线程#1:tid=0xeacb2f,0x000000010a548fb0 a.out`main,queue='com.apple.main thread',停止原因=断点1.1

``target=debugger.CreateTarget('')target.AddModule(“myapp”,None,None,“myapp.dsym”)``也可以工作。``target=debugger.CreateTarget('')target.AddModule(“myapp”,None,None,“myapp.dsym”)``也可以工作。