diff options
author | Phil Muldoon <pmuldoon@redhat.com> | 2011-12-16 15:55:40 +0000 |
---|---|---|
committer | Phil Muldoon <pmuldoon@redhat.com> | 2011-12-16 15:55:40 +0000 |
commit | 80b6e7564ff0168d392e69a46ded01ce1bf3dd73 (patch) | |
tree | 937a8f34be597f9dd4243f2e3691748ead3ef84a /gdb/testsuite | |
parent | b93a1992f4b3668cae4682e16a8add34f8411a8c (diff) | |
download | gdb-80b6e7564ff0168d392e69a46ded01ce1bf3dd73.zip gdb-80b6e7564ff0168d392e69a46ded01ce1bf3dd73.tar.gz gdb-80b6e7564ff0168d392e69a46ded01ce1bf3dd73.tar.bz2 |
2011-12-16 Phil Muldoon <pmuldoon@redhat.com>
* testsuite/gdb.python/py-function.exp: Change "on" to "full" for
python print-stack. Add set/show python print-stack
off|full|message tests.
2011-12-16 Phil Muldoon <pmuldoon@redhat.com>
* python/python.c: Define python_excp_enums.
(eval_python_from_control_command): Do not call gdbpy_print_stack.
(python_command): Ditto.
(gdbpy_print_stack): Rewrite to use new enum constants.
(maint_set_python): Remove function.
(maint_show_python): Ditto.
(_initialize_python): Do not add "maint" commands. Add "set/show
python print-stack commands".
* NEWS: Update to reflect removal for "maint set/show
print-stack"
2011-12-16 Phil Muldoon <pmuldoon@redhat.com>
* doc/gdb.texinfo (Python Commands): Remove "maint set/show print
stack". Add documentation for "set/show python print-stack".
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-function.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-prettyprint.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/python.exp | 75 |
4 files changed, 71 insertions, 14 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index c432e2b..4c98de1 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2011-12-16 Phil Muldoon <pmuldoon@redhat.com> + + * testsuite/gdb.python/py-function.exp: Change "on" to "full" for + python print-stack. Add set/show python print-stack + off|full|message tests. + 2011-12-15 Yao Qi <yao@codesourcery.com> * gdb.trace/strace.c: New diff --git a/gdb/testsuite/gdb.python/py-function.exp b/gdb/testsuite/gdb.python/py-function.exp index d579435..f670d52 100644 --- a/gdb/testsuite/gdb.python/py-function.exp +++ b/gdb/testsuite/gdb.python/py-function.exp @@ -93,7 +93,7 @@ gdb_py_test_multiple "Test Normal Error" \ "NormalError ()" "" \ "end" "" -gdb_test_no_output "set python print-stack on" +gdb_test_no_output "set python print-stack full" 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." diff --git a/gdb/testsuite/gdb.python/py-prettyprint.exp b/gdb/testsuite/gdb.python/py-prettyprint.exp index b0e7d62..9786d71 100644 --- a/gdb/testsuite/gdb.python/py-prettyprint.exp +++ b/gdb/testsuite/gdb.python/py-prettyprint.exp @@ -97,7 +97,7 @@ proc run_lang_tests {exefile lang} { gdb_test_no_output "python pp_ls_encoding = 'UTF-8'" gdb_test "print estring2" "\"embedded \", <incomplete sequence \\\\302>" - gdb_test_no_output "set python print-stack on" + gdb_test_no_output "set python print-stack full" gdb_test "print hint_error" "Exception: hint failed\r\nhint_error_val" gdb_test "print c" " = container \"container\" with 2 elements = {$nl *.0. = 23,$nl *.1. = 72$nl}" diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp index 94d6d0d..290a083 100644 --- a/gdb/testsuite/gdb.python/python.exp +++ b/gdb/testsuite/gdb.python/python.exp @@ -195,20 +195,15 @@ gdb_test "python gdb.write(\"Error stream\\n\", stream=gdb.STDERR)" "Error strea gdb_test "python gdb.write(\"Normal stream\\n\", stream=gdb.STDOUT)" "Normal stream" "Test stdout write" gdb_test "python gdb.write(\"Log stream\\n\", stream=gdb.STDLOG)" "Log stream" "Test stdlog write" -# Deprecate maint set/show python print-stack -gdb_test "maint show python print-stack" \ - "Warning: command 'maintenance show python print-stack' is deprecated.*Use 'show python print-stack'.*" \ - "Test deprecation maint show warning." -gdb_test "maint set python print-stack off" \ - "Warning: command 'maintenance set python print-stack' is deprecated.*Use 'set python print-stack'.*" \ - "Test deprecation maint set warning." +# print-stack gdb_test "show python print-stack" \ - "Whether Python stack will be printed on error is off.*" \ - "Test print-backtrace show setting. Default off." -gdb_py_test_silent_cmd "set python print-stack on" \ + "The mode of Python stack printing on error is \"message\".*" \ + "Test print-backtrace show setting. Default is message." +gdb_py_test_silent_cmd "set python print-stack full" \ "Test print-backtrace set setting" 1 gdb_test "show python print-stack" \ - "Whether Python stack will be printed on error is on.*" \ + "The mode of Python stack printing on error is \"full\".*" \ + "Test print-backtrace show setting to full." # Test prompt substituion @@ -313,7 +308,63 @@ gdb_test_multiple "set extended-prompt \\w " \ gdb_test_multiple "set extended-prompt some param \\p{python print-stack} " \ "set extended prompt parameter" { - -re "\[\r\n\]some param True $" { + -re "\[\r\n\]some param full $" { pass "set extended prompt parameter" } } + +# Start with a fresh gdb. +clean_restart ${testfile} + +# The following tests require execution. + +if ![runto_main] then { + fail "Can't run to main" + return 0 +} + +# print-stack settings +gdb_test "show python print-stack" \ + "The mode of Python stack printing on error is \"message\".*" \ + "Test print-backtrace show setting. Default is message." +gdb_py_test_silent_cmd "set python print-stack full" \ + "Test print-backtrace set setting" 1 +gdb_test "show python print-stack" \ + "The mode of Python stack printing on error is \"full\".*" \ + "Test print-backtrace show setting to full." +gdb_py_test_silent_cmd "set python print-stack none" \ + "Test print-backtrace set setting" 1 +gdb_test "show python print-stack" \ + "The mode of Python stack printing on error is \"none\".*" \ + "Test print-backtrace show setting to none." + +gdb_py_test_silent_cmd "set python print-stack message" \ + "Test print-backtrace set setting" 1 + +gdb_py_test_multiple "prompt substitution readline" \ + "python" "" \ + "pCounter = 0" "" \ + "def error_prompt(current):" "" \ + " raise RuntimeError(\"Python exception called\")" "" \ + "end" "" + +gdb_test_multiple "python gdb.prompt_hook = error_prompt" "set the hook" { + -re "Python Exception <type 'exceptions.RuntimeError'> Python exception called.*" { + pass "set hook" + } +} + +gdb_py_test_silent_cmd "python gdb.prompt_hook = None" \ + "set the hook to default" 1 + +gdb_py_test_silent_cmd "set python print-stack full" \ + "Test print-backtrace set setting" 1 + +gdb_test_multiple "python gdb.prompt_hook = error_prompt" "set the hook" { + -re "Traceback.*File.*line.*RuntimeError.*Python exception called.*" { + pass "set hook" + } +} + +gdb_py_test_silent_cmd "python gdb.prompt_hook = None" \ + "set the hook to default" 1 |