mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-28 15:18:37 +08:00
Remove find_inferior_in_random
Replace with find_thread_in_random. gdb/gdbserver/ChangeLog: * inferiors.c (find_inferior_in_random): Remove. * inferiors.h (find_inferior_in_random): Remove. * linux-low.c (status_pending_p_callback): Return bool, accept parameter ptid directly. (linux_wait_for_event_filtered): Use find_thread_in_random. (linux_wait_1): Likewise.
This commit is contained in:
@ -1,3 +1,12 @@
|
|||||||
|
2017-12-02 Simon Marchi <simon.marchi@polymtl.ca>
|
||||||
|
|
||||||
|
* inferiors.c (find_inferior_in_random): Remove.
|
||||||
|
* inferiors.h (find_inferior_in_random): Remove.
|
||||||
|
* linux-low.c (status_pending_p_callback): Return bool, accept
|
||||||
|
parameter ptid directly.
|
||||||
|
(linux_wait_for_event_filtered): Use find_thread_in_random.
|
||||||
|
(linux_wait_1): Likewise.
|
||||||
|
|
||||||
2017-12-02 Simon Marchi <simon.marchi@polymtl.ca>
|
2017-12-02 Simon Marchi <simon.marchi@polymtl.ca>
|
||||||
|
|
||||||
* inferiors.c (find_inferior_id): Remove.
|
* inferiors.c (find_inferior_id): Remove.
|
||||||
|
@ -42,18 +42,6 @@ find_inferior (std::list<thread_info *> *thread_list,
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
thread_info *
|
|
||||||
find_inferior_in_random (std::list<thread_info *> *thread_list,
|
|
||||||
int (*func) (thread_info *, void *),
|
|
||||||
void *arg)
|
|
||||||
{
|
|
||||||
gdb_assert (thread_list == &all_threads);
|
|
||||||
|
|
||||||
return find_thread_in_random ([&] (thread_info *thread) {
|
|
||||||
return func (thread, arg);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
for_each_inferior (std::list<thread_info *> *thread_list,
|
for_each_inferior (std::list<thread_info *> *thread_list,
|
||||||
void (*action) (thread_info *))
|
void (*action) (thread_info *))
|
||||||
|
@ -142,9 +142,6 @@ void clear_inferiors (void);
|
|||||||
|
|
||||||
thread_info *find_inferior (std::list<thread_info *> *thread_list,
|
thread_info *find_inferior (std::list<thread_info *> *thread_list,
|
||||||
int (*func) (thread_info *, void *), void *arg);
|
int (*func) (thread_info *, void *), void *arg);
|
||||||
thread_info *find_inferior_in_random (std::list<thread_info *> *thread_list,
|
|
||||||
int (*func) (thread_info *, void *),
|
|
||||||
void *arg);
|
|
||||||
void for_each_inferior (std::list<thread_info *> *thread_list,
|
void for_each_inferior (std::list<thread_info *> *thread_list,
|
||||||
void (*action) (thread_info *));
|
void (*action) (thread_info *));
|
||||||
void for_each_inferior_with_data (std::list<thread_info *> *thread_list,
|
void for_each_inferior_with_data (std::list<thread_info *> *thread_list,
|
||||||
|
@ -1807,16 +1807,15 @@ lwp_resumed (struct lwp_info *lwp)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return 1 if this lwp has an interesting status pending. */
|
/* Return true if this lwp has an interesting status pending. */
|
||||||
static int
|
static bool
|
||||||
status_pending_p_callback (thread_info *thread, void *arg)
|
status_pending_p_callback (thread_info *thread, ptid_t ptid)
|
||||||
{
|
{
|
||||||
struct lwp_info *lp = get_thread_lwp (thread);
|
struct lwp_info *lp = get_thread_lwp (thread);
|
||||||
ptid_t ptid = * (ptid_t *) arg;
|
|
||||||
|
|
||||||
/* Check if we're only interested in events from a specific process
|
/* Check if we're only interested in events from a specific process
|
||||||
or a specific LWP. */
|
or a specific LWP. */
|
||||||
if (!ptid_match (ptid_of (thread), ptid))
|
if (!thread->id.matches (ptid))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!lwp_resumed (lp))
|
if (!lwp_resumed (lp))
|
||||||
@ -2667,9 +2666,11 @@ linux_wait_for_event_filtered (ptid_t wait_ptid, ptid_t filter_ptid,
|
|||||||
|
|
||||||
if (ptid_equal (filter_ptid, minus_one_ptid) || ptid_is_pid (filter_ptid))
|
if (ptid_equal (filter_ptid, minus_one_ptid) || ptid_is_pid (filter_ptid))
|
||||||
{
|
{
|
||||||
event_thread = (struct thread_info *)
|
event_thread = find_thread_in_random ([&] (thread_info *thread)
|
||||||
find_inferior_in_random (&all_threads, status_pending_p_callback,
|
{
|
||||||
&filter_ptid);
|
return status_pending_p_callback (thread, filter_ptid);
|
||||||
|
});
|
||||||
|
|
||||||
if (event_thread != NULL)
|
if (event_thread != NULL)
|
||||||
event_child = get_thread_lwp (event_thread);
|
event_child = get_thread_lwp (event_thread);
|
||||||
if (debug_threads && event_thread)
|
if (debug_threads && event_thread)
|
||||||
@ -2780,9 +2781,11 @@ linux_wait_for_event_filtered (ptid_t wait_ptid, ptid_t filter_ptid,
|
|||||||
|
|
||||||
/* ... and find an LWP with a status to report to the core, if
|
/* ... and find an LWP with a status to report to the core, if
|
||||||
any. */
|
any. */
|
||||||
event_thread = (struct thread_info *)
|
event_thread = find_thread_in_random ([&] (thread_info *thread)
|
||||||
find_inferior_in_random (&all_threads, status_pending_p_callback,
|
{
|
||||||
&filter_ptid);
|
return status_pending_p_callback (thread, filter_ptid);
|
||||||
|
});
|
||||||
|
|
||||||
if (event_thread != NULL)
|
if (event_thread != NULL)
|
||||||
{
|
{
|
||||||
event_child = get_thread_lwp (event_thread);
|
event_child = get_thread_lwp (event_thread);
|
||||||
@ -3193,10 +3196,13 @@ linux_wait_1 (ptid_t ptid,
|
|||||||
in_step_range = 0;
|
in_step_range = 0;
|
||||||
ourstatus->kind = TARGET_WAITKIND_IGNORE;
|
ourstatus->kind = TARGET_WAITKIND_IGNORE;
|
||||||
|
|
||||||
|
auto status_pending_p_any = [&] (thread_info *thread)
|
||||||
|
{
|
||||||
|
return status_pending_p_callback (thread, minus_one_ptid);
|
||||||
|
};
|
||||||
|
|
||||||
/* Find a resumed LWP, if any. */
|
/* Find a resumed LWP, if any. */
|
||||||
if (find_inferior (&all_threads,
|
if (find_thread (status_pending_p_any) != NULL)
|
||||||
status_pending_p_callback,
|
|
||||||
&minus_one_ptid) != NULL)
|
|
||||||
any_resumed = 1;
|
any_resumed = 1;
|
||||||
else if ((find_inferior (&all_threads,
|
else if ((find_inferior (&all_threads,
|
||||||
not_stopped_callback,
|
not_stopped_callback,
|
||||||
|
Reference in New Issue
Block a user