We use the globally unique thread ID:

static uint64_t 
GetGloballyUniqueThreadIDForMachPortID (thread_t mach_port_id)
{
    kern_return_t kr;
    thread_identifier_info_data_t tident;
    mach_msg_type_number_t tident_count = THREAD_IDENTIFIER_INFO_COUNT;
    kr = thread_info (mach_port_id, THREAD_IDENTIFIER_INFO, (thread_info_t) 
&tident, &tident_count);
    if (kr != KERN_SUCCESS)
    {
        return mach_port_id;
    }
    return tident.thread_id;
}

this is the best way because mach ports can be re-used, but the globally unique 
thread ID is always guaranteed to be unique.

> On Jan 8, 2015, at 8:26 AM, Mario Zechner <badlogicga...@gmail.com> wrote:
> 
> Hi,
> 
> we are currently trying work around some issues with rapid suspend/resume. We 
> essentially setup a thread in the inferior with which we communicate via TCP 
> to get informed of events such as thread start/stop without having to set 
> breakpoints and stopping the inferior.
> 
> Eventually we need to associate the native threads with the SBThread we get 
> from LLDB's API. SBThread has an id and an index, but those don't seem to map 
> to anything on the inferior side (e.g. the pthread id of the thread).
> 
> Is there a way to perform this association?
> 
> Thanks,
> Mario
> 
> _______________________________________________
> lldb-dev mailing list
> lldb-dev@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev


_______________________________________________
lldb-dev mailing list
lldb-dev@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev

Reply via email to