* 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.
+
+ * 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.
+
* linux-low.h (PTRACE_ARG3_TYPE): Move macro from linux-low.c.
$(signals_h) \
$(generated_files)
-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
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)
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)
--- /dev/null
+/* 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 */
#include <stdlib.h>
#include "server.h"
+#include "gdbthread.h"
struct inferior_list all_processes;
struct inferior_list all_threads;
#endif
#include <signal.h>
+#include "gdbthread.h"
#include "gdb_proc_service.h"
#define PTRACE_ARG3_TYPE void *
#include "server.h"
+#include "gdbthread.h"
#include "nto-low.h"
#include <limits.h>
#include "server.h"
#include "regdef.h"
+#include "gdbthread.h"
#include <stdlib.h>
#include <string.h>
#include "server.h"
#include "terminal.h"
#include "target.h"
+#include "gdbthread.h"
#include <stdio.h>
#include <string.h>
#if HAVE_SYS_IOCTL_H
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
#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
{
/* 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);
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);
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 *,
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "server.h"
+#include "gdbthread.h"
#include "agent.h"
#include <ctype.h>
#include "gdb/fileio.h"
#include "mem-break.h"
#include "win32-low.h"
+#include "gdbthread.h"
#include <stdint.h>
#include <windows.h>