How to load symfile when using debugger.CreateTarget?

Hi all,

I can specify myapp.dsym in the lldb command line app:

target create --no-dependents -arch arm64 --symfile myapp.dsym myapp

But how can I specify dsym file when using python API?

target = debugger.CreateTarget(

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

I have search in https://github.com/llvm/llvm-project/ and https://lldb.llvm.org/python_reference/index.html . But cannot solve it.

Best regards,

You shouldn’t have to specify it if spotlight can see your .dSYM file if you are on a mac. But it would be nice to have an API way to do this. The only way right now is to call the SBTarget::AddModule(…) function, but that won’t correctly set the executable file and/or arch for the target correctly . There is a patch up for this:

https://reviews.llvm.org/D70847

You might try:

target = debugger.CreateTarget(“myapp”, triple, platform_name, add_dependents, lldb.SBError())

followed by:

target.AddModule(“myapp”, triple, None, “myapp.dsym”)

That might end up associating the symbol file for you, while it will re-use the module it first created in the CreateTarget(…) call