public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-tromey-ambiguous-linespec: remove bp_startup_disabled
@ 2011-10-06 20:38 tromey
  0 siblings, 0 replies; only message in thread
From: tromey @ 2011-10-06 20:38 UTC (permalink / raw)
  To: archer-commits

The branch, archer-tromey-ambiguous-linespec has been updated
       via  46427aeac097aef23dfc8ddd7a2619ba9a5a9e52 (commit)
       via  d1a56a1780431748090969b35c96290586008919 (commit)
      from  119571bd058c06566421918c88f4be4531bad0e7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 46427aeac097aef23dfc8ddd7a2619ba9a5a9e52
Author: Tom Tromey <tromey@redhat.com>
Date:   Thu Oct 6 14:37:19 2011 -0600

    remove bp_startup_disabled

commit d1a56a1780431748090969b35c96290586008919
Author: Tom Tromey <tromey@redhat.com>
Date:   Thu Oct 6 08:10:07 2011 -0600

    remove gdbarch from struct breakpoint

-----------------------------------------------------------------------

Summary of changes:
 gdb/breakpoint.c           |   96 ++++++++++++++++++-------------------------
 gdb/breakpoint.h           |   10 -----
 gdb/python/py-breakpoint.c |    5 +-
 gdb/tracepoint.c           |   16 ++++----
 4 files changed, 50 insertions(+), 77 deletions(-)

First 500 lines of diff:
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 2dc3e0e..534f43d 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -106,8 +106,7 @@ static void break_command_1 (char *, int, int);
 
 static void mention (struct breakpoint *);
 
-static struct breakpoint *set_raw_breakpoint_without_location (struct gdbarch *,
-							       enum bptype,
+static struct breakpoint *set_raw_breakpoint_without_location (enum bptype,
 							       const struct breakpoint_ops *);
 /* This function is used in gdbtk sources and thus can not be made
    static.  */
@@ -1579,6 +1578,9 @@ should_be_inserted (struct bp_location *bl)
   if (!bl->enabled || bl->shlib_disabled || bl->duplicate)
     return 0;
 
+  if (bl->pspace->executing_startup)
+    return 0;
+
   /* This is set for example, when we're attached to the parent of a
      vfork, and have detached from the child.  The child is running
      free, and we expect it to do an exec or exit, at which point the
@@ -4861,7 +4863,7 @@ print_one_breakpoint_location (struct breakpoint *b,
       /* FIXME: cagney/2002-12-01: Shouldn't be poking around inside
          the frame ID.  */
       ui_out_field_core_addr (uiout, "frame",
-			      b->gdbarch, b->frame_id.stack_addr);
+			      loc->gdbarch, b->frame_id.stack_addr);
       ui_out_text (uiout, "\n");
     }
   
