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:58 -0600 |
commit | 28688adf8f883fdd8b642a446ec5578236e84b1e (patch) | |
tree | 2183e5c7e4a1f52946c5d2c7b6d4bf1deeff1d09 /gdbserver/win32-low.cc | |
parent | 4834dad062658ef49ef86c9c48eb004c48a242a5 (diff) | |
download | gdb-28688adf8f883fdd8b642a446ec5578236e84b1e.zip gdb-28688adf8f883fdd8b642a446ec5578236e84b1e.tar.gz gdb-28688adf8f883fdd8b642a446ec5578236e84b1e.tar.bz2 |
Share thread_rec between gdb and gdbserver
This changes gdb and gdbserver to use the same calling convention for
the "thread_rec" helper function. Fully merging these is difficult
due to differences in how threads are managed by the enclosing
applications; but sharing a declaration makes it possible for future
shared code to call this method.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (enum thread_disposition_type): Move to
nat/windows-nat.h.
(windows_nat::thread_rec): Rename from thread_rec. No longer
static.
(windows_add_thread, windows_nat_target::fetch_registers)
(windows_nat_target::store_registers, handle_exception)
(windows_nat_target::resume, get_windows_debug_event)
(windows_nat_target::get_tib_address)
(windows_nat_target::thread_name)
(windows_nat_target::thread_alive): Update.
* nat/windows-nat.h (enum thread_disposition_type): Move from
windows-nat.c.
(thread_rec): Declare.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.c (windows_nat::thread_rec): Rename from thread_rec.
No longer static. Change parameters.
(child_add_thread, child_fetch_inferior_registers)
(child_store_inferior_registers, win32_resume)
(win32_get_tib_address): Update.
Diffstat (limited to 'gdbserver/win32-low.cc')
-rw-r--r-- | gdbserver/win32-low.cc | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/gdbserver/win32-low.cc b/gdbserver/win32-low.cc index 8f8b6ce..1e86b3b 100644 --- a/gdbserver/win32-low.cc +++ b/gdbserver/win32-low.cc @@ -178,17 +178,17 @@ win32_require_context (windows_thread_info *th) } } -/* Find a thread record given a thread id. If GET_CONTEXT is set then - also retrieve the context for this thread. */ -static windows_thread_info * -thread_rec (ptid_t ptid, int get_context) +/* See nat/windows-nat.h. */ + +windows_thread_info * +windows_nat::thread_rec (ptid_t ptid, thread_disposition_type disposition) { thread_info *thread = find_thread_ptid (ptid); if (thread == NULL) return NULL; windows_thread_info *th = (windows_thread_info *) thread_target_data (thread); - if (get_context) + if (disposition != DONT_INVALIDATE_CONTEXT) win32_require_context (th); return th; } @@ -200,7 +200,7 @@ child_add_thread (DWORD pid, DWORD tid, HANDLE h, void *tlb) windows_thread_info *th; ptid_t ptid = ptid_t (pid, tid, 0); - if ((th = thread_rec (ptid, FALSE))) + if ((th = thread_rec (ptid, DONT_INVALIDATE_CONTEXT))) return th; th = new windows_thread_info (tid, h, (CORE_ADDR) (uintptr_t) tlb); @@ -454,7 +454,8 @@ static void child_fetch_inferior_registers (struct regcache *regcache, int r) { int regno; - windows_thread_info *th = thread_rec (current_thread_ptid (), TRUE); + windows_thread_info *th = thread_rec (current_thread_ptid (), + INVALIDATE_CONTEXT); if (r == -1 || r > NUM_REGS) child_fetch_inferior_registers (regcache, NUM_REGS); else @@ -468,7 +469,8 @@ static void child_store_inferior_registers (struct regcache *regcache, int r) { int regno; - windows_thread_info *th = thread_rec (current_thread_ptid (), TRUE); + windows_thread_info *th = thread_rec (current_thread_ptid (), + INVALIDATE_CONTEXT); if (r == -1 || r == 0 || r > NUM_REGS) child_store_inferior_registers (regcache, NUM_REGS); else @@ -937,7 +939,7 @@ win32_process_target::resume (thread_resume *resume_info, size_t n) /* Get context for the currently selected thread. */ ptid = debug_event_ptid (¤t_event); - th = thread_rec (ptid, FALSE); + th = thread_rec (ptid, DONT_INVALIDATE_CONTEXT); if (th) { win32_prepare_to_resume (th); @@ -1807,7 +1809,7 @@ int win32_process_target::get_tib_address (ptid_t ptid, CORE_ADDR *addr) { windows_thread_info *th; - th = thread_rec (ptid, 0); + th = thread_rec (ptid, DONT_INVALIDATE_CONTEXT); if (th == NULL) return 0; if (addr != NULL) |