static unsigned long cygwin_get_dr6 (void);
static unsigned long cygwin_get_dr7 (void);
-static std::vector<windows_thread_info *> thread_list;
+static std::vector<std::unique_ptr<windows_thread_info>> thread_list;
/* Counts of things. */
static int saw_create;
windows_thread_info *
windows_nat::thread_rec (ptid_t ptid, thread_disposition_type disposition)
{
- for (windows_thread_info *th : thread_list)
+ for (auto &th : thread_list)
if (th->tid == ptid.lwp ())
{
if (!th->suspended)
break;
}
}
- return th;
+ return th.get ();
}
return NULL;
base += 0x2000;
#endif
th = new windows_thread_info (ptid.lwp (), h, base);
- thread_list.push_back (th);
+ thread_list.emplace_back (th);
/* Add this new thread to the list of threads.
{
DEBUG_EVENTS ("called");
init_thread_list ();
-
- for (windows_thread_info *here : thread_list)
- delete here;
-
thread_list.clear ();
}
delete_thread (find_thread_ptid (&the_windows_nat_target, ptid));
auto iter = std::find_if (thread_list.begin (), thread_list.end (),
- [=] (windows_thread_info *th)
+ [=] (auto &th)
{
return th->tid == id;
});
if (iter != thread_list.end ())
- {
- delete *iter;
- thread_list.erase (iter);
- }
+ thread_list.erase (iter);
}
/* Fetches register number R from the given windows_thread_info,
if (matching_pending_stop (debug_events))
return TRUE;
- for (windows_thread_info *th : thread_list)
+ for (auto &th : thread_list)
if (id == -1 || id == (int) th->tid)
{
#ifdef __x86_64__
_("Invalid register %d in cygwin_set_dr.\n"), i);
dr[i] = addr;
- for (windows_thread_info *th : thread_list)
+ for (auto &th : thread_list)
th->debug_registers_changed = true;
}
{
dr[7] = (CORE_ADDR) val;
- for (windows_thread_info *th : thread_list)
+ for (auto &th : thread_list)
th->debug_registers_changed = true;
}