aboutsummaryrefslogtreecommitdiff
path: root/gdbserver/gdbthread.h
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/gdbthread.h
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/gdbthread.h')
-rw-r--r--gdbserver/gdbthread.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/gdbserver/gdbthread.h b/gdbserver/gdbthread.h
index 0e45f9a..fc9b4d2 100644
--- a/gdbserver/gdbthread.h
+++ b/gdbserver/gdbthread.h
@@ -29,20 +29,31 @@ struct regcache;
struct thread_info
{
+ thread_info (ptid_t id, void *target_data)
+ : id (id), target_data (target_data)
+ {
+ this->last_status.kind = TARGET_WAITKIND_IGNORE;
+ }
+
+ ~thread_info ()
+ {
+ free_register_cache (this->regcache_data);
+ }
+
/* The id of this thread. */
ptid_t id;
void *target_data;
- struct regcache *regcache_data;
+ struct regcache *regcache_data = nullptr;
/* The last resume GDB requested on this thread. */
- enum resume_kind last_resume_kind;
+ enum resume_kind last_resume_kind = resume_continue;
/* The last wait status reported for this thread. */
struct target_waitstatus last_status;
/* True if LAST_STATUS hasn't been reported to GDB yet. */
- int status_pending_p;
+ int status_pending_p = 0;
/* Given `while-stepping', a thread may be collecting data for more
than one tracepoint simultaneously. E.g.:
@@ -67,10 +78,10 @@ struct thread_info
tracepoint actions this thread is now collecting; NULL if empty.
Each item in the list holds the current step of the while-stepping
action. */
- struct wstep_state *while_stepping;
+ struct wstep_state *while_stepping = nullptr;
/* Branch trace target information for this thread. */
- struct btrace_target_info *btrace;
+ struct btrace_target_info *btrace = nullptr;
};
extern std::list<thread_info *> all_threads;