How to know who is the parent thread of a given th

2019-08-03 15:40发布

I'm debugging a program in vs 2008. There is a thread list with thread IDs. Is the any way or tool that I can use to identify the parent thread of a given thread ID? Thanks.

4条回答
祖国的老花朵
2楼-- · 2019-08-03 16:04

I dont think you can do that, but I cant give you good explanation why. Just never heard of it as possible. I looked into Process Explorer, and it can give you only Start Address, but I doubt you can deduce parent thread ID from it.

If you need to do this in your app, then it should not be very difficult to implement, maybe it is even possible to hook system function to do that, but if SysInternals is not doing this then maybe this is not possible.

查看更多
祖国的老花朵
3楼-- · 2019-08-03 16:07

are you looking for programmatic way, or an external tool? if the later, try processExplorer. you can download it for free from MS, and it gives you the thread thread hierarchy plus a lot of other cool stuff.

查看更多
家丑人穷心不美
4楼-- · 2019-08-03 16:10

There is no API, at least standard and documented, to obtain a creator thread ID for a given thread. Neither Performance Monitor, Visual Studio IDE, Process Explorer nor Spy++ provide this information. Once started, a thread is not dependent on its creator any longer and runs independently; there is no parent-child relation in particular.

查看更多
姐就是有狂的资本
5楼-- · 2019-08-03 16:16

I think Spy++ (it's called spyxx.exe and is located in C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools on my machine) will give such information but it's hard work, however I am sure that sys internals do a much better version of process information

查看更多
登录 后发表回答