-
Notifications
You must be signed in to change notification settings - Fork 24
Description
When using lldb's console interface, to create a target for a Universal excutable on macOS, --arch <arch> must be provided (e.g. --arch x86_64) to target create, or else creating the target fails. Binary Ninja's LLDB adapter calls the SBDebugger::CreateTarget(const char *filename) function when creating a target, which does not specify the target's platform or architecture and does not fail on Universal executables. As a result, when it calls process launch without --arch <arch> later, the command fails (e.g. dbg.launch() returns False).
This is probably avoidable by passing --arch <arch> to process launch, but it looks like this isn't how LLDB wants to be doing things moving forward (this is accomplished via lldb_private::ProcessInfo::GetArchitecture()).
Instead, the SBDebugger::CreateTarget(const char *filename, const char *target_triple, const char *platform_name, bool add_dependent_modules, lldb::SBError &error) function could be called when creating a target. target_triple can be left empty to specify the currently selected platform's architecture (per SBDebugger::GetSelectedPlatform()), and platform_name also can be left empty to specify the currently selected platform. If a valid architecture is specified for a target, it's used as a default when launching. I don't see a way to assign an arch later via the launch_info argument to SBTarget::Launch(SBLaunchInfo &launch_info, SBError &error); SBLaunchInfo doesn't expose lldb_private::ProcessInfo::GetArchitecture().