aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2008-10-27 12:43:24 +0000
committerPedro Alves <palves@redhat.com>2008-10-27 12:43:24 +0000
commit8a305172062baab75e6a3c61c971153558245551 (patch)
tree9e396af11e2e0a3f87b003c6f154a7c518fd7414
parent676e87b3082eb253c4b3b7b2ce4ab4f3b241980d (diff)
downloadgdb-8a305172062baab75e6a3c61c971153558245551.zip
gdb-8a305172062baab75e6a3c61c971153558245551.tar.gz
gdb-8a305172062baab75e6a3c61c971153558245551.tar.bz2
* target.h (struct target_ops) <to_supports_multi_process>: New
field. (target_supports_multi_process): New define. * target.c (update_current_target): Inherit and de_fault to_supports_multi_process. * infcmd.c (attach_command): Allow attaching to multiple processes if the target supports it. (detach_command): If the target claims there is still execution, don't clear the thread list. * remote.c (remote_supports_multi_process): New. (init_remote_ops): Register remote_supports_multi_process.
-rw-r--r--gdb/ChangeLog14
-rw-r--r--gdb/infcmd.c12
-rw-r--r--gdb/remote.c8
-rw-r--r--gdb/target.c4
-rw-r--r--gdb/target.h10
5 files changed, 46 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 93a81e5..9744041 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,19 @@
2008-10-27 Pedro Alves <pedro@codesourcery.com>
+ * target.h (struct target_ops) <to_supports_multi_process>: New
+ field.
+ (target_supports_multi_process): New define.
+ * target.c (update_current_target): Inherit and de_fault
+ to_supports_multi_process.
+ * infcmd.c (attach_command): Allow attaching to multiple processes
+ if the target supports it.
+ (detach_command): If the target claims there is still execution,
+ don't clear the thread list.
+ * remote.c (remote_supports_multi_process): New.
+ (init_remote_ops): Register remote_supports_multi_process.
+
+2008-10-27 Pedro Alves <pedro@codesourcery.com>
+
* Makefile.in (.y.c, .l.c): sed free to xfree.
2008-10-27 Pedro Alves <pedro@codesourcery.com>
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 1854985..28ce813 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -2201,7 +2201,10 @@ attach_command (char *args, int from_tty)
dont_repeat (); /* Not for the faint of heart */
- if (target_has_execution)
+ if (target_supports_multi_process ())
+ /* Don't complain if we can be attached to multiple processes. */
+ ;
+ else if (target_has_execution)
{
if (query ("A program is being debugged already. Kill it? "))
target_kill ();
@@ -2311,7 +2314,12 @@ detach_command (char *args, int from_tty)
dont_repeat (); /* Not for the faint of heart. */
target_detach (args, from_tty);
no_shared_libraries (NULL, from_tty);
- init_thread_list ();
+
+ /* If the current target interface claims there's still execution,
+ then don't mess with threads of other processes. */
+ if (!target_has_execution)
+ init_thread_list ();
+
if (deprecated_detach_hook)
deprecated_detach_hook ();
}
diff --git a/gdb/remote.c b/gdb/remote.c
index da0a429..6af8267 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -8554,6 +8554,13 @@ remote_supports_non_stop (void)
return 1;
}
+static int
+remote_supports_multi_process (void)
+{
+ struct remote_state *rs = get_remote_state ();
+ return remote_multi_process_p (rs);
+}
+
static void
init_remote_ops (void)
{
@@ -8616,6 +8623,7 @@ Specify the serial device it is connected to\n\
remote_ops.to_terminal_inferior = remote_terminal_inferior;
remote_ops.to_terminal_ours = remote_terminal_ours;
remote_ops.to_supports_non_stop = remote_supports_non_stop;
+ remote_ops.to_supports_multi_process = remote_supports_multi_process;
}
/* Set up the extended remote vector by making a copy of the standard
diff --git a/gdb/target.c b/gdb/target.c
index b5cad35..0976ad1 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -471,6 +471,7 @@ update_current_target (void)
/* Do not inherit to_read_description. */
INHERIT (to_get_ada_task_ptid, t);
/* Do not inherit to_search_memory. */
+ INHERIT (to_supports_multi_process, t);
INHERIT (to_magic, t);
/* Do not inherit to_memory_map. */
/* Do not inherit to_flash_erase. */
@@ -638,6 +639,9 @@ update_current_target (void)
de_fault (to_get_ada_task_ptid,
(ptid_t (*) (long, long))
default_get_ada_task_ptid);
+ de_fault (to_supports_multi_process,
+ (int (*) (void))
+ return_zero);
#undef de_fault
/* Finally, position the target-stack beneath the squashed
diff --git a/gdb/target.h b/gdb/target.h
index 9ec8f5d..a010d2d 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -536,6 +536,10 @@ struct target_ops
/* Can target execute in reverse? */
int (*to_can_execute_reverse) ();
+ /* Does this target support debugging multiple processes
+ simultaneously? */
+ int (*to_supports_multi_process) (void);
+
int to_magic;
/* Need sub-structure for target machine related rather than comm related?
*/
@@ -647,6 +651,12 @@ extern void target_resume (ptid_t ptid, int step, enum target_signal signal);
#define target_prepare_to_store(regcache) \
(*current_target.to_prepare_to_store) (regcache)
+/* Returns true if this target can debug multiple processes
+ simultaneously. */
+
+#define target_supports_multi_process() \
+ (*current_target.to_supports_multi_process) ()
+
extern DCACHE *target_dcache;
extern int target_read_string (CORE_ADDR, char **, int, int *);