@@ -5324,8 +5326,7 @@ describe_other_breakpoints (struct gdbarch *gdbarch,
 	      printf_filtered (" (thread %d)", b->thread);
 	    printf_filtered ("%s%s ",
 			     ((b->enable_state == bp_disabled
-			       || b->enable_state == bp_call_disabled
-			       || b->enable_state == bp_startup_disabled)
+			       || b->enable_state == bp_call_disabled)
 			      ? " (disabled)"
 			      : b->enable_state == bp_permanent 
 			      ? " (permanent)"
@@ -5678,7 +5679,6 @@ add_to_breakpoint_chain (struct breakpoint *b)
 
 static void
 init_raw_breakpoint_without_location (struct breakpoint *b,
-				      struct gdbarch *gdbarch,
 				      enum bptype bptype,
 				      const struct breakpoint_ops *ops)
 {
@@ -5688,7 +5688,6 @@ init_raw_breakpoint_without_location (struct breakpoint *b,
 
   b->ops = ops;
   b->type = bptype;
-  b->gdbarch = gdbarch;
   b->language = current_language->la_language;
   b->input_radix = input_radix;
   b->thread = -1;
@@ -5707,13 +5706,12 @@ init_raw_breakpoint_without_location (struct breakpoint *b,
    that has type BPTYPE and has no locations as yet.  */
 
 static struct breakpoint *
-set_raw_breakpoint_without_location (struct gdbarch *gdbarch,
-				     enum bptype bptype,
+set_raw_breakpoint_without_location (enum bptype bptype,
 				     const struct breakpoint_ops *ops)
 {
   struct breakpoint *b = XNEW (struct breakpoint);
 
-  init_raw_breakpoint_without_location (b, gdbarch, bptype, ops);
+  init_raw_breakpoint_without_location (b, bptype, ops);
   add_to_breakpoint_chain (b);
   return b;
 }
@@ -5767,12 +5765,19 @@ set_breakpoint_location_function (struct bp_location *loc, int explicit_loc)
 static struct gdbarch *
 get_sal_arch (struct symtab_and_line sal)
 {
+  struct obj_section *sect;
+
   if (sal.section)
     return get_objfile_arch (sal.section->objfile);
   if (sal.symtab)
     return get_objfile_arch (sal.symtab->objfile);
 
-  return NULL;
+  sect = find_pc_section (sal.pc);
+  if (sect)
+    return get_objfile_arch (sect->objfile);
+
+  gdb_assert_not_reached ("could not find arch for SAL");
+  /* return NULL; */
 }
 
 /* Low level routine for partially initializing a breakpoint of type
@@ -5791,11 +5796,11 @@ init_raw_breakpoint (struct breakpoint *b, struct gdbarch *gdbarch,
   CORE_ADDR adjusted_address;
   struct gdbarch *loc_gdbarch;
 
-  init_raw_breakpoint_without_location (b, gdbarch, bptype, ops);
+  init_raw_breakpoint_without_location (b, bptype, ops);
 
   loc_gdbarch = get_sal_arch (sal);
   if (!loc_gdbarch)
-    loc_gdbarch = b->gdbarch;
+    loc_gdbarch = gdbarch;
 
   if (bptype != bp_catchpoint)
     gdb_assert (sal.pspace != NULL);
@@ -6956,48 +6961,48 @@ enable_watchpoints_after_interactive_call_stop (void)
 void
 disable_breakpoints_before_startup (void)
 {
-  struct breakpoint *b;
+  struct bp_location *loc, **locp_tmp;
   int found = 0;
 
-  ALL_BREAKPOINTS (b)
+  current_program_space->executing_startup = 1;
+
+  ALL_BP_LOCATIONS (loc, locp_tmp)
     {
-      if (b->pspace != current_program_space)
+      if (loc->pspace != current_program_space)
 	continue;
 
-      if ((b->type == bp_breakpoint
-	   || b->type == bp_hardware_breakpoint)
-	  && breakpoint_enabled (b))
+      if ((loc->owner->type == bp_breakpoint
+	   || loc->owner->type == bp_hardware_breakpoint)
+	  && breakpoint_enabled (loc->owner))
 	{
-	  b->enable_state = bp_startup_disabled;
 	  found = 1;
+	  break;
 	}
     }
 
   if (found)
     update_global_location_list (0);
-
-  current_program_space->executing_startup = 1;
 }
 
 void
 enable_breakpoints_after_startup (void)
 {
-  struct breakpoint *b;
+  struct bp_location *loc, **locp_tmp;
   int found = 0;
 
   current_program_space->executing_startup = 0;
 
-  ALL_BREAKPOINTS (b)
+  ALL_BP_LOCATIONS (loc, locp_tmp)
     {
-      if (b->pspace != current_program_space)
+      if (loc->pspace != current_program_space)
 	continue;
 
-      if ((b->type == bp_breakpoint
-	   || b->type == bp_hardware_breakpoint)
-	  && b->enable_state == bp_startup_disabled)
+      if ((loc->owner->type == bp_breakpoint
+	   || loc->owner->type == bp_hardware_breakpoint)
+	  && breakpoint_enabled (loc->owner))
 	{
-	  b->enable_state = bp_enabled;
 	  found = 1;
+	  break;
 	}
     }
 
@@ -7047,7 +7052,7 @@ momentary_breakpoint_from_master (struct breakpoint *orig,
 {
   struct breakpoint *copy;
 
-  copy = set_raw_breakpoint_without_location (orig->gdbarch, type, ops);
+  copy = set_raw_breakpoint_without_location (type, ops);
   copy->loc = allocate_bp_location (copy);
   set_breakpoint_location_function (copy->loc, 1);
 
@@ -7124,8 +7129,6 @@ add_location_to_breakpoint (struct breakpoint *b,
     ;
   *tmp = loc;
   loc->gdbarch = get_sal_arch (*sal);
-  if (!loc->gdbarch)
-    loc->gdbarch = b->gdbarch;
   loc->requested_address = sal->pc;
   loc->address = adjust_breakpoint_address (loc->gdbarch,
 					    loc->requested_address, b->type);
@@ -7281,11 +7284,6 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch,
 			   "tracepoint marker to probe"));
 	    }
 
-	  if (enabled && b->pspace->executing_startup
-	      && (b->type == bp_breakpoint
-		  || b->type == bp_hardware_breakpoint))
-	    b->enable_state = bp_startup_disabled;
-
 	  loc = b->loc;
 	}
       else
@@ -7994,7 +7992,7 @@ create_breakpoint (struct gdbarch *gdbarch,
 
       make_cleanup (xfree, copy_arg);
 
-      b = set_raw_breakpoint_without_location (gdbarch, type_wanted, ops);
+      b = set_raw_breakpoint_without_location (type_wanted, ops);
       set_breakpoint_number (internal, b);
       b->thread = -1;
       b->addr_string = copy_arg;
@@ -8006,11 +8004,6 @@ create_breakpoint (struct gdbarch *gdbarch,
       b->pspace = current_program_space;
       b->py_bp_object = NULL;
 
-      if (enabled && b->pspace->executing_startup
-	  && (b->type == bp_breakpoint
-	      || b->type == bp_hardware_breakpoint))
-	b->enable_state = bp_startup_disabled;
-
       if (!internal)
         /* Do not mention breakpoints with a negative number, 
 	   but do notify observers.  */
@@ -9338,10 +9331,10 @@ watch_command_1 (char *arg, int accessflag, int from_tty,
   w = XCNEW (struct watchpoint);
   b = &w->base;
   if (use_mask)
-    init_raw_breakpoint_without_location (b, NULL, bp_type,
+    init_raw_breakpoint_without_location (b, bp_type,
 					  &masked_watchpoint_breakpoint_ops);
   else
-    init_raw_breakpoint_without_location (b, NULL, bp_type,
+    init_raw_breakpoint_without_location (b, bp_type,
 					  &watchpoint_breakpoint_ops);
   b->thread = thread;
   b->disposition = disp_donttouch;
@@ -10635,13 +10628,8 @@ update_global_location_list (int should_insert)
       struct breakpoint *b = loc->owner;
       struct bp_location **loc_first_p;
 
-      if (b->enable_state == bp_disabled
-	  || b->enable_state == bp_call_disabled
-	  || b->enable_state == bp_startup_disabled
-	  || !loc->enabled
-	  || loc->shlib_disabled
-	  || !breakpoint_address_is_meaningful (b)
-	  || is_tracepoint (b))
+      if (!should_be_inserted (loc)
+	  || !breakpoint_address_is_meaningful (b))
 	continue;
 
       /* Permanent breakpoint should always be inserted.  */
@@ -10930,10 +10918,6 @@ static struct breakpoint_ops base_breakpoint_ops =
 static void
 bkpt_re_set (struct breakpoint *b)
 {
-  /* Do not attempt to re-set breakpoints disabled during startup.  */
-  if (b->enable_state == bp_startup_disabled)
-    return;
-
   /* FIXME: is this still reachable?  */
   if (b->addr_string == NULL)
     {
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index ad4a885..70a211b 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -186,14 +186,6 @@ enum enable_state
 			    automatically enabled and reset when the
 			    call "lands" (either completes, or stops
 			    at another eventpoint).  */
-    bp_startup_disabled, /* The eventpoint has been disabled during
-			    inferior startup.  This is necessary on
-			    some targets where the main executable
-			    will get relocated during startup, making
-			    breakpoint addresses invalid.  The
-			    eventpoint will be automatically enabled
-			    and reset once inferior startup is
-			    complete.  */
     bp_permanent	 /* There is a breakpoint instruction
 			    hard-wired into the target's code.  Don't
 			    try to write another breakpoint
@@ -586,8 +578,6 @@ struct breakpoint
        the end of the range (malloc'd).  */
     char *addr_string_range_end;
 
-    /* Architecture we used to set the breakpoint.  */
-    struct gdbarch *gdbarch;
     /* Language we used to set the breakpoint.  */
     enum language language;
     /* Input radix we used to set the breakpoint.  */
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index 3dc0fca..5f150c8 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -730,7 +730,7 @@ gdbpy_should_stop (struct breakpoint_object *bp_obj)
 
   PyObject *py_bp = (PyObject *) bp_obj;
   struct breakpoint *b = bp_obj->bp;
-  struct gdbarch *garch = b->gdbarch ? b->gdbarch : get_current_arch ();
+  struct gdbarch *garch = get_current_arch (); /* FIXME?  */
   struct cleanup *cleanup = ensure_python_env (garch, current_language);
 
   if (PyObject_HasAttrString (py_bp, stop_func))
@@ -768,8 +768,7 @@ gdbpy_breakpoint_has_py_cond (struct breakpoint_object *bp_obj)
 {
   int has_func = 0;
   PyObject *py_bp = (PyObject *) bp_obj;
-  struct gdbarch *garch = bp_obj->bp->gdbarch ? bp_obj->bp->gdbarch :
-    get_current_arch ();
+  struct gdbarch *garch = get_current_arch (); /* FIXME? */
   struct cleanup *cleanup = ensure_python_env (garch, current_language);
   
   if (py_bp != NULL)
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 56b672f..f389458 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -1321,14 +1321,14 @@ encode_actions_1 (struct command_line *action,
 
 	      if (0 == strncasecmp ("$reg", action_exp, 4))
 		{
-		  for (i = 0; i < gdbarch_num_regs (t->gdbarch); i++)
+		  for (i = 0; i < gdbarch_num_regs (tloc->gdbarch); i++)
 		    add_register (collect, i);
 		  action_exp = strchr (action_exp, ',');	/* more? */
 		}
 	      else if (0 == strncasecmp ("$arg", action_exp, 4))
 		{
 		  add_local_symbols (collect,
-				     t->gdbarch,
+				     tloc->gdbarch,
 				     tloc->address,
 				     frame_reg,
 				     frame_offset,
@@ -1338,7 +1338,7 @@ encode_actions_1 (struct command_line *action,
 	      else if (0 == strncasecmp ("$loc", action_exp, 4))
 		{
 		  add_local_symbols (collect,
-				     t->gdbarch,
+				     tloc->gdbarch,
 				     tloc->address,
 				     frame_reg,
 				     frame_offset,
@@ -1350,7 +1350,7 @@ encode_actions_1 (struct command_line *action,
 		  struct cleanup *old_chain1 = NULL;
 
 		  aexpr = gen_trace_for_return_address (tloc->address,
-							t->gdbarch);
+							tloc->gdbarch);
 
 		  old_chain1 = make_cleanup_free_agent_expr (aexpr);
 
@@ -1403,7 +1403,7 @@ encode_actions_1 (struct command_line *action,
 		      {
 			const char *name = &exp->elts[2].string;
 
-			i = user_reg_map_name_to_regnum (t->gdbarch,
+			i = user_reg_map_name_to_regnum (tloc->gdbarch,
 							 name, strlen (name));
 			if (i == -1)
 			  internal_error (__FILE__, __LINE__,
@@ -1426,7 +1426,7 @@ encode_actions_1 (struct command_line *action,
 		    case OP_VAR_VALUE:
 		      collect_symbol (collect,
 				      exp->elts[2].symbol,
-				      t->gdbarch,
+				      tloc->gdbarch,
 				      frame_reg,
 				      frame_offset,
 				      tloc->address);
@@ -1539,8 +1539,8 @@ encode_actions (struct breakpoint *t, struct bp_location *tloc,
   *tdp_actions = NULL;
   *stepping_actions = NULL;
 
-  gdbarch_virtual_frame_pointer (t->gdbarch,
-				 t->loc->address, &frame_reg, &frame_offset);
+  gdbarch_virtual_frame_pointer (tloc->gdbarch,
+				 tloc->address, &frame_reg, &frame_offset);
 
   actions = breakpoint_commands (t);
 


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-10-06 20:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-06 20:38 [SCM] archer-tromey-ambiguous-linespec: remove bp_startup_disabled tromey

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).