Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Target-specific thread switching backend
@ 2007-12-05 14:26 Maciej W. Rozycki
  2007-12-05 15:22 ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Maciej W. Rozycki @ 2007-12-05 14:26 UTC (permalink / raw)
  To: gdb-patches; +Cc: Maciej W. Rozycki

Hello,

 In preparation for submitting support for the MDI target I propose the 
following enhancement to target_switch_to_thread().  The MDI implements a 
multi-threaded target which remembers the currently selected thread within 
itself.  All the operations that have thread-local scope, such as 
accessing of the CPU registers, use that thread identifier.  Therefore I 
think it is reasonable to propagate the thread-switch event down to the 
target, which is what the following change implements.

 Tested using the mipsisa32-sde-elf target, with the mips-sim-sde32/-EB 
and mips-sim-sde32/-EL boards with no regressions.

2007-12-05  Maciej W. Rozycki  <macro@mips.com>

	* target.c (update_current_target): Initialize
	to_switch_to_thread.
	* target.h (target_switch_to_thread): New macro.
	* thread.c (switch_to_thread): Call target_switch_to_thread().

 OK to apply?

  Maciej

13327-1.diff
Index: binutils-quilt/src/gdb/target.h
===================================================================
--- binutils-quilt.orig/src/gdb/target.h	2007-12-03 14:28:21.000000000 +0000
+++ binutils-quilt/src/gdb/target.h	2007-12-03 14:28:24.000000000 +0000
@@ -393,6 +393,7 @@
     void (*to_mourn_inferior) (void);
     int (*to_can_run) (void);
     void (*to_notice_signals) (ptid_t ptid);
+    void (*to_switch_to_thread) (void);
     int (*to_thread_alive) (ptid_t ptid);
     void (*to_find_new_threads) (void);
     char *(*to_pid_to_str) (ptid_t);
@@ -878,6 +879,14 @@
 #define target_notice_signals(ptid) \
      (*current_target.to_notice_signals) (ptid)
 
+/* Switch to a selected thread.  */
+
+#define target_switch_to_thread()					\
+  do									\
+    if (current_target.to_switch_to_thread)				\
+      (*current_target.to_switch_to_thread) ();				\
+  while (0)
+
 /* Check to see if a thread is still alive.  */
 
 #define target_thread_alive(ptid) \
Index: binutils-quilt/src/gdb/thread.c
===================================================================
--- binutils-quilt.orig/src/gdb/thread.c	2007-12-03 14:20:57.000000000 +0000
+++ binutils-quilt/src/gdb/thread.c	2007-12-03 14:28:24.000000000 +0000
@@ -462,6 +462,7 @@
   inferior_ptid = ptid;
   reinit_frame_cache ();
   registers_changed ();
+  target_switch_to_thread ();
   stop_pc = read_pc ();
 }
 
Index: binutils-quilt/src/gdb/target.c
===================================================================
--- binutils-quilt.orig/src/gdb/target.c	2007-12-03 14:20:57.000000000 +0000
+++ binutils-quilt/src/gdb/target.c	2007-12-03 14:28:24.000000000 +0000
@@ -438,6 +438,7 @@
       INHERIT (to_mourn_inferior, t);
       INHERIT (to_can_run, t);
       INHERIT (to_notice_signals, t);
+      INHERIT (to_switch_to_thread, t);
       INHERIT (to_thread_alive, t);
       INHERIT (to_find_new_threads, t);
       INHERIT (to_pid_to_str, t);


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

end of thread, other threads:[~2007-12-05 16:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-05 14:26 Target-specific thread switching backend Maciej W. Rozycki
2007-12-05 15:22 ` Daniel Jacobowitz
2007-12-05 16:07   ` Maciej W. Rozycki
2007-12-05 18:37     ` Daniel Jacobowitz

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