2002-03-26 Michael Snyder <msnyder@redhat.com>
authorMichael Snyder <msnyder@vmware.com>
Fri, 29 Mar 2002 01:19:11 +0000 (01:19 +0000)
committerMichael Snyder <msnyder@vmware.com>
Fri, 29 Mar 2002 01:19:11 +0000 (01:19 +0000)
* gdb.base/default.exp: Add tests for dump, append, and restore.
* gdb.base/help.exp: Add tests for dump, append, and restore.
* gdb.base/dump.exp: New file, test dump, append and restore.
* gdb.base/dump.c: New file.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/default.exp
gdb/testsuite/gdb.base/dump.c [new file with mode: 0644]
gdb/testsuite/gdb.base/dump.exp [new file with mode: 0644]
gdb/testsuite/gdb.base/help.exp

index 1d3317a..930aaf1 100644 (file)
@@ -1,3 +1,10 @@
+2002-03-26  Michael Snyder  <msnyder@redhat.com>
+
+       * gdb.base/default.exp: Add tests for dump, append, and restore.
+       * gdb.base/help.exp: Add tests for dump, append, and restore.
+       * gdb.base/dump.exp: New file, test dump, append and restore.
+       * gdb.base/dump.c: New file.
+
 2002-03-27  Michael Snyder  <msnyder@redhat.com>
 
        * gdb.base/help.exp: Modify expect strings to reflect 
index f9dc85f..8ebeba8 100644 (file)
@@ -34,6 +34,14 @@ set timeout 60
 
 gdb_test "add-symbol-file" "add-symbol-file takes a file name and an address" "add-symbol-file"
 
