Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Hannes Domani <ssbssa@yahoo.de>
To: gdb-patches@sourceware.org
Subject: [PATCH v2 04/11] Create x86-windows-nat.c
Date: Sat, 17 Jan 2026 14:36:15 +0100	[thread overview]
Message-ID: <20260117134052.2660009-4-ssbssa@yahoo.de> (raw)
In-Reply-To: <20260117134052.2660009-1-ssbssa@yahoo.de>

Also creates the x86_windows_per_inferior and x86_windows_nat_target
derived classes in there which will then hold the arch-specific data and
function overrides.
---
Changes in v2:
  - kept windows_process variable in windows-nat.c and initialized it
    in INIT_GDB_FILE(x86_windows_nat)
---
 gdb/Makefile.in       |  1 +
 gdb/configure.nat     | 12 ++++++++----
 gdb/windows-nat.c     |  7 +------
 gdb/x86-windows-nat.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 52 insertions(+), 10 deletions(-)
 create mode 100644 gdb/x86-windows-nat.c

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 161e8128e98..b564048f9fa 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1985,6 +1985,7 @@ ALLDEPFILES = \
 	x86-gnu-nat.c \
 	x86-nat.c \
 	x86-tdep.c \
+	x86-windows-nat.c \
 	xstormy16-tdep.c \
 	xtensa-config.c \
 	xtensa-linux-nat.c \
diff --git a/gdb/configure.nat b/gdb/configure.nat
index 1325d584bea..3ac0319328f 100644
--- a/gdb/configure.nat
+++ b/gdb/configure.nat
@@ -128,7 +128,8 @@ case ${gdb_host} in
 	    i386)
 		# Native config information for GDB on i386
 		# systems running Cygwin.
-		NATDEPFILES="${NATDEPFILES} i386-windows-nat.o"
+		NATDEPFILES="${NATDEPFILES} i386-windows-nat.o \
+		x86-windows-nat.o"
 		;;
 	esac
 	;;
@@ -137,7 +138,8 @@ case ${gdb_host} in
 	    i386)
 		# Native config information for GDB on amd64
 		# systems running Cygwin.
-		NATDEPFILES="${NATDEPFILES} i386-windows-nat.o amd64-windows-nat.o"
+		NATDEPFILES="${NATDEPFILES} i386-windows-nat.o \
+		amd64-windows-nat.o x86-windows-nat.o"
 		;;
 	esac
 	;;
@@ -361,14 +363,16 @@ case ${gdb_host} in
     mingw)
 	case ${gdb_host_cpu} in
 	    i386)
-		NATDEPFILES="${NATDEPFILES} i386-windows-nat.o"
+		NATDEPFILES="${NATDEPFILES} i386-windows-nat.o \
+		x86-windows-nat.o"
 		;;
 	esac
 	;;
     mingw64)
 	case ${gdb_host_cpu} in
 	    i386)
-		NATDEPFILES="${NATDEPFILES} i386-windows-nat.o amd64-windows-nat.o"
+		NATDEPFILES="${NATDEPFILES} i386-windows-nat.o \
+		amd64-windows-nat.o x86-windows-nat.o"
 		;;
 	esac
 	;;
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 7fdd6cf81b5..68eebe1eaf9 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -73,8 +73,7 @@
 using namespace windows_nat;
 
 /* The current process.  */
-static windows_per_inferior x86_windows_process;
-windows_per_inferior *windows_process = &x86_windows_process;
+windows_per_inferior *windows_process;
 
 #undef STARTUPINFO
 
@@ -2868,10 +2867,6 @@ INIT_GDB_FILE (windows_nat)
      calling x86_set_debug_register_length function
      in processor windows specific native file.  */
 
-  /* The target is not a global specifically to avoid a C++ "static
-     initializer fiasco" situation.  */
-  add_inf_child_target (new x86_nat_target<windows_nat_target>);
-
 #ifdef __CYGWIN__
   cygwin_internal (CW_SET_DOS_FILE_WARNING, 0);
 #endif
diff --git a/gdb/x86-windows-nat.c b/gdb/x86-windows-nat.c
new file mode 100644
index 00000000000..d1f78a01255
--- /dev/null
+++ b/gdb/x86-windows-nat.c
@@ -0,0 +1,42 @@
+/* Native-dependent code for Windows x86 (i386 and x86-64).
+
+   Copyright (C) 2025-2026 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include "windows-nat.h"
+
+#include "x86-nat.h"
+
+struct x86_windows_per_inferior : public windows_per_inferior
+{
+};
+
+struct x86_windows_nat_target final : public x86_nat_target<windows_nat_target>
+{
+};
+
+/* The current process.  */
+static x86_windows_per_inferior x86_windows_process;
+
+INIT_GDB_FILE (x86_windows_nat)
+{
+  /* The target is not a global specifically to avoid a C++ "static
+     initializer fiasco" situation.  */
+  add_inf_child_target (new x86_windows_nat_target);
+
+  windows_process = &x86_windows_process;
+}
-- 
2.52.0


  parent reply	other threads:[~2026-01-17 13:42 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260117134052.2660009-1-ssbssa.ref@yahoo.de>
2026-01-17 13:36 ` [PATCH v2 01/11] Remove duplicate code from windows_nat_target::resume Hannes Domani
2026-01-17 13:36   ` [PATCH v2 02/11] Simplify windows_nat_target::resume Hannes Domani
2026-01-19 13:55     ` Schimpe, Christina
2026-01-21 15:42       ` Tom Tromey
2026-01-23 19:11       ` Hannes Domani
2026-01-17 13:36   ` [PATCH v2 03/11] Move struct declarations into windows-nat.h Hannes Domani
2026-01-17 13:36   ` Hannes Domani [this message]
2026-01-21 15:38     ` [PATCH v2 04/11] Create x86-windows-nat.c Tom Tromey
2026-01-17 13:36   ` [PATCH v2 05/11] Move x86 debug registers and related code into x86-windows-nat.c Hannes Domani
2026-01-19 12:49     ` Schimpe, Christina
2026-01-20 15:49       ` Hannes Domani
2026-01-21  8:06         ` Schimpe, Christina
2026-01-23 13:17     ` [PATCH v3] " Hannes Domani
2026-01-23 18:50       ` Tom Tromey
2026-01-23 19:20         ` Hannes Domani
2026-01-23 19:56           ` Tom Tromey
2026-01-17 13:36   ` [PATCH v2 06/11] Move x86 register " Hannes Domani
2026-01-19 12:50     ` Schimpe, Christina
2026-01-17 13:36   ` [PATCH v2 07/11] Move x86 selector " Hannes Domani
2026-01-19 13:56     ` Schimpe, Christina
2026-01-17 13:36   ` [PATCH v2 08/11] Move software breakpoint recognition " Hannes Domani
2026-01-19 12:51     ` Schimpe, Christina
2026-01-21 15:43       ` Tom Tromey
2026-01-23 19:12         ` Hannes Domani
2026-01-17 13:36   ` [PATCH v2 09/11] Move auto_wide_charset gdbarch method to windows-tdep Hannes Domani
2026-01-17 13:36   ` [PATCH v2 10/11] Move setting size of long " Hannes Domani
2026-01-21 15:47     ` Tom Tromey
2026-01-17 13:54   ` [PATCH v2 04/11] Create x86-windows-nat.c Hannes Domani
2026-01-17 14:01     ` Hannes Domani
2026-01-17 14:14       ` Hannes Domani
2026-01-17 15:04       ` Simon Marchi
2026-01-17 15:15         ` Hannes Domani
2026-01-17 13:54   ` [PATCH v2 05/11] Move x86 debug registers and related code into x86-windows-nat.c Hannes Domani
2026-01-17 13:54   ` [PATCH v2 06/11] Move x86 register " Hannes Domani
2026-01-21 16:08     ` Tom Tromey
2026-01-17 13:54   ` [PATCH v2 09/11] Move auto_wide_charset gdbarch method to windows-tdep Hannes Domani
2026-01-21 15:48     ` Tom Tromey
2026-01-23 19:13       ` Hannes Domani
2026-01-17 13:54   ` [PATCH v2 10/11] Move setting size of long " Hannes Domani
2026-01-21 15:59     ` Tom Tromey
2026-01-17 13:54   ` [PATCH v2 11/11] Add aarch64-windows support Hannes Domani
2026-01-17 16:04     ` Eli Zaretskii
2026-01-21 16:18     ` Tom Tromey
2026-01-23 19:14       ` Hannes Domani

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260117134052.2660009-4-ssbssa@yahoo.de \
    --to=ssbssa@yahoo.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox