public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-pmuldoon-python-breakpoints: Rename "condition" to "eval".  Use the breakpoint architecture if available.
@ 2011-01-27 10:10 pmuldoon
  0 siblings, 0 replies; only message in thread
From: pmuldoon @ 2011-01-27 10:10 UTC (permalink / raw)
  To: archer-commits

The branch, archer-pmuldoon-python-breakpoints has been updated
       via  568f5fb70c4465a4b2b64759530222b16c42adc8 (commit)
      from  cb967e63703e837b28a48cb944c00f303bb535d2 (commit)

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

- Log -----------------------------------------------------------------
commit 568f5fb70c4465a4b2b64759530222b16c42adc8
Author: Phil Muldoon <pmuldoon@redhat.com>
Date:   Thu Jan 27 10:09:23 2011 +0000

    Rename "condition" to "eval".  Use the breakpoint architecture if
    available.

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

Summary of changes:
 gdb/doc/gdb.texinfo                        |   12 ++++++------
 gdb/python/py-breakpoint.c                 |   18 ++++++++++--------
 gdb/testsuite/gdb.python/py-breakpoint.exp |    6 +++---
 3 files changed, 19 insertions(+), 17 deletions(-)

First 500 lines of diff:
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 1cb0cca..79b510f 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -22933,9 +22933,9 @@ argument defines the class of watchpoint to create, if @var{type} is
 assumed to be a @var{WP_WRITE} class.
 @end defmethod
 
-@defop Operation {gdb.Breakpoint} condition (self)
+@defop Operation {gdb.Breakpoint} eval (self)
 The @code{gdb.Breakpoint} class can be sub-classed and, in
-particular, you may choose to implement the @code{condition} method.
+particular, you may choose to implement the @code{eval} method.
 If this method is defined as a sub-class of @code{gdb.Breakpoint},
 it will be called when the inferior stops at any location of a
 breakpoint which instantiates that sub-class.  If the method returns
@@ -22943,17 +22943,17 @@ breakpoint which instantiates that sub-class.  If the method returns
 breakpoint, otherwise the inferior will continue.
 
 If there are multiple breakpoints at the same location with a
-@code{condition} method, each one will be called regardless of the
-return status of the previous.  This ensures that all @code{condition}
+@code{eval} method, each one will be called regardless of the
+return status of the previous.  This ensures that all @code{eval}
 methods have a chance to execute at that location.  In this scenario
 if one of the methods returns @code{True} but the others return
 @code{False}, the inferior will still be stopped.
 
-Example @code{condition} implementation:
+Example @code{eval} implementation:
 
 @smallexample
 class MyBreakpoint (gdb.Breakpoint):
-      def condition (self):
+      def eval (self):
         inf_val = gdb.parse_and_eval("foo")
         if inf_val == 3:
           return True
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index d58dadd..f0c4ad0 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -698,18 +698,20 @@ gdbpy_breakpoints (PyObject *self, PyObject *args)
   return PyList_AsTuple (list);
 }
 
-/* Evaluate the "condition" method (if implemented) in
-   the breakpoint class.  If the method returns True, the inferior
-   will be stopped at the breakpoint.  Otherwise the inferior will be
-   allowed to continue.  */
+/* Call the "eval" method (if implemented) in the breakpoint class.  If
+   the method returns True, the inferior  will be stopped at the
+   breakpoint.  Otherwise the inferior will be allowed to continue.  */
+
 int
 gdbpy_cond_evaluate (struct breakpoint_object *bp_obj)
 {
-  struct cleanup *cleanup = ensure_python_env (get_current_arch (),
-					       current_language);
-  PyObject *py_bp = (PyObject *) bp_obj;
   int should_stop = 1;
-  char *method = "condition";
+  char *method = "eval";
+
+  PyObject *py_bp = (PyObject *) bp_obj;
+  struct breakpoint *b = bp_obj->bp;
+  struct gdbarch *garch = b->gdbarch ? b->gdbarch : get_current_arch ();
+  struct cleanup *cleanup = ensure_python_env (garch, current_language);
 
   if (PyObject_HasAttrString (py_bp, method))
     {
diff --git a/gdb/testsuite/gdb.python/py-breakpoint.exp b/gdb/testsuite/gdb.python/py-breakpoint.exp
index 3e0f2de..e4a43e3 100644
--- a/gdb/testsuite/gdb.python/py-breakpoint.exp
+++ b/gdb/testsuite/gdb.python/py-breakpoint.exp
@@ -215,7 +215,7 @@ gdb_py_test_multiple "Sub-class a breakpoint" \
   "class bp_eval (gdb.Breakpoint):" "" \
   "   inf_i = 0" "" \
   "   count = 0" "" \
-  "   def condition (self):" "" \
+  "   def eval (self):" "" \
   "      self.count = self.count + 1" "" \
   "      self.inf_i = gdb.parse_and_eval(\"i\")" "" \
   "      if self.inf_i == 3:" "" \
@@ -227,7 +227,7 @@ gdb_py_test_multiple "Sub-class a second breakpoint" \
   "python" "" \
   "class bp_also_eval (gdb.Breakpoint):" "" \
   "   count = 0" "" \
-  "   def condition (self):" "" \
+  "   def eval (self):" "" \
   "      self.count = self.count + 1" "" \
   "      if self.count == 9:" "" \
   "        return True" "" \
@@ -259,7 +259,7 @@ gdb_test "python print check_eval.count" "1" \
 gdb_py_test_multiple "Sub-class a watchpoint" \
   "python" "" \
   "class wp_eval (gdb.Breakpoint):" "" \
-  "   def condition (self):" "" \
+  "   def eval (self):" "" \
   "      self.result = gdb.parse_and_eval(\"result\")" "" \
   "      if self.result == 788:" "" \
   "        return True" "" \


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


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

only message in thread, other threads:[~2011-01-27 10:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-27 10:10 [SCM] archer-pmuldoon-python-breakpoints: Rename "condition" to "eval". Use the breakpoint architecture if available 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).