public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-pmuldoon-python-breakpoints: Remove internal breakpoints number use. Use visibility flag instead.
@ 2010-09-23 11:02 pmuldoon
  0 siblings, 0 replies; only message in thread
From: pmuldoon @ 2010-09-23 11:02 UTC (permalink / raw)
  To: archer-commits

The branch, archer-pmuldoon-python-breakpoints has been updated
       via  7cba5e2afd758c6b3462ca52f0d3c6f4144b3355 (commit)
      from  ce008365f446a6294aef76cb09f184105ccb5690 (commit)

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

- Log -----------------------------------------------------------------
commit 7cba5e2afd758c6b3462ca52f0d3c6f4144b3355
Author: Phil Muldoon <pmuldoon@redhat.com>
Date:   Thu Sep 23 12:01:39 2010 +0100

    Remove internal breakpoints number use. Use visibility flag instead.

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

Summary of changes:
 gdb/breakpoint.c           |   65 ++++++++++++++++++++-----------------------
 gdb/breakpoint.h           |    9 +++++-
 gdb/python/py-breakpoint.c |   22 ++++++++++++---
 3 files changed, 56 insertions(+), 40 deletions(-)

First 500 lines of diff:
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 178cdf8..c980d93 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -4907,6 +4907,14 @@ user_settable_breakpoint (const struct breakpoint *b)
 	  || is_tracepoint (b)
 	  || is_watchpoint (b));
 }
+
+/* Return non-zero if B is visible to the user.  */
+
+static int
+breakpoint_visible (const struct breakpoint *b)
+{
+  return b->visible;
+}
 	
 /* Print information on user settable breakpoint (watchpoint, etc)
    number BNUM.  If BNUM is -1 print all user-settable breakpoints.
@@ -4939,7 +4947,7 @@ breakpoint_1 (int bnum, int allflag, int (*filter) (const struct breakpoint *))
 	if (filter && !filter (b))
 	  continue;
 	
-	if (allflag || user_settable_breakpoint (b))
+	if (allflag || (user_settable_breakpoint (b)  && breakpoint_visible (b)))
 	  {
 	    int addr_bit, type_len;
 
@@ -5007,7 +5015,8 @@ breakpoint_1 (int bnum, int allflag, int (*filter) (const struct breakpoint *))
 	
 	/* We only print out user settable breakpoints unless the
 	   allflag is set. */
-	if (allflag || user_settable_breakpoint (b))
+	if (allflag || (user_settable_breakpoint (b)
+			&& breakpoint_visible (b)))
 	  print_one_breakpoint (b, &last_loc, print_address_bits, allflag);
       }
   }
