This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

split new gdbarch_has_global_breakpoints out of gdbarch_has_global_solist.


I've checked in this patch to split the global breakpoints
property out of gdbarch_has_global_solist into a new
gdbarch_has_global_breakpoints, with the main goal of not
abusing of target_supports_multi_process.

-- 
Pedro Alves

2009-05-19  Pedro Alves  <pedro@codesourcery.com>

	* breakpoint.c (insert_breakpoints, breakpoint_init_inferior)
	(update_global_location_list): Use gdbarch_has_global_breakpoints
	instead of gdbarch_has_global_solist and
	target_supports_multi_process.
	* dicos-tdep.c (dicos_init_abi): Set
	gdbarch_has_global_breakpoints.
	* gdbarch.sh (has_global_solist): Update comment.
	(has_global_breakpoints): New.
	* remote.c (remote_start_remote): Use
	gdbarch_has_global_breakpoints instead of
	gdbarch_has_global_solist.
	* target.c (target_detach): Use gdbarch_has_global_breakpoints
	instead of gdbarch_has_global_solist.
	* infcmd.c (attach_command): Use gdbarch_has_global_solist instead
	of target_supports_multi_process.

---
 gdb/breakpoint.c |    8 +++-----
 gdb/dicos-tdep.c |    7 ++++++-
 gdb/gdbarch.c    |   23 +++++++++++++++++++++++
 gdb/gdbarch.h    |   14 +++++++++++---
 gdb/gdbarch.sh   |   12 +++++++++---
 gdb/infcmd.c     |    5 +++--
 gdb/remote.c     |    5 ++---
 gdb/target.c     |    2 +-
 8 files changed, 58 insertions(+), 18 deletions(-)

Index: src/gdb/breakpoint.c
===================================================================
--- src.orig/gdb/breakpoint.c	2009-05-19 00:01:25.000000000 +0100
+++ src/gdb/breakpoint.c	2009-05-19 01:02:14.000000000 +0100
@@ -1290,8 +1290,7 @@ insert_breakpoints (void)
 
   if (!breakpoints_always_inserted_mode ()
       && (target_has_execution
- 	  || (gdbarch_has_global_solist (target_gdbarch)
-	      && target_supports_multi_process ())))
+ 	  || gdbarch_has_global_breakpoints (target_gdbarch)))
     /* update_global_location_list does not insert breakpoints
        when always_inserted_mode is not enabled.  Explicitly
        insert them now.  */
@@ -1780,7 +1779,7 @@ breakpoint_init_inferior (enum inf_conte
 
   /* If breakpoint locations are shared across processes, then there's
      nothing to do.  */
-  if (gdbarch_has_global_solist (target_gdbarch))
+  if (gdbarch_has_global_breakpoints (target_gdbarch))
     return;
 
   ALL_BP_LOCATIONS (bpt)
@@ -7200,8 +7199,7 @@ update_global_location_list (int should_
 
   if (breakpoints_always_inserted_mode () && should_insert
       && (target_has_execution
-	  || (gdbarch_has_global_solist (target_gdbarch)
-	      && target_supports_multi_process ())))
+	  || (gdbarch_has_global_breakpoints (target_gdbarch))))
     insert_breakpoint_locations ();
 
   do_cleanups (cleanups);
Index: src/gdb/dicos-tdep.c
===================================================================
--- src.orig/gdb/dicos-tdep.c	2009-05-19 00:09:08.000000000 +0100
+++ src/gdb/dicos-tdep.c	2009-05-19 01:07:09.000000000 +0100
@@ -33,9 +33,14 @@ dicos_init_abi (struct gdbarch *gdbarch)
   set_solib_ops (gdbarch, &solib_target_so_ops);
 
   /* Every process, although has its own address space, sees the same
-     list of shared libraries.  */
+     list of shared libraries.  There's no "main executable" in DICOS,
+     so this accounts for all code.  */
   set_gdbarch_has_global_solist (gdbarch, 1);
 
+  /* The DICOS breakpoint API takes care of magically making
+     breakpoints visible to all inferiors.  */
+  set_gdbarch_has_global_breakpoints (gdbarch, 1);
+
   /* There's no (standard definition of) entry point or a guaranteed
      text location with a symbol where to place the call dummy, so we
      put it on the stack.  */
Index: src/gdb/gdbarch.c
===================================================================
--- src.orig/gdb/gdbarch.c	2009-05-19 00:01:19.000000000 +0100
+++ src/gdb/gdbarch.c	2009-05-19 00:08:42.000000000 +0100
@@ -245,6 +245,7 @@ struct gdbarch
   gdbarch_get_siginfo_type_ftype *get_siginfo_type;
   gdbarch_record_special_symbol_ftype *record_special_symbol;
   int has_global_solist;
+  int has_global_breakpoints;
 };
 
 
@@ -381,6 +382,7 @@ struct gdbarch startup_gdbarch =
   0,  /* get_siginfo_type */
   0,  /* record_special_symbol */
   0,  /* has_global_solist */
+  0,  /* has_global_breakpoints */
   /* startup_gdbarch() */
 };
 
@@ -638,6 +640,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
   /* Skip verify of get_siginfo_type, has predicate */
   /* Skip verify of record_special_symbol, has predicate */
   /* Skip verify of has_global_solist, invalid_p == 0 */
+  /* Skip verify of has_global_breakpoints, invalid_p == 0 */
   buf = ui_file_xstrdup (log, &dummy);
   make_cleanup (xfree, buf);
   if (strlen (buf) > 0)
