This is the mail archive of the archer@sourceware.org mailing list for the Archer 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]

[python] Rename gdb.get_value_from_history to gdb.history.


Hi,

I just committed the following, as I suggested earlier.

Now I am looking at renaming get_blah methods to just blah, and
assessing whether some of those would be better implemented as
properties instead of methods. I'll post patches about those for
comments instead of committing them right away, to get opinions.
-- 
[]'s
Thiago Jung Bauermann
IBM Linux Technology Center


2008-12-03  Thiago Jung Bauermann  <bauerman@br.ibm.com>

    	Rename gdb.get_value_from_history to gdb.history.

	gdb/
    	* python/python-internal.h (gdbpy_get_value_from_history): Rename
    	prototype to gdbpy_history.
    	* python/python-value.c (gdbpy_get_value_from_history): Rename
    	function to gdbpy_history.
    	* python/python.c (GdbMethods): Rename function from
    	`get_value_from_history' to `history'.

	gdb/testsuite/
    	* gdb.python/python-template.exp: Use `gdb.history' instead of
    	`gdb.value_from_history'.
    	* gdb.python/python-value.exp: Likewise.

diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index 83fc1e2..f66d674 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -69,7 +69,7 @@ extern PyTypeObject block_object_type;
 extern PyTypeObject value_object_type;
 extern PyTypeObject symbol_object_type;
 
-PyObject *gdbpy_get_value_from_history (PyObject *self, PyObject *args);
+PyObject *gdbpy_history (PyObject *self, PyObject *args);
 PyObject *gdbpy_get_breakpoints (PyObject *, PyObject *);
 PyObject *gdbpy_get_frames (PyObject *, PyObject *);
 PyObject *gdbpy_get_current_frame (PyObject *, PyObject *);
diff --git a/gdb/python/python-value.c b/gdb/python/python-value.c
index 342cf28..2d12de3 100644
--- a/gdb/python/python-value.c
+++ b/gdb/python/python-value.c
@@ -846,7 +846,7 @@ convert_value_from_python (PyObject *obj)
 
 /* Returns value object in the ARGth position in GDB's history.  */
 PyObject *
-gdbpy_get_value_from_history (PyObject *self, PyObject *args)
+gdbpy_history (PyObject *self, PyObject *args)
 {
   int i;
   struct value *res_val = NULL;	  /* Initialize to appease gcc warning.  */
diff --git a/gdb/python/python.c b/gdb/python/python.c
index bb0b428..b6fbc73 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1342,7 +1342,7 @@ if hasattr (gdb, 'datadir'):\n\
 
 static PyMethodDef GdbMethods[] =
 {
-  { "get_value_from_history", gdbpy_get_value_from_history, METH_VARARGS,
+  { "history", gdbpy_history, METH_VARARGS,
     "Get a value from history" },
   { "execute", execute_gdb_command, METH_VARARGS,
     "Execute a gdb command" },
diff --git a/gdb/testsuite/gdb.python/python-template.exp b/gdb/testsuite/gdb.python/python-template.exp
index c02e887..561ff73 100644
--- a/gdb/testsuite/gdb.python/python-template.exp
+++ b/gdb/testsuite/gdb.python/python-template.exp
@@ -58,7 +58,7 @@ proc test_template_arg {type} {
     }
     # There is no executable code in main(), so we are where we want to be
     gdb_test "print foo" ""
-    gdb_test "python foo = gdb.get_value_from_history(0)" ""
+    gdb_test "python foo = gdb.history(0)" ""
 
     # Replace '*' with '\*' in regex.
     regsub -all {\*} $type {\*} t
diff --git a/gdb/testsuite/gdb.python/python-value.exp b/gdb/testsuite/gdb.python/python-value.exp
index 9f76906..5850a7f 100644
--- a/gdb/testsuite/gdb.python/python-value.exp
+++ b/gdb/testsuite/gdb.python/python-value.exp
@@ -113,16 +113,16 @@ proc test_value_numeric_ops {} {
 
   # Conversion test.
   gdb_test "print evalue" " = TWO"
-  gdb_test "python evalue = gdb.get_value_from_history (0)" ""
+  gdb_test "python evalue = gdb.history (0)" ""
   gdb_test "python print int (evalue)" "2"
 
   # Test pointer arithmethic
 
   # First, obtain the pointers
   gdb_test "print (void *) 2" "" ""
-  gdb_test "python a = gdb.get_value_from_history (0)" "" ""
+  gdb_test "python a = gdb.history (0)" "" ""
   gdb_test "print (void *) 5" "" ""
-  gdb_test "python b = gdb.get_value_from_history (0)" "" ""
+  gdb_test "python b = gdb.history (0)" "" ""
 
   gdb_test "python print 'result = ' + str(a+5)" " = 0x7" "add pointer value with python integer"
   gdb_test "python print 'result = ' + str(b-2)" " = 0x3" "subtract python integer from pointer value"
@@ -210,7 +210,7 @@ proc test_value_in_inferior {} {
   # Just get inferior variable s in the value history, available to python.
   gdb_test "print s" " = {a = 3, b = 5}" ""
 
-  gdb_py_test_silent_cmd "python s = gdb.get_value_from_history (0)" "get value from history" 1
+  gdb_py_test_silent_cmd "python s = gdb.history (0)" "get value from history" 1
 
   gdb_test "python print 'result = ' + str(s\['a'\])" " = 3" "access element inside struct using 8-bit string name"
   gdb_test "python print 'result = ' + str(s\[u'a'\])" " = 3" "access element inside struct using unicode name"
@@ -220,7 +220,7 @@ proc test_value_in_inferior {} {
   # Just get inferior variable argv the value history, available to python.
   gdb_test "print argv" " = \\(char \\*\\*\\) 0x.*" ""
 
-  gdb_py_test_silent_cmd "python argv = gdb.get_value_from_history (0)" "" 0
+  gdb_py_test_silent_cmd "python argv = gdb.history (0)" "" 0
   gdb_py_test_silent_cmd "python arg0 = argv.dereference ()" "dereference value" 1
 
   # Check that the dereferenced value is sane



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