aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.python
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.python')
-rw-r--r--gdb/testsuite/gdb.python/py-function.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-prettyprint.exp2
-rw-r--r--gdb/testsuite/gdb.python/python.exp75
3 files changed, 65 insertions, 14 deletions
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