public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Refactor common/target-common into meaningful bits
@ 2013-08-01 17:09 Luis Machado
  2013-08-01 17:50 ` Tom Tromey
  2013-08-16 14:49 ` Luis Machado
  0 siblings, 2 replies; 16+ messages in thread
From: Luis Machado @ 2013-08-01 17:09 UTC (permalink / raw)
  To: 'gdb-patches@sourceware.org', Pedro Alves, Tom Tromey

[-- Attachment #1: Type: text/plain, Size: 1108 bytes --]

Hi,

After the previous discussion 
(http://sourceware.org/ml/gdb-patches/2013-07/msg00840.html), follows a 
patch to refactor the ill-named target-common.[c|h] files into something 
a bit more meaningful.

First, it seems like a good idea to stablish a  more meaningful 
directory structure as well, so we are moving target-common.[c|h] from 
the "common" dir to the new "target" dir. This new directory will hold 
anything more backend-related. For now it contains only generic target 
definitions and functions.

I've broken target-common.[c|h] into the following:

- target-resume.h: Definition for resume_kind.

- target-waitstatus.[c|h]: Definitions and code for anything related to 
waitstatus.

- target-wait.h: A tiny bit that does not seem to fit properly in the 
waitstatus files, so it is left here.

As usual, Makefile and other dependencies have been adjusted. Everything 
builds fine and does not show any regressions.

The copyright headers have been adjusted and cleaned up to remove 
contribution messages.

Comments over 70 columns have also been adjusted for this patch.

Thoughts?

Luis

[-- Attachment #2: cleanup.diff --]
[-- Type: text/x-patch, Size: 25093 bytes --]

2013-08-01  Luis Machado  <lgustavo@codesourcery.com>

	gdb/
	* Makefile.in (GDB_CFLAGS): Add -I$(srcdir)/target.
	(SFILES): Remove common/target-common.c and add
	target/target-waitstatus.c.
	(HFILES_NO_SRCDIR): Remove common/target-common.h and add
	target/target-resume.h, target/target-wait.h and
	target/target-waitstatus.h.
	(COMMON_OBS): Remove target-common.o and add
	target-waitstatus.o.
	(target-common.o): Remove.
	(target-waitstatus.o): New target object file.
	* common/target-common.c: Remove.
	* common/target-common.h: Remove.
	* target.h: Don't include target-common.h and
	include target-resume.h, target-wait.h and
	target-waitstatus.h instead.
	* target/target-resume.h: New file.
	* target/target-wait.h: New file.
	* target/target-waitstatus.c: New file.
	* target/target-waitstatus.h: New file.

	gdbserver/
	* Makefile.in (INCLUDE_CFLAGS): Add -I$(srcdir)/../target.
	(SFILES): Remove $(srcdir)/common/target-common.c and add
	$(srcdir)/target/target-waitstatus.c.
	(OBS): Remove target-common.o and add target-waitstatus.o.
	(server_h): Remove $(srcdir)/../common/target-common.h and
	add $(srcdir)/../target/target-resume.h,
	$(srcdir)/../target/target-wait.h and
	$(srcdir)/../target/target-waitstatus.h.
	(target-common.o): Remove.
	(target-waitstatus.o): New target object file.
	* target.h: Don't include target-common.h and
	include target-resume.h, target-wait.h and
	target-waitstatus.h instead.

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 8f4ee9e..670a8c3 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -432,7 +432,8 @@ HAVE_NATIVE_GCORE_TARGET = @HAVE_NATIVE_GCORE_TARGET@
 # your system doesn't have fcntl.h in /usr/include (which is where it
 # should be according to Posix).
 DEFS = @DEFS@
-GDB_CFLAGS = -I. -I$(srcdir) -I$(srcdir)/common -I$(srcdir)/config \
+GDB_CFLAGS = -I. -I$(srcdir) -I$(srcdir)/common -I$(srcdir)/target \
+	-I$(srcdir)/config \
 	-DLOCALEDIR="\"$(localedir)\"" $(DEFS)
 
 # MH_CFLAGS, if defined, has host-dependent CFLAGS from the config directory.
@@ -775,7 +776,7 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \
 	common/gdb_vecs.c common/common-utils.c common/xml-utils.c \
 	common/ptid.c common/buffer.c gdb-dlfcn.c common/agent.c \
 	common/format.c common/filestuff.c btrace.c record-btrace.c ctf.c \
-	common/target-common.c
+	target/target-waitstatus.c
 
 LINTFILES = $(SFILES) $(YYFILES) $(CONFIG_SRCS) init.c
 
@@ -854,7 +855,8 @@ common/common-utils.h common/xml-utils.h common/buffer.h common/ptid.h \
 common/format.h common/host-defs.h utils.h common/queue.h common/gdb_string.h \
 common/linux-osdata.h gdb-dlfcn.h auto-load.h probe.h stap-probe.h \
 gdb_bfd.h sparc-ravenscar-thread.h ppc-ravenscar-thread.h common/linux-btrace.h \
-ctf.h common/i386-cpuid.h common/i386-gcc-cpuid.h common/target-common.h
+ctf.h common/i386-cpuid.h common/i386-gcc-cpuid.h target/target-resume.h \
+target/target-wait.h target/target-waitstatus.h
 
 # Header files that already have srcdir in them, or which are in objdir.
 
@@ -948,7 +950,7 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \
 	inferior.o osdata.o gdb_usleep.o record.o record-full.o gcore.o \
 	gdb_vecs.o jit.o progspace.o skip.o probe.o \
 	common-utils.o buffer.o ptid.o gdb-dlfcn.o common-agent.o \
-	format.o registry.o btrace.o record-btrace.o target-common.o
+	format.o registry.o btrace.o record-btrace.o target-waitstatus.o
 
 TSOBS = inflow.o
 
@@ -2022,8 +2024,8 @@ linux-btrace.o: ${srcdir}/common/linux-btrace.c
 	$(COMPILE) $(srcdir)/common/linux-btrace.c
 	$(POSTCOMPILE)
 
-target-common.o: ${srcdir}/common/target-common.c
-	$(COMPILE) $(srcdir)/common/target-common.c
+target-waitstatus.o: ${srcdir}/target/target-waitstatus.c
+	$(COMPILE) $(srcdir)/target/target-waitstatus.c
 	$(POSTCOMPILE)
 
 mips-linux-watch.o: ${srcdir}/common/mips-linux-watch.c
diff --git a/gdb/common/target-common.c b/gdb/common/target-common.c
deleted file mode 100644
index 2edbb2a..0000000
--- a/gdb/common/target-common.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Common target operations for GDB and gdbserver.
-
-   Copyright (C) 1990-2013 Free Software Foundation, Inc.
-
-   Contributed by Cygnus Support.
-   Contributed by MontaVista Software.
-
-   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/>.  */
-
-#ifdef GDBSERVER
-#include "server.h"
-#else
-#include "defs.h"
-#endif
-
-/* Return a pretty printed form of target_waitstatus.
-   Space for the result is malloc'd, caller must free.  */
-
-#include "target-common.h"
-
-/* Return a pretty printed form of target_waitstatus.
-   Space for the result is malloc'd, caller must free.  */
-
-char *
-target_waitstatus_to_string (const struct target_waitstatus *ws)
-{
-  const char *kind_str = "status->kind = ";
-
-  switch (ws->kind)
-    {
-    case TARGET_WAITKIND_EXITED:
-      return xstrprintf ("%sexited, status = %d",
-			 kind_str, ws->value.integer);
-    case TARGET_WAITKIND_STOPPED:
-      return xstrprintf ("%sstopped, signal = %s",
-			 kind_str, gdb_signal_to_name (ws->value.sig));
-    case TARGET_WAITKIND_SIGNALLED:
-      return xstrprintf ("%ssignalled, signal = %s",
-			 kind_str, gdb_signal_to_name (ws->value.sig));
-    case TARGET_WAITKIND_LOADED:
-      return xstrprintf ("%sloaded", kind_str);
-    case TARGET_WAITKIND_FORKED:
-      return xstrprintf ("%sforked", kind_str);
-    case TARGET_WAITKIND_VFORKED:
-      return xstrprintf ("%svforked", kind_str);
-    case TARGET_WAITKIND_EXECD:
-      return xstrprintf ("%sexecd", kind_str);
-    case TARGET_WAITKIND_VFORK_DONE:
-      return xstrprintf ("%svfork-done", kind_str);
-    case TARGET_WAITKIND_SYSCALL_ENTRY:
-      return xstrprintf ("%sentered syscall", kind_str);
-    case TARGET_WAITKIND_SYSCALL_RETURN:
-      return xstrprintf ("%sexited syscall", kind_str);
-    case TARGET_WAITKIND_SPURIOUS:
-      return xstrprintf ("%sspurious", kind_str);
-    case TARGET_WAITKIND_IGNORE:
-      return xstrprintf ("%signore", kind_str);
-    case TARGET_WAITKIND_NO_HISTORY:
-      return xstrprintf ("%sno-history", kind_str);
-    case TARGET_WAITKIND_NO_RESUMED:
-      return xstrprintf ("%sno-resumed", kind_str);
-    default:
-      return xstrprintf ("%sunknown???", kind_str);
-    }
-}
diff --git a/gdb/common/target-common.h b/gdb/common/target-common.h
deleted file mode 100644
index d4d73f6..0000000
--- a/gdb/common/target-common.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/* Interface between the debugger and target environments, including files
-   and processes, shared between GDB and gdbserver.
-
-   Copyright (C) 1990-2013 Free Software Foundation, Inc.
-
-   Contributed by Cygnus Support.  Written by John Gilmore.
-
-   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 TARGET_COMMON_H
-#define TARGET_COMMON_H
-
-#include "common-utils.h"
-#include "ptid.h"
-#include "gdb_signals.h"
-
-/* Ways to "resume" a thread.  */
-
-enum resume_kind
-{
-  /* Thread should continue.  */
-  resume_continue,
-
-  /* Thread should single-step.  */
-  resume_step,
-
-  /* Thread should be stopped.  */
-  resume_stop
-};
-
-/* Stuff for target_wait.  */
-
-/* Generally, what has the program done?  */
-enum target_waitkind
-{
-  /* The program has exited.  The exit status is in value.integer.  */
-  TARGET_WAITKIND_EXITED,
-
-  /* The program has stopped with a signal.  Which signal is in
-     value.sig.  */
-  TARGET_WAITKIND_STOPPED,
-
-  /* The program has terminated with a signal.  Which signal is in
-     value.sig.  */
-  TARGET_WAITKIND_SIGNALLED,
-
-  /* The program is letting us know that it dynamically loaded something
-     (e.g. it called load(2) on AIX).  */
-  TARGET_WAITKIND_LOADED,
-
-  /* The program has forked.  A "related" process' PTID is in
-     value.related_pid.  I.e., if the child forks, value.related_pid
-     is the parent's ID.  */
-  TARGET_WAITKIND_FORKED,
- 
-  /* The program has vforked.  A "related" process's PTID is in
-     value.related_pid.  */
-  TARGET_WAITKIND_VFORKED,
- 
-  /* The program has exec'ed a new executable file.  The new file's
-     pathname is pointed to by value.execd_pathname.  */
-  TARGET_WAITKIND_EXECD,
-  
-  /* The program had previously vforked, and now the child is done
-     with the shared memory region, because it exec'ed or exited.
-     Note that the event is reported to the vfork parent.  This is
-     only used if GDB did not stay attached to the vfork child,
-     otherwise, a TARGET_WAITKIND_EXECD or
-     TARGET_WAITKIND_EXIT|SIGNALLED event associated with the child
-     has the same effect.  */
-  TARGET_WAITKIND_VFORK_DONE,
-
-  /* The program has entered or returned from a system call.  On
-     HP-UX, this is used in the hardware watchpoint implementation.
-     The syscall's unique integer ID number is in value.syscall_id.  */
-  TARGET_WAITKIND_SYSCALL_ENTRY,
-  TARGET_WAITKIND_SYSCALL_RETURN,
-
-  /* Nothing happened, but we stopped anyway.  This perhaps should be handled
-     within target_wait, but I'm not sure target_wait should be resuming the
-     inferior.  */
-  TARGET_WAITKIND_SPURIOUS,
-
-  /* An event has occured, but we should wait again.
-     Remote_async_wait() returns this when there is an event
-     on the inferior, but the rest of the world is not interested in
-     it.  The inferior has not stopped, but has just sent some output
-     to the console, for instance.  In this case, we want to go back
-     to the event loop and wait there for another event from the
-     inferior, rather than being stuck in the remote_async_wait()
-     function. sThis way the event loop is responsive to other events,
-     like for instance the user typing.  */
-  TARGET_WAITKIND_IGNORE,
- 
-  /* The target has run out of history information,
-     and cannot run backward any further.  */
-  TARGET_WAITKIND_NO_HISTORY,
- 
-  /* There are no resumed children left in the program.  */
-  TARGET_WAITKIND_NO_RESUMED
-};
-
-struct target_waitstatus
-{
-  enum target_waitkind kind;
-
-  /* Additional information about the event.  */
-  union
-    {
-      /* Exit status */
-      int integer;
-      /* Signal number */
-      enum gdb_signal sig;
-      /* Forked child pid */
-      ptid_t related_pid;
-      /* execd pathname */
-      char *execd_pathname;
-      /* Syscall number */
-      int syscall_number;
-    } value;
-};
-
-/* Options that can be passed to target_wait.  */
-
-/* Return immediately if there's no event already queued.  If this
-   options is not requested, target_wait blocks waiting for an
-   event.  */
-#define TARGET_WNOHANG 1
-
-/* Prototypes */
-
-/* Return a pretty printed form of target_waitstatus.
-   Space for the result is malloc'd, caller must free.  */
-extern char *target_waitstatus_to_string (const struct target_waitstatus *);
-
-#endif /* TARGET_COMMON_H */
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index e541497..f06b98e 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -101,7 +101,7 @@ GNULIB_H = $(GNULIB_BUILDDIR)/import/string.h @GNULIB_STDINT_H@
 # -I${srcdir} for our headers.
 # -I$(srcdir)/../regformats for regdef.h.
 INCLUDE_CFLAGS = -I. -I${srcdir} -I$(srcdir)/../common \
-	-I$(srcdir)/../regformats -I$(INCLUDE_DIR) \
+	-I$(srcdir)/../regformats -I$(srcdir)/../target -I$(INCLUDE_DIR) \
 	$(INCGNU)
 
 # M{H,T}_CFLAGS, if defined, has host- and target-dependent CFLAGS
@@ -157,7 +157,7 @@ SFILES=	$(srcdir)/gdbreplay.c $(srcdir)/inferiors.c $(srcdir)/dll.c \
 	$(srcdir)/common/common-utils.c $(srcdir)/common/xml-utils.c \
 	$(srcdir)/common/linux-osdata.c $(srcdir)/common/ptid.c \
 	$(srcdir)/common/buffer.c $(srcdir)/common/linux-btrace.c \
-	$(srcdir)/common/filestuff.c $(srcdir)/common/target-common.c \
+	$(srcdir)/common/filestuff.c $(srcdir)/target/target-waitstatus.c \
     $(srcdir)/common/mips-linux-watch.c
 
 DEPFILES = @GDBSERVER_DEPFILES@
@@ -168,7 +168,7 @@ SOURCES = $(SFILES)
 TAGFILES = $(SOURCES) ${HFILES} ${ALLPARAM} ${POSSLIBS}
 
 OBS = agent.o ax.o inferiors.o regcache.o remote-utils.o server.o signals.o \
-      target.o target-common.o utils.o version.o vec.o gdb_vecs.o \
+      target.o target-waitstatus.o utils.o version.o vec.o gdb_vecs.o \
       mem-break.o hostio.o event-loop.o tracepoint.o xml-utils.o \
       common-utils.o ptid.o buffer.o format.o filestuff.o dll.o notif.o \
       tdesc.o $(XML_BUILTIN) $(DEPFILES) $(LIBOBJS)
@@ -437,7 +437,9 @@ server_h = $(srcdir)/server.h $(regcache_h) $(srcdir)/target.h \
 		$(srcdir)/../common/buffer.h \
 		$(srcdir)/../common/gdb_assert.h \
 		$(srcdir)/../common/gdb_locale.h \
-		$(srcdir)/../common/target-common.h \
+		$(srcdir)/../target/target-resume.h \
+		$(srcdir)/../target/target-wait.h \
+		$(srcdir)/../target/target-waitstatus.h \
 		$(ptid_h) \
 		$(signals_h) \
 		$(libiberty_h) \
@@ -550,7 +552,7 @@ filestuff.o: ../common/filestuff.c
 agent.o: ../common/agent.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
-target-common.o: ../common/target-common.c
+target-waitstatus.o: ../target/target-waitstatus.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h
index d064b79..43d1022 100644
--- a/gdb/gdbserver/target.h
+++ b/gdb/gdbserver/target.h
@@ -21,7 +21,9 @@
 #ifndef TARGET_H
 #define TARGET_H
 
-#include "target-common.h"
+#include "target-resume.h"
+#include "target-wait.h"
+#include "target-waitstatus.h"
 
 struct emit_ops;
 struct btrace_target_info;
diff --git a/gdb/target.h b/gdb/target.h
index 1d73bcd..190965e 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -57,7 +57,9 @@ struct expression;
    it goes into the file stratum, which is always below the process
    stratum.  */
 
-#include "target-common.h"
+#include "target-resume.h"
+#include "target-wait.h"
+#include "target-waitstatus.h"
 #include "bfd.h"
 #include "symtab.h"
 #include "memattr.h"
diff --git a/gdb/target/target-resume.h b/gdb/target/target-resume.h
new file mode 100644
index 0000000..adf9ac1
--- /dev/null
+++ b/gdb/target/target-resume.h
@@ -0,0 +1,37 @@
+/* Target resumption definitions and prototypes.
+
+   Copyright (C) 1990-2013 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 TARGET_RESUME_H
+#define TARGET_RESUME_H
+
+/* Ways to "resume" a thread.  */
+
+enum resume_kind
+{
+  /* Thread should continue.  */
+  resume_continue,
+
+  /* Thread should single-step.  */
+  resume_step,
+
+  /* Thread should be stopped.  */
+  resume_stop
+};
+
+#endif /* TARGET_RESUME_H */
diff --git a/gdb/target/target-wait.h b/gdb/target/target-wait.h
new file mode 100644
index 0000000..f168ea8
--- /dev/null
+++ b/gdb/target/target-wait.h
@@ -0,0 +1,30 @@
+/* Target wait definitions and prototypes.
+
+   Copyright (C) 1990-2013 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 TARGET_WAIT_H
+#define TARGET_WAIT_H
+
+/* Options that can be passed to target_wait.  */
+
+/* Return immediately if there's no event already queued.  If this
+   options is not requested, target_wait blocks waiting for an
+   event.  */
+#define TARGET_WNOHANG 1
+
+#endif /* TARGET_WAIT_H */
diff --git a/gdb/target/target-waitstatus.c b/gdb/target/target-waitstatus.c
new file mode 100644
index 0000000..efa852e
--- /dev/null
+++ b/gdb/target/target-waitstatus.c
@@ -0,0 +1,72 @@
+/* Target waitstatus implementations.
+
+   Copyright (C) 1990-2013 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/>.  */
+
+#ifdef GDBSERVER
+#include "server.h"
+#else
+#include "defs.h"
+#endif
+
+#include "target-waitstatus.h"
+
+/* Return a pretty printed form of target_waitstatus.
+   Space for the result is malloc'd, caller must free.  */
+
+char *
+target_waitstatus_to_string (const struct target_waitstatus *ws)
+{
+  const char *kind_str = "status->kind = ";
+
+  switch (ws->kind)
+    {
+    case TARGET_WAITKIND_EXITED:
+      return xstrprintf ("%sexited, status = %d",
+			 kind_str, ws->value.integer);
+    case TARGET_WAITKIND_STOPPED:
+      return xstrprintf ("%sstopped, signal = %s",
+			 kind_str, gdb_signal_to_name (ws->value.sig));
+    case TARGET_WAITKIND_SIGNALLED:
+      return xstrprintf ("%ssignalled, signal = %s",
+			 kind_str, gdb_signal_to_name (ws->value.sig));
+    case TARGET_WAITKIND_LOADED:
+      return xstrprintf ("%sloaded", kind_str);
+    case TARGET_WAITKIND_FORKED:
+      return xstrprintf ("%sforked", kind_str);
+    case TARGET_WAITKIND_VFORKED:
+      return xstrprintf ("%svforked", kind_str);
+    case TARGET_WAITKIND_EXECD:
+      return xstrprintf ("%sexecd", kind_str);
+    case TARGET_WAITKIND_VFORK_DONE:
+      return xstrprintf ("%svfork-done", kind_str);
+    case TARGET_WAITKIND_SYSCALL_ENTRY:
+      return xstrprintf ("%sentered syscall", kind_str);
+    case TARGET_WAITKIND_SYSCALL_RETURN:
+      return xstrprintf ("%sexited syscall", kind_str);
+    case TARGET_WAITKIND_SPURIOUS:
+      return xstrprintf ("%sspurious", kind_str);
+    case TARGET_WAITKIND_IGNORE:
+      return xstrprintf ("%signore", kind_str);
+    case TARGET_WAITKIND_NO_HISTORY:
+      return xstrprintf ("%sno-history", kind_str);
+    case TARGET_WAITKIND_NO_RESUMED:
+      return xstrprintf ("%sno-resumed", kind_str);
+    default:
+      return xstrprintf ("%sunknown???", kind_str);
+    }
+}
diff --git a/gdb/target/target-waitstatus.h b/gdb/target/target-waitstatus.h
new file mode 100644
index 0000000..28e070c
--- /dev/null
+++ b/gdb/target/target-waitstatus.h
@@ -0,0 +1,126 @@
+/* Target waitstatus definitions and prototypes.
+
+   Copyright (C) 1990-2013 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 TARGET_WAITSTATUS_H
+#define TARGET_WAITSTATUS_H
+
+#include "common-utils.h"
+#include "ptid.h"
+#include "gdb_signals.h"
+
+/* Stuff for target_wait.  */
+
+/* Generally, what has the program done?  */
+enum target_waitkind
+{
+  /* The program has exited.  The exit status is in value.integer.  */
+  TARGET_WAITKIND_EXITED,
+
+  /* The program has stopped with a signal.  Which signal is in
+     value.sig.  */
+  TARGET_WAITKIND_STOPPED,
+
+  /* The program has terminated with a signal.  Which signal is in
+     value.sig.  */
+  TARGET_WAITKIND_SIGNALLED,
+
+  /* The program is letting us know that it dynamically loaded
+     something (e.g. it called load(2) on AIX).  */
+  TARGET_WAITKIND_LOADED,
+
+  /* The program has forked.  A "related" process' PTID is in
+     value.related_pid.  I.e., if the child forks, value.related_pid
+     is the parent's ID.  */
+  TARGET_WAITKIND_FORKED,
+ 
+  /* The program has vforked.  A "related" process's PTID is in
+     value.related_pid.  */
+  TARGET_WAITKIND_VFORKED,
+ 
+  /* The program has exec'ed a new executable file.  The new file's
+     pathname is pointed to by value.execd_pathname.  */
+  TARGET_WAITKIND_EXECD,
+  
+  /* The program had previously vforked, and now the child is done
+     with the shared memory region, because it exec'ed or exited.
+     Note that the event is reported to the vfork parent.  This is
+     only used if GDB did not stay attached to the vfork child,
+     otherwise, a TARGET_WAITKIND_EXECD or
+     TARGET_WAITKIND_EXIT|SIGNALLED event associated with the child
+     has the same effect.  */
+  TARGET_WAITKIND_VFORK_DONE,
+
+  /* The program has entered or returned from a system call.  On
+     HP-UX, this is used in the hardware watchpoint implementation.
+     The syscall's unique integer ID number is in
+     value.syscall_id.  */
+  TARGET_WAITKIND_SYSCALL_ENTRY,
+  TARGET_WAITKIND_SYSCALL_RETURN,
+
+  /* Nothing happened, but we stopped anyway.  This perhaps should
+     be handled within target_wait, but I'm not sure target_wait
+     should be resuming the inferior.  */
+  TARGET_WAITKIND_SPURIOUS,
+
+  /* An event has occured, but we should wait again.
+     Remote_async_wait() returns this when there is an event
+     on the inferior, but the rest of the world is not interested in
+     it.  The inferior has not stopped, but has just sent some output
+     to the console, for instance.  In this case, we want to go back
+     to the event loop and wait there for another event from the
+     inferior, rather than being stuck in the remote_async_wait()
+     function. sThis way the event loop is responsive to other events,
+     like for instance the user typing.  */
+  TARGET_WAITKIND_IGNORE,
+ 
+  /* The target has run out of history information,
+     and cannot run backward any further.  */
+  TARGET_WAITKIND_NO_HISTORY,
+ 
+  /* There are no resumed children left in the program.  */
+  TARGET_WAITKIND_NO_RESUMED
+};
+
+struct target_waitstatus
+{
+  enum target_waitkind kind;
+
+  /* Additional information about the event.  */
+  union
+    {
+      /* Exit status */
+      int integer;
+      /* Signal number */
+      enum gdb_signal sig;
+      /* Forked child pid */
+      ptid_t related_pid;
+      /* execd pathname */
+      char *execd_pathname;
+      /* Syscall number */
+      int syscall_number;
+    } value;
+};
+
+/* Prototypes */
+
+/* Return a pretty printed form of target_waitstatus.
+   Space for the result is malloc'd, caller must free.  */
+extern char *target_waitstatus_to_string (const struct target_waitstatus *);
+
+#endif /* TARGET_WAITSTATUS_H */

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Refactor common/target-common into meaningful bits
  2013-08-01 17:09 [PATCH] Refactor common/target-common into meaningful bits Luis Machado
@ 2013-08-01 17:50 ` Tom Tromey
  2013-08-01 17:52   ` Luis Machado
  2013-08-01 17:54   ` Pedro Alves
  2013-08-16 14:49 ` Luis Machado
  1 sibling, 2 replies; 16+ messages in thread
From: Tom Tromey @ 2013-08-01 17:50 UTC (permalink / raw)
  To: lgustavo; +Cc: 'gdb-patches@sourceware.org', Pedro Alves

>>>>> "Luis" == Luis Machado <lgustavo@codesourcery.com> writes:

Luis> First, it seems like a good idea to stablish a  more meaningful
Luis> directory structure as well, so we are moving target-common.[c|h] from
Luis> the "common" dir to the new "target" dir. This new directory will hold
Luis> anything more backend-related. For now it contains only generic target
Luis> definitions and functions.

I like it.

Luis> I've broken target-common.[c|h] into the following:
Luis> - target-resume.h: Definition for resume_kind.
Luis> - target-waitstatus.[c|h]: Definitions and code for anything related
Luis> to waitstatus.
Luis> - target-wait.h: A tiny bit that does not seem to fit properly in the
Luis> waitstatus files, so it is left here.

If I may be permitted to bikeshed just a bit longer...

Right now the file is named "target/target-waitstatus.h" and the code
says:

+#include "target-waitstatus.h"


I wonder whether you considered naming the file "target/waitstatus.h"
and having the code say:

+#include "target/waitstatus.h"


That is, let the directory provide the namespace service for us.

Tom

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Refactor common/target-common into meaningful bits
  2013-08-01 17:50 ` Tom Tromey
@ 2013-08-01 17:52   ` Luis Machado
  2013-08-02  9:29     ` Pedro Alves
  2013-08-01 17:54   ` Pedro Alves
  1 sibling, 1 reply; 16+ messages in thread
From: Luis Machado @ 2013-08-01 17:52 UTC (permalink / raw)
  To: Tom Tromey; +Cc: 'gdb-patches@sourceware.org', Pedro Alves

On 08/01/2013 02:49 PM, Tom Tromey wrote:
>>>>>> "Luis" == Luis Machado <lgustavo@codesourcery.com> writes:
>
> Luis> First, it seems like a good idea to stablish a  more meaningful
> Luis> directory structure as well, so we are moving target-common.[c|h] from
> Luis> the "common" dir to the new "target" dir. This new directory will hold
> Luis> anything more backend-related. For now it contains only generic target
> Luis> definitions and functions.
>
> I like it.
>
> Luis> I've broken target-common.[c|h] into the following:
> Luis> - target-resume.h: Definition for resume_kind.
> Luis> - target-waitstatus.[c|h]: Definitions and code for anything related
> Luis> to waitstatus.
> Luis> - target-wait.h: A tiny bit that does not seem to fit properly in the
> Luis> waitstatus files, so it is left here.
>
> If I may be permitted to bikeshed just a bit longer...
>
> Right now the file is named "target/target-waitstatus.h" and the code
> says:
>
> +#include "target-waitstatus.h"
>
>
> I wonder whether you considered naming the file "target/waitstatus.h"
> and having the code say:

I did and it does sound more intuitive, but i didn't want to turn too 
many knobs at a time. If others are OK with this, i can make that change.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Refactor common/target-common into meaningful bits
  2013-08-01 17:50 ` Tom Tromey
  2013-08-01 17:52   ` Luis Machado
@ 2013-08-01 17:54   ` Pedro Alves
  1 sibling, 0 replies; 16+ messages in thread
From: Pedro Alves @ 2013-08-01 17:54 UTC (permalink / raw)
  To: Tom Tromey; +Cc: lgustavo, 'gdb-patches@sourceware.org'

On 08/01/2013 06:49 PM, Tom Tromey wrote:

> If I may be permitted to bikeshed just a bit longer...
> 
> Right now the file is named "target/target-waitstatus.h" and the code
> says:
> 
> +#include "target-waitstatus.h"
> 
> 
> I wonder whether you considered naming the file "target/waitstatus.h"
> and having the code say:
> 
> +#include "target/waitstatus.h"
> 
> 
> That is, let the directory provide the namespace service for us.

+1 !

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Refactor common/target-common into meaningful bits
  2013-08-01 17:52   ` Luis Machado
@ 2013-08-02  9:29     ` Pedro Alves
  2013-08-02 20:48       ` Tom Tromey
  2013-08-04 12:35       ` Yao Qi
  0 siblings, 2 replies; 16+ messages in thread
From: Pedro Alves @ 2013-08-02  9:29 UTC (permalink / raw)
  To: lgustavo; +Cc: Tom Tromey, 'gdb-patches@sourceware.org'

On 08/01/2013 06:52 PM, Luis Machado wrote:
> On 08/01/2013 02:49 PM, Tom Tromey wrote:
>>>>>>> "Luis" == Luis Machado <lgustavo@codesourcery.com> writes:
>>
>> Luis> First, it seems like a good idea to stablish a  more meaningful
>> Luis> directory structure as well, so we are moving target-common.[c|h] from
>> Luis> the "common" dir to the new "target" dir. This new directory will hold
>> Luis> anything more backend-related. For now it contains only generic target
>> Luis> definitions and functions.
>>
>> I like it.
>>
>> Luis> I've broken target-common.[c|h] into the following:
>> Luis> - target-resume.h: Definition for resume_kind.
>> Luis> - target-waitstatus.[c|h]: Definitions and code for anything related
>> Luis> to waitstatus.
>> Luis> - target-wait.h: A tiny bit that does not seem to fit properly in the
>> Luis> waitstatus files, so it is left here.
>>
>> If I may be permitted to bikeshed just a bit longer...
>>
>> Right now the file is named "target/target-waitstatus.h" and the code
>> says:
>>
>> +#include "target-waitstatus.h"
>>
>>
>> I wonder whether you considered naming the file "target/waitstatus.h"
>> and having the code say:
> 
> I did and it does sound more intuitive, but i didn't want to turn too 
> many knobs at a time. If others are OK with this, i can make that change.

We had a discussion on IRC yesterday on this.  To sum it up:

"target" is an overloaded word in GDB-speak.  My idea for this new
directory, would be for it to hold the native target backend bits.
But "target" could also suggest that corelow.c, file.c, remote.c, etc.
should be put in this directory, while I don't think they should.

Sounds like a better name for this native target backend directory
should be invented.  GDB uses *-nat.c naming for most of
these files, while GDBserver uses *-low.c.

( "low" itself in GDBserver is also ambiguous -- e.g., linux-low.h
introduces the "struct linux_target_ops", and we call _that_ the
"low target" at places (seems its my own fault for introducing
that ambiguity...) ... )

So to me that suggests "nat", "native" or "low", in my order
of preference.

These new target-resume.h, target-wait.h, target-waitstatus.h,
target-waitstatus.c files might be looked at as actually something
else.  This is code defining the interface between GDB core and
target_ops, and as such is used by all sort of targets on the
GDB side (remote.c, etc.).  I'm not sure they should go in the same
directory as the *-nat.c, etc. files.  GDBserver's "struct target_ops"
is both smaller, and different at places from GDB's own "struct target_ops".
In a world where we fuse gdb's and gdbserver's target backends, it's
not clear to me at this point whether we'll end up with only one
"struct target_ops", or whether we'll still end up with two
different structures, with parts of GDBserver core implementing
GDB's own target_ops, and marshalling things to the lower GDBserver's
struct target_ops, while handling others behind GDB core's back.

I guess I'm saying, someone should sit, and think this
through, and come up with a design/guide of what things look like
in the end, before we start moving things around too much.  In
the mean time, I propose avoiding diverging from Luis' original
goal, and continuing what we had been doing, by
putting target-resume.h, target-wait.h, target-waitstatus.h,
target-waitstatus.c under common/.  Further moves can always
be done later.

WDYT?

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Refactor common/target-common into meaningful bits
  2013-08-02  9:29     ` Pedro Alves
@ 2013-08-02 20:48       ` Tom Tromey
  2013-08-05 10:44         ` Pedro Alves
  2013-08-04 12:35       ` Yao Qi
  1 sibling, 1 reply; 16+ messages in thread
From: Tom Tromey @ 2013-08-02 20:48 UTC (permalink / raw)
  To: Pedro Alves; +Cc: lgustavo, 'gdb-patches@sourceware.org'

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> "target" is an overloaded word in GDB-speak.  My idea for this new
Pedro> directory, would be for it to hold the native target backend bits.
Pedro> But "target" could also suggest that corelow.c, file.c, remote.c, etc.
Pedro> should be put in this directory, while I don't think they should.

I've been thinking about this a bit since the discussion yesterday.

I think I'm generally in favor of using the names Luis already has.

The basic reason I have is that I think that, by and large, gdb's module
boundaries make sense.  I may quibble with some exact lines that have
been drawn (and certainly I dislike the insides of some modules), but by
and large the modules, at least as I understand the breakdown, have
proven resilient.

I agree that "target" is not the best possible name de novo.  However,
it is the nature of language to overload words with meanings -- the
norm, not the exception -- and furthermore "target" is the name
historically chosen inside gdb to represent the connection between the
core (+ CLI) and the back end.

You had a few specific issues, which I've quoted & will address below.

Pedro> Sounds like a better name for this native target backend directory
Pedro> should be invented.  GDB uses *-nat.c naming for most of
Pedro> these files, while GDBserver uses *-low.c.

I think it's fine to use "nat" in the same way that gdb does now.

Looking at the current patch, though, I don't see anything "nat" in
there.  The ptrace options discovery bits could go there, but that
wasn't addressed in this thread IIRC.

Pedro> These new target-resume.h, target-wait.h, target-waitstatus.h,
Pedro> target-waitstatus.c files might be looked at as actually something
Pedro> else.  This is code defining the interface between GDB core and
Pedro> target_ops, and as such is used by all sort of targets on the
Pedro> GDB side (remote.c, etc.).  I'm not sure they should go in the same
Pedro> directory as the *-nat.c, etc. files.

These seem like classic "target" bits to me.

Pedro> In a world where we fuse gdb's and gdbserver's target backends, it's
Pedro> not clear to me at this point whether we'll end up with only one
Pedro> "struct target_ops"

That's ok though.  We can use subclassing.  We will need to come up with
new names, but it seems premature to worry about that.

Tom

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Refactor common/target-common into meaningful bits
  2013-08-02  9:29     ` Pedro Alves
  2013-08-02 20:48       ` Tom Tromey
@ 2013-08-04 12:35       ` Yao Qi
  1 sibling, 0 replies; 16+ messages in thread
From: Yao Qi @ 2013-08-04 12:35 UTC (permalink / raw)
  To: Pedro Alves; +Cc: lgustavo, Tom Tromey, 'gdb-patches@sourceware.org'

On 08/02/2013 05:29 PM, Pedro Alves wrote:
> "target" is an overloaded word in GDB-speak.  My idea for this new
> directory, would be for it to hold the native target backend bits.
> But "target" could also suggest that corelow.c, file.c, remote.c, etc.
> should be put in this directory, while I don't think they should.

If we don't move corelow.c and remote.c to "target" directory, that is 
not confusing.  People will get to know the meaning of the directory 
when they list the files in this directory.  For example, there is a 
directory "Target" in LLDB source tree lldb/source/Target, and I get to 
know what does "Target" mean in LLDB when I list the files in it.

>
> Sounds like a better name for this native target backend directory
> should be invented.  GDB uses *-nat.c naming for most of
> these files, while GDBserver uses *-low.c.
>
> ( "low" itself in GDBserver is also ambiguous -- e.g., linux-low.h
> introduces the "struct linux_target_ops", and we call_that_  the
> "low target" at places (seems its my own fault for introducing
> that ambiguity...) ... )
>
> So to me that suggests "nat", "native" or "low", in my order
> of preference.

I feel "target" is better than them, so I prefer "target".

-- 
Yao (齐尧)

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Refactor common/target-common into meaningful bits
  2013-08-02 20:48       ` Tom Tromey
@ 2013-08-05 10:44         ` Pedro Alves
  2013-08-05 15:33           ` Luis Machado
  2013-08-05 19:12           ` Tom Tromey
  0 siblings, 2 replies; 16+ messages in thread
From: Pedro Alves @ 2013-08-05 10:44 UTC (permalink / raw)
  To: Tom Tromey; +Cc: lgustavo, 'gdb-patches@sourceware.org'

On 08/02/2013 09:48 PM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
> 
> Pedro> "target" is an overloaded word in GDB-speak.  My idea for this new
> Pedro> directory, would be for it to hold the native target backend bits.
> Pedro> But "target" could also suggest that corelow.c, file.c, remote.c, etc.
> Pedro> should be put in this directory, while I don't think they should.
> 
> I've been thinking about this a bit since the discussion yesterday.
> 
> I think I'm generally in favor of using the names Luis already has.
>
> The basic reason I have is that I think that, by and large, gdb's module
> boundaries make sense.  I may quibble with some exact lines that have
> been drawn (and certainly I dislike the insides of some modules), but by
> and large the modules, at least as I understand the breakdown, have
> proven resilient.
> 
> I agree that "target" is not the best possible name de novo.  However,
> it is the nature of language to overload words with meanings -- the
> norm, not the exception -- and furthermore "target" is the name
> historically chosen inside gdb to represent the connection between the
> core (+ CLI) and the back end.

I've read your email several times over, and I sense that we're
talking past each other.  Myself, I'm used to the use of "target",
in "struct target_ops" & friends, and I have no desire to push
into a change here.  "back end" is also a little vague, in that
the gdbarch bits could also be seen as a backend.  When trying to
think of a more precise term, I end up thinking of "target"
representing the connection between the core and a system's debug
API (though that has it's own shortfalls too).  So "target" being
vague is good.  :-)

> You had a few specific issues, which I've quoted & will address below.
> 
> Pedro> Sounds like a better name for this native target backend directory
> Pedro> should be invented.  GDB uses *-nat.c naming for most of
> Pedro> these files, while GDBserver uses *-low.c.
> 
> I think it's fine to use "nat" in the same way that gdb does now.
> 
> Looking at the current patch, though, I don't see anything "nat" in
> there.  

Sure.  But this thread is coming as preparatory work for the
ptrace-sharing patch, and the gdbserver fork support work, and if you
look at  http://sourceware.org/ml/gdb-patches/2013-07/msg00840.html
you'll see that the original "target/" directory was thrown around
as place for holding the native backends.
If we don't use "target/" for the native backends, then, yes,
a "target/" directory for target_ops things would make better
sense.  (I'm not excluding a "target/nat/linux/" subdirectory
scheme, though, to me, that's less a concern than 'target/ for all'
vs 'target/ + nat/'.)

> The ptrace options discovery bits could go there, but that
> wasn't addressed in this thread IIRC.

So what I'm trying to point out, is that the new files in
the patch in these threads are not really "native backend"
files, so they best not go in the "native backend" files
directory.
IOW, after this, and
http://sourceware.org/ml/gdb-patches/2013-07/msg00788.html
and continuing that direction, I don't think we would want
to end up with:

 target/resume.h
 target/waitstatus.[c|h]
 target/wait.h
 target/i386-nat.c
 target/linux-nat.c
 target/linux-ptrace.c
 target/linux-waitpid.c
 etc.

> 
> Pedro> These new target-resume.h, target-wait.h, target-waitstatus.h,
> Pedro> target-waitstatus.c files might be looked at as actually something
> Pedro> else.  This is code defining the interface between GDB core and
> Pedro> target_ops, and as such is used by all sort of targets on the
> Pedro> GDB side (remote.c, etc.).  I'm not sure they should go in the same
> Pedro> directory as the *-nat.c, etc. files.
> 
> These seem like classic "target" bits to me.

Yep.  So, if we move the classic "target" bits to a "target/"
module directory, and put the native bits in their own dir, we
have:

 target/resume.h
 target/waitstatus.[c|h]
 target/wait.h
 nat/i386-nat.c
 nat/linux-nat.c
 nat/linux-ptrace.c
 nat/linux-waitpid.c
 etc.

Is this what you're thinking of?  _This_, I'm fine with.
No mix of native bits with generic "target" bits, which was
my main worry.

It's actually very similar to something else I suggested on IRC,
but forgot to put in email form:  "IMO, the interfaces themselves would be
in an include dir.  e.g., gdb/include/target-waitstatus.h or some such,
and then we'd have gdb/nat/linux-nat.c, etc."

What else goes in "target/" ?  remote.c, corelow.c, etc.?
Do we move things into subdirectories beneath it too, for better
submodule partitioning?  I didn't want to suggest starting a
mass move, that's easy to overdo.  (That was the point at which I
suggested that someone thinks this through, and comes up with an
initial design/guide of what things will look like in the end, so
that we can then discuss and hash it out.)

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Refactor common/target-common into meaningful bits
  2013-08-05 10:44         ` Pedro Alves
@ 2013-08-05 15:33           ` Luis Machado
  2013-08-05 19:12           ` Tom Tromey
  1 sibling, 0 replies; 16+ messages in thread
From: Luis Machado @ 2013-08-05 15:33 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Tom Tromey, 'gdb-patches@sourceware.org', Yao Qi

On 08/05/2013 07:43 AM, Pedro Alves wrote:
> On 08/02/2013 09:48 PM, Tom Tromey wrote:
>> Pedro> These new target-resume.h, target-wait.h, target-waitstatus.h,
>> Pedro> target-waitstatus.c files might be looked at as actually something
>> Pedro> else.  This is code defining the interface between GDB core and
>> Pedro> target_ops, and as such is used by all sort of targets on the
>> Pedro> GDB side (remote.c, etc.).  I'm not sure they should go in the same
>> Pedro> directory as the *-nat.c, etc. files.
>>
>> These seem like classic "target" bits to me.
>
> Yep.  So, if we move the classic "target" bits to a "target/"
> module directory, and put the native bits in their own dir, we
> have:
>
>   target/resume.h
>   target/waitstatus.[c|h]
>   target/wait.h
>   nat/i386-nat.c
>   nat/linux-nat.c
>   nat/linux-ptrace.c
>   nat/linux-waitpid.c
>   etc.
>
> Is this what you're thinking of?  _This_, I'm fine with.
> No mix of native bits with generic "target" bits, which was
> my main worry.
>
> It's actually very similar to something else I suggested on IRC,
> but forgot to put in email form:  "IMO, the interfaces themselves would be
> in an include dir.  e.g., gdb/include/target-waitstatus.h or some such,
> and then we'd have gdb/nat/linux-nat.c, etc."
>
> What else goes in "target/" ?  remote.c, corelow.c, etc.?
> Do we move things into subdirectories beneath it too, for better
> submodule partitioning?  I didn't want to suggest starting a
> mass move, that's easy to overdo.  (That was the point at which I
> suggested that someone thinks this through, and comes up with an
> initial design/guide of what things will look like in the end, so
> that we can then discuss and hash it out.)
>

I was checking the discussion and the above is something i had in mind, 
that is, split the generic target (as in target_ops) bits into their own 
dir and slowly move native bits to a separate "nat", "low" or "native" 
directory as well. The nat bits would deal with the system API's to do 
debugging. The target bits would be data structure and generic bits not 
directly related to the system API's.

Seems to be a bit more organized this way.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Refactor common/target-common into meaningful bits
  2013-08-05 10:44         ` Pedro Alves
  2013-08-05 15:33           ` Luis Machado
@ 2013-08-05 19:12           ` Tom Tromey
  2013-08-05 19:21             ` Mark Kettenis
  1 sibling, 1 reply; 16+ messages in thread
From: Tom Tromey @ 2013-08-05 19:12 UTC (permalink / raw)
  To: Pedro Alves; +Cc: lgustavo, 'gdb-patches@sourceware.org'

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> I've read your email several times over, and I sense that we're
Pedro> talking past each other.

Yeah.  And thanks for your follow-up, I think it is clarifying.

Pedro> Yep.  So, if we move the classic "target" bits to a "target/"
Pedro> module directory, and put the native bits in their own dir, we
Pedro> have:

Pedro>  target/resume.h
Pedro>  target/waitstatus.[c|h]
Pedro>  target/wait.h
Pedro>  nat/i386-nat.c
Pedro>  nat/linux-nat.c
Pedro>  nat/linux-ptrace.c
Pedro>  nat/linux-waitpid.c
Pedro>  etc.

Pedro> Is this what you're thinking of?  _This_, I'm fine with.

Yeah, this is what I think we ought to do.

Pedro> It's actually very similar to something else I suggested on IRC,
Pedro> but forgot to put in email form: "IMO, the interfaces themselves
Pedro> would be in an include dir.  e.g.,
Pedro> gdb/include/target-waitstatus.h or some such, and then we'd have
Pedro> gdb/nat/linux-nat.c, etc."

I'm usually against include dirs, but if they are near enough to the
implementation it is ok by me.  My issue with them is mainly
forgettability -- like, I never, ever remember to look for things in
src/include/gdb; and then directories like this tend to become forgotten
graveyards.

Pedro> What else goes in "target/" ?  remote.c, corelow.c, etc.?

Yes, I see the issue here; but I think it is far enough off that we
should ignore it.  Just merging the bits we can merge today is enough to
occupy our energies.

Pedro> Do we move things into subdirectories beneath it too, for better
Pedro> submodule partitioning?  I didn't want to suggest starting a
Pedro> mass move, that's easy to overdo.

Either way is fine by me.
gdb-ish seems to be to prefer flatter.

Pedro> (That was the point at which I
Pedro> suggested that someone thinks this through, and comes up with an
Pedro> initial design/guide of what things will look like in the end, so
Pedro> that we can then discuss and hash it out.)

If reasonably quick I think it is better to come up with a plan now, at
the beginning.  It doesn't have to be a perfect plan, but we're already
hitting the limits of the current ("stuff it all in common/") plan.

A little investment now will pay off: we won't curse ourselves in two
years.

Tom

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Refactor common/target-common into meaningful bits
  2013-08-05 19:12           ` Tom Tromey
@ 2013-08-05 19:21             ` Mark Kettenis
  2013-08-06  8:48               ` Pedro Alves
  0 siblings, 1 reply; 16+ messages in thread
From: Mark Kettenis @ 2013-08-05 19:21 UTC (permalink / raw)
  To: tromey; +Cc: palves, lgustavo, gdb-patches

> From: Tom Tromey <tromey@redhat.com>
> Date: Mon, 05 Aug 2013 13:11:58 -0600
> 
> >>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
> 
> Pedro> I've read your email several times over, and I sense that we're
> Pedro> talking past each other.
> 
> Yeah.  And thanks for your follow-up, I think it is clarifying.
> 
> Pedro> Yep.  So, if we move the classic "target" bits to a "target/"
> Pedro> module directory, and put the native bits in their own dir, we
> Pedro> have:
> 
> Pedro>  target/resume.h
> Pedro>  target/waitstatus.[c|h]
> Pedro>  target/wait.h
> Pedro>  nat/i386-nat.c
> Pedro>  nat/linux-nat.c
> Pedro>  nat/linux-ptrace.c
> Pedro>  nat/linux-waitpid.c
> Pedro>  etc.
> 
> Pedro> Is this what you're thinking of?  _This_, I'm fine with.
> 
> Yeah, this is what I think we ought to do.
> 
> Pedro> It's actually very similar to something else I suggested on IRC,
> Pedro> but forgot to put in email form: "IMO, the interfaces themselves
> Pedro> would be in an include dir.  e.g.,
> Pedro> gdb/include/target-waitstatus.h or some such, and then we'd have
> Pedro> gdb/nat/linux-nat.c, etc."
> 
> I'm usually against include dirs, but if they are near enough to the
> implementation it is ok by me.  My issue with them is mainly
> forgettability -- like, I never, ever remember to look for things in
> src/include/gdb; and then directories like this tend to become forgotten
> graveyards.

Yea, we shouldn't put anything in src/include/gdb unless it is
absolutely necessary.  That pretty much translates into "unless sim
needs it".

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Refactor common/target-common into meaningful bits
  2013-08-05 19:21             ` Mark Kettenis
@ 2013-08-06  8:48               ` Pedro Alves
  0 siblings, 0 replies; 16+ messages in thread
From: Pedro Alves @ 2013-08-06  8:48 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: tromey, lgustavo, gdb-patches

On 08/05/2013 08:20 PM, Mark Kettenis wrote:
>> From: Tom Tromey <tromey@redhat.com>
>> Date: Mon, 05 Aug 2013 13:11:58 -0600
>>
>>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
>>
>> Pedro> I've read your email several times over, and I sense that we're
>> Pedro> talking past each other.
>>
>> Yeah.  And thanks for your follow-up, I think it is clarifying.
>>
>> Pedro> Yep.  So, if we move the classic "target" bits to a "target/"
>> Pedro> module directory, and put the native bits in their own dir, we
>> Pedro> have:
>>
>> Pedro>  target/resume.h
>> Pedro>  target/waitstatus.[c|h]
>> Pedro>  target/wait.h
>> Pedro>  nat/i386-nat.c
>> Pedro>  nat/linux-nat.c
>> Pedro>  nat/linux-ptrace.c
>> Pedro>  nat/linux-waitpid.c
>> Pedro>  etc.
>>
>> Pedro> Is this what you're thinking of?  _This_, I'm fine with.
>>
>> Yeah, this is what I think we ought to do.
>>

>> Pedro> It's actually very similar to something else I suggested on IRC,
>> Pedro> but forgot to put in email form: "IMO, the interfaces themselves
>> Pedro> would be in an include dir.  e.g.,
>> Pedro> gdb/include/target-waitstatus.h or some such, and then we'd have
>> Pedro> gdb/nat/linux-nat.c, etc."
>>
>> I'm usually against include dirs, but if they are near enough to the
>> implementation it is ok by me.  My issue with them is mainly
>> forgettability -- like, I never, ever remember to look for things in
>> src/include/gdb; and then directories like this tend to become forgotten
>> graveyards.

Agreed.  grep-friendliness is the antithesis of scattering
things around in lots of out of sight subdirs.  But note I was suggesting
a new gdb/include/, not the existing src/include/gdb.  Anyway, let's leave
this idea out for now.

> Yea, we shouldn't put anything in src/include/gdb unless it is
> absolutely necessary.  That pretty much translates into "unless sim
> needs it".

*nod*

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Refactor common/target-common into meaningful bits
  2013-08-01 17:09 [PATCH] Refactor common/target-common into meaningful bits Luis Machado
  2013-08-01 17:50 ` Tom Tromey
@ 2013-08-16 14:49 ` Luis Machado
  2013-08-17  4:01   ` Luis Machado
  2013-08-19 13:45   ` Pedro Alves
  1 sibling, 2 replies; 16+ messages in thread
From: Luis Machado @ 2013-08-16 14:49 UTC (permalink / raw)
  Cc: 'gdb-patches@sourceware.org', Pedro Alves, Tom Tromey

[-- Attachment #1: Type: text/plain, Size: 1631 bytes --]

Hi,

This is an updated version of the patch that drops the target-* naming, 
creates a new directory named "target" under src/gdb and renames the 
files target-<something>.* to <something.*.

Based on previous discussions, it seems this is what it should look like 
in the future.

One of the differences now is the inclusion of, for example, 
"target/resume.h" instead of "resume.h". It looks more intuitive this way.

Ok?

Luis

On 08/01/2013 02:09 PM, Luis Machado wrote:
> Hi,
>
> After the previous discussion
> (http://sourceware.org/ml/gdb-patches/2013-07/msg00840.html), follows a
> patch to refactor the ill-named target-common.[c|h] files into something
> a bit more meaningful.
>
> First, it seems like a good idea to stablish a  more meaningful
> directory structure as well, so we are moving target-common.[c|h] from
> the "common" dir to the new "target" dir. This new directory will hold
> anything more backend-related. For now it contains only generic target
> definitions and functions.
>
> I've broken target-common.[c|h] into the following:
>
> - target-resume.h: Definition for resume_kind.
>
> - target-waitstatus.[c|h]: Definitions and code for anything related to
> waitstatus.
>
> - target-wait.h: A tiny bit that does not seem to fit properly in the
> waitstatus files, so it is left here.
>
> As usual, Makefile and other dependencies have been adjusted. Everything
> builds fine and does not show any regressions.
>
> The copyright headers have been adjusted and cleaned up to remove
> contribution messages.
>
> Comments over 70 columns have also been adjusted for this patch.
>
> Thoughts?
>
> Luis


[-- Attachment #2: refactor.diff --]
[-- Type: text/x-patch, Size: 24496 bytes --]

2013-08-16  Luis Machado  <lgustavo@codesourcery.com>

	gdb/
	* Makefile.in (SFILES): Remove common/target-common.c and
	add target/waitstatus.c.
	(HFILES_NO_SRCDIR): Remove common/target-common.h and add target/resume.h,
	target/wait.h and target/waitstatus.h.
	(COMMON_OBS): Remove target-common.o and add
	target-waitstatus.o.
	(target-common.o): Remove.
	(target-waitstatus.o): New target object file.
	* common/target-common.c: Move contents to
	target/waitstatus.c and remove.
	* common/target-common.h: Move contents to other files and
	remove.
	(enum resume_kind: Move to target/resume.h.
	(TARGET_WNOHANG): Move to target/wait.h.
	(enum target_waitkind): Move to target/waitstatus.h.
	(struct target_waitstatus): Likewise.
	* target.h: Do not include target-common.h and
	include target/resume.h, target/wait.h and
	target/waitstatus.h.
	* target/resume.h: New file.
	* target/wait.h: New file.
	* target/waitstatus.h: New file.
	* target/waitstatus.c: New file.

	gdb/gdbserver/
	* Makefile.in (INCLUDE_CFLAGS): Include -I$(srcdir)/../.
	(SFILES): Remove $(srcdir)/common/target-common.c and
	add $(srcdir)/target/waitstatus.c.
	(OBS): Remove target-common.o and add target-waitstatus.o.
	(server_h): Remove $(srcdir)/../common/target-common.h and
	add $(srcdir)/../target/resume.h, $(srcdir)/../target/wait.h
	and $(srcdir)/../target/waitstatus.h.
	(target-common.o): Remove.
	(target-waitstatus.o): New target object file.
	* target.h: Do not include target-common.h and
	include target/resume.h, target/wait.h and
	target/waitstatus.h.

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 9171940..e8b07d7 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -775,7 +775,7 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \
 	common/gdb_vecs.c common/common-utils.c common/xml-utils.c \
 	common/ptid.c common/buffer.c gdb-dlfcn.c common/agent.c \
 	common/format.c common/filestuff.c btrace.c record-btrace.c ctf.c \
-	common/target-common.c
+	target/waitstatus.c
 
 LINTFILES = $(SFILES) $(YYFILES) $(CONFIG_SRCS) init.c
 
@@ -854,7 +854,8 @@ common/common-utils.h common/xml-utils.h common/buffer.h common/ptid.h \
 common/format.h common/host-defs.h utils.h common/queue.h common/gdb_string.h \
 common/linux-osdata.h gdb-dlfcn.h auto-load.h probe.h stap-probe.h \
 gdb_bfd.h sparc-ravenscar-thread.h ppc-ravenscar-thread.h common/linux-btrace.h \
-ctf.h common/i386-cpuid.h common/i386-gcc-cpuid.h common/target-common.h
+ctf.h common/i386-cpuid.h common/i386-gcc-cpuid.h target/resume.h \
+target/wait.h target/waitstatus.h
 
 # Header files that already have srcdir in them, or which are in objdir.
 
@@ -948,7 +949,7 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \
 	inferior.o osdata.o gdb_usleep.o record.o record-full.o gcore.o \
 	gdb_vecs.o jit.o progspace.o skip.o probe.o \
 	common-utils.o buffer.o ptid.o gdb-dlfcn.o common-agent.o \
-	format.o registry.o btrace.o record-btrace.o target-common.o
+	format.o registry.o btrace.o record-btrace.o target-waitstatus.o
 
 TSOBS = inflow.o
 
@@ -2022,8 +2023,8 @@ linux-btrace.o: ${srcdir}/common/linux-btrace.c
 	$(COMPILE) $(srcdir)/common/linux-btrace.c
 	$(POSTCOMPILE)
 
-target-common.o: ${srcdir}/common/target-common.c
-	$(COMPILE) $(srcdir)/common/target-common.c
+target-waitstatus.o: ${srcdir}/target/waitstatus.c
+	$(COMPILE) $(srcdir)/target/waitstatus.c
 	$(POSTCOMPILE)
 
 mips-linux-watch.o: ${srcdir}/common/mips-linux-watch.c
diff --git a/gdb/common/target-common.c b/gdb/common/target-common.c
deleted file mode 100644
index 2edbb2a..0000000
--- a/gdb/common/target-common.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Common target operations for GDB and gdbserver.
-
-   Copyright (C) 1990-2013 Free Software Foundation, Inc.
-
-   Contributed by Cygnus Support.
-   Contributed by MontaVista Software.
-
-   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/>.  */
-
-#ifdef GDBSERVER
-#include "server.h"
-#else
-#include "defs.h"
-#endif
-
-/* Return a pretty printed form of target_waitstatus.
-   Space for the result is malloc'd, caller must free.  */
-
-#include "target-common.h"
-
-/* Return a pretty printed form of target_waitstatus.
-   Space for the result is malloc'd, caller must free.  */
-
-char *
-target_waitstatus_to_string (const struct target_waitstatus *ws)
-{
-  const char *kind_str = "status->kind = ";
-
-  switch (ws->kind)
-    {
-    case TARGET_WAITKIND_EXITED:
-      return xstrprintf ("%sexited, status = %d",
-			 kind_str, ws->value.integer);
-    case TARGET_WAITKIND_STOPPED:
-      return xstrprintf ("%sstopped, signal = %s",
-			 kind_str, gdb_signal_to_name (ws->value.sig));
-    case TARGET_WAITKIND_SIGNALLED:
-      return xstrprintf ("%ssignalled, signal = %s",
-			 kind_str, gdb_signal_to_name (ws->value.sig));
-    case TARGET_WAITKIND_LOADED:
-      return xstrprintf ("%sloaded", kind_str);
-    case TARGET_WAITKIND_FORKED:
-      return xstrprintf ("%sforked", kind_str);
-    case TARGET_WAITKIND_VFORKED:
-      return xstrprintf ("%svforked", kind_str);
-    case TARGET_WAITKIND_EXECD:
-      return xstrprintf ("%sexecd", kind_str);
-    case TARGET_WAITKIND_VFORK_DONE:
-      return xstrprintf ("%svfork-done", kind_str);
-    case TARGET_WAITKIND_SYSCALL_ENTRY:
-      return xstrprintf ("%sentered syscall", kind_str);
-    case TARGET_WAITKIND_SYSCALL_RETURN:
-      return xstrprintf ("%sexited syscall", kind_str);
-    case TARGET_WAITKIND_SPURIOUS:
-      return xstrprintf ("%sspurious", kind_str);
-    case TARGET_WAITKIND_IGNORE:
-      return xstrprintf ("%signore", kind_str);
-    case TARGET_WAITKIND_NO_HISTORY:
-      return xstrprintf ("%sno-history", kind_str);
-    case TARGET_WAITKIND_NO_RESUMED:
-      return xstrprintf ("%sno-resumed", kind_str);
-    default:
-      return xstrprintf ("%sunknown???", kind_str);
-    }
-}
diff --git a/gdb/common/target-common.h b/gdb/common/target-common.h
deleted file mode 100644
index d4d73f6..0000000
--- a/gdb/common/target-common.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/* Interface between the debugger and target environments, including files
-   and processes, shared between GDB and gdbserver.
-
-   Copyright (C) 1990-2013 Free Software Foundation, Inc.
-
-   Contributed by Cygnus Support.  Written by John Gilmore.
-
-   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 TARGET_COMMON_H
-#define TARGET_COMMON_H
-
-#include "common-utils.h"
-#include "ptid.h"
-#include "gdb_signals.h"
-
-/* Ways to "resume" a thread.  */
-
-enum resume_kind
-{
-  /* Thread should continue.  */
-  resume_continue,
-
-  /* Thread should single-step.  */
-  resume_step,
-
-  /* Thread should be stopped.  */
-  resume_stop
-};
-
-/* Stuff for target_wait.  */
-
-/* Generally, what has the program done?  */
-enum target_waitkind
-{
-  /* The program has exited.  The exit status is in value.integer.  */
-  TARGET_WAITKIND_EXITED,
-
-  /* The program has stopped with a signal.  Which signal is in
-     value.sig.  */
-  TARGET_WAITKIND_STOPPED,
-
-  /* The program has terminated with a signal.  Which signal is in
-     value.sig.  */
-  TARGET_WAITKIND_SIGNALLED,
-
-  /* The program is letting us know that it dynamically loaded something
-     (e.g. it called load(2) on AIX).  */
-  TARGET_WAITKIND_LOADED,
-
-  /* The program has forked.  A "related" process' PTID is in
-     value.related_pid.  I.e., if the child forks, value.related_pid
-     is the parent's ID.  */
-  TARGET_WAITKIND_FORKED,
- 
-  /* The program has vforked.  A "related" process's PTID is in
-     value.related_pid.  */
-  TARGET_WAITKIND_VFORKED,
- 
-  /* The program has exec'ed a new executable file.  The new file's
-     pathname is pointed to by value.execd_pathname.  */
-  TARGET_WAITKIND_EXECD,
-  
-  /* The program had previously vforked, and now the child is done
-     with the shared memory region, because it exec'ed or exited.
-     Note that the event is reported to the vfork parent.  This is
-     only used if GDB did not stay attached to the vfork child,
-     otherwise, a TARGET_WAITKIND_EXECD or
-     TARGET_WAITKIND_EXIT|SIGNALLED event associated with the child
-     has the same effect.  */
-  TARGET_WAITKIND_VFORK_DONE,
-
-  /* The program has entered or returned from a system call.  On
-     HP-UX, this is used in the hardware watchpoint implementation.
-     The syscall's unique integer ID number is in value.syscall_id.  */
-  TARGET_WAITKIND_SYSCALL_ENTRY,
-  TARGET_WAITKIND_SYSCALL_RETURN,
-
-  /* Nothing happened, but we stopped anyway.  This perhaps should be handled
-     within target_wait, but I'm not sure target_wait should be resuming the
-     inferior.  */
-  TARGET_WAITKIND_SPURIOUS,
-
-  /* An event has occured, but we should wait again.
-     Remote_async_wait() returns this when there is an event
-     on the inferior, but the rest of the world is not interested in
-     it.  The inferior has not stopped, but has just sent some output
-     to the console, for instance.  In this case, we want to go back
-     to the event loop and wait there for another event from the
-     inferior, rather than being stuck in the remote_async_wait()
-     function. sThis way the event loop is responsive to other events,
-     like for instance the user typing.  */
-  TARGET_WAITKIND_IGNORE,
- 
-  /* The target has run out of history information,
-     and cannot run backward any further.  */
-  TARGET_WAITKIND_NO_HISTORY,
- 
-  /* There are no resumed children left in the program.  */
-  TARGET_WAITKIND_NO_RESUMED
-};
-
-struct target_waitstatus
-{
-  enum target_waitkind kind;
-
-  /* Additional information about the event.  */
-  union
-    {
-      /* Exit status */
-      int integer;
-      /* Signal number */
-      enum gdb_signal sig;
-      /* Forked child pid */
-      ptid_t related_pid;
-      /* execd pathname */
-      char *execd_pathname;
-      /* Syscall number */
-      int syscall_number;
-    } value;
-};
-
-/* Options that can be passed to target_wait.  */
-
-/* Return immediately if there's no event already queued.  If this
-   options is not requested, target_wait blocks waiting for an
-   event.  */
-#define TARGET_WNOHANG 1
-
-/* Prototypes */
-
-/* Return a pretty printed form of target_waitstatus.
-   Space for the result is malloc'd, caller must free.  */
-extern char *target_waitstatus_to_string (const struct target_waitstatus *);
-
-#endif /* TARGET_COMMON_H */
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index e541497..25b9a2c 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -101,7 +101,7 @@ GNULIB_H = $(GNULIB_BUILDDIR)/import/string.h @GNULIB_STDINT_H@
 # -I${srcdir} for our headers.
 # -I$(srcdir)/../regformats for regdef.h.
 INCLUDE_CFLAGS = -I. -I${srcdir} -I$(srcdir)/../common \
-	-I$(srcdir)/../regformats -I$(INCLUDE_DIR) \
+	-I$(srcdir)/../regformats -I$(srcdir)/../ -I$(INCLUDE_DIR) \
 	$(INCGNU)
 
 # M{H,T}_CFLAGS, if defined, has host- and target-dependent CFLAGS
@@ -157,7 +157,7 @@ SFILES=	$(srcdir)/gdbreplay.c $(srcdir)/inferiors.c $(srcdir)/dll.c \
 	$(srcdir)/common/common-utils.c $(srcdir)/common/xml-utils.c \
 	$(srcdir)/common/linux-osdata.c $(srcdir)/common/ptid.c \
 	$(srcdir)/common/buffer.c $(srcdir)/common/linux-btrace.c \
-	$(srcdir)/common/filestuff.c $(srcdir)/common/target-common.c \
+	$(srcdir)/common/filestuff.c $(srcdir)/target/waitstatus.c \
     $(srcdir)/common/mips-linux-watch.c
 
 DEPFILES = @GDBSERVER_DEPFILES@
@@ -168,7 +168,7 @@ SOURCES = $(SFILES)
 TAGFILES = $(SOURCES) ${HFILES} ${ALLPARAM} ${POSSLIBS}
 
 OBS = agent.o ax.o inferiors.o regcache.o remote-utils.o server.o signals.o \
-      target.o target-common.o utils.o version.o vec.o gdb_vecs.o \
+      target.o target-waitstatus.o utils.o version.o vec.o gdb_vecs.o \
       mem-break.o hostio.o event-loop.o tracepoint.o xml-utils.o \
       common-utils.o ptid.o buffer.o format.o filestuff.o dll.o notif.o \
       tdesc.o $(XML_BUILTIN) $(DEPFILES) $(LIBOBJS)
@@ -437,7 +437,9 @@ server_h = $(srcdir)/server.h $(regcache_h) $(srcdir)/target.h \
 		$(srcdir)/../common/buffer.h \
 		$(srcdir)/../common/gdb_assert.h \
 		$(srcdir)/../common/gdb_locale.h \
-		$(srcdir)/../common/target-common.h \
+		$(srcdir)/../target/resume.h \
+		$(srcdir)/../target/wait.h \
+		$(srcdir)/../target/waitstatus.h \
 		$(ptid_h) \
 		$(signals_h) \
 		$(libiberty_h) \
@@ -550,7 +552,7 @@ filestuff.o: ../common/filestuff.c
 agent.o: ../common/agent.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
-target-common.o: ../common/target-common.c
+target-waitstatus.o: ../target/waitstatus.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h
index d064b79..7629b14 100644
--- a/gdb/gdbserver/target.h
+++ b/gdb/gdbserver/target.h
@@ -21,7 +21,9 @@
 #ifndef TARGET_H
 #define TARGET_H
 
-#include "target-common.h"
+#include "target/resume.h"
+#include "target/wait.h"
+#include "target/waitstatus.h"
 
 struct emit_ops;
 struct btrace_target_info;
diff --git a/gdb/target.h b/gdb/target.h
index 1d73bcd..d538e02 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -57,7 +57,9 @@ struct expression;
    it goes into the file stratum, which is always below the process
    stratum.  */
 
-#include "target-common.h"
+#include "target/resume.h"
+#include "target/wait.h"
+#include "target/waitstatus.h"
 #include "bfd.h"
 #include "symtab.h"
 #include "memattr.h"
diff --git a/gdb/target/resume.h b/gdb/target/resume.h
new file mode 100644
index 0000000..bb7a38c
--- /dev/null
+++ b/gdb/target/resume.h
@@ -0,0 +1,37 @@
+/* Target resumption definitions and prototypes.
+
+   Copyright (C) 1990-2013 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 RESUME_H
+#define RESUME_H
+
+/* Ways to "resume" a thread.  */
+
+enum resume_kind
+{
+  /* Thread should continue.  */
+  resume_continue,
+
+  /* Thread should single-step.  */
+  resume_step,
+
+  /* Thread should be stopped.  */
+  resume_stop
+};
+
+#endif /* RESUME_H */
diff --git a/gdb/target/wait.h b/gdb/target/wait.h
new file mode 100644
index 0000000..a5f18b5
--- /dev/null
+++ b/gdb/target/wait.h
@@ -0,0 +1,30 @@
+/* Target wait definitions and prototypes.
+
+   Copyright (C) 1990-2013 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 WAIT_H
+#define WAIT_H
+
+/* Options that can be passed to target_wait.  */
+
+/* Return immediately if there's no event already queued.  If this
+   options is not requested, target_wait blocks waiting for an
+   event.  */
+#define TARGET_WNOHANG 1
+
+#endif /* WAIT_H */
diff --git a/gdb/target/waitstatus.c b/gdb/target/waitstatus.c
new file mode 100644
index 0000000..e6b8502
--- /dev/null
+++ b/gdb/target/waitstatus.c
@@ -0,0 +1,72 @@
+/* Target waitstatus implementations.
+
+   Copyright (C) 1990-2013 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/>.  */
+
+#ifdef GDBSERVER
+#include "server.h"
+#else
+#include "defs.h"
+#endif
+
+#include "waitstatus.h"
+
+/* Return a pretty printed form of target_waitstatus.
+   Space for the result is malloc'd, caller must free.  */
+
+char *
+target_waitstatus_to_string (const struct target_waitstatus *ws)
+{
+  const char *kind_str = "status->kind = ";
+
+  switch (ws->kind)
+    {
+    case TARGET_WAITKIND_EXITED:
+      return xstrprintf ("%sexited, status = %d",
+			 kind_str, ws->value.integer);
+    case TARGET_WAITKIND_STOPPED:
+      return xstrprintf ("%sstopped, signal = %s",
+			 kind_str, gdb_signal_to_name (ws->value.sig));
+    case TARGET_WAITKIND_SIGNALLED:
+      return xstrprintf ("%ssignalled, signal = %s",
+			 kind_str, gdb_signal_to_name (ws->value.sig));
+    case TARGET_WAITKIND_LOADED:
+      return xstrprintf ("%sloaded", kind_str);
+    case TARGET_WAITKIND_FORKED:
+      return xstrprintf ("%sforked", kind_str);
+    case TARGET_WAITKIND_VFORKED:
+      return xstrprintf ("%svforked", kind_str);
+    case TARGET_WAITKIND_EXECD:
+      return xstrprintf ("%sexecd", kind_str);
+    case TARGET_WAITKIND_VFORK_DONE:
+      return xstrprintf ("%svfork-done", kind_str);
+    case TARGET_WAITKIND_SYSCALL_ENTRY:
+      return xstrprintf ("%sentered syscall", kind_str);
+    case TARGET_WAITKIND_SYSCALL_RETURN:
+      return xstrprintf ("%sexited syscall", kind_str);
+    case TARGET_WAITKIND_SPURIOUS:
+      return xstrprintf ("%sspurious", kind_str);
+    case TARGET_WAITKIND_IGNORE:
+      return xstrprintf ("%signore", kind_str);
+    case TARGET_WAITKIND_NO_HISTORY:
+      return xstrprintf ("%sno-history", kind_str);
+    case TARGET_WAITKIND_NO_RESUMED:
+      return xstrprintf ("%sno-resumed", kind_str);
+    default:
+      return xstrprintf ("%sunknown???", kind_str);
+    }
+}
diff --git a/gdb/target/waitstatus.h b/gdb/target/waitstatus.h
new file mode 100644
index 0000000..cafbf15
--- /dev/null
+++ b/gdb/target/waitstatus.h
@@ -0,0 +1,126 @@
+/* Target waitstatus definitions and prototypes.
+
+   Copyright (C) 1990-2013 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 WAITSTATUS_H
+#define WAITSTATUS_H
+
+#include "common-utils.h"
+#include "ptid.h"
+#include "gdb_signals.h"
+
+/* Stuff for target_wait.  */
+
+/* Generally, what has the program done?  */
+enum target_waitkind
+{
+  /* The program has exited.  The exit status is in value.integer.  */
+  TARGET_WAITKIND_EXITED,
+
+  /* The program has stopped with a signal.  Which signal is in
+     value.sig.  */
+  TARGET_WAITKIND_STOPPED,
+
+  /* The program has terminated with a signal.  Which signal is in
+     value.sig.  */
+  TARGET_WAITKIND_SIGNALLED,
+
+  /* The program is letting us know that it dynamically loaded
+     something (e.g. it called load(2) on AIX).  */
+  TARGET_WAITKIND_LOADED,
+
+  /* The program has forked.  A "related" process' PTID is in
+     value.related_pid.  I.e., if the child forks, value.related_pid
+     is the parent's ID.  */
+  TARGET_WAITKIND_FORKED,
+ 
+  /* The program has vforked.  A "related" process's PTID is in
+     value.related_pid.  */
+  TARGET_WAITKIND_VFORKED,
+ 
+  /* The program has exec'ed a new executable file.  The new file's
+     pathname is pointed to by value.execd_pathname.  */
+  TARGET_WAITKIND_EXECD,
+  
+  /* The program had previously vforked, and now the child is done
+     with the shared memory region, because it exec'ed or exited.
+     Note that the event is reported to the vfork parent.  This is
+     only used if GDB did not stay attached to the vfork child,
+     otherwise, a TARGET_WAITKIND_EXECD or
+     TARGET_WAITKIND_EXIT|SIGNALLED event associated with the child
+     has the same effect.  */
+  TARGET_WAITKIND_VFORK_DONE,
+
+  /* The program has entered or returned from a system call.  On
+     HP-UX, this is used in the hardware watchpoint implementation.
+     The syscall's unique integer ID number is in
+     value.syscall_id.  */
+  TARGET_WAITKIND_SYSCALL_ENTRY,
+  TARGET_WAITKIND_SYSCALL_RETURN,
+
+  /* Nothing happened, but we stopped anyway.  This perhaps should
+     be handled within target_wait, but I'm not sure target_wait
+     should be resuming the inferior.  */
+  TARGET_WAITKIND_SPURIOUS,
+
+  /* An event has occured, but we should wait again.
+     Remote_async_wait() returns this when there is an event
+     on the inferior, but the rest of the world is not interested in
+     it.  The inferior has not stopped, but has just sent some output
+     to the console, for instance.  In this case, we want to go back
+     to the event loop and wait there for another event from the
+     inferior, rather than being stuck in the remote_async_wait()
+     function. sThis way the event loop is responsive to other events,
+     like for instance the user typing.  */
+  TARGET_WAITKIND_IGNORE,
+ 
+  /* The target has run out of history information,
+     and cannot run backward any further.  */
+  TARGET_WAITKIND_NO_HISTORY,
+ 
+  /* There are no resumed children left in the program.  */
+  TARGET_WAITKIND_NO_RESUMED
+};
+
+struct target_waitstatus
+{
+  enum target_waitkind kind;
+
+  /* Additional information about the event.  */
+  union
+    {
+      /* Exit status */
+      int integer;
+      /* Signal number */
+      enum gdb_signal sig;
+      /* Forked child pid */
+      ptid_t related_pid;
+      /* execd pathname */
+      char *execd_pathname;
+      /* Syscall number */
+      int syscall_number;
+    } value;
+};
+
+/* Prototypes */
+
+/* Return a pretty printed form of target_waitstatus.
+   Space for the result is malloc'd, caller must free.  */
+extern char *target_waitstatus_to_string (const struct target_waitstatus *);
+
+#endif /* WAITSTATUS_H */

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Refactor common/target-common into meaningful bits
  2013-08-16 14:49 ` Luis Machado
@ 2013-08-17  4:01   ` Luis Machado
  2013-08-19 13:45   ` Pedro Alves
  1 sibling, 0 replies; 16+ messages in thread
From: Luis Machado @ 2013-08-17  4:01 UTC (permalink / raw)
  Cc: 'gdb-patches@sourceware.org', Pedro Alves, Tom Tromey

I see some gotchas with this patch (on Makefile.in etc).

I'll get those fixed and will submit an updated version.

On 08/16/2013 11:49 AM, Luis Machado wrote:
> Hi,
>
> This is an updated version of the patch that drops the target-* naming,
> creates a new directory named "target" under src/gdb and renames the
> files target-<something>.* to <something.*.
>
> Based on previous discussions, it seems this is what it should look like
> in the future.
>
> One of the differences now is the inclusion of, for example,
> "target/resume.h" instead of "resume.h". It looks more intuitive this way.
>
> Ok?
>
> Luis
>
> On 08/01/2013 02:09 PM, Luis Machado wrote:
>> Hi,
>>
>> After the previous discussion
>> (http://sourceware.org/ml/gdb-patches/2013-07/msg00840.html), follows a
>> patch to refactor the ill-named target-common.[c|h] files into something
>> a bit more meaningful.
>>
>> First, it seems like a good idea to stablish a  more meaningful
>> directory structure as well, so we are moving target-common.[c|h] from
>> the "common" dir to the new "target" dir. This new directory will hold
>> anything more backend-related. For now it contains only generic target
>> definitions and functions.
>>
>> I've broken target-common.[c|h] into the following:
>>
>> - target-resume.h: Definition for resume_kind.
>>
>> - target-waitstatus.[c|h]: Definitions and code for anything related to
>> waitstatus.
>>
>> - target-wait.h: A tiny bit that does not seem to fit properly in the
>> waitstatus files, so it is left here.
>>
>> As usual, Makefile and other dependencies have been adjusted. Everything
>> builds fine and does not show any regressions.
>>
>> The copyright headers have been adjusted and cleaned up to remove
>> contribution messages.
>>
>> Comments over 70 columns have also been adjusted for this patch.
>>
>> Thoughts?
>>
>> Luis
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Refactor common/target-common into meaningful bits
  2013-08-16 14:49 ` Luis Machado
  2013-08-17  4:01   ` Luis Machado
@ 2013-08-19 13:45   ` Pedro Alves
  2013-08-19 16:57     ` Luis Machado
  1 sibling, 1 reply; 16+ messages in thread
From: Pedro Alves @ 2013-08-19 13:45 UTC (permalink / raw)
  To: lgustavo; +Cc: 'gdb-patches@sourceware.org', Tom Tromey

On 08/16/2013 03:49 PM, Luis Machado wrote:

> This is an updated version of the patch that drops the target-* naming, 
> creates a new directory named "target" under src/gdb and renames the 
> files target-<something>.* to <something.*.
> 
> Based on previous discussions, it seems this is what it should look like 
> in the future.
> 
> One of the differences now is the inclusion of, for example, 
> "target/resume.h" instead of "resume.h". It looks more intuitive this way.

Yes, and the corresponding '#include "wait.h"' would collide with
the system's /usr/include/wait.h.

> -target-common.o: ${srcdir}/common/target-common.c
> -	$(COMPILE) $(srcdir)/common/target-common.c
> +target-waitstatus.o: ${srcdir}/target/waitstatus.c

Any reason this isn't waitstatus.o?

> @@ -550,7 +552,7 @@ filestuff.o: ../common/filestuff.c
>  agent.o: ../common/agent.c
>  	$(COMPILE) $<
>  	$(POSTCOMPILE)
> -target-common.o: ../common/target-common.c
> +target-waitstatus.o: ../target/waitstatus.c
>  	$(COMPILE) $<
>  	$(POSTCOMPILE)

Here too.

Otherwise looks fine to me.

Thanks,
-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Refactor common/target-common into meaningful bits
  2013-08-19 13:45   ` Pedro Alves
@ 2013-08-19 16:57     ` Luis Machado
  0 siblings, 0 replies; 16+ messages in thread
From: Luis Machado @ 2013-08-19 16:57 UTC (permalink / raw)
  To: Pedro Alves; +Cc: 'gdb-patches@sourceware.org', Tom Tromey

[-- Attachment #1: Type: text/plain, Size: 1245 bytes --]

On 08/19/2013 10:45 AM, Pedro Alves wrote:
> On 08/16/2013 03:49 PM, Luis Machado wrote:
>
>> This is an updated version of the patch that drops the target-* naming,
>> creates a new directory named "target" under src/gdb and renames the
>> files target-<something>.* to <something.*.
>>
>> Based on previous discussions, it seems this is what it should look like
>> in the future.
>>
>> One of the differences now is the inclusion of, for example,
>> "target/resume.h" instead of "resume.h". It looks more intuitive this way.
>
> Yes, and the corresponding '#include "wait.h"' would collide with
> the system's /usr/include/wait.h.
>
>> -target-common.o: ${srcdir}/common/target-common.c
>> -	$(COMPILE) $(srcdir)/common/target-common.c
>> +target-waitstatus.o: ${srcdir}/target/waitstatus.c
>
> Any reason this isn't waitstatus.o?
>

Yeah. Fixed this in the final version now.

>> @@ -550,7 +552,7 @@ filestuff.o: ../common/filestuff.c
>>   agent.o: ../common/agent.c
>>   	$(COMPILE) $<
>>   	$(POSTCOMPILE)
>> -target-common.o: ../common/target-common.c
>> +target-waitstatus.o: ../target/waitstatus.c
>>   	$(COMPILE) $<
>>   	$(POSTCOMPILE)
>
> Here too.
>
> Otherwise looks fine to me.
>
> Thanks,
>

Thanks! Here is what i checked in.



[-- Attachment #2: target.diff --]
[-- Type: text/x-patch, Size: 24807 bytes --]

2013-08-19  Luis Machado  <lgustavo@codesourcery.com>
    
	gdb/
	* Makefile.in (SFILES): Remove common/target-common.c and
	add target/waitstatus.c.
	(HFILES_NO_SRCDIR): Remove common/target-common.h and add
	target/resume.h, target/wait.h and target/waitstatus.h.
	(COMMON_OBS): Remove target-common.o and add
	waitstatus.o.
	(target-common.o): Remove.
	(waitstatus.o): New target object file.
	* common/target-common.c: Move contents to
	target/waitstatus.c and remove.
	* common/target-common.h: Move contents to other files and
	remove.
	(enum resume_kind: Move to target/resume.h.
	(TARGET_WNOHANG): Move to target/wait.h.
	(enum target_waitkind): Move to target/waitstatus.h.
	(struct target_waitstatus): Likewise.
	* target.h: Do not include target-common.h and
	include target/resume.h, target/wait.h and
	target/waitstatus.h.
	* target/resume.h: New file.
	* target/wait.h: New file.
	* target/waitstatus.h: New file.
	* target/waitstatus.c: New file.
    
	gdb/gdbserver/
	* Makefile.in (INCLUDE_CFLAGS): Include -I$(srcdir)/../.
	(SFILES): Remove $(srcdir)/common/target-common.c and
	add $(srcdir)/target/waitstatus.c.
	(OBS): Remove target-common.o and add waitstatus.o.
	(server_h): Remove $(srcdir)/../common/target-common.h and
	add $(srcdir)/../target/resume.h, $(srcdir)/../target/wait.h
	and $(srcdir)/../target/waitstatus.h.
	(target-common.o): Remove.
	(waitstatus.o): New target object file.
	* target.h: Do not include target-common.h and
	include target/resume.h, target/wait.h and
	target/waitstatus.h.

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 9171940..45cddaf 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -775,7 +775,7 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \
 	common/gdb_vecs.c common/common-utils.c common/xml-utils.c \
 	common/ptid.c common/buffer.c gdb-dlfcn.c common/agent.c \
 	common/format.c common/filestuff.c btrace.c record-btrace.c ctf.c \
-	common/target-common.c
+	target/waitstatus.c
 
 LINTFILES = $(SFILES) $(YYFILES) $(CONFIG_SRCS) init.c
 
@@ -854,7 +854,8 @@ common/common-utils.h common/xml-utils.h common/buffer.h common/ptid.h \
 common/format.h common/host-defs.h utils.h common/queue.h common/gdb_string.h \
 common/linux-osdata.h gdb-dlfcn.h auto-load.h probe.h stap-probe.h \
 gdb_bfd.h sparc-ravenscar-thread.h ppc-ravenscar-thread.h common/linux-btrace.h \
-ctf.h common/i386-cpuid.h common/i386-gcc-cpuid.h common/target-common.h
+ctf.h common/i386-cpuid.h common/i386-gcc-cpuid.h target/resume.h \
+target/wait.h target/waitstatus.h
 
 # Header files that already have srcdir in them, or which are in objdir.
 
@@ -948,7 +949,7 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \
 	inferior.o osdata.o gdb_usleep.o record.o record-full.o gcore.o \
 	gdb_vecs.o jit.o progspace.o skip.o probe.o \
 	common-utils.o buffer.o ptid.o gdb-dlfcn.o common-agent.o \
-	format.o registry.o btrace.o record-btrace.o target-common.o
+	format.o registry.o btrace.o record-btrace.o waitstatus.o
 
 TSOBS = inflow.o
 
@@ -2022,15 +2023,21 @@ linux-btrace.o: ${srcdir}/common/linux-btrace.c
 	$(COMPILE) $(srcdir)/common/linux-btrace.c
 	$(POSTCOMPILE)
 
-target-common.o: ${srcdir}/common/target-common.c
-	$(COMPILE) $(srcdir)/common/target-common.c
-	$(POSTCOMPILE)
-
 mips-linux-watch.o: ${srcdir}/common/mips-linux-watch.c
 	$(COMPILE) $(srcdir)/common/mips-linux-watch.c
 	$(POSTCOMPILE)
 
 #
+# gdb/target/ dependencies
+#
+# Need to explicitly specify the compile rule as make will do nothing
+# or try to compile the object file into the sub-directory.
+
+waitstatus.o: ${srcdir}/target/waitstatus.c
+	$(COMPILE) $(srcdir)/target/waitstatus.c
+	$(POSTCOMPILE)
+
+#
 # gdb/tui/ dependencies
 #
 # Need to explicitly specify the compile rule as make will do nothing
diff --git a/gdb/common/target-common.c b/gdb/common/target-common.c
deleted file mode 100644
index 2edbb2a..0000000
--- a/gdb/common/target-common.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Common target operations for GDB and gdbserver.
-
-   Copyright (C) 1990-2013 Free Software Foundation, Inc.
-
-   Contributed by Cygnus Support.
-   Contributed by MontaVista Software.
-
-   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/>.  */
-
-#ifdef GDBSERVER
-#include "server.h"
-#else
-#include "defs.h"
-#endif
-
-/* Return a pretty printed form of target_waitstatus.
-   Space for the result is malloc'd, caller must free.  */
-
-#include "target-common.h"
-
-/* Return a pretty printed form of target_waitstatus.
-   Space for the result is malloc'd, caller must free.  */
-
-char *
-target_waitstatus_to_string (const struct target_waitstatus *ws)
-{
-  const char *kind_str = "status->kind = ";
-
-  switch (ws->kind)
-    {
-    case TARGET_WAITKIND_EXITED:
-      return xstrprintf ("%sexited, status = %d",
-			 kind_str, ws->value.integer);
-    case TARGET_WAITKIND_STOPPED:
-      return xstrprintf ("%sstopped, signal = %s",
-			 kind_str, gdb_signal_to_name (ws->value.sig));
-    case TARGET_WAITKIND_SIGNALLED:
-      return xstrprintf ("%ssignalled, signal = %s",
-			 kind_str, gdb_signal_to_name (ws->value.sig));
-    case TARGET_WAITKIND_LOADED:
-      return xstrprintf ("%sloaded", kind_str);
-    case TARGET_WAITKIND_FORKED:
-      return xstrprintf ("%sforked", kind_str);
-    case TARGET_WAITKIND_VFORKED:
-      return xstrprintf ("%svforked", kind_str);
-    case TARGET_WAITKIND_EXECD:
-      return xstrprintf ("%sexecd", kind_str);
-    case TARGET_WAITKIND_VFORK_DONE:
-      return xstrprintf ("%svfork-done", kind_str);
-    case TARGET_WAITKIND_SYSCALL_ENTRY:
-      return xstrprintf ("%sentered syscall", kind_str);
-    case TARGET_WAITKIND_SYSCALL_RETURN:
-      return xstrprintf ("%sexited syscall", kind_str);
-    case TARGET_WAITKIND_SPURIOUS:
-      return xstrprintf ("%sspurious", kind_str);
-    case TARGET_WAITKIND_IGNORE:
-      return xstrprintf ("%signore", kind_str);
-    case TARGET_WAITKIND_NO_HISTORY:
-      return xstrprintf ("%sno-history", kind_str);
-    case TARGET_WAITKIND_NO_RESUMED:
-      return xstrprintf ("%sno-resumed", kind_str);
-    default:
-      return xstrprintf ("%sunknown???", kind_str);
-    }
-}
diff --git a/gdb/common/target-common.h b/gdb/common/target-common.h
deleted file mode 100644
index d4d73f6..0000000
--- a/gdb/common/target-common.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/* Interface between the debugger and target environments, including files
-   and processes, shared between GDB and gdbserver.
-
-   Copyright (C) 1990-2013 Free Software Foundation, Inc.
-
-   Contributed by Cygnus Support.  Written by John Gilmore.
-
-   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 TARGET_COMMON_H
-#define TARGET_COMMON_H
-
-#include "common-utils.h"
-#include "ptid.h"
-#include "gdb_signals.h"
-
-/* Ways to "resume" a thread.  */
-
-enum resume_kind
-{
-  /* Thread should continue.  */
-  resume_continue,
-
-  /* Thread should single-step.  */
-  resume_step,
-
-  /* Thread should be stopped.  */
-  resume_stop
-};
-
-/* Stuff for target_wait.  */
-
-/* Generally, what has the program done?  */
-enum target_waitkind
-{
-  /* The program has exited.  The exit status is in value.integer.  */
-  TARGET_WAITKIND_EXITED,
-
-  /* The program has stopped with a signal.  Which signal is in
-     value.sig.  */
-  TARGET_WAITKIND_STOPPED,
-
-  /* The program has terminated with a signal.  Which signal is in
-     value.sig.  */
-  TARGET_WAITKIND_SIGNALLED,
-
-  /* The program is letting us know that it dynamically loaded something
-     (e.g. it called load(2) on AIX).  */
-  TARGET_WAITKIND_LOADED,
-
-  /* The program has forked.  A "related" process' PTID is in
-     value.related_pid.  I.e., if the child forks, value.related_pid
-     is the parent's ID.  */
-  TARGET_WAITKIND_FORKED,
- 
-  /* The program has vforked.  A "related" process's PTID is in
-     value.related_pid.  */
-  TARGET_WAITKIND_VFORKED,
- 
-  /* The program has exec'ed a new executable file.  The new file's
-     pathname is pointed to by value.execd_pathname.  */
-  TARGET_WAITKIND_EXECD,
-  
-  /* The program had previously vforked, and now the child is done
-     with the shared memory region, because it exec'ed or exited.
-     Note that the event is reported to the vfork parent.  This is
-     only used if GDB did not stay attached to the vfork child,
-     otherwise, a TARGET_WAITKIND_EXECD or
-     TARGET_WAITKIND_EXIT|SIGNALLED event associated with the child
-     has the same effect.  */
-  TARGET_WAITKIND_VFORK_DONE,
-
-  /* The program has entered or returned from a system call.  On
-     HP-UX, this is used in the hardware watchpoint implementation.
-     The syscall's unique integer ID number is in value.syscall_id.  */
-  TARGET_WAITKIND_SYSCALL_ENTRY,
-  TARGET_WAITKIND_SYSCALL_RETURN,
-
-  /* Nothing happened, but we stopped anyway.  This perhaps should be handled
-     within target_wait, but I'm not sure target_wait should be resuming the
-     inferior.  */
-  TARGET_WAITKIND_SPURIOUS,
-
-  /* An event has occured, but we should wait again.
-     Remote_async_wait() returns this when there is an event
-     on the inferior, but the rest of the world is not interested in
-     it.  The inferior has not stopped, but has just sent some output
-     to the console, for instance.  In this case, we want to go back
-     to the event loop and wait there for another event from the
-     inferior, rather than being stuck in the remote_async_wait()
-     function. sThis way the event loop is responsive to other events,
-     like for instance the user typing.  */
-  TARGET_WAITKIND_IGNORE,
- 
-  /* The target has run out of history information,
-     and cannot run backward any further.  */
-  TARGET_WAITKIND_NO_HISTORY,
- 
-  /* There are no resumed children left in the program.  */
-  TARGET_WAITKIND_NO_RESUMED
-};
-
-struct target_waitstatus
-{
-  enum target_waitkind kind;
-
-  /* Additional information about the event.  */
-  union
-    {
-      /* Exit status */
-      int integer;
-      /* Signal number */
-      enum gdb_signal sig;
-      /* Forked child pid */
-      ptid_t related_pid;
-      /* execd pathname */
-      char *execd_pathname;
-      /* Syscall number */
-      int syscall_number;
-    } value;
-};
-
-/* Options that can be passed to target_wait.  */
-
-/* Return immediately if there's no event already queued.  If this
-   options is not requested, target_wait blocks waiting for an
-   event.  */
-#define TARGET_WNOHANG 1
-
-/* Prototypes */
-
-/* Return a pretty printed form of target_waitstatus.
-   Space for the result is malloc'd, caller must free.  */
-extern char *target_waitstatus_to_string (const struct target_waitstatus *);
-
-#endif /* TARGET_COMMON_H */
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index e541497..2cdbf47 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -101,7 +101,7 @@ GNULIB_H = $(GNULIB_BUILDDIR)/import/string.h @GNULIB_STDINT_H@
 # -I${srcdir} for our headers.
 # -I$(srcdir)/../regformats for regdef.h.
 INCLUDE_CFLAGS = -I. -I${srcdir} -I$(srcdir)/../common \
-	-I$(srcdir)/../regformats -I$(INCLUDE_DIR) \
+	-I$(srcdir)/../regformats -I$(srcdir)/../ -I$(INCLUDE_DIR) \
 	$(INCGNU)
 
 # M{H,T}_CFLAGS, if defined, has host- and target-dependent CFLAGS
@@ -157,7 +157,7 @@ SFILES=	$(srcdir)/gdbreplay.c $(srcdir)/inferiors.c $(srcdir)/dll.c \
 	$(srcdir)/common/common-utils.c $(srcdir)/common/xml-utils.c \
 	$(srcdir)/common/linux-osdata.c $(srcdir)/common/ptid.c \
 	$(srcdir)/common/buffer.c $(srcdir)/common/linux-btrace.c \
-	$(srcdir)/common/filestuff.c $(srcdir)/common/target-common.c \
+	$(srcdir)/common/filestuff.c $(srcdir)/target/waitstatus.c \
     $(srcdir)/common/mips-linux-watch.c
 
 DEPFILES = @GDBSERVER_DEPFILES@
@@ -168,7 +168,7 @@ SOURCES = $(SFILES)
 TAGFILES = $(SOURCES) ${HFILES} ${ALLPARAM} ${POSSLIBS}
 
 OBS = agent.o ax.o inferiors.o regcache.o remote-utils.o server.o signals.o \
-      target.o target-common.o utils.o version.o vec.o gdb_vecs.o \
+      target.o waitstatus.o utils.o version.o vec.o gdb_vecs.o \
       mem-break.o hostio.o event-loop.o tracepoint.o xml-utils.o \
       common-utils.o ptid.o buffer.o format.o filestuff.o dll.o notif.o \
       tdesc.o $(XML_BUILTIN) $(DEPFILES) $(LIBOBJS)
@@ -437,7 +437,9 @@ server_h = $(srcdir)/server.h $(regcache_h) $(srcdir)/target.h \
 		$(srcdir)/../common/buffer.h \
 		$(srcdir)/../common/gdb_assert.h \
 		$(srcdir)/../common/gdb_locale.h \
-		$(srcdir)/../common/target-common.h \
+		$(srcdir)/../target/resume.h \
+		$(srcdir)/../target/wait.h \
+		$(srcdir)/../target/waitstatus.h \
 		$(ptid_h) \
 		$(signals_h) \
 		$(libiberty_h) \
@@ -550,7 +552,7 @@ filestuff.o: ../common/filestuff.c
 agent.o: ../common/agent.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
-target-common.o: ../common/target-common.c
+waitstatus.o: ../target/waitstatus.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h
index d064b79..7629b14 100644
--- a/gdb/gdbserver/target.h
+++ b/gdb/gdbserver/target.h
@@ -21,7 +21,9 @@
 #ifndef TARGET_H
 #define TARGET_H
 
-#include "target-common.h"
+#include "target/resume.h"
+#include "target/wait.h"
+#include "target/waitstatus.h"
 
 struct emit_ops;
 struct btrace_target_info;
diff --git a/gdb/target.h b/gdb/target.h
index 1d73bcd..d538e02 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -57,7 +57,9 @@ struct expression;
    it goes into the file stratum, which is always below the process
    stratum.  */
 
-#include "target-common.h"
+#include "target/resume.h"
+#include "target/wait.h"
+#include "target/waitstatus.h"
 #include "bfd.h"
 #include "symtab.h"
 #include "memattr.h"
diff --git a/gdb/target/resume.h b/gdb/target/resume.h
new file mode 100644
index 0000000..bb7a38c
--- /dev/null
+++ b/gdb/target/resume.h
@@ -0,0 +1,37 @@
+/* Target resumption definitions and prototypes.
+
+   Copyright (C) 1990-2013 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 RESUME_H
+#define RESUME_H
+
+/* Ways to "resume" a thread.  */
+
+enum resume_kind
+{
+  /* Thread should continue.  */
+  resume_continue,
+
+  /* Thread should single-step.  */
+  resume_step,
+
+  /* Thread should be stopped.  */
+  resume_stop
+};
+
+#endif /* RESUME_H */
diff --git a/gdb/target/wait.h b/gdb/target/wait.h
new file mode 100644
index 0000000..a5f18b5
--- /dev/null
+++ b/gdb/target/wait.h
@@ -0,0 +1,30 @@
+/* Target wait definitions and prototypes.
+
+   Copyright (C) 1990-2013 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 WAIT_H
+#define WAIT_H
+
+/* Options that can be passed to target_wait.  */
+
+/* Return immediately if there's no event already queued.  If this
+   options is not requested, target_wait blocks waiting for an
+   event.  */
+#define TARGET_WNOHANG 1
+
+#endif /* WAIT_H */
diff --git a/gdb/target/waitstatus.c b/gdb/target/waitstatus.c
new file mode 100644
index 0000000..e6b8502
--- /dev/null
+++ b/gdb/target/waitstatus.c
@@ -0,0 +1,72 @@
+/* Target waitstatus implementations.
+
+   Copyright (C) 1990-2013 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/>.  */
+
+#ifdef GDBSERVER
+#include "server.h"
+#else
+#include "defs.h"
+#endif
+
+#include "waitstatus.h"
+
+/* Return a pretty printed form of target_waitstatus.
+   Space for the result is malloc'd, caller must free.  */
+
+char *
+target_waitstatus_to_string (const struct target_waitstatus *ws)
+{
+  const char *kind_str = "status->kind = ";
+
+  switch (ws->kind)
+    {
+    case TARGET_WAITKIND_EXITED:
+      return xstrprintf ("%sexited, status = %d",
+			 kind_str, ws->value.integer);
+    case TARGET_WAITKIND_STOPPED:
+      return xstrprintf ("%sstopped, signal = %s",
+			 kind_str, gdb_signal_to_name (ws->value.sig));
+    case TARGET_WAITKIND_SIGNALLED:
+      return xstrprintf ("%ssignalled, signal = %s",
+			 kind_str, gdb_signal_to_name (ws->value.sig));
+    case TARGET_WAITKIND_LOADED:
+      return xstrprintf ("%sloaded", kind_str);
+    case TARGET_WAITKIND_FORKED:
+      return xstrprintf ("%sforked", kind_str);
+    case TARGET_WAITKIND_VFORKED:
+      return xstrprintf ("%svforked", kind_str);
+    case TARGET_WAITKIND_EXECD:
+      return xstrprintf ("%sexecd", kind_str);
+    case TARGET_WAITKIND_VFORK_DONE:
+      return xstrprintf ("%svfork-done", kind_str);
+    case TARGET_WAITKIND_SYSCALL_ENTRY:
+      return xstrprintf ("%sentered syscall", kind_str);
+    case TARGET_WAITKIND_SYSCALL_RETURN:
+      return xstrprintf ("%sexited syscall", kind_str);
+    case TARGET_WAITKIND_SPURIOUS:
+      return xstrprintf ("%sspurious", kind_str);
+    case TARGET_WAITKIND_IGNORE:
+      return xstrprintf ("%signore", kind_str);
+    case TARGET_WAITKIND_NO_HISTORY:
+      return xstrprintf ("%sno-history", kind_str);
+    case TARGET_WAITKIND_NO_RESUMED:
+      return xstrprintf ("%sno-resumed", kind_str);
+    default:
+      return xstrprintf ("%sunknown???", kind_str);
+    }
+}
diff --git a/gdb/target/waitstatus.h b/gdb/target/waitstatus.h
new file mode 100644
index 0000000..cafbf15
--- /dev/null
+++ b/gdb/target/waitstatus.h
@@ -0,0 +1,126 @@
+/* Target waitstatus definitions and prototypes.
+
+   Copyright (C) 1990-2013 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 WAITSTATUS_H
+#define WAITSTATUS_H
+
+#include "common-utils.h"
+#include "ptid.h"
+#include "gdb_signals.h"
+
+/* Stuff for target_wait.  */
+
+/* Generally, what has the program done?  */
+enum target_waitkind
+{
+  /* The program has exited.  The exit status is in value.integer.  */
+  TARGET_WAITKIND_EXITED,
+
+  /* The program has stopped with a signal.  Which signal is in
+     value.sig.  */
+  TARGET_WAITKIND_STOPPED,
+
+  /* The program has terminated with a signal.  Which signal is in
+     value.sig.  */
+  TARGET_WAITKIND_SIGNALLED,
+
+  /* The program is letting us know that it dynamically loaded
+     something (e.g. it called load(2) on AIX).  */
+  TARGET_WAITKIND_LOADED,
+
+  /* The program has forked.  A "related" process' PTID is in
+     value.related_pid.  I.e., if the child forks, value.related_pid
+     is the parent's ID.  */
+  TARGET_WAITKIND_FORKED,
+ 
+  /* The program has vforked.  A "related" process's PTID is in
+     value.related_pid.  */
+  TARGET_WAITKIND_VFORKED,
+ 
+  /* The program has exec'ed a new executable file.  The new file's
+     pathname is pointed to by value.execd_pathname.  */
+  TARGET_WAITKIND_EXECD,
+  
+  /* The program had previously vforked, and now the child is done
+     with the shared memory region, because it exec'ed or exited.
+     Note that the event is reported to the vfork parent.  This is
+     only used if GDB did not stay attached to the vfork child,
+     otherwise, a TARGET_WAITKIND_EXECD or
+     TARGET_WAITKIND_EXIT|SIGNALLED event associated with the child
+     has the same effect.  */
+  TARGET_WAITKIND_VFORK_DONE,
+
+  /* The program has entered or returned from a system call.  On
+     HP-UX, this is used in the hardware watchpoint implementation.
+     The syscall's unique integer ID number is in
+     value.syscall_id.  */
+  TARGET_WAITKIND_SYSCALL_ENTRY,
+  TARGET_WAITKIND_SYSCALL_RETURN,
+
+  /* Nothing happened, but we stopped anyway.  This perhaps should
+     be handled within target_wait, but I'm not sure target_wait
+     should be resuming the inferior.  */
+  TARGET_WAITKIND_SPURIOUS,
+
+  /* An event has occured, but we should wait again.
+     Remote_async_wait() returns this when there is an event
+     on the inferior, but the rest of the world is not interested in
+     it.  The inferior has not stopped, but has just sent some output
+     to the console, for instance.  In this case, we want to go back
+     to the event loop and wait there for another event from the
+     inferior, rather than being stuck in the remote_async_wait()
+     function. sThis way the event loop is responsive to other events,
+     like for instance the user typing.  */
+  TARGET_WAITKIND_IGNORE,
+ 
+  /* The target has run out of history information,
+     and cannot run backward any further.  */
+  TARGET_WAITKIND_NO_HISTORY,
+ 
+  /* There are no resumed children left in the program.  */
+  TARGET_WAITKIND_NO_RESUMED
+};
+
+struct target_waitstatus
+{
+  enum target_waitkind kind;
+
+  /* Additional information about the event.  */
+  union
+    {
+      /* Exit status */
+      int integer;
+      /* Signal number */
+      enum gdb_signal sig;
+      /* Forked child pid */
+      ptid_t related_pid;
+      /* execd pathname */
+      char *execd_pathname;
+      /* Syscall number */
+      int syscall_number;
+    } value;
+};
+
+/* Prototypes */
+
+/* Return a pretty printed form of target_waitstatus.
+   Space for the result is malloc'd, caller must free.  */
+extern char *target_waitstatus_to_string (const struct target_waitstatus *);
+
+#endif /* WAITSTATUS_H */

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2013-08-19 16:57 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-01 17:09 [PATCH] Refactor common/target-common into meaningful bits Luis Machado
2013-08-01 17:50 ` Tom Tromey
2013-08-01 17:52   ` Luis Machado
2013-08-02  9:29     ` Pedro Alves
2013-08-02 20:48       ` Tom Tromey
2013-08-05 10:44         ` Pedro Alves
2013-08-05 15:33           ` Luis Machado
2013-08-05 19:12           ` Tom Tromey
2013-08-05 19:21             ` Mark Kettenis
2013-08-06  8:48               ` Pedro Alves
2013-08-04 12:35       ` Yao Qi
2013-08-01 17:54   ` Pedro Alves
2013-08-16 14:49 ` Luis Machado
2013-08-17  4:01   ` Luis Machado
2013-08-19 13:45   ` Pedro Alves
2013-08-19 16:57     ` Luis Machado

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).