@@ -5456,7 +5465,7 @@ set_raw_breakpoint_without_location (struct gdbarch *gdbarch,
   b->syscalls_to_be_caught = NULL;
   b->ops = NULL;
   b->condition_not_parsed = 0;
-
+  b->visible = 1;
   /* Add this breakpoint to the end of the chain
      so that a list of breakpoints will come out in order
      of increasing numbers.  */
@@ -6915,7 +6924,7 @@ create_breakpoint_sal (struct gdbarch *gdbarch,
 		       enum bptype type, enum bpdisp disposition,
 		       int thread, int task, int ignore_count,
 		       struct breakpoint_ops *ops, int from_tty, 
-		       int enabled, int count_down)
+		       int enabled, int visible)
 {
   struct breakpoint *b = NULL;
   int i;
@@ -6952,13 +6961,8 @@ create_breakpoint_sal (struct gdbarch *gdbarch,
       if (i == 0)
 	{
 	  b = set_raw_breakpoint (gdbarch, sal, type);
-	  if (count_down)
-	    b->number = internal_breakpoint_number--;
-	  else
-	    {
-	      set_breakpoint_count (breakpoint_count + 1);
-	      b->number = breakpoint_count;
-	    }
+	  set_breakpoint_count (breakpoint_count + 1);
+	  b->number = breakpoint_count;
 	  b->thread = thread;
 	  b->task = task;
   
@@ -6967,7 +6971,7 @@ create_breakpoint_sal (struct gdbarch *gdbarch,
 	  b->enable_state = enabled ? bp_enabled : bp_disabled;
 	  b->disposition = disposition;
 	  b->pspace = sals.sals[0].pspace;
-
+	  b->visible = visible;
 	  if (type == bp_static_tracepoint)
 	    {
 	      struct static_tracepoint_marker marker;
@@ -7040,7 +7044,7 @@ Couldn't determine the static tracepoint marker to probe"));
       = xstrprintf ("*%s", paddress (b->loc->gdbarch, b->loc->address));
 
   b->ops = ops;
-  if (!count_down)
+  if (visible)
     mention (b);
 }
 
@@ -7197,7 +7201,7 @@ create_breakpoints_sal (struct gdbarch *gdbarch,
 			enum bptype type, enum bpdisp disposition,
 			int thread, int task, int ignore_count,
 			struct breakpoint_ops *ops, int from_tty,
-			int enabled, int count_down)
+			int enabled, int visible)
 {
   int i;
 
@@ -7209,7 +7213,7 @@ create_breakpoints_sal (struct gdbarch *gdbarch,
       create_breakpoint_sal (gdbarch, expanded, addr_string[i],
 			     cond_string, type, disposition,
 			     thread, task, ignore_count, ops,
-			     from_tty, enabled, count_down);
+			     from_tty, enabled, visible);
     }
 }
 
@@ -7491,7 +7495,7 @@ create_new_breakpoint (struct gdbarch *gdbarch,
 		       struct breakpoint_ops *ops,
 		       int from_tty,
 		       int enabled,
-		       int count_down)
+		       int visible)
 {
   struct gdb_exception e;
   struct symtabs_and_lines sals;
@@ -7508,10 +7512,7 @@ create_new_breakpoint (struct gdbarch *gdbarch,
   int task = 0;
   int prev_bkpt_count = 0;
   
-  if (count_down)  
-    prev_bkpt_count = internal_breakpoint_number;
-  else
-    prev_bkpt_count = breakpoint_count;
+  prev_bkpt_count = breakpoint_count;
 
   sals.sals = NULL;
   sals.nelts = 0;
@@ -7672,15 +7673,12 @@ create_new_breakpoint (struct gdbarch *gdbarch,
 				     cond_string, type_wanted,
 				     tempflag ? disp_del : disp_donttouch,
 				     thread, task, ignore_count, ops,
-				     from_tty, enabled, count_down);
+				     from_tty, enabled, visible);
 
 	      do_cleanups (old_chain);
 
 	      /* Get the tracepoint we just created.  */
-	      if (count_down)
-		tp = get_breakpoint (internal_breakpoint_number);
-	      else
-		tp = get_breakpoint (breakpoint_count);
+	      tp = get_breakpoint (breakpoint_count);
 	      gdb_assert (tp != NULL);
 
 	      /* Given that its possible to have multiple markers with
@@ -7696,7 +7694,7 @@ create_new_breakpoint (struct gdbarch *gdbarch,
 	create_breakpoints_sal (gdbarch, sals, addr_string, cond_string,
 				type_wanted, tempflag ? disp_del : disp_donttouch,
 				thread, task, ignore_count, ops, from_tty,
-				enabled, count_down);
+				enabled, visible);
     }
   else
     {
@@ -7705,13 +7703,9 @@ create_new_breakpoint (struct gdbarch *gdbarch,
       make_cleanup (xfree, copy_arg);
 
       b = set_raw_breakpoint_without_location (gdbarch, type_wanted);
-      if (count_down)
-	  b->number = internal_breakpoint_number--;
-      else
-	{
-	  set_breakpoint_count (breakpoint_count + 1);
-	  b->number = breakpoint_count;
-	}
+      set_breakpoint_count (breakpoint_count + 1);
+      b->number = breakpoint_count;
+
       b->thread = -1;
       b->addr_string = addr_string[0];
       b->cond_string = NULL;
@@ -7721,13 +7715,14 @@ create_new_breakpoint (struct gdbarch *gdbarch,
       b->ops = ops;
       b->enable_state = enabled ? bp_enabled : bp_disabled;
       b->pspace = current_program_space;
+      b->visible = visible;
 
       if (enabled && b->pspace->executing_startup
 	  && (b->type == bp_breakpoint
 	      || b->type == bp_hardware_breakpoint))
 	b->enable_state = bp_startup_disabled;
 
-      if (!count_down)
+      if (visible)
 	mention (b);
     }
   
@@ -7775,7 +7770,7 @@ create_breakpoint (struct gdbarch *gdbarch,
 				parse_condition_and_thread, tempflag,
 				type_wanted, ignore_count,
 				pending_break_support,			       
-				ops, from_tty, enabled, 0);
+				ops, from_tty, enabled, 1);
 }
 
 /* Set a breakpoint. 
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index 4dd0137..8315e76 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -557,6 +557,13 @@ struct breakpoint
        breakpoints, we will use this index to try to find the same
        marker again.  */
     int static_trace_marker_id_idx;
+
+    /* Python breakpoints are allowed to specify whether the
+       breakpoint will be visible to the user via 'info breakpoints'.
+       This is to enable Python scripts to set many breakpoints in
+       commands/functions without impacting the readability of the
+       'info breakpoints' command.  */
+    int visible;
   };
 
 typedef struct breakpoint *breakpoint_p;
@@ -880,7 +887,7 @@ extern int create_new_breakpoint (struct gdbarch *gdbarch, char *arg,
 				  struct breakpoint_ops *ops,  
 				  int from_tty,
 				  int enabled,
-				  int count_down);
+				  int visible);
 
 extern void insert_breakpoints (void);
 
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index 045b09a..2cbd751 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -496,6 +496,17 @@ bppy_get_type (PyObject *self, void *closure)
   return PyInt_FromLong (self_bp->bp->type);
 }
 
