[lldb-dev] Load fat executable when uncertain about the target process' architecture

Greg Clayton gclayton at apple.com
Thu Oct 10 10:00:37 PDT 2013


On Oct 10, 2013, at 8:13 AM, Carlo Kok <ck at remobjects.com> wrote:

> I use:
> m_target = m_debugger.CreateTarget(fn, archd, NULL, true, m_error);
> m_process = m_target.ConnectRemote(SBListener(), target, NULL, m_error);
> 
> (fn points to an executable with x86 and x86_64 in it. archd this x86_64-apple-ios)
> 
> However the target ends up being a 32bits process. At this point the ABI code loads 64bits and ends up crashing in some 64bits register loading code in ABISysV_x86_64.h:
> 
> argument_register_ids[0] = reg_ctx->GetRegisterInfoByName("rdi", 0)->kinds[eRegisterKindLLDB];
> 
> 
> the problem I'm having is that I don't know what architecture the target will be before connecting. Passing no arch to CreateTarget gives this error:
> 
> "'App10' doesn't contain any 'ios-simulator' platform architectures"
> 
> I do know GDB has (and gets called for) a command that asks the process architecture, but this doesn't seem to be used to get the abi (and probably more things), what can I do in this case?

The key issue that is going wrong here is you are not specifying a platform. If you know you are going to be doing remote macosx debugging, then you can tell the target this when you create it. The 3rd argument (NULL) in CreateTarget is the platform name. Try specifying "remote-macosx".

> 
> -- 
> Carlo Kok
> RemObjects Software
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev




More information about the lldb-dev mailing list