From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 20/22] [GDBserver] Multi-process + multi-arch: Windows
Date: Wed, 29 May 2013 17:22:00 -0000 [thread overview]
Message-ID: <20130529163014.24586.2942.stgit@brno.lan> (raw)
In-Reply-To: <20130529162434.24586.5697.stgit@brno.lan>
This adjusts the Windows ports to new interfaces.
Previously cross built for i386 mingw32, and smoke tested under Wine.
(yep, GDBserver does work under Wine these days.) Rechecked that
GDBserver still builds.
2013-05-29 Pedro Alves <palves@redhat.com>
* win32-arm-low.c (tdesc_arm): Declare.
(arm_arch_setup): New function.
(the_low_target): Install arm_arch_setup instead of
init_registers_arm.
* win32-i386-low.c (tdesc_i386, tdesc_amd64): Declare.
(init_windows_x86): Rename to ...
(i386_arch_setup): ... this. Set `win32_tdesc'.
(the_low_target): Adjust.
* win32-low.c (win32_tdesc): New global.
(child_add_thread): Don't create the thread cache here.
(do_initial_child_stuff): Set the new process'es tdesc.
* win32-low.h (struct target_desc): Forward declare.
(win32_tdesc): Declare.
---
gdb/gdbserver/win32-arm-low.c | 11 +++++++++--
gdb/gdbserver/win32-i386-low.c | 8 ++++++--
gdb/gdbserver/win32-low.c | 10 ++++++----
gdb/gdbserver/win32-low.h | 6 ++++++
4 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/gdb/gdbserver/win32-arm-low.c b/gdb/gdbserver/win32-arm-low.c
index 09ac1da..1c8e308 100644
--- a/gdb/gdbserver/win32-arm-low.c
+++ b/gdb/gdbserver/win32-arm-low.c
@@ -24,7 +24,7 @@
/* Defined in auto-generated file reg-arm.c. */
void init_registers_arm (void);
-
+extern struct target_desc *tdesc_arm;
static void
arm_get_thread_context (win32_thread_info *th, DEBUG_EVENT* current_event)
@@ -108,12 +108,19 @@ arm_store_inferior_register (struct regcache *regcache,
collect_register (regcache, r, regptr (&th->context, r));
}
+static void
+arm_arch_setup (void)
+{
+ init_registers_arm ();
+ win32_tdesc = tdesc_arm;
+}
+
/* Correct in either endianness. We do not support Thumb yet. */
static const unsigned long arm_wince_breakpoint = 0xe6000010;
#define arm_wince_breakpoint_len 4
struct win32_target_ops the_low_target = {
- init_registers_arm,
+ arm_arch_setup,
sizeof (mappings) / sizeof (mappings[0]),
NULL, /* initial_stuff */
arm_get_thread_context,
diff --git a/gdb/gdbserver/win32-i386-low.c b/gdb/gdbserver/win32-i386-low.c
index 1db9393..0237653 100644
--- a/gdb/gdbserver/win32-i386-low.c
+++ b/gdb/gdbserver/win32-i386-low.c
@@ -31,9 +31,11 @@
#ifdef __x86_64__
/* Defined in auto-generated file reg-amd64.c. */
void init_registers_amd64 (void);
+extern struct target_desc *tdesc_amd64;
#else
/* Defined in auto-generated file reg-i386.c. */
void init_registers_i386 (void);
+extern struct target_desc *tdesc_i386;
#endif
static struct i386_debug_reg_state debug_reg_state;
@@ -399,17 +401,19 @@ static const unsigned char i386_win32_breakpoint = 0xcc;
#define i386_win32_breakpoint_len 1
static void
-init_windows_x86 (void)
+i386_arch_setup (void)
{
#ifdef __x86_64__
init_registers_amd64 ();
+ win32_tdesc = tdesc_amd64;
#else
init_registers_i386 ();
+ win32_tdesc = tdesc_i386;
#endif
}
struct win32_target_ops the_low_target = {
- init_windows_x86,
+ i386_arch_setup,
sizeof (mappings) / sizeof (mappings[0]),
i386_initial_stuff,
i386_get_thread_context,
diff --git a/gdb/gdbserver/win32-low.c b/gdb/gdbserver/win32-low.c
index 2cb5465..a38008a 100644
--- a/gdb/gdbserver/win32-low.c
+++ b/gdb/gdbserver/win32-low.c
@@ -87,6 +87,8 @@ static int soft_interrupt_requested = 0;
by suspending all the threads. */
static int faked_breakpoint = 0;
+struct target_desc *win32_tdesc;
+
#define NUM_REGS (the_low_target.num_regs)
typedef BOOL WINAPI (*winapi_DebugActiveProcessStop) (DWORD dwProcessId);
@@ -193,9 +195,6 @@ child_add_thread (DWORD pid, DWORD tid, HANDLE h, void *tlb)
th->thread_local_base = (CORE_ADDR) (uintptr_t) tlb;
add_thread (ptid, th);
- set_inferior_regcache_data ((struct thread_info *)
- find_inferior_id (&all_threads, ptid),
- new_register_cache ());
if (the_low_target.thread_added != NULL)
(*the_low_target.thread_added) (th);
@@ -308,6 +307,8 @@ child_init_thread_list (void)
static void
do_initial_child_stuff (HANDLE proch, DWORD pid, int attached)
{
+ struct process_info *proc;
+
last_sig = GDB_SIGNAL_0;
current_process_handle = proch;
@@ -319,7 +320,8 @@ do_initial_child_stuff (HANDLE proch, DWORD pid, int attached)
memset (¤t_event, 0, sizeof (current_event));
- add_process (pid, attached);
+ proc = add_process (pid, attached);
+ proc->tdesc = win32_tdesc;
child_init_thread_list ();
if (the_low_target.initial_stuff != NULL)
diff --git a/gdb/gdbserver/win32-low.h b/gdb/gdbserver/win32-low.h
index 4f262c2..4a5acee 100644
--- a/gdb/gdbserver/win32-low.h
+++ b/gdb/gdbserver/win32-low.h
@@ -18,6 +18,12 @@
#include <windows.h>
+struct target_desc;
+
+/* The inferior's target description. This is a global because the
+ Windows ports support neither bi-arch nor multi-process. */
+extern struct target_desc *win32_tdesc;
+
/* Thread information structure used to track extra information about
each thread. */
typedef struct win32_thread_info
next prev parent reply other threads:[~2013-05-29 17:22 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-29 16:24 [PATCH 00/22] [GDBserver] Multi-process + multi-arch Pedro Alves
2013-05-29 16:25 ` [PATCH 01/22] [GDBserver] Multi-process + multi-arch: core + GNU/Linux x86* Pedro Alves
2013-05-29 19:03 ` Tom Tromey
2013-05-30 12:01 ` Pedro Alves
2013-05-29 16:25 ` [PATCH 02/22] [GDBserver] Multi-process + multi-arch: GNU/Linux IA64 Pedro Alves
2013-05-29 16:25 ` [PATCH 03/22] [GDBserver] Multi-process + multi-arch: GNU/Linux SPARC Pedro Alves
2013-05-29 16:25 ` [PATCH 04/22] [GDBserver] Multi-process + multi-arch: GNU/Linux PowerPC Pedro Alves
2013-05-29 16:26 ` [PATCH 06/22] [GDBserver] Multi-process + multi-arch: GNU/Linux MIPS Pedro Alves
2013-05-29 16:26 ` [PATCH 05/22] [GDBserver] Multi-process + multi-arch: GNU/Linux S/390 Pedro Alves
2013-05-29 16:26 ` [PATCH 07/22] [GDBserver] Multi-process + multi-arch: GNU/Linux ARM Pedro Alves
2013-05-29 16:27 ` [PATCH 09/22] [GDBserver] Multi-process + multi-arch: GNU/Linux SH Pedro Alves
2013-05-29 16:27 ` [PATCH 10/22] [GDBserver] Multi-process + multi-arch: GNU/Linux Blackfin Pedro Alves
2013-05-29 16:27 ` [PATCH 11/22] [GDBserver] Multi-process + multi-arch: GNU/Linux CRIS Pedro Alves
2013-05-29 16:27 ` [PATCH 08/22] [GDBserver] Multi-process + multi-arch: GNU/Linux m68k Pedro Alves
2013-05-29 16:28 ` [PATCH 15/22] [GDBserver] Multi-process + multi-arch: GNU/Linux Xtensa Pedro Alves
2013-05-29 16:28 ` [PATCH 14/22] [GDBserver] Multi-process + multi-arch: GNU/Linux TI C6x Pedro Alves
2013-05-29 16:28 ` [PATCH 12/22] [GDBserver] Multi-process + multi-arch: GNU/Linux CRISv32 Pedro Alves
2013-05-29 16:28 ` [PATCH 13/22] [GDBserver] Multi-process + multi-arch: GNU/Linux M32R Pedro Alves
2013-05-29 16:29 ` [PATCH 16/22] [GDBserver] Multi-process + multi-arch: GNU/Linux Nios 2 Pedro Alves
2013-05-29 16:29 ` [PATCH 18/22] [GDBserver] Multi-process + multi-arch: GNU/Linux TILE-Gx Pedro Alves
2013-05-29 16:29 ` [PATCH 17/22] [GDBserver] Multi-process + multi-arch: GNU/Linux Aarch64 Pedro Alves
2013-05-29 16:30 ` [PATCH 19/22] [GDBserver] Multi-process + multi-arch: SPU Pedro Alves
2013-05-29 16:30 ` [PATCH 21/22] [GDBserver] Multi-process + multi-arch: LynxOS Pedro Alves
2013-05-29 16:30 ` [PATCH 22/22] [GDBserver] Multi-process + multi-arch: QNX NTO Pedro Alves
2013-05-29 17:22 ` Pedro Alves [this message]
2013-05-29 17:29 ` [PATCH 00/22] [GDBserver] Multi-process + multi-arch Pedro Alves
2013-05-30 12:13 [PATCH 00/22 v3] " Pedro Alves
2013-05-30 12:16 ` [PATCH 20/22] [GDBserver] Multi-process + multi-arch: Windows Pedro Alves
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=20130529163014.24586.2942.stgit@brno.lan \
--to=palves@redhat.com \
--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