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/windows-nat.c | |
parent | ae1f8880758d8087ad9fdb137d45c4abc1137b52 (diff) | |
download | fsf-binutils-gdb-e9534bd257ac9ea2f7921e8000d27c5dc4477b4e.zip fsf-binutils-gdb-e9534bd257ac9ea2f7921e8000d27c5dc4477b4e.tar.gz fsf-binutils-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/windows-nat.c')
-rw-r--r-- | gdb/windows-nat.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 9368396..715cf60 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -468,16 +468,14 @@ windows_add_thread (ptid_t ptid, HANDLE h, void *tlb, bool main_thread_p) if ((th = thread_rec (id, FALSE))) return th; - th = XCNEW (windows_thread_info); - th->tid = id; - th->h = h; - th->thread_local_base = (CORE_ADDR) (uintptr_t) tlb; + CORE_ADDR base = (CORE_ADDR) (uintptr_t) tlb; #ifdef __x86_64__ /* For WOW64 processes, this is actually the pointer to the 64bit TIB, and the 32bit TIB is exactly 2 pages after it. */ if (wow64_process) - th->thread_local_base += 0x2000; + base += 0x2000; #endif + th = new windows_thread_info (id, h, base); thread_list.push_back (th); /* Add this new thread to the list of threads. @@ -536,7 +534,7 @@ windows_init_thread_list (void) init_thread_list (); for (windows_thread_info *here : thread_list) - xfree (here); + delete here; thread_list.clear (); } @@ -581,8 +579,7 @@ windows_delete_thread (ptid_t ptid, DWORD exit_code, bool main_thread_p) if (iter != thread_list.end ()) { - xfree ((*iter)->name); - xfree (*iter); + delete *iter; thread_list.erase (iter); } } @@ -1718,7 +1715,7 @@ windows_nat_target::get_windows_debug_event (int pid, BOOL debug_event; DWORD continue_status, event_code; windows_thread_info *th; - static windows_thread_info dummy_thread_info; + static windows_thread_info dummy_thread_info (0, 0, 0); DWORD thread_id = 0; last_sig = GDB_SIGNAL_0; |