From: Yao Qi <yao@codesourcery.com>
To: Tom Tromey <tromey@redhat.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH 5/5] move server.h to gdbthread.h.
Date: Thu, 19 Apr 2012 04:35:00 -0000 [thread overview]
Message-ID: <4F8F90F1.4020701@codesourcery.com> (raw)
In-Reply-To: <87wr5jwn2r.fsf@fleche.redhat.com>
On 04/14/2012 01:36 AM, Tom Tromey wrote:
>>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:
>
> Yao> diff --git a/gdb/gdbserver/gdbthread.h b/gdb/gdbserver/gdbthread.h
> Yao> new file mode 100644
> Yao> index 0000000..d42b6fd
> Yao> --- /dev/null
> Yao> +++ b/gdb/gdbserver/gdbthread.h
> Yao> @@ -0,0 +1,53 @@
> Yao> +#ifndef GDB_THREAD_H
> Yao> +#define GDB_THREAD_H
> Yao> +
>
> This one needs a copyright header too.
>
This version adds copyright header in gdbserver/gdbthread.h, and make
this patch as a standalone one, not depends on patch 3/5 and 4/5 anymore.
I'll commit next week if no objections.
--
gdb/gdbserver:
2012-04-19 Yao Qi <yao@codesourcery.com>
* server.h: Move some code to ...
* gdbthread.h: ... here. New.
* Makefile.in (inferiors.o, regcache.o): Depends on gdbthread.h
(remote-utils.o, server.o, target.o tracepoint.o): Likewise.
(nto-low.o, win32-low.o): Likewise.
* inferiors.c, linux-low.h, nto-low.c: Include gdbthread.h.
* regcache.c, remote-utils.c, server.c: Likewise.
* target.c, tracepoint.c, win32-low.c: Likewise.
---
gdb/gdbserver/Makefile.in | 19 ++++++-----
gdb/gdbserver/gdbthread.h | 71 ++++++++++++++++++++++++++++++++++++++++++
gdb/gdbserver/inferiors.c | 1 +
gdb/gdbserver/linux-low.h | 1 +
gdb/gdbserver/nto-low.c | 1 +
gdb/gdbserver/regcache.c | 1 +
gdb/gdbserver/remote-utils.c | 1 +
gdb/gdbserver/server.c | 1 +
gdb/gdbserver/server.h | 46 +--------------------------
gdb/gdbserver/tracepoint.c | 1 +
gdb/gdbserver/win32-low.c | 1 +
11 files changed, 91 insertions(+), 53 deletions(-)
create mode 100644 gdb/gdbserver/gdbthread.h
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index 7d29f85..39976b9 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -398,7 +398,8 @@ server_h = $(srcdir)/server.h $(regcache_h) config.h $(srcdir)/target.h \
$(ptid_h) \
$(signals_h)
-linux_low_h = $(srcdir)/linux-low.h
+gdbthread_h = $(srcdir)/gdbthread.h $(target_h) $(srcdir)/server.h
+linux_low_h = $(srcdir)/linux-low.h $(gdbthread_h)
linux_ptrace_h = $(srcdir)/../common/linux-ptrace.h
@@ -444,16 +445,16 @@ ax.o: ax.c $(server_h) $(ax_h) $(srcdir)/../common/ax.def
event-loop.o: event-loop.c $(server_h)
hostio.o: hostio.c $(server_h)
hostio-errno.o: hostio-errno.c $(server_h)
-inferiors.o: inferiors.c $(server_h)
+inferiors.o: inferiors.c $(server_h) $(gdbthread_h)
mem-break.o: mem-break.c $(server_h) $(ax_h)
proc-service.o: proc-service.c $(server_h) $(gdb_proc_service_h)
-regcache.o: regcache.c $(server_h) $(regdef_h)
-remote-utils.o: remote-utils.c terminal.h $(server_h)
-server.o: server.c $(server_h) $(agent_h)
-target.o: target.c $(server_h)
+regcache.o: regcache.c $(server_h) $(regdef_h) $(gdbthread_h)
+remote-utils.o: remote-utils.c terminal.h $(server_h) $(gdbthread_h)
+server.o: server.c $(server_h) $(agent_h) $(gdbthread_h)
+target.o: target.c $(server_h)
thread-db.o: thread-db.c $(server_h) $(linux_low_h) $(gdb_proc_service_h) \
$(gdb_thread_db_h)
-tracepoint.o: tracepoint.c $(server_h) $(ax_h) $(agent_h)
+tracepoint.o: tracepoint.c $(server_h) $(ax_h) $(agent_h) $(gdbthread_h)
utils.o: utils.c $(server_h)
gdbreplay.o: gdbreplay.c config.h
dll.o: dll.c $(server_h)
@@ -526,12 +527,12 @@ linux-xtensa-low.o: linux-xtensa-low.c xtensa-xtregs.c $(linux_low_h) $(server_h
lynx-low.o: lynx-low.c $(server_h) $(target_h) $(lynx_low_h)
lynx-ppc-low.o: lynx-ppc-low.c $(server_h) $(lynx_low_h)
-nto-low.o: nto-low.c $(server_h) $(nto_low_h)
+nto-low.o: nto-low.c $(server_h) $(nto_low_h) $(gdbthread_h)
nto-x86-low.o: nto-x86-low.c $(server_h) $(nto_low_h) $(regdef_h) $(regcache_h)
win32_low_h = $(srcdir)/win32-low.h
-win32-low.o: win32-low.c $(win32_low_h) $(server_h) $(regdef_h) $(regcache_h)
+win32-low.o: win32-low.c $(win32_low_h) $(server_h) $(regdef_h) $(regcache_h) $(gdbthread_h)
win32-arm-low.o: win32-arm-low.c $(win32_low_h) $(server_h)
win32-i386-low.o: win32-i386-low.c $(win32_low_h) $(server_h) $(i386_low_h)
diff --git a/gdb/gdbserver/gdbthread.h b/gdb/gdbserver/gdbthread.h
new file mode 100644
index 0000000..d863ec0
--- /dev/null
+++ b/gdb/gdbserver/gdbthread.h
@@ -0,0 +1,71 @@
+/* Multi-thread control defs for remote server for GDB.
+ Copyright (C) 1993, 1995, 1997-2000, 2002-2012 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/>. */
+
+#ifndef GDB_THREAD_H
+#define GDB_THREAD_H
+
+#include "server.h"
+
+struct thread_info
+{
+ struct inferior_list_entry entry;
+ void *target_data;
+ void *regcache_data;
+
+ /* The last resume GDB requested on this thread. */
+ enum resume_kind last_resume_kind;
+
+ /* The last wait status reported for this thread. */
+ struct target_waitstatus last_status;
+
+ /* Given `while-stepping', a thread may be collecting data for more
+ than one tracepoint simultaneously. E.g.:
+
+ ff0001 INSN1 <-- TP1, while-stepping 10 collect $regs
+ ff0002 INSN2
+ ff0003 INSN3 <-- TP2, collect $regs
+ ff0004 INSN4 <-- TP3, while-stepping 10 collect $regs
+ ff0005 INSN5
+
+ Notice that when instruction INSN5 is reached, the while-stepping
+ actions of both TP1 and TP3 are still being collected, and that TP2
+ had been collected meanwhile. The whole range of ff0001-ff0005
+ should be single-stepped, due to at least TP1's while-stepping
+ action covering the whole range.
+
+ On the other hand, the same tracepoint with a while-stepping action
+ may be hit by more than one thread simultaneously, hence we can't
+ keep the current step count in the tracepoint itself.
+
+ This is the head of the list of the states of `while-stepping'
+ tracepoint actions this thread is now collecting; NULL if empty.
+ Each item in the list holds the current step of the while-stepping
+ action. */
+ struct wstep_state *while_stepping;
+};
+
+extern struct inferior_list all_threads;
+
+void remove_thread (struct thread_info *thread);
+void add_thread (ptid_t ptid, void *target_data);
+
+struct thread_info *find_thread_ptid (ptid_t ptid);
+struct thread_info *gdb_id_to_thread (unsigned int);
+
+#endif /* GDB_THREAD_H */
diff --git a/gdb/gdbserver/inferiors.c b/gdb/gdbserver/inferiors.c
index 2b9169a..76abaf5 100644
--- a/gdb/gdbserver/inferiors.c
+++ b/gdb/gdbserver/inferiors.c
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include "server.h"
+#include "gdbthread.h"
struct inferior_list all_processes;
struct inferior_list all_threads;
diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h
index a1a6777..59b897e 100644
--- a/gdb/gdbserver/linux-low.h
+++ b/gdb/gdbserver/linux-low.h
@@ -22,6 +22,7 @@
#endif
#include <signal.h>
+#include "gdbthread.h"
#include "gdb_proc_service.h"
#ifdef HAVE_LINUX_REGSETS
diff --git a/gdb/gdbserver/nto-low.c b/gdb/gdbserver/nto-low.c
index eabee10..bfff825 100644
--- a/gdb/gdbserver/nto-low.c
+++ b/gdb/gdbserver/nto-low.c
@@ -19,6 +19,7 @@
#include "server.h"
+#include "gdbthread.h"
#include "nto-low.h"
#include <limits.h>
diff --git a/gdb/gdbserver/regcache.c b/gdb/gdbserver/regcache.c
index 5eda9df..5e4c149 100644
--- a/gdb/gdbserver/regcache.c
+++ b/gdb/gdbserver/regcache.c
@@ -19,6 +19,7 @@
#include "server.h"
#include "regdef.h"
+#include "gdbthread.h"
#include <stdlib.h>
#include <string.h>
diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
index 995e3b1..0b3adac 100644
--- a/gdb/gdbserver/remote-utils.c
+++ b/gdb/gdbserver/remote-utils.c
@@ -19,6 +19,7 @@
#include "server.h"
#include "terminal.h"
#include "target.h"
+#include "gdbthread.h"
#include <stdio.h>
#include <string.h>
#if HAVE_SYS_IOCTL_H
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 23c9d47..b3d1b41 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -18,6 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "server.h"
+#include "gdbthread.h"
#include "agent.h"
#if HAVE_UNISTD_H
diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h
index 7f4c51a..225d07e 100644
--- a/gdb/gdbserver/server.h
+++ b/gdb/gdbserver/server.h
@@ -145,44 +145,7 @@ struct regcache;
#include "gdb_signals.h"
#include "target.h"
#include "mem-break.h"
-
-struct thread_info
-{
- struct inferior_list_entry entry;
- void *target_data;
- void *regcache_data;
-
- /* The last resume GDB requested on this thread. */
- enum resume_kind last_resume_kind;
-
- /* The last wait status reported for this thread. */
- struct target_waitstatus last_status;
-
- /* Given `while-stepping', a thread may be collecting data for more
- than one tracepoint simultaneously. E.g.:
-
- ff0001 INSN1 <-- TP1, while-stepping 10 collect $regs
- ff0002 INSN2
- ff0003 INSN3 <-- TP2, collect $regs
- ff0004 INSN4 <-- TP3, while-stepping 10 collect $regs
- ff0005 INSN5
-
- Notice that when instruction INSN5 is reached, the while-stepping
- actions of both TP1 and TP3 are still being collected, and that TP2
- had been collected meanwhile. The whole range of ff0001-ff0005
- should be single-stepped, due to at least TP1's while-stepping
- action covering the whole range.
-
- On the other hand, the same tracepoint with a while-stepping action
- may be hit by more than one thread simultaneously, hence we can't
- keep the current step count in the tracepoint itself.
-
- This is the head of the list of the states of `while-stepping'
- tracepoint actions this thread is now collecting; NULL if empty.
- Each item in the list holds the current step of the while-stepping
- action. */
- struct wstep_state *while_stepping;
-};
+#include "gdbthread.h"
struct dll_info
{
@@ -239,7 +202,6 @@ void initialize_low ();
/* From inferiors.c. */
extern struct inferior_list all_processes;
-extern struct inferior_list all_threads;
extern struct inferior_list all_dlls;
extern int dlls_changed;
extern void clear_dlls (void);
@@ -252,8 +214,6 @@ void for_each_inferior (struct inferior_list *list,
extern struct thread_info *current_inferior;
void remove_inferior (struct inferior_list *list,
struct inferior_list_entry *entry);
-void remove_thread (struct thread_info *thread);
-void add_thread (ptid_t ptid, void *target_data);
struct process_info *add_process (int pid, int attached);
void remove_process (struct process_info *process);
@@ -261,12 +221,10 @@ struct process_info *find_process_pid (int pid);
int have_started_inferiors_p (void);
int have_attached_inferiors_p (void);
-struct thread_info *find_thread_ptid (ptid_t ptid);
-
ptid_t thread_id_to_gdb_id (ptid_t);
ptid_t thread_to_gdb_id (struct thread_info *);
ptid_t gdb_id_to_thread_id (ptid_t);
-struct thread_info *gdb_id_to_thread (unsigned int);
+
void clear_inferiors (void);
struct inferior_list_entry *find_inferior
(struct inferior_list *,
diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index 959dba0..6e59650 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -17,6 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "server.h"
+#include "gdbthread.h"
#include "agent.h"
#include <ctype.h>
diff --git a/gdb/gdbserver/win32-low.c b/gdb/gdbserver/win32-low.c
index 3e10490..315d449 100644
--- a/gdb/gdbserver/win32-low.c
+++ b/gdb/gdbserver/win32-low.c
@@ -24,6 +24,7 @@
#include "gdb/fileio.h"
#include "mem-break.h"
#include "win32-low.h"
+#include "gdbthread.h"
#include <stdint.h>
#include <windows.h>
--
1.7.0.4
next prev parent reply other threads:[~2012-04-19 4:14 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-16 15:01 [PATCH 0/5] Preparatory patches for ITSET in GDBserver Yao Qi
2012-03-16 15:01 ` [PATCH 1/5] Define target_core_of_thread in gdbserver Yao Qi
2012-03-16 15:01 ` [PATCH 4/5] move server.h to inferior.h Yao Qi
2012-04-13 17:37 ` Tom Tromey
2012-03-16 15:01 ` [PATCH 3/5] s/struct process_info/struct inferior/ Yao Qi
2012-03-20 16:28 ` Doug Evans
2012-03-20 17:55 ` Pedro Alves
2012-03-20 21:31 ` Doug Evans
2012-03-21 4:27 ` Yao Qi
2012-03-21 3:18 ` Yao Qi
2012-03-16 15:02 ` [PATCH 5/5] move server.h to gdbthread.h Yao Qi
2012-04-13 17:43 ` Tom Tromey
2012-04-19 4:35 ` Yao Qi [this message]
2012-04-29 6:46 ` [committed]: " Yao Qi
2012-03-16 15:02 ` [PATCH 2/5] Move vec to common/ Yao Qi
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=4F8F90F1.4020701@codesourcery.com \
--to=yao@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@redhat.com \
/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