Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH 1/5] Define target_core_of_thread in gdbserver.
@ 2012-03-16 14:44 Yao Qi
  2012-03-16 14:44 ` [PATCH 2/5] Move vec to common/ Yao Qi
  2012-03-16 14:47 ` [PATCH 1/5] Define target_core_of_thread in gdbserver Yao Qi
  0 siblings, 2 replies; 8+ messages in thread
From: Yao Qi @ 2012-03-16 14:44 UTC (permalink / raw)
  To: gdb-patches

In ITSET, it needs to know the core number for a given thread id.  It is done
by target_core_of_thread in GDB.  In GDBserver, we do have code for this
purpose, but both side is not unified.  In this patch, a new macro
`target_core_of_thread' is defined, so code in gdb/common/ can use
target_core_of_thread without #if/#else/#endif wrappings.

gdb/gdbserver:

2012-03-16  Yao Qi  <yao@codesourcery.com>

	* remote-utils.c (prepare_resume_reply): Replace with macro
	target_core_of_thread.
	* server.c (handle_qxfer_threads_proper): Likewise.
	* target.h (traget_core_of_thread): New macro.
---
 gdb/gdbserver/remote-utils.c |    4 ++--
 gdb/gdbserver/server.c       |    5 +----
 gdb/gdbserver/target.h       |    4 ++++
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
index 4e35bb7..995e3b1 100644
--- a/gdb/gdbserver/remote-utils.c
+++ b/gdb/gdbserver/remote-utils.c
@@ -1390,8 +1390,8 @@ prepare_resume_reply (char *buf, ptid_t ptid,
 		strcat (buf, ";");
 		buf += strlen (buf);
 
-		if (the_target->core_of_thread)
-		  core = (*the_target->core_of_thread) (ptid);
+		core = target_core_of_thread (ptid);
+
 		if (core != -1)
 		  {
 		    sprintf (buf, "core:");
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 0de3f52..c330d17 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -1120,14 +1120,11 @@ handle_qxfer_threads_proper (struct buffer *buffer)
     {
       ptid_t ptid = thread_to_gdb_id ((struct thread_info *)thread);
       char ptid_s[100];
-      int core = -1;
+      int core = target_core_of_thread (ptid);
       char core_s[21];
 
       write_ptid (ptid_s, ptid);
 
-      if (the_target->core_of_thread)
-	core = (*the_target->core_of_thread) (ptid);
-
       if (core != -1)
 	{
 	  sprintf (core_s, "%d", core);
diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h
index 256cfd9..dcf0230 100644
--- a/gdb/gdbserver/target.h
+++ b/gdb/gdbserver/target.h
@@ -540,6 +540,10 @@ ptid_t mywait (ptid_t ptid, struct target_waitstatus *ourstatus, int options,
 	(*the_target->done_accessing_memory) ();  	\
     } while (0)
 
+#define target_core_of_thread(ptid)		\
+  (the_target->core_of_thread ? (*the_target->core_of_thread) (ptid) \
+   : -1)
+
 int read_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len);
 
 int write_inferior_memory (CORE_ADDR memaddr, const unsigned char *myaddr,
-- 
1.7.0.4


^ permalink raw reply	[flat|nested] 8+ messages in thread
* [PATCH 0/5] Preparatory patches for ITSET in GDBserver
@ 2012-03-16 15:01 Yao Qi
  2012-03-16 15:02 ` [PATCH 2/5] Move vec to common/ Yao Qi
  0 siblings, 1 reply; 8+ messages in thread
From: Yao Qi @ 2012-03-16 15:01 UTC (permalink / raw)
  To: gdb-patches

Hi,
This patch series include something that will be used when we support
ITSET in GDBserver, and even in IPA.

I applied Pedro's patches [1] on top of CVS trunk, and move most of ITSET
code to gdb/common/, so that both GDB, GDBserver and IPA supports
ITSET.  I am still looking at the regressions in native testing
and remote testing caused by patch 2/14 `running all-stop on top of
non-stop', meanwhile I've queued too many patches in my local tree, so
I think it is good if I:
  - Send some refactor patches upstreams first, to reduce the length
of my patch queue, and to be motivated to look at the rest of
regressions :)
  - Post my thoughts on supporting ITSET in GDB, GDBserver and IPA, to
get feedbacks as early as possible.

Before explain these patches, I want to explain my design on supporting
ITSET in GDB, GDBserver and IPA.  In patch series [1], ITSET is
supported in GDB naturally.  When supporting ITSET in GDBserver and IPA,
GDB has to send ITSET to them in some format over RSP and IPA protocol.
One decision we have to make here is the format of ITSET when sending
it.  We have two choices here,

  - ITSET spec, which is a string.  GDB just sends a compiled version
of ITSET (which is still an ITSET, but with different contents, I'll
explain it later).  Then GDBserver and IPA should be able to parse
ITSET spec, build up a tree, and evaluate thread/cores on a given
ITSET instance.

  - Agent Expression.  GDB just transform ITSET from a string format
to agent expression, and send agent expression to GDBsever and IPA.
Agent expression has been supported in GDBserver and IPA, so we may
have to add new opcode specific to ITSET operations, which is hard
to me  In ITSET, set is a unit in each operation, such as
INTERSECTION and UNION.  Looks hard to operate sets with arbitrary
number of elements in a stack machine model.  Then, I give up on
this direction.

Finally I choose the former approach.  When GDB sending ITSET, it
"compiles" itset to a new instance of itset which

  a) still complies to ITSET spec,
  b) replaced thread/inferior information that GDBserver or IPA
understands.

The string of compiled itset is sent over RSP to GDBserver, and
get parsed there.  In other words, GDBserver and IPA has
equivalent ITSET functionality compared with GDB, so most of
itset code is moved to gdb/common/.  Then, it needs GDBserver
can give similar support in GDB to ITSET code, so these patches
come up.

[1] [RFC/WIP I/T sets V2 PATCH 00/14] I/T sets.  http://sourceware.org/ml/gdb-patches/2011-12/msg00550.html


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

end of thread, other threads:[~2012-04-19  6:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-16 14:44 [PATCH 1/5] Define target_core_of_thread in gdbserver Yao Qi
2012-03-16 14:44 ` [PATCH 2/5] Move vec to common/ Yao Qi
2012-04-13 17:30   ` Tom Tromey
2012-04-19  7:15     ` [committed]: " Yao Qi
2012-03-16 14:47 ` [PATCH 1/5] Define target_core_of_thread in gdbserver Yao Qi
2012-04-13 17:35   ` Tom Tromey
2012-04-19  6:03     ` [committed]: " Yao Qi
2012-03-16 15:01 [PATCH 0/5] Preparatory patches for ITSET in GDBserver Yao Qi
2012-03-16 15:02 ` [PATCH 2/5] Move vec to common/ Yao Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox