📄 dump.exp
字号:
fail "$msg; value restored ok" }}# srec format can not be loaded for 64-bit-only platformsif ![string compare $is64bitonly "no"] then { 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"}# ihex format can not be loaded for 64-bit-only platformsif ![string compare $is64bitonly "no"] then { 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"}# tekhex format can not be loaded for 64-bit-only platformsif ![string compare $is64bitonly "no"] then { 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 sessiongdb_exitgdb_startgdb_reinitialize_dir $srcdir/$subdirgdb_load ${binfile}# Run to main.if { ! [ runto_main ] } then { untested dump.exp return -1}if { ![string compare $array_val \ [capture_value "intarray" "load binfile"]] } 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" "load binfile"]] } then { fail "start with intstruct un-initialized, runto main"} else { pass "start with intstruct un-initialized, runto main"}if ![string compare $is64bitonly "no"] then { 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 "(char *) &intarray2 - (char *) &intarray"]set struct2_offset \ [capture_value "(char *) &intstruct2 - (char *) &intstruct"]gdb_test "print zero_all ()" ""if ![string compare $is64bitonly "no"] then { 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\]"]if ![string compare $is64bitonly "no"] then { gdb_test "print zero_all ()" "" test_restore_saved_value "intarr1.srec 0 $element3_start $element4_start" \ "array partial, srec" 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" 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" 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" 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"if ![string compare $is64bitonly "no"] then { 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" 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 filesremote_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"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -