diff options
author | Tom Tromey <tromey@adacore.com> | 2020-04-08 14:33:35 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2020-04-08 14:47:57 -0600 |
commit | e9534bd257ac9ea2f7921e8000d27c5dc4477b4e (patch) | |
tree | b35d6e3be01a4fea2dd0650cbcfd549ae5b8c872 /gdb/nat | |
parent | ae1f8880758d8087ad9fdb137d45c4abc1137b52 (diff) | |
download | gdb-e9534bd257ac9ea2f7921e8000d27c5dc4477b4e.zip gdb-e9534bd257ac9ea2f7921e8000d27c5dc4477b4e.tar.gz gdb-e9534bd257ac9ea2f7921e8000d27c5dc4477b4e.tar.bz2 |
Use new and delete for windows_thread_info
This adds a constructor, destructor, and member initializers to
windows_thread_info, and changes gdb and gdbserver to use new and
delete.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (windows_add_thread): Use new.
(windows_init_thread_list, windows_delete_thread): Use delete.
(get_windows_debug_event): Update.
* nat/windows-nat.h (struct windows_thread_info): Add constructor,
destructor, and initializers.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.c (child_add_thread): Use new.
(delete_thread_info): Use delete.
Diffstat (limited to 'gdb/nat')
-rw-r--r-- | gdb/nat/windows-nat.h | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/gdb/nat/windows-nat.h b/gdb/nat/windows-nat.h index 71df097..a3da268 100644 --- a/gdb/nat/windows-nat.h +++ b/gdb/nat/windows-nat.h @@ -25,6 +25,20 @@ each thread. */ struct windows_thread_info { + windows_thread_info (DWORD tid_, HANDLE h_, CORE_ADDR tlb) + : tid (tid_), + h (h_), + thread_local_base (tlb) + { + } + + ~windows_thread_info () + { + xfree (name); + } + + DISABLE_COPY_AND_ASSIGN (windows_thread_info); + /* The Win32 thread identifier. */ DWORD tid; @@ -35,17 +49,17 @@ struct windows_thread_info CORE_ADDR thread_local_base; /* Non zero if SuspendThread was called on this thread. */ - int suspended; + int suspended = 0; #ifdef _WIN32_WCE /* The context as retrieved right after suspending the thread. */ - CONTEXT base_context; + CONTEXT base_context {}; #endif /* The context of the thread, including any manipulations. */ union { - CONTEXT context; + CONTEXT context {}; #ifdef __x86_64__ WOW64_CONTEXT wow64_context; #endif @@ -53,14 +67,14 @@ struct windows_thread_info /* Whether debug registers changed since we last set CONTEXT back to the thread. */ - int debug_registers_changed; + int debug_registers_changed = 0; /* Nonzero if CONTEXT is invalidated and must be re-read from the inferior thread. */ - int reload_context; + int reload_context = 0; /* The name of the thread, allocated by xmalloc. */ - char *name; + char *name = nullptr; }; #endif |