Implement pahole-like 'ptype /o' option
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / default.exp
index b6ecdcb86fe670197878bef4a40b87a8f9d44f9d..c25069a86e16179a836173c5882cfe9285f7074a 100644 (file)
@@ -1,6 +1,4 @@
-#   Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010
-#   Free Software Foundation, Inc.
+#   Copyright 1988-2017 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -39,30 +37,28 @@ gdb_test "append value"  "Missing filename\."
 gdb_test "append binary memory" "Missing filename\." 
 gdb_test "append binary value"  "Missing filename\." 
 
-setup_xfail "mips-idt-*"
-gdb_test_multiple "attach" "attach" {
-    -re "Argument required .(process-id|program) to attach.*$gdb_prompt $"\
-       { pass "attach" }
-    -re "You can't do that when your target is `None'.*$gdb_prompt $"\
-       { pass "attach" }
-    -re "You can't do that without a process to debug.*$gdb_prompt $"\
-       { pass "attach" }
-    -re "Don't know how to attach.  Try \"help target\"..*$gdb_prompt $"\
-       { pass "attach" }
-    -re "Kill it. .y or n." {
-       send_gdb "y\n"
-       exp_continue
+if !$use_gdb_stub {
+    gdb_test_multiple "attach" "attach" {
+       -re "Argument required .(process-id|program) to attach.*$gdb_prompt $"\
+           { pass "attach" }
+       -re "You can't do that when your target is `None'.*$gdb_prompt $"\
+           { pass "attach" }
+       -re "You can't do that without a process to debug.*$gdb_prompt $"\
+           { pass "attach" }
+       -re "Don't know how to attach.  Try \"help target\"..*$gdb_prompt $"\
+           { pass "attach" }
+       -re "Kill it. .y or n." {
+           send_gdb "y\n"
+           exp_continue
+       }
     }
-}
 
-if ![target_info exists use_gdb_stub] {
     gdb_test "break" "No default breakpoint address now." "break"
     foreach i "b br bre brea" {
        gdb_test $i "No default breakpoint address now." "break \"$i\" abbreviation"
     }
 
     
-    setup_xfail "mips-idt-*"
     gdb_test "backtrace" "No stack."
 
     # ba and bac are no longer unique command prefixes. So these tests
@@ -70,18 +66,14 @@ if ![target_info exists use_gdb_stub] {
     # GDB needs to be fixed to map unique alias here for ba bac.
     #
     foreach i "bt ba bac" {
-       setup_xfail "mips-idt-*"
        gdb_test $i "No stack." "backtrace \"$i\" abbreviation"
     }
 } else {
     warning "Skipping backtrace and break tests because of GDB stub."
 }
 
-# This works on the MIPS IDT board, but confuses future tests.
-if ![istarget "mips-idt-*"] then {
-    gdb_test "continue" "The program is not being run." "continue"
-    gdb_test "c" "The program is not being run." "continue \"c\" abbreviation"
-}
+gdb_test "continue" "The program is not being run." "continue"
+gdb_test "c" "The program is not being run." "continue \"c\" abbreviation"
 
 #test call
 gdb_test "call" "The history is empty..*" "call"
@@ -91,7 +83,7 @@ gdb_test "call" "The history is empty..*" "call"
 gdb_test "catch" "Catch requires an event name..*" "catch"
 
 #test cd
-gdb_test "cd" "Argument required .new working directory.*" "cd"
+gdb_test "cd" "Working directory \[^\r\n\]*\(\r\n \\(canonically \[^\r\n\]*\\)\)?\\."
 
 #test clear
 gdb_test "clear" "No source file specified..*" "clear"
@@ -103,7 +95,7 @@ gdb_test "commands" "Argument required .one or more breakpoint numbers...*" "com
 gdb_test "condition" "Argument required .breakpoint number.*" "condition"
 
 #test core-file
-gdb_test "core-file" "No core file now.|GDB can't read core files on this machine." "core-file"
+gdb_test "core-file" "No core file now." "core-file"
 #test delete "d" abbreviation
 gdb_test_no_output "d" "delete \"d\" abbreviation"
 #test delete
@@ -125,11 +117,6 @@ gdb_test "delete display" \
 #test detach
 gdb_test "detach" ".*" "detach"
 
-if [istarget "h8300-*-hms"] then {
-    gdb_exit
-    gdb_start
-}
-
 #test directory
 # FIXME -- need to dump full output to detailed log
 
@@ -217,7 +204,7 @@ gdb_test "f" "No stack." "frame \"f\" abbreviation"
 gdb_test "frame" "No stack." "frame"
 #test fg
 gdb_test "fg" "The program is not being run." "fg"
-# FIXME: fg kills the udi connection
+
 #test file
 send_gdb "file\n"
 gdb_expect {
@@ -283,8 +270,6 @@ gdb_test "info args" "No frame selected." "info args"
 gdb_test "info bogus-gdb-command" "Undefined info command: \"bogus-gdb-command\".  Try \"help info\".*" "info bogus-gdb-command"
 #test info breakpoints
 gdb_test "info breakpoints" "No breakpoints or watchpoints." "info breakpoints"
-#test info catch
-gdb_test "info catch" "No frame selected." "info catch"
 #test info copying
 # FIXME -- doesn't work worth a shit
 #send_gdb "info copying"
@@ -356,6 +341,8 @@ gdb_test "info sources" "No symbol table is loaded.  Use the \"file\" command.*"
 gdb_test_no_output "info target" "info target"
 #test info terminal
 gdb_test "info terminal" "No saved terminal information." "info terminal"
+# test info threads
+gdb_test "info threads" "No threads." "info threads"
 #test info types
 gdb_test "info types" "All defined types:" "info types"
 #test info variables
@@ -418,14 +405,8 @@ gdb_test "ptype" "The history is empty." "ptype"
 gdb_test "pwd" "Working directory .*" "pwd"
 
 #test run "r" abbreviation
-if [istarget "*-*-vxworks*"] then {
-    gdb_test "set args" ".*" "" 
-
-    gdb_test "r" "Starting program: .*
-You must specify a function name to run, and arguments if any"\
-               "run \"r\" abbreviation"
-    gdb_test "set args main" ".*" "" 
-
+if $use_gdb_stub {
+    # Only extended-remote supports "run".
 } else {
     gdb_test_multiple "r" "run \"r\" abbreviation" {
        -re "Starting program:  .*You can't do that when your target is `None'.*$gdb_prompt $"\
@@ -440,17 +421,14 @@ You must specify a function name to run, and arguments if any"\
            { pass "run \"r\" abbreviation" }
        -re "Don't know how to run.  Try \"help target\"..*$gdb_prompt $"\
            { pass "run \"r\" abbreviation" }
+       -re "Starting program:  .*Running the default executable on the remote target failed; try \"set remote exec-file\"?.*$gdb_prompt $"\
+           { pass "run \"r\" abbreviation" }
     }
 }
 
 #test run
-if [istarget "*-*-vxworks*"] then {
-    gdb_test "set args" ".*" "" 
-
-    gdb_test "run" "Starting program: .*
-You must specify a function name to run, and arguments if any"
-    gdb_test "set args main" ".*" "" 
-
+if $use_gdb_stub {
+    # Only extended-remote supports "run".
 } else {
     gdb_test_multiple "run" "run" {
        -re "Starting program:.*You can't do that when your target is `None'.*$gdb_prompt $"\
@@ -465,6 +443,8 @@ You must specify a function name to run, and arguments if any"
            { pass "run" }
        -re "Don't know how to run.  Try \"help target\"..*$gdb_prompt $"\
            { pass "run" }
+       -re "Starting program:  .*Running the default executable on the remote target failed; try \"set remote exec-file\"?.*$gdb_prompt $"\
+           { pass "run" }
     }
 }
 
@@ -494,12 +474,13 @@ gdb_test "section" "Must specify section name and its virtual address.*" "sectio
 gdb_test "set annotate" "Argument required .integer to set it to.*" "set annotate"
 #test set args
 gdb_test_no_output "set args" "set args"
-#test set check "c" abbreviation
-gdb_test "set c" "\"set check\" must be followed by the name of a check subcommand.(\[^\r\n\]*\[\r\n\])+List of set check subcommands:(\[^\r\n\]*\[\r\n\])+set check range -- Set range checking(\[^\r\n\]*\[\r\n\])+set check type -- Set type checking(\[^\r\n\]*\[\r\n\])+Type \"help set check\" followed by set check subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set check \"c\" abbreviation"
-#test set check "ch" abbreviation
-gdb_test "set ch" "\"set check\" must be followed by the name of a check subcommand.(\[^\r\n\]*\[\r\n\])+List of set check subcommands:(\[^\r\n\]*\[\r\n\])+set check range -- Set range checking(\[^\r\n\]*\[\r\n\])+set check type -- Set type checking(\[^\r\n\]*\[\r\n\])+Type \"help set check\" followed by set check subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set check \"ch\" abbreviation"
-#test set check
-gdb_test "set check" "\"set check\" must be followed by the name of a check subcommand.(\[^\r\n\]*\[\r\n\])+List of set check subcommands:(\[^\r\n\]*\[\r\n\])+set check range -- Set range checking(\[^\r\n\]*\[\r\n\])+set check type -- Set type checking(\[^\r\n\]*\[\r\n\])+Type \"help set check\" followed by set check subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set check"
+
+# Test set check abbreviations
+foreach x {"c" "ch" "check"} {
+    gdb_test "set $x" "\"set check\" must be followed by the name of a check subcommand.(\[^\r\n\]*\[\r\n\])+List of set check subcommands:(\[^\r\n\]*\[\r\n\])+set check range -- Set range checking(\[^\r\n\]*\[\r\n\])+set check type -- Set strict type checking(\[^\r\n\]*\[\r\n\])+Type \"help set check\" followed by set check subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." \
+       "set check \"$x\" abbreviation"
+}
+
 #test set check range
 gdb_test "set check range" ".*" "set check range"
 #test set check type
@@ -520,6 +501,9 @@ gdb_test "set height" "Argument required .integer to set it to.*" "set height"
 gdb_test_no_output "set history expansion" "set history expansion"
 #test set history filename
 gdb_test "set history filename" "Argument required .filename to set it to.*" "set history filename"
+# Make sure the history ends up in the right place.
+gdb_test_no_output "set history filename [standard_output_file .gdb_history]" \
+    "set the history filename"
 #test set history save
 gdb_test_no_output "set history save" "set history save"
 #test set history size
@@ -527,7 +511,7 @@ gdb_test "set history size" "Argument required .integer to set it to.*" "set his
 #test set history
 gdb_test "set history" "\"set history\" must be followed by the name of a history subcommand.(\[^\r\n\]*\[\r\n\])+List of set history subcommands:(\[^\r\n\]*\[\r\n\])+set history expansion -- Set history expansion on command input(\[^\r\n\]*\[\r\n\])+set history filename -- Set the filename in which to record the command history(\[^\r\n\]*\[\r\n\])+set history save -- Set saving of the history record on exit(\[^\r\n\]*\[\r\n\])+set history size -- Set the size of the command history(\[^\r\n\]*\[\r\n\])+Type \"help set history\" followed by set history subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set history"
 #test set language
-gdb_test "set language" "Requires an argument. Valid arguments are auto, local, unknown, ada, c, c.., asm, minimal, d, fortran, objective-c, java, modula-2, opencl, pascal." "set language"
+gdb_test "set language" "Requires an argument. Valid arguments are auto, local, unknown, ada, asm, c, c.., d, fortran, go, minimal, modula-2, objective-c, opencl, pascal, rust." "set language"
 #test set listsize
 gdb_test "set listsize" "Argument required .integer to set it to.*" "set listsize"
 #test set print "p" abbreviation
@@ -559,8 +543,6 @@ gdb_test_no_output "set print vtbl" "set print vtbl"
 # FIXME -- need a test for "set prompt"
 #test set radix
 gdb_test "set radix" "Input and output radices now set to decimal 10, hex a, octal 12.*" "set radix"
-#test set symbol-reloading
-gdb_test_no_output "set symbol-reloading" "set symbol-reloading"
 #test set variable
 gdb_test "set variable" "Argument required .expression to compute.*" "set variable"
 #test set verbose
@@ -578,16 +560,17 @@ gdb_test "shell echo Hi dad!" "Hi dad!" "shell echo Hi dad!"
 gdb_test "show annotate" "Annotation_level is 0."       "show annotate"
 #test show args
 gdb_test "show args" "Argument list to give program being debugged when it is started is \"\"." "show args"
-#test show check "c" abbreviation
-gdb_test "show c" "range:  *Range checking is \"auto; currently off\".(\[^\r\n\]*\[\r\n\])+type:  *Type checking is \"auto; currently off\".*" "show check \"c\" abbreviation"
-#test show check "ch" abbreviation
-gdb_test "show ch" "range: *Range checking is \"auto; currently off\".(\[^\r\n\]*\[\r\n\])+type:  *Type checking is \"auto; currently off\"." "show check \"ch\" abbreviation"
-#test show check
-gdb_test "show check" "range:  *Range checking is \"auto; currently off\".(\[^\r\n\]*\[\r\n\])+type:  *Type checking is \"auto; currently off\"." "show check"
+
+# test show check abbreviations
+foreach x {"c" "ch" "check"} {
+    gdb_test "show $x" "range:  *Range checking is \"auto; currently off\".(\[^\r\n\]*\[\r\n\])+type:  *Strict type checking is on\..*" \
+       "show check \"$x\" abbreviation"
+}
+
 #test show check range
 gdb_test "show check range" "Range checking is \"auto; currently off\"." "show check range"
 #test show check type
-gdb_test "show check type" "Type checking is \"auto; currently off\"." "show check type"
+gdb_test "show check type" "Strict type checking is on\." "show check type"
 #test show commands
 gdb_test "show commands" ".*" "show commands"
 #test show complaints
@@ -596,16 +579,50 @@ gdb_test "show complaints" "Max number of complaints about incorrect symbols is
 gdb_test "show confirm" "Whether to confirm potentially dangerous operations is o\[a-z\]*." "show confirm"
 
 #test show convenience
-# This is tricker as there are multiple internal convenience vars and we
-# can't assume any particular order.
-gdb_test_list_exact "show convenience" "show convenience" \
-    {[^\r\n]+[\r\n]+} \
-    {[^\r\n]+} \
+# This is trickier as there are multiple internal convenience vars and
+# functions and we can't assume any particular order.
+# And we have to handle the extra convenience funs provided by Python.
+set show_conv_list \
     { \
        {$_sdata = void} \
        {$_siginfo = void} \
        {$_thread = 0} \
+       {$_gthread = 0} \
+       {$_inferior = 1} \
+       {$_exception = <error: No frame selected>} \
+       {$_probe_argc = <error: No frame selected>} \
+       {$_probe_arg0 = <error: No frame selected>} \
+       {$_probe_arg1 = <error: No frame selected>} \
+       {$_probe_arg2 = <error: No frame selected>} \
+       {$_probe_arg3 = <error: No frame selected>} \
+       {$_probe_arg4 = <error: No frame selected>} \
+       {$_probe_arg5 = <error: No frame selected>} \
+       {$_probe_arg6 = <error: No frame selected>} \
+       {$_probe_arg7 = <error: No frame selected>} \
+       {$_probe_arg8 = <error: No frame selected>} \
+       {$_probe_arg9 = <error: No frame selected>} \
+       {$_probe_arg10 = <error: No frame selected>} \
+       {$_probe_arg11 = <error: No frame selected>} \
+       {$_isvoid = <internal function _isvoid>} \
     }
+if ![skip_python_tests] {
+    append show_conv_list \
+       {
+           {$_memeq = <internal function _memeq>} \
+           {$_regex = <internal function _regex>} \
+           {$_streq = <internal function _streq>} \
+           {$_strlen = <internal function _strlen>} \
+           {$_as_string = <internal function _as_string>} \
+           {$_caller_is = <internal function _caller_is>} \
+           {$_caller_matches = <internal function _caller_matches>} \
+           {$_any_caller_is = <internal function _any_caller_is>} \
+           {$_any_caller_matches = <internal function _any_caller_matches>} \
+       }
+}
+gdb_test_list_exact "show convenience" "show convenience" \
+    "\[^\r\n\]+\[\r\n\]+" \
+    "\[^\r\n\]+" \
+    $show_conv_list
 
 #test show directories
 gdb_test "show directories" "Source directories searched: .cdir\[:;\].cwd" "show directories"
@@ -638,7 +655,7 @@ gdb_test "show paths" "Executable and object file path:.*" "show paths"
 #test show print address
 gdb_test "show print address" "Printing of addresses is on." "show print address"
 #test show print array
-gdb_test "show print array" "Prettyprinting of arrays is on." "show print array"
+gdb_test "show print array" "Pretty formatting of arrays is on." "show print array"
 #test show print asm-demangle
 gdb_test "show print asm-demangle" "Demangling of C\[+\]+/ObjC names in disassembly listings is on." "show print asm-demangle"
 #test show print demangle
@@ -648,7 +665,7 @@ gdb_test "show print elements" "Limit on string chars or array elements to print
 #test show print object
 gdb_test "show print object" "Printing of object's derived type based on vtable info is on." "show print object"
 #test show print pretty
-gdb_test "show print pretty" "Prettyprinting of structures is on." "show print pretty"
+gdb_test "show print pretty" "Pretty formatting of structures is on." "show print pretty"
 #test show print sevenbit-strings
 gdb_test "show print sevenbit-strings" "Printing of 8-bit characters in strings as .nnn is on." "show print sevenbit-strings"
 #test show print union
@@ -662,8 +679,6 @@ gdb_test "show print vtbl" "Printing of C\[+\]+ virtual function tables is on."
 gdb_test "show prompt" "Gdb's prompt is \"$gdb_prompt \".*" "show prompt"
 #test show radix
 gdb_test "show radix" "Input and output radices set to decimal 10, hex a, octal 12." "show radix"
-#test show symbol-reloading
-gdb_test "show symbol-reloading" "Dynamic symbol table reloading multiple times in one run is on." "show symbol-reloading"
 #test show user
 gdb_test_no_output "show user" "show user"
 #test show values
@@ -701,6 +716,8 @@ gdb_test_multiple "show" "show" {
        }
     }
 }
+#history saving should stay disabled
+gdb_test_no_output "set history save off" "set history save off"
 #test stepi "si" abbreviation
 gdb_test  "si" "The program is not being run." "stepi \"si\" abbreviation"
 #test stepi
@@ -716,11 +733,8 @@ gdb_test "step" "The program is not being run." "step #2"
 #test symbol-file
 gdb_test "symbol-file" ".*" "symbol-file"
 
-#test target child
-gdb_test "target child" "Use the \"run\" command to start a Unix child process.*|Undefined target command: \"child\".  *Try \"help target\".*" "target child"
-
-#test target procfs
-gdb_test "target procfs" "Use the \"run\" command to start a Unix child process.*|Undefined target command: \"procfs\".  *Try \"help target\".*" "target procfs"
+#test target native
+gdb_test "target native" "Use the \"run\" command to start a process.*|Undefined target command: \"native\".  *Try \"help target\".*" "target native"
 
 #test target core
 send_gdb "target core\n"
@@ -757,30 +771,34 @@ gdb_expect {
        }
 
 #test target remote
-if ![istarget "*-*-udi*"] then {
-    send_gdb "target remote\n"
-    gdb_expect {
-       -re "To open a remote debug connection, you need to specify what.*serial.*device is attached to the remote system.*.e.g. .*$gdb_prompt $"\
-                       { pass "target remote" }
-       -re ".*A program is being debugged already.  Kill it. .y or n.*$" {
-           send_gdb "n\n"
-           if $verbose>1 then {
-               send_user "\t\tDidn't kill program being debugged\n"
-           }
-           gdb_expect -re "$gdb_prompt $" { }
-           pass "target remote"
+send_gdb "target remote\n"
+gdb_expect {
+    -re "To open a remote debug connection, you need to specify what.*serial.*device is attached to the remote system.*.e.g. .*$gdb_prompt $"\
+       { pass "target remote" }
+    -re ".*A program is being debugged already.  Kill it. .y or n.*$" {
+       send_gdb "n\n"
+       if $verbose>1 then {
+           send_user "\t\tDidn't kill program being debugged\n"
        }
-       -re ".*$gdb_prompt $"   { fail "target remote" }
-       timeout         { fail "(timeout) target remote" }
+       gdb_expect -re "$gdb_prompt $" { }
+       pass "target remote"
     }
+    -re ".*$gdb_prompt $"      { fail "target remote" }
+    timeout            { fail "(timeout) target remote" }
 }
 
 #test target
 gdb_test "target" "Argument required .target name.*" "target"
 #test tbreak
 gdb_test "tbreak" "No default breakpoint address now." "tbreak"
-#test tty
-gdb_test "tty" "Argument required .filename to set it to\..*" "tty"
+#test thread
+gdb_test "thread" "No thread selected" "thread"
+#test thread apply
+gdb_test "thread apply" "Please specify a thread ID list" "thread apply"
+#test thread find
+gdb_test "thread find" "Command requires an argument." "thread find"
+#test thread name
+gdb_test "thread name" "No thread selected" "thread name"
 #test until "u" abbreviation
 gdb_test "u" "The program is not being run." "until \"u\" abbreviation"
 #test until
This page took 0.028991 seconds and 4 git commands to generate.