aboutsummaryrefslogtreecommitdiff
path: root/gdbserver/inferiors.cc
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-09-28 16:02:29 -0400
committerSimon Marchi <simon.marchi@efficios.com>2021-10-21 16:10:54 -0400
commitd2f325df0b54b0fed87f74c284f0a067b7233a14 (patch)
tree7415bedf2283d7f1ce356275aa628463870a984e /gdbserver/inferiors.cc
parentadd3db9182348555b80ec850b58a6f423b0e6bc5 (diff)
downloadgdb-d2f325df0b54b0fed87f74c284f0a067b7233a14.zip
gdb-d2f325df0b54b0fed87f74c284f0a067b7233a14.tar.gz
gdb-d2f325df0b54b0fed87f74c284f0a067b7233a14.tar.bz2
gdbserver: make thread_info non-POD
Add a constructor and a destructor. The constructor takes care of the initialization that happened in add_thread, while the destructor takes care of the freeing that happened in free_one_thread. This is needed to make target_waitstatus non-POD, as thread_info contains a member of that type. Change-Id: I1db321b4de9dd233ede0d5c101950f1d6f1d13b7
Diffstat (limited to 'gdbserver/inferiors.cc')
-rw-r--r--gdbserver/inferiors.cc11
1 files changed, 2 insertions, 9 deletions
diff --git a/gdbserver/inferiors.cc b/gdbserver/inferiors.cc
index 32f8478..a636266 100644
--- a/gdbserver/inferiors.cc
+++ b/gdbserver/inferiors.cc
@@ -36,19 +36,13 @@ static std::string current_inferior_cwd;
struct thread_info *
add_thread (ptid_t thread_id, void *target_data)
{
- struct thread_info *new_thread = XCNEW (struct thread_info);
-
- new_thread->id = thread_id;
- new_thread->last_resume_kind = resume_continue;
- new_thread->last_status.kind = TARGET_WAITKIND_IGNORE;
+ thread_info *new_thread = new thread_info (thread_id, target_data);
all_threads.push_back (new_thread);
if (current_thread == NULL)
current_thread = new_thread;
- new_thread->target_data = target_data;
-
return new_thread;
}
@@ -93,8 +87,7 @@ find_any_thread_of_pid (int pid)
static void
free_one_thread (thread_info *thread)
{
- free_register_cache (thread_regcache_data (thread));
- free (thread);
+ delete thread;
}
void