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.
This commit is contained in:
Phil Muldoon 2011-03-22 09:38:16 +00:00
parent 07aead7b67
commit 057758407c
4 changed files with 88 additions and 2 deletions

View file

@ -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."