2 // KDThreadMapEntry.hpp
5 // Created by James McIlree on 10/25/12.
6 // Copyright (c) 2014 Apple. All rights reserved.
9 #ifndef kdprof_KDThreadMapEntry_hpp
10 #define kdprof_KDThreadMapEntry_hpp
13 // This is the kd_threadmap from the kernel
15 // There is one interesting conflict I have noticed so far.
17 // The _pid field is set to 1 for kernel threads that have no user space
18 // representation. However, 1 is a valid pid, and in fact, used by launchd.
20 // A full disambiguation of entries *must* include the tid, pid, AND name:
22 // 000000000000011f 00000001 launchd
23 // 000000000000014f 00000001 launchd
24 // 0000000000000150 00000001 launchd
26 // 0000000000000110 00000001 kernel_task
27 // 0000000000000120 00000001 kernel_task
28 // 0000000000000133 00000001 kernel_task
30 template <typename SIZE>
31 class KDThreadMapEntry {
33 typename SIZE::ptr_t _tid;
35 char _name[20]; // This is process name, not thread name!
38 typename SIZE::ptr_t tid() const { return _tid; }
39 int32_t pid() const { return _pid; }
40 const char* name() const { return _name; }