@@ -862,6 +865,9 @@ gdbarch_dump (struct gdbarch *gdbarch, s
                       "gdbarch_dump: get_siginfo_type = <%s>\n",
                       host_address_to_string (gdbarch->get_siginfo_type));
   fprintf_unfiltered (file,
+                      "gdbarch_dump: has_global_breakpoints = %s\n",
+                      plongest (gdbarch->has_global_breakpoints));
+  fprintf_unfiltered (file,
                       "gdbarch_dump: has_global_solist = %s\n",
                       plongest (gdbarch->has_global_solist));
   fprintf_unfiltered (file,
@@ -3382,6 +3388,23 @@ set_gdbarch_has_global_solist (struct gd
   gdbarch->has_global_solist = has_global_solist;
 }
 
+int
+gdbarch_has_global_breakpoints (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  /* Skip verify of has_global_breakpoints, invalid_p == 0 */
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_has_global_breakpoints called\n");
+  return gdbarch->has_global_breakpoints;
+}
+
+void
+set_gdbarch_has_global_breakpoints (struct gdbarch *gdbarch,
+                                    int has_global_breakpoints)
+{
+  gdbarch->has_global_breakpoints = has_global_breakpoints;
+}
+
 
 /* Keep a registry of per-architecture data-pointers required by GDB
    modules. */
Index: src/gdb/gdbarch.h
===================================================================
--- src.orig/gdb/gdbarch.h	2009-05-19 00:01:18.000000000 +0100
+++ src/gdb/gdbarch.h	2009-05-19 01:20:23.000000000 +0100
@@ -863,13 +863,21 @@ extern void set_gdbarch_record_special_s
 
 /* True if the list of shared libraries is one and only for all
    processes, as opposed to a list of shared libraries per inferior.
-   When this property is true, GDB assumes that since shared libraries
-   are shared across processes, so is all code.  Hence, GDB further
-   assumes an inserted breakpoint location is visible to all processes. */
+   This usually means that all processes, although may or may not share
+   an address space, will see the same set of symbols at the same
+   addresses. */
 
 extern int gdbarch_has_global_solist (struct gdbarch *gdbarch);
 extern void set_gdbarch_has_global_solist (struct gdbarch *gdbarch, int has_global_solist);
 
+/* On some targets, even though each inferior has its own private
+   address space, the debug interface takes care of making breakpoints
+   visible to all address spaces automatically.  For such cases,
+   this property should be set to true. */
+
+extern int gdbarch_has_global_breakpoints (struct gdbarch *gdbarch);
+extern void set_gdbarch_has_global_breakpoints (struct gdbarch *gdbarch, int has_global_breakpoints);
+
 extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch);
 
 
Index: src/gdb/gdbarch.sh
===================================================================
--- src.orig/gdb/gdbarch.sh	2009-05-19 00:01:16.000000000 +0100
+++ src/gdb/gdbarch.sh	2009-05-19 01:20:02.000000000 +0100
@@ -732,10 +732,16 @@ M:void:record_special_symbol:struct objf
 
 # True if the list of shared libraries is one and only for all
 # processes, as opposed to a list of shared libraries per inferior.
-# When this property is true, GDB assumes that since shared libraries
-# are shared across processes, so is all code.  Hence, GDB further
-# assumes an inserted breakpoint location is visible to all processes.
+# This usually means that all processes, although may or may not share
+# an address space, will see the same set of symbols at the same
+# addresses.
 v:int:has_global_solist:::0:0::0
+
+# On some targets, even though each inferior has its own private
+# address space, the debug interface takes care of making breakpoints
+# visible to all address spaces automatically.  For such cases,
+# this property should be set to true.
+v:int:has_global_breakpoints:::0:0::0
 EOF
 }
 
Index: src/gdb/remote.c
===================================================================
--- src.orig/gdb/remote.c	2009-05-19 00:01:23.000000000 +0100
+++ src/gdb/remote.c	2009-05-19 00:13:33.000000000 +0100
@@ -2824,9 +2824,8 @@ remote_start_remote (struct ui_out *uiou
 	remote_check_symbols (symfile_objfile);
     }
 
-  /* If code is shared between processes, then breakpoints are global
-     too; Insert them now.  */
-  if (gdbarch_has_global_solist (target_gdbarch)
+  /* If breakpoints are global, insert them now.  */
+  if (gdbarch_has_global_breakpoints (target_gdbarch)
       && breakpoints_always_inserted_mode ())
     insert_breakpoints ();
 }
Index: src/gdb/target.c
===================================================================
--- src.orig/gdb/target.c	2009-05-19 00:01:28.000000000 +0100
+++ src/gdb/target.c	2009-05-19 00:14:41.000000000 +0100
@@ -1788,7 +1788,7 @@ target_detach (char *args, int from_tty)
 {
   struct target_ops* t;
   
-  if (gdbarch_has_global_solist (target_gdbarch))
+  if (gdbarch_has_global_breakpoints (target_gdbarch))
     /* Don't remove global breakpoints here.  They're removed on
        disconnection from the target.  */
     ;
Index: src/gdb/infcmd.c
===================================================================
--- src.orig/gdb/infcmd.c	2009-05-19 00:12:28.000000000 +0100
+++ src/gdb/infcmd.c	2009-05-19 00:21:38.000000000 +0100
@@ -2220,8 +2220,9 @@ attach_command (char *args, int from_tty
 
   dont_repeat ();		/* Not for the faint of heart */
 
-  if (target_supports_multi_process ())
-    /* Don't complain if we can be attached to multiple processes.  */
+  if (gdbarch_has_global_solist (target_gdbarch))
+    /* Don't complain if all processes share the same symbol
+       space.  */
     ;
   else if (target_has_execution)
     {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]