aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.python
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2009-12-03 18:30:02 +0000
committerTom Tromey <tromey@redhat.com>2009-12-03 18:30:02 +0000
commit57a1d736959fb92e39abab59511a903b7ec59547 (patch)
tree5ec223f0d33bfe64a7583c5993325705b1fad1cc /gdb/testsuite/gdb.python
parentfb169834478e0db3ffe865300c0cf4556160c7bd (diff)
downloadgdb-57a1d736959fb92e39abab59511a903b7ec59547.zip
gdb-57a1d736959fb92e39abab59511a903b7ec59547.tar.gz
gdb-57a1d736959fb92e39abab59511a903b7ec59547.tar.bz2
gdb
* python/python.c (gdbpy_parse_and_eval): New function. (GdbMethods): Add "parse_and_eval". gdb/testsuite * gdb.python/py-value.exp (test_parse_and_eval): New function. gdb/doc * gdb.texinfo (Basic Python): Document gdb.parse_and_eval.
Diffstat (limited to 'gdb/testsuite/gdb.python')
-rw-r--r--gdb/testsuite/gdb.python/py-value.exp12
1 files changed, 12 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp
index 2958233..01f6023 100644
--- a/gdb/testsuite/gdb.python/py-value.exp
+++ b/gdb/testsuite/gdb.python/py-value.exp
@@ -361,6 +361,17 @@ proc test_subscript_regression {lang} {
gdb_test "python print marray\[1\]\[2\]" "o." "Test multiple subscript"
}
+# A few tests of gdb.parse_and_eval.
+proc test_parse_and_eval {} {
+ gdb_test "python print gdb.parse_and_eval ('23')" "23" \
+ "parse_and_eval constant test"
+ gdb_test "python print gdb.parse_and_eval ('5 + 7')" "12" \
+ "parse_and_eval simple expression test"
+ gdb_test "python print type(gdb.parse_and_eval ('5 + 7'))" \
+ ".type 'gdb.Value'."\
+ "parse_and_eval type test"
+}
+
# Start with a fresh gdb.
gdb_exit
@@ -381,6 +392,7 @@ test_value_numeric_ops
test_value_boolean
test_value_compare
test_objfiles
+test_parse_and_eval
# The following tests require execution.