]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/testsuite/gdb.base/options.exp
Make "backtrace" support -OPT options
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / options.exp
index 3b4e7ee189f4c0e5e2535aadefa22d3140d6967e..17573460b4d4480370f54066a64da1f977785aaf 100644 (file)
 # The test uses the "maintenance test-options" subcommands to exercise
 # TAB-completion and option processing.
 #
-# It also tests option integration in various commands, including
-# "print" and "compile print".
+# It also tests option integration in various commands, including:
+#
+#  - print
+#  - compile print
+#  - backtrace
 
 load_lib completion-support.exp
 
@@ -231,6 +234,56 @@ proc_with_prefix test-print {{prefix ""}} {
        "Left operand of assignment is not an lvalue\\."
 }
 
+# Basic option-machinery + "backtrace" command integration tests.
+proc_with_prefix test-backtrace {} {
+    clean_restart
+
+    test_gdb_complete_unique "backtrace" "backtrace"
+    test_gdb_complete_none "backtrace "
+
+    gdb_test "backtrace -" "Ambiguous option at: -"
+    gdb_test "backtrace --" "No stack\\."
+    gdb_test "backtrace -- -" "No stack\\."
+
+    test_gdb_complete_multiple "backtrace " "-" "" {
+       "-entry-values"
+       "-frame-arguments"
+       "-full"
+       "-hide"
+       "-no-filters"
+       "-past-entry"
+       "-past-main"
+       "-raw-frame-arguments"
+    }
+
+    global binfile
+    clean_restart $binfile
+
+    if ![runto_main] {
+       fail "cannot run to main"
+       return
+    }
+
+    # COUNT in "backtrace COUNT" is parsed as an expression.  Check
+    # that we complete expressions.
+
+    test_gdb_complete_unique \
+       "backtrace xxx" \
+       "backtrace xxx1"
+
+    test_gdb_complete_unique \
+       "backtrace -xxx" \
+       "backtrace -xxx1"
+
+    test_gdb_complete_unique \
+       "backtrace 1 + xxx" \
+       "backtrace 1 + xxx1"
+
+    test_gdb_complete_unique \
+       "backtrace (1 + xxx" \
+       "backtrace (1 + xxx1"
+}
+
 # Miscellaneous tests.
 proc_with_prefix test-misc {variant} {
     global all_options
@@ -674,3 +727,6 @@ test-print ""
 if ![skip_compile_feature_tests] {
     test-print "compile "
 }
+
+# Basic "backtrace" integration tests.
+test-backtrace