[lldb-dev] [PATCH] The kalimba Platform plugin

Greg Clayton gclayton at apple.com
Mon Jul 14 11:27:28 PDT 2014


A few questions:

In PlatformKalimba::GetProcessInfo() the code is:


bool
PlatformKalimba::GetProcessInfo (lldb::pid_t pid, ProcessInstanceInfo &process_info)
{
    bool success = false;
    if (IsHost())
    {
        success = Platform::GetProcessInfo (pid, process_info);
    }
    else
    {
        if (m_remote_platform_sp) 
            success = m_remote_platform_sp->GetProcessInfo (pid, process_info);
    }
    return success;
}


Can "kalimba" processes actually run locally on your host machine as native apps? I would guess that PlatformKalimba is for remote debugging only and would expect your code to return false if "IsHost()" is true in that case. If you are running a simulator that uses local processes on the host machine, then this is correct.


In your GetSupportedArchitectureAtIndex you should only return true if "idx == 0":

bool
PlatformKalimba::GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch)
{
    if (idx == 0)
    {
        arch = ArchSpec("kalimba-csr-unknown");
        return true;
    }
    return false;
}

GetSupportedArchitectureAtIndex gets used when you select your platform and then load an executable. It will search for valid architectures by iterating through the architectures using an increasing index. This is needed for cases like iOS where the iOS device might be "armv7s", but when we load a binary, we will start with "armv7s" and then back up to looking for "armv7", armv6", etc.

You will need to fill out:

size_t
PlatformDarwin::GetSoftwareBreakpointTrapOpcode (Target &target, BreakpointSite *bp_site)
{
}

You mainly need to figure out which opcode your target will use as a breakpoint instruction and return its size and fill in the bytes for the instruction, see PlatformDarwin::GetSoftwareBreakpointTrapOpcode() for an example.


In PlatformKalimba::LaunchProcess() you end up launching a host process after checking IsHost(), is this your intention? Are you running a simulator? Same thing for PlatformKalimba::Attach().

Greg

> On Jul 14, 2014, at 6:24 AM, Matthew Gardiner <mg11 at csr.com> wrote:
> 
> Abid, Hafiz wrote:
>> Hi Mathew,
>> I had a quick look and nothing jumped at me. Although I think you are missing call
>> to PlatformKalimba::Terminate().
>> 
>> Regards,
>> Abid
> 
> Thanks for the review, Abid.
> 
> I've just attached a corrected patch with the call to PlatformKalimba::Terminate() made from lldb_private::Terminate().
> 
> thanks
> Matt
> 
> 
> 
> 
> Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
> More information can be found at www.csr.com. Keep up to date with CSR on our technical blog, www.csr.com/blog, CSR people blog, www.csr.com/people, YouTube, www.youtube.com/user/CSRplc, Facebook, www.facebook.com/pages/CSR/191038434253534, or follow us on Twitter at www.twitter.com/CSR_plc.
> New for 2014, you can now access the wide range of products powered by aptX at www.aptx.com.
> <PlatformKalimba2.patch>_______________________________________________
> 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