Re: Breakpoint Implementation
Re: Breakpoint Implementation
- Subject: Re: Breakpoint Implementation
- From: Terry Lambert <email@hidden>
- Date: Thu, 7 Oct 2010 18:29:34 -0700
On Oct 7, 2010, at 5:07 PM, Dave Keck wrote:
>>> 1. Suspend every thread
>>
>> This procedure is not instantaneous.
>
> I see. Is there a technique to determine when a thread has actually
> stopped executing? My testing shows that the information returned by
> thread_info() cannot be used for this purpose.
These are unsupported interfaces, and if you use them, you *will* break at some point in the future...
Note that Apple generally does not document this type of information, since doing so would prevent changing the internal implementation details from release to release. Since we ship both the debugger and the OS, we can safely make such changes, but third parties can't rely on the implementation details not changing on a software update. So if this breaks your hobby project in a future release, you will need to recompile your code.
-
Actually, the "run_state" member of the thread_basic_info_t structure returned for the thread_info() "flavor" argument of THREAD_BASIC_INFO returned in the "thread_info_out" data area argument will be TH_STATE_STOPPED. If you iterate over the task thread list, you can verify that this is the case for all threads. You really should be looking at the gdb source code for this type of information, since gdb has to solve similar problems.
Typically, this is done after a task_suspend(), which iterates over the threads in the task and sets suspend counts on all of them. Eventually they drain out of the scheduler run queues to an actually suspended state.
It may be that you are looking at the thread state information before the threads have actually had a chance to get into the suspended state, or you could maybe be looking at the wrong information, since you can get several "flavors" of information back about threads, not just THREAD_BASIC_INFO.
-- Terry _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden