aboutsummaryrefslogtreecommitdiff
path: root/gdbserver/win32-low.h
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2022-04-05 13:22:16 -0600
committerTom Tromey <tromey@adacore.com>2022-06-07 11:44:53 -0600
commit20489cca9058f4823ee1c913ab1fbaabea4d4f8d (patch)
tree4a6f7c55a3f6ade63f3a9834600a83ae1c65fa0c /gdbserver/win32-low.h
parent551765020680c23de7641577e72d88083c50194d (diff)
downloadgdb-20489cca9058f4823ee1c913ab1fbaabea4d4f8d.zip
gdb-20489cca9058f4823ee1c913ab1fbaabea4d4f8d.tar.gz
gdb-20489cca9058f4823ee1c913ab1fbaabea4d4f8d.tar.bz2
Use subclasses of windows_process_info
This changes windows_process_info to use virtual methods for its callbacks, and then changes the two clients of this code to subclass this class to implement the methods. I considered using CRTP here, but that would require making the new structures visible to the compilation of of nat/windows-nat.c. This seemed like a bit of a pain, so I didn't do it. This change then lets us change all the per-inferior globals to be members of the new subclass. Note that there can still only be a single inferior -- currently there's a single global of the new type. This is just another step toward possibly implementing multi-inferior for Windows. It's possible this could be cleaned up further... ideally I'd like to move more of the data into the base class. However, because gdb supports Cygwin and gdbserver does not, and because I don't have a way to build or test Cygwin, larger refactorings are difficult.
Diffstat (limited to 'gdbserver/win32-low.h')
-rw-r--r--gdbserver/win32-low.h35
1 files changed, 34 insertions, 1 deletions
diff --git a/gdbserver/win32-low.h b/gdbserver/win32-low.h
index b29e8b3..58bb105 100644
--- a/gdbserver/win32-low.h
+++ b/gdbserver/win32-low.h
@@ -172,8 +172,41 @@ public:
}
};
+struct gdbserver_windows_process : public windows_nat::windows_process_info
+{
+ windows_nat::windows_thread_info *thread_rec
+ (ptid_t ptid,
+ windows_nat::thread_disposition_type disposition) override;
+ int handle_output_debug_string (struct target_waitstatus *ourstatus) override;
+ void handle_load_dll (const char *dll_name, LPVOID base) override;
+ void handle_unload_dll () override;
+ bool handle_access_violation (const EXCEPTION_RECORD *rec) override;
+
+ int attaching = 0;
+
+ /* A status that hasn't been reported to the core yet, and so
+ win32_wait should return it next, instead of fetching the next
+ debug event off the win32 API. */
+ struct target_waitstatus cached_status;
+
+ /* Non zero if an interrupt request is to be satisfied by suspending
+ all threads. */
+ int soft_interrupt_requested = 0;
+
+ /* Non zero if the inferior is stopped in a simulated breakpoint done
+ by suspending all the threads. */
+ int faked_breakpoint = 0;
+
+ /* True if current_process_handle needs to be closed. */
+ bool open_process_used = false;
+
+ /* Zero during the child initialization phase, and nonzero
+ otherwise. */
+ int child_initialization_done = 0;
+};
+
/* The sole Windows process. */
-extern windows_nat::windows_process_info windows_process;
+extern gdbserver_windows_process windows_process;
/* Retrieve the context for this thread, if not already retrieved. */
extern void win32_require_context (windows_nat::windows_thread_info *th);