X-Git-Url: https://git.saurik.com/apple/system_cmds.git/blobdiff_plain/1a7e3f61d38d679bba59130891c2031b5a0092b6..bd6521f0fc816ab056bc71376f9706a69b3b52c1:/KDBG/KDThreadMapEntry.hpp diff --git a/KDBG/KDThreadMapEntry.hpp b/KDBG/KDThreadMapEntry.hpp new file mode 100644 index 0000000..82dd3db --- /dev/null +++ b/KDBG/KDThreadMapEntry.hpp @@ -0,0 +1,43 @@ +// +// KDThreadMapEntry.hpp +// KDBG +// +// Created by James McIlree on 10/25/12. +// Copyright (c) 2014 Apple. All rights reserved. +// + +#ifndef kdprof_KDThreadMapEntry_hpp +#define kdprof_KDThreadMapEntry_hpp + +// +// This is the kd_threadmap from the kernel +// +// There is one interesting conflict I have noticed so far. +// +// The _pid field is set to 1 for kernel threads that have no user space +// representation. However, 1 is a valid pid, and in fact, used by launchd. +// +// A full disambiguation of entries *must* include the tid, pid, AND name: +// +// 000000000000011f 00000001 launchd +// 000000000000014f 00000001 launchd +// 0000000000000150 00000001 launchd +// +// 0000000000000110 00000001 kernel_task +// 0000000000000120 00000001 kernel_task +// 0000000000000133 00000001 kernel_task +// +template +class KDThreadMapEntry { + protected: + typename SIZE::ptr_t _tid; + int32_t _pid; + char _name[20]; // This is process name, not thread name! + + public: + typename SIZE::ptr_t tid() const { return _tid; } + int32_t pid() const { return _pid; } + const char* name() const { return _name; } +}; + +#endif