gdb
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / commands.exp
index 6bd9be5ba24e255b5b23cccc11b96c7e3bfa4925..9839896a1d94278518c68739c662c27173218f64 100644 (file)
@@ -1,22 +1,19 @@
 #   Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1997, 1998, 1999, 2000,
-#   2001, 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
+#   2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009
+#   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
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
 # (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
-
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 if $tracelevel then {
     strace $tracelevel
@@ -275,6 +272,11 @@ proc watchpoint_command_test {} {
         return
     }
 
+    # Disable hardware watchpoints if necessary.
+    if [target_info exists gdb,no_hardware_watchpoints] {
+       gdb_test "set can-use-hw-watchpoints 0" "" ""
+    }
+
     gdb_test "set args 6" "" "set args in watchpoint_command_test"
     if { ![runto factorial] } then { return }
     delete_breakpoints
@@ -522,7 +524,7 @@ proc temporary_breakpoint_commands {} {
     # This test will verify that this commands list is executed when the
     # breakpoint is hit.
     gdb_test "tbreak factorial" \
-           "Breakpoint \[0-9\]+ at .*: file .*/run.c, line \[0-9\]+\." \
+           "Temporary breakpoint \[0-9\]+ at .*: file .*/run.c, line \[0-9\]+\." \
            "breakpoint in temporary_breakpoint_commands"
     
     send_gdb "commands\n"
@@ -691,6 +693,68 @@ proc if_commands_test {} {
     }
 }
 
+proc redefine_hook_test {} {
+    global gdb_prompt
+
+    gdb_test "define one\nend" \
+      "" \
+      "define one"
+
+    gdb_test "define hook-one\necho hibob\\n\nend" \
+      "" \
+      "define hook-one"
+
+    gdb_test_multiple "define one" "redefine one" {
+       -re "Redefine command .one.. .y or n. $" {
+           send_gdb "y\n"
+           exp_continue
+       }
+
+       -re "End with"  {
+           pass "define one in redefine_hook_test"
+       }
+        default {
+           fail "(timeout or eof) define one in redefine_hook_test"
+       }
+    }
+
+    gdb_test "end" \
+           "" \
+           "enter commands for one redefinition in redefine_hook_test"
+
+    gdb_test "one" \
+           "hibob" \
+           "execute one command in redefine_hook_test"
+}
+
+proc redefine_backtrace_test {} {
+    global gdb_prompt
+
+    gdb_test_multiple "define backtrace" "define backtrace" {
+       -re "Really redefine built-in.*$" {
+           send_gdb "y\n"
+           exp_continue
+       }
+
+       -re "End with"  {
+           pass "define backtrace in redefine_backtrace_test"
+       }
+        default {
+           fail "(timeout or eof) define backtrace in redefine_backtrace_test"
+       }
+    }
+    gdb_test "echo hibob\\n\nend" \
+           "" \
+           "enter commands in redefine_backtrace_test"
+
+    gdb_test "backtrace" \
+           "hibob" \
+           "execute backtrace command in redefine_backtrace_test"
+    gdb_test "bt" \
+           "hibob" \
+           "execute bt command in redefine_backtrace_test"
+}
+
 gdbvar_simple_if_test
 gdbvar_simple_while_test
 gdbvar_complex_if_while_test
@@ -709,3 +773,6 @@ temporary_breakpoint_commands
 stray_arg0_test
 recursive_source_test
 if_commands_test
+redefine_hook_test
+# This one should come last, as it redefines "backtrace".
+redefine_backtrace_test
This page took 0.025696 seconds and 4 git commands to generate.