+/* Python function to get the visibility of the breakpoint.  */
+static PyObject *
+bppy_get_visibility (PyObject *self, void *closure)
+{
+  breakpoint_object *self_bp = (breakpoint_object *) self;
+
+  BPPY_REQUIRE_VALID (self_bp);
+
+  return PyInt_FromLong (self_bp->bp->visible);
+}
+
 /* Python function to get the breakpoint's number.  */
 static PyObject *
 bppy_get_number (PyObject *self, void *closure)
@@ -562,15 +573,15 @@ static PyObject *
 bppy_new (PyTypeObject *subtype, PyObject *args, PyObject *kwargs)
 {
   PyObject *result;
-  static char *keywords[] = { "spec", "type", "wp_class", "internal", NULL };
+  static char *keywords[] = { "spec", "type", "wp_class", "visible", NULL };
   char *spec;
   int type = bp_breakpoint;
   int access_type = hw_write;
-  int internal = 0;
+  int visible = 1;
   volatile struct gdb_exception except;
 
   if (! PyArg_ParseTupleAndKeywords (args, kwargs, "s|iii", keywords,
-				     &spec, &type, &access_type, &internal))
+				     &spec, &type, &access_type, &visible))
     return NULL;
 
   result = subtype->tp_alloc (subtype, 0);
@@ -594,7 +605,7 @@ bppy_new (PyTypeObject *subtype, PyObject *args, PyObject *kwargs)
 				   0, bp_breakpoint,
 				   0,
 				   AUTO_BOOLEAN_TRUE,
-				   NULL, 0, 1, internal);
+				   NULL, 0, 1, visible);
 	    break;
 	  }
         case bp_watchpoint:
@@ -829,6 +840,9 @@ or None if no condition set."},
     "Commands of the breakpoint, as specified by the user."},
   { "type", bppy_get_type, NULL,
     "Type of breakpoint."},
+  { "visible", bppy_get_visibility, NULL,
+    "Whether the breakpoint is visible to the user."},
+
   { NULL }  /* Sentinel.  */
 };
 


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


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

only message in thread, other threads:[~2010-09-23 11:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-23 11:02 [SCM] archer-pmuldoon-python-breakpoints: Remove internal breakpoints number use. Use visibility flag instead pmuldoon

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