+# test append
+gdb_test "append" "\"append\" must be followed by a subcommand\.\[\r\n\]+List of append subcommands:.*" 
+gdb_test "append binary" "\"append binary\" must be followed by a subcommand\.\[\r\n\]+List of append binary subcommands:.*" 
+gdb_test "append memory" "Missing filename\." 
+gdb_test "append value"  "Missing filename\." 
+gdb_test "append binary memory" "Missing filename\." 
+gdb_test "append binary value"  "Missing filename\." 
+
 setup_xfail "mips-idt-*"
 send_gdb "attach\n"
 gdb_expect {
@@ -191,6 +199,22 @@ gdb_test "document" "Argument required .name of command to define.*" "document"
 gdb_test "down" "No stack.*" "down"
 #test down-silently
 gdb_test "down-silently" "No stack." "down-silently"
+# test dump
+gdb_test "dump" "\"dump\" must be followed by a subcommand\.\[\r\n\]+List of dump subcommands:.*" 
+gdb_test "dump binary" "\"dump binary\" must be followed by a subcommand\.\[\r\n\]+List of dump binary subcommands:.*" 
+gdb_test "dump ihex" "\"dump ihex\" must be followed by a subcommand\.\[\r\n\]+List of dump ihex subcommands:.*" 
+gdb_test "dump memory" "Missing filename\." 
+gdb_test "dump srec" "\"dump srec\" must be followed by a subcommand\.\[\r\n\]+List of dump srec subcommands:.*" 
+gdb_test "dump tekhex" "\"dump tekhex\" must be followed by a subcommand\.\[\r\n\]+List of dump tekhex subcommands:.*" 
+gdb_test "dump value" "Missing filename\." 
+gdb_test "dump binary memory" "Missing filename\." 
+gdb_test "dump binary value"  "Missing filename\." 
+gdb_test "dump ihex memory" "Missing filename\." 
+gdb_test "dump ihex value"  "Missing filename\." 
+gdb_test "dump srec memory" "Missing filename\." 
+gdb_test "dump srec value"  "Missing filename\." 
+gdb_test "dump tekhex memory" "Missing filename\." 
+gdb_test "dump tekhex value"  "Missing filename\." 
 #test echo
 gdb_test "echo" "" "echo"
 #test enable breakpoints delete
@@ -491,6 +515,9 @@ No program loaded.*$gdb_prompt $"\
 #test rbreak
 gdb_test "rbreak" "" "rbreak"
 
+# test restore
+gdb_test "restore" "You can't do that without a process to debug\."
+
 #test return
 # The middle case accomodated the OBSOLETE a29k, where doing the "ni"
 # above causes an initial stack to be created.
diff --git a/gdb/testsuite/gdb.base/dump.c b/gdb/testsuite/gdb.base/dump.c
new file mode 100644 (file)
index 0000000..784edf6
--- /dev/null
@@ -0,0 +1,44 @@
+#define ARRSIZE 32
+int intarray[ARRSIZE], intarray2[ARRSIZE];
+
+struct teststruct {
+  int a;
+  int b;
+  int c;
+  int d;
+  int e;
+  int f;
+  int g;
+} intstruct, intstruct2;
+
+void checkpoint1 ()
+{
+  /* intarray and teststruct have been initialized. */
+}
+
+void
+zero_all ()
+{
+  memset ((char *) &intarray,   0, sizeof (intarray));
+  memset ((char *) &intarray2,  0, sizeof (intarray2));
+  memset ((char *) &intstruct,  0, sizeof (intstruct));
+  memset ((char *) &intstruct2, 0, sizeof (intstruct2));
+}
+
+main()
+{
+  int i;
+
+  for (i = 0; i < ARRSIZE; i++)
+    intarray[i] = i+1;
+
+  intstruct.a = 12 * 1;
+  intstruct.b = 12 * 2;
+  intstruct.c = 12 * 3;
+  intstruct.d = 12 * 4;
+  intstruct.e = 12 * 5;
+  intstruct.f = 12 * 6;
+  intstruct.g = 12 * 7;
+
+  checkpoint1 ();
+}
diff --git a/gdb/testsuite/gdb.base/dump.exp b/gdb/testsuite/gdb.base/dump.exp
new file mode 100644 (file)
index 0000000..826fdfb
--- /dev/null
@@ -0,0 +1,442 @@
+
+# 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
+# (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
+
+# This file was written by Michael Snyder (msnyder@redhat.com)
+# This is a test for the gdb command "dump".
+
+if $tracelevel then {
+       strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile "dump"
+
+set srcfile  ${testfile}.c
+set binfile  ${objdir}/${subdir}/${testfile}
+
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+# Start with a fresh gdb.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+# Clean up any stale output files from previous test runs
+
+remote_exec build "rm -f intarr1.bin intarr1b.bin intarr1.ihex intarr1.srec intarr1.tekhex intarr2.bin intarr2b.bin intarr2.ihex intarr2.srec intarr2.tekhex intstr1.bin intstr1b.bin intstr1.ihex intstr1.srec intstr1.tekhex intstr2.bin intstr2b.bin intstr2.ihex intstr2.srec intstr2.tekhex intarr3.srec"
+
+# Test help (FIXME:)
+
+# Run target program until data structs are initialized.
+
+if { ! [ runto checkpoint1 ] } then {
+    gdb_suppress_entire_file "Program failed to run, so all tests in this file will automatically fail."
+}
+
+# Now generate some dump files.
+
+proc make_dump_file { command msg } {
+  global gdb_prompt
+
+    send_gdb "${command}\n"
+    gdb_expect {
+       -re ".*\[Ee\]rror.*$gdb_prompt $"      { fail $msg }
+       -re ".*\[Ww\]arning.*$gdb_prompt $"    { fail $msg }
+       -re ".*\[Uu\]ndefined .*$gdb_prompt $" { fail $msg }
+       -re ".*$gdb_prompt $" { pass $msg }
+       timeout                                { fail "$msg (timeout)" }
+    }
+}
+
+make_dump_file "dump val intarr1.bin intarray" \
+       "dump array as value, default"
+
+make_dump_file "dump val intstr1.bin intstruct" \
+       "dump struct as value, default"
+
+make_dump_file "dump bin val intarr1b.bin intarray" \
+       "dump array as value, binary"
+
+make_dump_file "dump bin val intstr1b.bin intstruct" \
+       "dump struct as value, binary"
+
+make_dump_file "dump srec val intarr1.srec intarray" \
+       "dump array as value, srec"
+
+make_dump_file "dump srec val intstr1.srec intstruct" \
+       "dump struct as value, srec"
+
+make_dump_file "dump ihex val intarr1.ihex intarray" \
+       "dump array as value, intel hex"
+
+make_dump_file "dump ihex val intstr1.ihex intstruct" \
+       "dump struct as value, intel hex"
+
+make_dump_file "dump tekhex val intarr1.tekhex intarray" \
+       "dump array as value, tekhex"
+
+make_dump_file "dump tekhex val intstr1.tekhex intstruct" \
+       "dump struct as value, tekhex"
+
+proc capture_value { expression } {
+    global gdb_prompt
+    global expect_out
+
+    set output_string ""
+    send_gdb "print ${expression}\n"
+    gdb_expect {
+       -re ".*\[\r\n\]+.\[0123456789\]+ = (\[^\r\n\]+).*$gdb_prompt $" {
+           set output_string $expect_out(1,string)
+       }
+       default {
+           fail "capture_value failed on $expression."
+       }
+    }
+    return $output_string
+}
+
+set array_start  [capture_value "/x &intarray\[0\]"]
+set array_end    [capture_value "/x &intarray\[32\]"]
+set struct_start [capture_value "/x &intstruct"]
+set struct_end   [capture_value "/x &intstruct + 1"]
+
+set array_val    [capture_value "intarray"]
+set struct_val   [capture_value "intstruct"]
+
+make_dump_file "dump mem intarr2.bin $array_start $array_end" \
+       "dump array as memory, default"
+
+make_dump_file "dump  mem intstr2.bin $struct_start $struct_end" \
+       "dump struct as memory, default"
+
+make_dump_file "dump bin mem intarr2b.bin $array_start $array_end" \
+       "dump array as memory, binary"
+
+make_dump_file "dump bin mem intstr2b.bin $struct_start $struct_end" \
+       "dump struct as memory, binary"
+
+make_dump_file "dump srec mem intarr2.srec $array_start $array_end" \
+       "dump array as memory, srec"
+
+make_dump_file "dump srec mem intstr2.srec $struct_start $struct_end" \
+       "dump struct as memory, srec"
+
+make_dump_file "dump ihex mem intarr2.ihex $array_start $array_end" \
+       "dump array as memory, ihex"
+
+make_dump_file "dump ihex mem intstr2.ihex $struct_start $struct_end" \
+       "dump struct as memory, ihex"
+
+make_dump_file "dump tekhex mem intarr2.tekhex $array_start $array_end" \
+       "dump array as memory, tekhex"
+
+make_dump_file "dump tekhex mem intstr2.tekhex $struct_start $struct_end" \
+       "dump struct as memory, tekhex"
+
+# test complex expressions
+make_dump_file \
+       "dump srec mem intarr3.srec &intarray \(char *\) &intarray + sizeof intarray" \
+       "dump array as mem, srec, expressions"
+
+
+# Now start a fresh gdb session, and reload the saved value files.
+
+gdb_exit
+gdb_start
+gdb_file_cmd ${binfile}
+
+# Reload saved values one by one, and compare.
+
+if { ![string compare $array_val [capture_value "intarray"]] } then {
+    fail "start with intarray un-initialized"
+} else {
+    pass "start with intarray un-initialized"
+}
+
+if { ![string compare $struct_val [capture_value "intstruct"]] } then {
+    fail "start with intstruct un-initialized"
+} else {
+    pass "start with intstruct un-initialized"
+}
+
+proc test_reload_saved_value { filename msg oldval newval } {
+    global gdb_prompt
+    
+    gdb_file_cmd $filename
+    if { ![string compare $oldval [capture_value $newval]] } then { 
+       pass $msg 
+    } else {
+       fail $msg 
+    }
+}
+
+proc test_restore_saved_value { restore_args msg oldval newval } {
+    global gdb_prompt
+    
+    gdb_test "restore $restore_args" \
+           "Restoring .*" \
+           "Restore command, $msg"
+
+    if { ![string compare $oldval [capture_value $newval]] } then { 
+       pass "Restored value, $msg"
+    } else {
+       fail "Restored value, $msg"
+    }
+}
+
+test_reload_saved_value "intarr1.srec" "reload array as value, srec" \
+       $array_val "intarray"
+test_reload_saved_value "intstr1.srec" "reload struct as value, srec" \
+       $struct_val "intstruct"
+test_reload_saved_value "intarr2.srec" "reload array as memory, srec" \
+       $array_val "intarray"
+test_reload_saved_value "intstr2.srec" "reload struct as memory, srec" \
+       $struct_val "intstruct"
+
+test_reload_saved_value "intarr1.ihex" "reload array as value, intel hex" \
+       $array_val "intarray"
+test_reload_saved_value "intstr1.ihex" "reload struct as value, intel hex" \
+       $struct_val "intstruct"
+test_reload_saved_value "intarr2.ihex" "reload array as memory, intel hex" \
+       $array_val "intarray"
+test_reload_saved_value "intstr2.ihex" "reload struct as memory, intel hex" \
+       $struct_val "intstruct"
+
+test_reload_saved_value "intarr1.tekhex" "reload array as value, tekhex" \
+       $array_val "intarray"
+test_reload_saved_value "intstr1.tekhex" "reload struct as value, tekhex" \
+       $struct_val "intstruct"
+test_reload_saved_value "intarr2.tekhex" "reload array as memory, tekhex" \
+       $array_val "intarray"
+test_reload_saved_value "intstr2.tekhex" "reload struct as memory, tekhex" \
+       $struct_val "intstruct"
+
+# Start a fresh gdb session
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+# Run to main.
+if { ! [ runto main ] } then {
+    gdb_suppress_entire_file "Program failed to run, so remaining tests in this file will automatically fail."
+}
+
+if { ![string compare $array_val [capture_value "intarray"]] } then {
+    fail "start with intarray un-initialized, runto main"
+} else {
+    pass "start with intarray un-initialized, runto main"
+}
+
+if { ![string compare $struct_val [capture_value "intstruct"]] } then {
+    fail "start with intstruct un-initialized, runto main"
+} else {
+    pass "start with intstruct un-initialized, runto main"
+}
+
+test_restore_saved_value "intarr1.srec" "array as value, srec" \
+       $array_val "intarray"
+
+test_restore_saved_value "intstr1.srec" "struct as value, srec" \
+       $struct_val "intstruct"
+
+gdb_test "print zero_all ()" "void" "zero all"
+
+test_restore_saved_value "intarr2.srec" "array as memory, srec" \
+       $array_val "intarray"
+
+test_restore_saved_value "intstr2.srec" "struct as memory, srec" \
+       $struct_val "intstruct"
+
+gdb_test "print zero_all ()" ""
+
+test_restore_saved_value "intarr1.ihex" "array as value, ihex" \
+       $array_val "intarray"
+
+test_restore_saved_value "intstr1.ihex" "struct as value, ihex" \
+       $struct_val "intstruct"
+
+gdb_test "print zero_all ()" ""
+
+test_restore_saved_value "intarr2.ihex" "array as memory, ihex" \
+       $array_val "intarray"
+
+test_restore_saved_value "intstr2.ihex" "struct as memory, ihex" \
+       $struct_val "intstruct"
+
+gdb_test "print zero_all ()" ""
+
+test_restore_saved_value "intarr1.tekhex" "array as value, tekhex" \
+       $array_val "intarray"
+
+test_restore_saved_value "intstr1.tekhex" "struct as value, tekhex" \
+       $struct_val "intstruct"
+
+gdb_test "print zero_all ()" ""
+
+test_restore_saved_value "intarr2.tekhex" "array as memory, tekhex" \
+       $array_val "intarray"
+
+test_restore_saved_value "intstr2.tekhex" "struct as memory, tekhex" \
+       $struct_val "intstruct"
+
+gdb_test "print zero_all ()" ""
+
+test_restore_saved_value "intarr1.bin binary $array_start" \
+       "array as value, binary" \
+       $array_val "intarray"
+
+test_restore_saved_value "intstr1.bin binary $struct_start" \
+       "struct as value, binary" \
+       $struct_val "intstruct"
+
+gdb_test "print zero_all ()" ""
+
+test_restore_saved_value "intarr2.bin binary $array_start" \
+       "array as memory, binary" \
+       $array_val "intarray"
+
+test_restore_saved_value "intstr2.bin binary $struct_start" \
+       "struct as memory, binary" \
+       $struct_val "intstruct"
+
+# test restore with offset.
+
+set array2_start   [capture_value "/x &intarray2\[0\]"]
+set struct2_start  [capture_value "/x &intstruct2"]
+set array2_offset  \
+       [capture_value "/x (char *) &intarray2 - (char *) &intarray"]
+set struct2_offset \
+       [capture_value "/x (char *) &intstruct2 - (char *) &intstruct"]
+
+gdb_test "print zero_all ()" ""
+
+test_restore_saved_value "intarr1.srec $array2_offset" \
+       "array copy, srec" \
+       $array_val "intarray2"
+
+test_restore_saved_value "intstr1.srec $struct2_offset" \
+       "struct copy, srec" \
+       $struct_val "intstruct2"
+
+gdb_test "print zero_all ()" ""
+
+test_restore_saved_value "intarr1.ihex $array2_offset" \
+       "array copy, ihex" \
+       $array_val "intarray2"
+
+test_restore_saved_value "intstr1.ihex $struct2_offset" \
+       "struct copy, ihex" \
+       $struct_val "intstruct2"
+
+gdb_test "print zero_all ()" ""
+
+test_restore_saved_value "intarr1.tekhex $array2_offset" \
+       "array copy, tekhex" \
+       $array_val "intarray2"
+
+test_restore_saved_value "intstr1.tekhex $struct2_offset" \
+       "struct copy, tekhex" \
+       $struct_val "intstruct2"
+
+gdb_test "print zero_all ()" ""
+
+test_restore_saved_value "intarr1.bin binary $array2_start" \
+       "array copy, binary" \
+       $array_val "intarray2"
+
+test_restore_saved_value "intstr1.bin binary $struct2_start" \
+       "struct copy, binary" \
+       $struct_val "intstruct2"
+
+#
+# test restore with start/stop addresses.
+#
+# For this purpose, we will restore just the third element of the array, 
+# and check to see that adjacent elements are not modified.
+#
+# We will need the address and offset of the third and fourth elements.
+#
+
+set element3_start  [capture_value "/x &intarray\[3\]"]
+set element4_start  [capture_value "/x &intarray\[4\]"]
+set element3_offset \
+       [capture_value "/x (char *) &intarray\[3\] - (char *) &intarray\[0\]"]
+set element4_offset \
+       [capture_value "/x (char *) &intarray\[4\] - (char *) &intarray\[0\]"]
+
+gdb_test "print zero_all ()" ""
+
+test_restore_saved_value "intarr1.srec 0 $element3_start $element4_start" \
+       "array partial, srec" \
+       [capture_value "4"] "intarray\[3\]"
+
+gdb_test "print intarray\[2\] == 0" " = 1" "element 2 not changed - 1"
+gdb_test "print intarray\[4\] == 0" " = 1" "element 4 not changed - 1"
+
+gdb_test "print zero_all ()" ""
+
+test_restore_saved_value "intarr1.ihex 0 $element3_start $element4_start" \
+       "array partial, ihex" \
+       [capture_value "4"] "intarray\[3\]"
+
+gdb_test "print intarray\[2\] == 0" " = 1" "element 2 not changed - 2"
+gdb_test "print intarray\[4\] == 0" " = 1" "element 4 not changed - 2"
+
+gdb_test "print zero_all ()" ""
+
+test_restore_saved_value "intarr1.tekhex 0 $element3_start $element4_start" \
+       "array partial, tekhex" \
+       [capture_value "4"] "intarray\[3\]"
+
+gdb_test "print intarray\[2\] == 0" " = 1" "element 2 not changed - 3"
+gdb_test "print intarray\[4\] == 0" " = 1" "element 4 not changed - 3"
+
+gdb_test "print zero_all ()" ""
+
+test_restore_saved_value \
+    "intarr1.bin binary $array_start $element3_offset $element4_offset" \
+    "array partial, binary" \
+    [capture_value "4"] "intarray\[3\]"
+
+gdb_test "print intarray\[2\] == 0" " = 1" "element 2 not changed - 4"
+gdb_test "print intarray\[4\] == 0" " = 1" "element 4 not changed - 4"
+
+gdb_test "print zero_all ()" "" ""
+
+# restore with expressions 
+test_restore_saved_value \
+       "intarr3.srec ${array2_start}-${array_start} &intarray\[3\] &intarray\[4\]" \
+       "array partial with expressions" \
+       [capture_value "4"] "intarray2\[3\]"
+
+gdb_test "print intarray2\[2\] == 0" " = 1" "element 2 not changed, == 4"
+gdb_test "print intarray2\[4\] == 0" " = 1" "element 4 not changed, == 4"
+
+
+# clean up files
+
+remote_exec build "rm -f intarr1.bin intarr1b.bin intarr1.ihex intarr1.srec intarr1.tekhex intarr2.bin intarr2b.bin intarr2.ihex intarr2.srec intarr2.tekhex intstr1.bin intstr1b.bin intstr1.ihex intstr1.srec intstr1.tekhex intstr2.bin intstr2b.bin intstr2.ihex intstr2.srec intstr2.tekhex intarr3.srec"
+
index 4d5ec2c..80bae8c 100644 (file)
@@ -38,6 +38,14 @@ gdb_test "set height 400" "" "test set height"
 gdb_test "help add-symbol-file" "Usage: add-symbol-file FILE ADDR \\\[-s <SECT> <SECT_ADDR> -s <SECT> <SECT_ADDR> \.\.\.\\\]\[\r\n\]+Load the symbols from FILE, assuming FILE has been dynamically loaded\.\[\r\n\]+ADDR is the starting address of the file's text\.\[\r\n\]+The optional arguments are section-name section-address pairs and\[\r\n\]+should be specified if the data and bss segments are not contiguous\[\r\n\]+with the text\.  SECT is a section name to be loaded at SECT_ADDR\." "help add-symbol-file"
 # test help aliases
 gdb_test "help aliases" "Aliases of other commands\.\[\r\n\]+List of commands\:.*\[\r\n\]+Type \"help\" followed by command name for full documentation\.\[\r\n\]+Command name abbreviations are allowed if unambiguous\." "help aliases"
+# test help append
+gdb_test "help append" "Append target code/data to a local file\.\[\r\n\]+List of append subcommands:.*" 
+gdb_test "help append binary" "Append target code/data to a raw binary file\.\[\r\n\]+List of append binary subcommands:.*" 
+gdb_test "help append memory" "Append contents of memory to a raw binary file\.\[\r\n\]+Arguments are FILE START STOP\.  Writes the contents of memory within the\[\r\n\]+range \\\[START \.\. STOP\\) to the specifed FILE in raw target ordered bytes\." 
+gdb_test "help append value" "Append the value of an expression to a raw binary file\.\[\r\n\]+Arguments are FILE EXPRESSION\.  Writes the value of EXPRESSION to\[\r\n\]+the specified FILE in raw target ordered bytes\." 
+gdb_test "help append binary memory" "Append contents of memory to a raw binary file\.\[\r\n\]+Arguments are FILE START STOP\.  Writes the contents of memory within the\[\r\n\]+range \\\[START \.\. STOP\\) to the specifed FILE in raw target ordered bytes\." 
+gdb_test "help append binary value" "Append the value of an expression to a raw binary file\.\[\r\n\]+Arguments are FILE EXPRESSION\.  Writes the value of EXPRESSION\[\r\n\]+to the specified FILE in raw target ordered bytes\." 
+# test help attach
 gdb_test "help attach" "Attach to a process or file outside of GDB\.\[\r\n\]+This command attaches to another target, of the same type as your last\[\r\n\]+\"target\" command \\(\"info files\" will show your target stack\\)\.\[\r\n\]+The command may take as argument a process id or a device file\.\[\r\n\]+For a process id, you must have permission to send the process a signal,\[\r\n\]+and it must have the same effective uid as the debugger\.\[\r\n\]+When using \"attach\" with a process id, the debugger finds the\[\r\n\]+program running in the process, looking first in the current working\[\r\n\]+directory, or \\(if not found there\\) using the source file search path\[\r\n\]+\\(see the \"directory\" command\\)\.  You can also use the \"file\" command\[\r\n\]+to specify the program, and to load its symbol table\." "help attach"
 # test help breakpoint "b" abbreviation
 gdb_test "help b" "Set breakpoint at specified line or function\.\[\r\n\]+Argument may be line number, function name, or \"\[*\]\" and an address\.\[\r\n\]+If line number is specified, break at start of code for that line\.\[\r\n\]+If function is specified, break at start of code for that function\.\[\r\n\]+If an address is specified, break at that exact address\.\[\r\n\]+With no arg, uses current execution address of selected stack frame\.\[\r\n\]+This is useful for breaking on return to a stack frame\.\[\r\n\]+Multiple breakpoints at one place are permitted, and useful if conditional\.\[\r\n\]+Do \"help breakpoints\" for info on other commands dealing with breakpoints\." "help breakpoint \"b\" abbreviation"
@@ -111,6 +119,22 @@ gdb_test "help document" "Document a user-defined command\.\[\r\n\]+Give command
 gdb_test "help down" "Select and print stack frame called by this one\.\[\r\n\]+An argument says how many frames down to go\." "help down"
 # test help down-silently
 gdb_test "help down-silently" "Same as the `down' command, but does not print anything\.\[\r\n\]+This is useful in command scripts\." "help down-silently"
+# test help dump 
+gdb_test "help dump" "Dump target code/data to a local file\.\[\r\n\]+List of dump subcommands:.*" 
+gdb_test "help dump binary" "Write target code/data to a raw binary file\.\[\r\n\]+List of dump binary subcommands:.*" 
+gdb_test "help dump ihex" "Write target code/data to an intel hex file\.\[\r\n\]+List of dump ihex subcommands:.*" 
+gdb_test "help dump memory" "Write contents of memory to a raw binary file\.\[\r\n\]+Arguments are FILE START STOP\.  Writes the contents of memory within the\[\r\n\]+range \\\[START \.\. STOP\\) to the specifed FILE in raw target ordered bytes\." 
+gdb_test "help dump srec" "Write target code/data to an srec file\.\[\r\n\]+List of dump srec subcommands:.*" 
+gdb_test "help dump tekhex" "Write target code/data to a tekhex file\.\[\r\n\]+List of dump tekhex subcommands:.*" 
+gdb_test "help dump value" "Write the value of an expression to a raw binary file\.\[\r\n\]+Arguments are FILE EXPRESSION\.  Writes the value of EXPRESSION to\[\r\n\]+the specified FILE in raw target ordered bytes\." 
+gdb_test "help dump binary memory" "Write contents of memory to a raw binary file\.\[\r\n\]+Arguments are FILE START STOP\.  Writes the contents of memory\[\r\n\]+within the range \\\[START \.\. STOP\\) to the specifed FILE in binary format\." 
+gdb_test "help dump binary value" "Write the value of an expression to a raw binary file\.\[\r\n\]+Arguments are FILE EXPRESSION\.  Writes the value of EXPRESSION\[\r\n\]+to the specified FILE in raw target ordered bytes\." "help dump binary value"
+gdb_test "help dump ihex memory" "Write contents of memory to an ihex file\.\[\r\n\]+Arguments are FILE START STOP\.  Writes the contents of memory within\[\r\n\]+the range \\\[START \.\. STOP\\) to the specifed FILE in intel hex format\." 
+gdb_test "help dump ihex value" "Write the value of an expression to an ihex file\.\[\r\n\]+Arguments are FILE EXPRESSION\.  Writes the value of EXPRESSION\[\r\n\]+to the specified FILE in intel hex format\." 
+gdb_test "help dump srec memory" "Write contents of memory to an srec file\.\[\r\n\]+Arguments are FILE START STOP\.  Writes the contents of memory\[\r\n\]+within the range \\\[START \.\. STOP\\) to the specifed FILE in srec format\." 
+gdb_test "help dump srec value" "Write the value of an expression to an srec file\.\[\r\n\]+Arguments are FILE EXPRESSION\.  Writes the value of EXPRESSION\[\r\n\]+to the specified FILE in srec format\." 
+gdb_test "help dump tekhex memory" "Write contents of memory to a tekhex file\.\[\r\n\]+Arguments are FILE START STOP\.  Writes the contents of memory\[\r\n\]+within the range \\\[START \.\. STOP\\) to the specifed FILE in tekhex format\." 
+gdb_test "help dump tekhex value" "Write the value of an expression to a tekhex file\.\[\r\n\]+Arguments are FILE EXPRESSION\.  Writes the value of EXPRESSION\[\r\n\]+to the specified FILE in tekhex format\." 
 # this command was removed from GDB 4.5.8
 # test help dump-me
 #send_gdb "help dump-me"
@@ -298,6 +322,8 @@ gdb_test "help r" "Start debugged program\.  You may specify arguments to give i
 gdb_test "help run" "Start debugged program\.  You may specify arguments to give it\.\[\r\n\]+Args may include \"\\*\", or \"\\\[\.\.\.\\\]\"; they are expanded using \"sh\"\.\[\r\n\]+Input and output redirection with \">\", \"<\", or \">>\" are also allowed\.\[\r\n\]+With no arguments, uses arguments last specified \\(with \"run\" or \"set args\"\\)\.\[\r\n\]+To cancel previous arguments and run with no arguments,\[\r\n\]+use \"set args\" without arguments\." "help run"
 # test help rbreak
 gdb_test "help rbreak" "Set a breakpoint for all functions matching REGEXP\." "help rbreak"
+# test help restore
+gdb_test "help restore" "Restore the contents of FILE to target memory\.\[\r\n\]+Arguments are FILE OFFSET START END where all except FILE are optional\.\[\r\n\]+OFFSET will be added to the base address of the file \\(default zero\\)\.\[\r\n\]+If START and END are given, only the file contents within that range\[\r\n\]+\\(file relative\\) will be restored to target memory\."
 # test help return
 gdb_test "help return" "Make selected stack frame return to its caller\.\[\r\n\]+Control remains in the debugger, but when you continue\[\r\n\]+execution will resume in the frame above the one now selected\.\[\r\n\]+If an argument is given, it is an expression for the value to return\." "help return"
 # test help reverse-search
@@ -317,11 +343,11 @@ gdb_test "help set annotate" "Set annotation_level\.\[\r\n\]+0 == normal;     1
 # test help set args
 gdb_test "help set args" "Set argument list to give program being debugged when it is started\.\[\r\n\]+Follow this command with any number of args, to be passed to the program\."
 # test help set check "c" abbreviation
-gdb_test "help set c" "Set the status of the type/range checker.\[\r\n\]+List of set check subcommands:\[\r\n\]+set check range -- Set range checking\[\r\n\]+set check type -- Set type checking\[\r\n\]+Type \"help set check\" followed by set check subcommand name for full documentation\.\[\r\n\]+Command name abbreviations are allowed if unambiguous\." "help set check \"c\" abbreviation"
+gdb_test "help set c" "Set the status of the type/range checker\.\[\r\n\]+List of set check subcommands:\[\r\n\]+set check range -- Set range checking\[\r\n\]+set check type -- Set type checking\[\r\n\]+Type \"help set check\" followed by set check subcommand name for full documentation\.\[\r\n\]+Command name abbreviations are allowed if unambiguous\." "help set check \"c\" abbreviation"
 # test help set check "ch" abbreviation
-gdb_test "help set ch" "Set the status of the type/range checker.\[\r\n\]+List of set check subcommands:\[\r\n\]+set check range -- Set range checking\[\r\n\]+set check type -- Set type checking\[\r\n\]+Type \"help set check\" followed by set check subcommand name for full documentation\.\[\r\n\]+Command name abbreviations are allowed if unambiguous\." "help set check \"ch\" abbreviation"
+gdb_test "help set ch" "Set the status of the type/range checker\.\[\r\n\]+List of set check subcommands:\[\r\n\]+set check range -- Set range checking\[\r\n\]+set check type -- Set type checking\[\r\n\]+Type \"help set check\" followed by set check subcommand name for full documentation\.\[\r\n\]+Command name abbreviations are allowed if unambiguous\." "help set check \"ch\" abbreviation"
 # test help set check
-gdb_test "help set check" "Set the status of the type/range checker.\[\r\n\]+List of set check subcommands:\[\r\n\]+set check range -- Set range checking\[\r\n\]+set check type -- Set type checking\[\r\n\]+Type \"help set check\" followed by set check subcommand name for full documentation\.\[\r\n\]+Command name abbreviations are allowed if unambiguous\." "help set check"
+gdb_test "help set check" "Set the status of the type/range checker\.\[\r\n\]+List of set check subcommands:\[\r\n\]+set check range -- Set range checking\[\r\n\]+set check type -- Set type checking\[\r\n\]+Type \"help set check\" followed by set check subcommand name for full documentation\.\[\r\n\]+Command name abbreviations are allowed if unambiguous\." "help set check"
 # test help set check range
 gdb_test "help set check range" "Set range checking\.  \\(on/warn/off/auto\\)" "help set check range"
 # test help set check type
@@ -339,7 +365,7 @@ gdb_test "help set height" "Set number of lines gdb thinks are in a page\." "hel
 # test help set history expansion
 gdb_test "help set history expansion" "Set history expansion on command input\.\[\r\n\]+Without an argument, history expansion is enabled\." "help set history expansion"
 # test help set history filename
-gdb_test "help set history filename" "Set the filename in which to record the command history\[\r\n\]+ \\(the list of previous commands of which a record is kept\\)\." "help set history filename"
+gdb_test "help set history filename" "Set the filename in which to record the command history\[\r\n\]+\\(the list of previous commands of which a record is kept\\)\." "help set history filename"
 # test help set history save
 gdb_test "help set history save" "Set saving of the history record on exit\.\[\r\n\]+Use \"on\" to enable the saving, and \"off\" to disable it\.\[\r\n\]+Without an argument, saving is enabled\." "help set history save"
 # test help set history size
@@ -406,9 +432,9 @@ gdb_test "help show annotate" "Show annotation_level\.\[\r\n\]+0 == normal;
 # test help show args
 gdb_test "help show args" "Show argument list to give program being debugged when it is started\.\[\r\n\]+Follow this command with any number of args, to be passed to the program\."
 # test help show check "c" abbreviation
-gdb_test "help show c" "Show the status of the type/range checker.\[\r\n\]+List of show check subcommands:\[\r\n\]+show check range -- Show range checking\[\r\n\]+show check type -- Show type checking\[\r\n\]+Type \"help show check\" followed by show check subcommand name for full documentation\.\[\r\n\]+Command name abbreviations are allowed if unambiguous\." "help show check \"c\" abbreviation"
+gdb_test "help show c" "Show the status of the type/range checker\.\[\r\n\]+List of show check subcommands:\[\r\n\]+show check range -- Show range checking\[\r\n\]+show check type -- Show type checking\[\r\n\]+Type \"help show check\" followed by show check subcommand name for full documentation\.\[\r\n\]+Command name abbreviations are allowed if unambiguous\." "help show check \"c\" abbreviation"
 # test help show check
-gdb_test "help show check" "Show the status of the type/range checker.\[\r\n\]+List of show check subcommands:\[\r\n\]+show check range -- Show range checking\[\r\n\]+show check type -- Show type checking\[\r\n\]+Type \"help show check\" followed by show check subcommand name for full documentation\.\[\r\n\]+Command name abbreviations are allowed if unambiguous\." "help show check"
+gdb_test "help show check" "Show the status of the type/range checker\.\[\r\n\]+List of show check subcommands:\[\r\n\]+show check range -- Show range checking\[\r\n\]+show check type -- Show type checking\[\r\n\]+Type \"help show check\" followed by show check subcommand name for full documentation\.\[\r\n\]+Command name abbreviations are allowed if unambiguous\." "help show check"
 # test help show check range
 gdb_test "help show check range" "Show range checking\.  \\(on/warn/off/auto\\)" "help show check range"
 # test help show check type
@@ -436,7 +462,7 @@ gdb_test "help show history filename" "Show the filename in which to record the
 # test help show history save
 gdb_test "help show history save" "Show saving of the history record on exit\.\[\r\n\]+Use \"on\" to enable the saving, and \"off\" to disable it\.\[\r\n\]+Without an argument, saving is enabled\." "help show history save"
 # test help show history size
-gdb_test "help show history size" "Show the size of the command history, \[\r\n\]+ie\. the number of previous commands to keep a record of\." "help show history size"
+gdb_test "help show history size" "Show the size of the command history,\[\r\n\]+ie\. the number of previous commands to keep a record of\." "help show history size"
 # test help show history
 gdb_test "help show history" "Generic command for showing command history parameters\.\[\r\n\]+List of show history subcommands:\[\r\n\]+show history expansion -- Show history expansion on command input\[\r\n\]+show history filename -- Show the filename in which to record the command history\[\r\n\]+show history save -- Show saving of the history record on exit\[\r\n\]+show history size -- Show the size of the command history\[\r\n\]+Type \"help show history\" followed by show history subcommand name for full documentation\.\[\r\n\]+Command name abbreviations are allowed if unambiguous\." "help show history"
 # test help show language
@@ -543,7 +569,7 @@ gdb_test "help undisplay" "Cancel some expressions to be displayed when program
 # test help unset environment
 gdb_test "help unset environment" "Cancel environment variable VAR for the program\.\[\r\n\]+This does not affect the program until the next \"run\" command\." "help unset environment"
 # test help unset
-gdb_test "help unset" "Complement to certain \"set\" commands.\[\r\n\]+List of unset subcommands:\[\r\n\]+unset environment -- Cancel environment variable VAR for the program\[\r\n\]+Type \"help unset\" followed by unset subcommand name for full documentation\.\[\r\n\]+Command name abbreviations are allowed if unambiguous\." "help unset"
+gdb_test "help unset" "Complement to certain \"set\" commands\.\[\r\n\]+List of unset subcommands:\[\r\n\]+unset environment -- Cancel environment variable VAR for the program\[\r\n\]+Type \"help unset\" followed by unset subcommand name for full documentation\.\[\r\n\]+Command name abbreviations are allowed if unambiguous\." "help unset"
 # test help up
 gdb_test "help up" "Select and print stack frame that called this one\.\[\r\n\]+An argument says how many frames up to go\." "help up"
 # test help up-silently