aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorPhil Muldoon <pmuldoon@redhat.com>2011-03-22 09:38:16 +0000
committerPhil Muldoon <pmuldoon@redhat.com>2011-03-22 09:38:16 +0000
commit057758407cda4549e446ab0d061482ae6f7cd021 (patch)
tree6e8fd30479844b71cb0f42ecf9034cd8e7fd6116 /gdb/testsuite
parent07aead7b6735a00e1d1fd4ce265a64bdfda15c77 (diff)
downloadgdb-057758407cda4549e446ab0d061482ae6f7cd021.zip
gdb-057758407cda4549e446ab0d061482ae6f7cd021.tar.gz
gdb-057758407cda4549e446ab0d061482ae6f7cd021.tar.bz2
2011-03-21 Phil Muldoon <pmuldoon@redhat.com>
PR python/12183 * python/py-function.c (fnpy_call): Treat GdbErrors differently to other error classes. Do not print stack trace. 2011-03-21 Phil Muldoon <pmuldoon@redhat.com> PR python/12183 * gdb.python/py-function.exp: Add GdbError tests.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog6
-rw-r--r--gdb/testsuite/gdb.python/py-function.exp26
2 files changed, 32 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 2abb0f9..5508901 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2011-03-22 Phil Muldoon <pmuldoon@redhat.com>
+
+ PR python/12183
+
+ * gdb.python/py-function.exp: Add GdbError tests.
+
2011-03-18 Pedro Alves <pedro@codesourcery.com>
* gdb.trace/unavailable.cc (args_test_func, local_test_func)
diff --git a/gdb/testsuite/gdb.python/py-function.exp b/gdb/testsuite/gdb.python/py-function.exp
index bbbbf42..dfccdff 100644
--- a/gdb/testsuite/gdb.python/py-function.exp
+++ b/gdb/testsuite/gdb.python/py-function.exp
@@ -69,3 +69,29 @@ gdb_py_test_multiple "input int-returning function" \
gdb_test "print \$yes() && \$yes()" " = 1" "call yes with &&"
gdb_test "print \$yes() || \$yes()" " = 1" "call yes with ||"
+
+gdb_py_test_multiple "Test GDBError" \
+ "python" "" \
+ "class GDBError(gdb.Function):" "" \
+ " def __init__(self):" "" \
+ " gdb.Function.__init__(self, 'gdberror')" "" \
+ " def invoke(self):" "" \
+ " raise gdb.GdbError(\"This is a GdbError\")" "" \
+ "GDBError ()" "" \
+ "end" ""
+
+gdb_test "print \$gdberror()" "This is a GdbError.*" \
+ "Test GdbError. There should not be a stack trace"
+
+gdb_py_test_multiple "Test Normal Error" \
+ "python" "" \
+ "class NormalError(gdb.Function):" "" \
+ " def __init__(self):" "" \
+ " gdb.Function.__init__(self, 'normalerror')" "" \
+ " def invoke(self):" "" \
+ " raise RuntimeError(\"This is a Normal Error\")" "" \
+ "NormalError ()" "" \
+ "end" ""
+
+gdb_test "print \$normalerror()" "Traceback.*File.*line 5.*in invoke.*RuntimeError.*This is a Normal Error.*" \
+ "Test a Runtime error. There should be a stack trace."