Open bb010g opened 2 years ago
Related to #262
https://github.com/Vector35/debugger/issues/262 resolves the issue that we cannot debug fat binaries on macOS. Although this issue tracks to a broader problem, it does not seem to be immediately blocking any workflow. So I keep this issue open, while assigning a lower priority to it.
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
) totarget create
, or else creating the target fails. Binary Ninja's LLDB adapter calls theSBDebugger::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 callsprocess launch
without--arch <arch>
later, the command fails (e.g.dbg.launch()
returnsFalse
).This is probably avoidable by passing
--arch <arch>
toprocess launch
, but it looks like this isn't how LLDB wants to be doing things moving forward (this is accomplished vialldb_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 (perSBDebugger::GetSelectedPlatform()
), andplatform_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 thelaunch_info
argument toSBTarget::Launch(SBLaunchInfo &launch_info, SBError &error)
;SBLaunchInfo
doesn't exposelldb_private::ProcessInfo::GetArchitecture()
.