home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / gdb-4.9 / gdb / testsuite / gdb.t04 / setvar.exp < prev    next >
Encoding:
Text File  |  1993-05-12  |  67.2 KB  |  1,870 lines

  1. #   Copyright (C) 1988, 1990, 1991, 1992 Free Software Foundation, Inc.
  2.  
  3. # This program is free software; you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License as published by
  5. # the Free Software Foundation; either version 2 of the License, or
  6. # (at your option) any later version.
  7. # This program is distributed in the hope that it will be useful,
  8. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  10. # GNU General Public License for more details.
  11. # You should have received a copy of the GNU General Public License
  12. # along with this program; if not, write to the Free Software
  13. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  14.  
  15. # Please email any bugs, comments, and/or additions to this file to:
  16. # bug-gdb@prep.ai.mit.edu
  17.  
  18. # This file was written by Rob Savoye. (rob@cygnus.com)
  19.  
  20. if $tracelevel then {
  21.     strace $tracelevel
  22.     }
  23.  
  24. #
  25. # test running programs
  26. #
  27. set prms_id 0
  28. set bug_id 0
  29.  
  30. set binfile "gdbme"
  31.  
  32. if ![file exists $objdir/$subdir/$binfile] then {
  33.     error "$objdir/$subdir/$binfile does not exist."
  34.     alldone
  35. }
  36.  
  37. gdb_reinitialize_dir $srcdir/$subdir
  38. gdb_load $objdir/$subdir/$binfile
  39.  
  40. #
  41. # set it up at a breakpoint so we canplay with the variable values
  42. #
  43. send "set print sevenbit-strings\n" ; expect -re "$prompt $"
  44.  
  45. if ![runto main] then {
  46.     error "couldn't run to breakpoint"
  47.     continue
  48. }
  49.  
  50. #
  51. # test "set variable" for type "char"
  52. #
  53. # Because bare char types can be either signed or unsigned, we just test the
  54. # range of values that are common to both (0-127).
  55. #    
  56. send "set variable v_char=0\n"
  57. expect {
  58.     -re "$prompt $"\
  59.     {
  60.     send "print v_char\n"
  61.     expect {
  62.         -re ".\[0-9\]* = 0 \'.000\'.*$prompt $"       { pass "set variable char=0" }
  63.         -re "$prompt $"                      { fail "set variable char=0" }
  64.         timeout                              { fail "(timeout) set variable char=0" }
  65.     }
  66.     }
  67.     -re "$prompt $"                              { fail "set variable char=0" }
  68.     timeout                                      { fail "(timeout) set variable char=0" }
  69. }                         
  70.  
  71.  
  72. send "set variable v_char=1\n"
  73. expect {
  74.     -re "$prompt $"\
  75.     {
  76.     send "print v_char\n"
  77.     expect {
  78.         -re ".\[0-9\]* = 1 \'.001\'.*$prompt $"       { pass "set variable char=1" }
  79.         -re "$prompt $"                      { fail "set variable char=1" }
  80.         timeout                              { fail "(timeout) set variable char=1" }
  81.     }
  82.     }
  83.     -re "$prompt $"                              { fail "set variable char=1" }
  84.     timeout                                      { fail "(timeout) set variable char=1" }
  85. }                         
  86.  
  87.  
  88. send "set variable v_char=27\n"
  89. expect {
  90.     -re "$prompt $"\
  91.     {
  92.     send "print v_char\n"
  93.     expect {
  94.         -re ".\[0-9\]* = 27 \'.e\'.*$prompt $"       { pass "set variable char=27 (Esc)" }
  95.         -re "$prompt $"                      { fail "set variable char=27 (Esc)" }
  96.         timeout                              { fail "(timeout) set variable char=27 (Esc)" }
  97.     }
  98.     }
  99.     -re "$prompt $"                              { fail "set variable char=27 (Esc)" }
  100.     timeout                                      { fail "(timeout) set variable char=27 (Esc)" }
  101. }                         
  102.  
  103.  
  104. send "set variable v_char=32\n"
  105. expect {
  106.     -re "$prompt $"\
  107.     {
  108.     send "print v_char\n"
  109.     expect {
  110.         -re ".\[0-9\]* = 32 \' \'.*$prompt $"       { pass "set variable char=32 (SPC)" }
  111.         -re "$prompt $"                      { fail "set variable char=32 (SPC)" }
  112.         timeout                              { fail "(timeout) set variable char=32 (SPC)" }
  113.     }
  114.     }
  115.     -re "$prompt $"                              { fail "set variable char=32 (SPC)" }
  116.     timeout                                      { fail "(timeout) set variable char=32 (SPC)" }
  117. }                         
  118.  
  119.  
  120. send "set variable v_char=65\n"
  121. expect {
  122.     -re "$prompt $"\
  123.     {
  124.     send "print v_char\n"
  125.     expect {
  126.         -re ".\[0-9\]* = 65 \'A\'.*$prompt $"       { pass "set variable char=65 ('A')" }
  127.         -re "$prompt $"                      { fail "set variable char=65 ('A')" }
  128.         timeout                              { fail "(timeout) set variable char=65 ('A')" }
  129.     }
  130.     }
  131.     -re "$prompt $"                              { fail "set variable char=65 ('A')" }
  132.     timeout                                      { fail "(timeout) set variable char=65 ('A')" }
  133. }                         
  134.  
  135.  
  136. send "set variable v_char=97\n"
  137. expect {
  138.     -re "$prompt $"\
  139.     {
  140.     send "print v_char\n"
  141.     expect {
  142.         -re ".\[0-9\]* = 97 \'a\'.*$prompt $"       { pass "set variable char=97 ('a')" }
  143.         -re "$prompt $"                      { fail "set variable char=97 ('a')" }
  144.         timeout                              { fail "(timeout) set variable char=97 ('a')" }
  145.     }
  146.     }
  147.     -re "$prompt $"                              { fail "set variable char=97 ('a')" }
  148.     timeout                                      { fail "(timeout) set variable char=97 ('a')" }
  149. }                         
  150.  
  151.  
  152. send "set variable v_char=126\n"
  153. expect {
  154.     -re "$prompt $"\
  155.     {
  156.     send "print v_char\n"
  157.     expect {
  158.         -re ".\[0-9\]* = 126 \'~\'.*$prompt $"       { pass "set variable char=126 ('~')" }
  159.         -re "$prompt $"                      { fail "set variable char=126 ('~')" }
  160.         timeout                              { fail "(timeout) set variable char=126 ('~')" }
  161.     }
  162.     }
  163.     -re "$prompt $"                              { fail "set variable char=126 ('~')" }
  164.     timeout                                      { fail "(timeout) set variable char=126 ('~')" }
  165. }                         
  166.  
  167.  
  168. send "set variable v_char=127\n"
  169. expect {
  170.     -re "$prompt $"\
  171.     {
  172.     send "print v_char\n"
  173.     expect {
  174.         -re ".\[0-9\]* = 127 \'.177\'.*$prompt $"       { pass "set variable char=127 (8-bit)" }
  175.         -re "$prompt $"                      { fail "set variable char=127 (8-bit)" }
  176.         timeout                              { fail "(timeout) set variable char=127 (8-bit)" }
  177.     }
  178.     }
  179.     -re "$prompt $"                              { fail "set variable char=127 (8-bit)" }
  180.     timeout                                      { fail "(timeout) set variable char=127 (8-bit)" }
  181. }                         
  182.  
  183.  
  184. #
  185. # test "set variable" for type "signed char"
  186. #    
  187. send "set variable v_char=0\n"
  188. expect {
  189.     -re "$prompt $"\
  190.     {
  191.     send "print v_signed_char\n"
  192.     expect {
  193.         -re ".\[0-9\]* = 0 \'.000\'.*$prompt $"       { pass "set variable signed char=0" }
  194.         -re "$prompt $"                      { fail "set variable signed char=0" }
  195.         timeout                              { fail "(timeout) set variable signed char=0" }
  196.     }
  197.     }
  198.     -re "$prompt $"                              { fail "set variable signed char=0" }
  199.     timeout                                      { fail "(timeout) set variable signed char=0" }
  200. }                         
  201.  
  202.  
  203. send "set variable v_signed_char=1\n"
  204. expect {
  205.     -re "$prompt $"\
  206.     {
  207.     send "print v_signed_char\n"
  208.     expect {
  209.         -re ".\[0-9\]* = 1 \'.001\'.*$prompt $"       { pass "set variable signed char=1" }
  210.         -re "$prompt $"                      { fail "set variable signed char=1" }
  211.         timeout                              { fail "(timeout) set variable signed char=1" }
  212.     }
  213.     }
  214.     -re "$prompt $"                              { fail "set variable signed char=1" }
  215.     timeout                                      { fail "(timeout) set variable signed char=1" }
  216. }                         
  217.  
  218.  
  219. send "set variable v_signed_char=27\n"
  220. expect {
  221.     -re "$prompt $"\
  222.     {
  223.     send "print v_signed_char\n"
  224.     expect {
  225.         -re ".\[0-9\]* = 27 \'.e\'.*$prompt $"       { pass "set variable signed char=27 (Esc)" }
  226.         -re "$prompt $"                      { fail "set variable signed char=27 (Esc)" }
  227.         timeout                              { fail "(timeout) set variable signed char=27 (Esc)" }
  228.     }
  229.     }
  230.     -re "$prompt $"                              { fail "set variable signed char=27 (Esc)" }
  231.     timeout                                      { fail "(timeout) set variable signed char=27 (Esc)" }
  232. }                         
  233.  
  234.  
  235. send "set variable v_signed_char=32\n"
  236. expect {
  237.     -re "$prompt $"\
  238.     {
  239.     send "print v_signed_char\n"
  240.     expect {
  241.         -re ".\[0-9\]* = 32 \' \'.*$prompt $"       { pass "set variable signed char=32 (SPC)" }
  242.         -re "$prompt $"                      { fail "set variable signed char=32 (SPC)" }
  243.         timeout                              { fail "(timeout) set variable signed char=32 (SPC)" }
  244.     }
  245.     }
  246.     -re "$prompt $"                              { fail "set variable signed char=32 (SPC)" }
  247.     timeout                                      { fail "(timeout) set variable signed char=32 (SPC)" }
  248. }                         
  249.  
  250.  
  251. send "set variable v_signed_char=65\n"
  252. expect {
  253.     -re "$prompt $"\
  254.     {
  255.     send "print v_signed_char\n"
  256.     expect {
  257.         -re ".\[0-9\]* = 65 \'A\'.*$prompt $"       { pass "set variable signed char=65 ('A')" }
  258.         -re "$prompt $"                      { fail "set variable signed char=65 ('A')" }
  259.         timeout                              { fail "(timeout) set variable signed char=65 ('A')" }
  260.     }
  261.     }
  262.     -re "$prompt $"                              { fail "set variable signed char=65 ('A')" }
  263.     timeout                                      { fail "(timeout) set variable signed char=65 ('A')" }
  264. }                         
  265.  
  266.  
  267. send "set variable v_signed_char=97\n"
  268. expect {
  269.     -re "$prompt $"\
  270.     {
  271.     send "print v_signed_char\n"
  272.     expect {
  273.         -re ".\[0-9\]* = 97 \'a\'.*$prompt $"       { pass "set variable signed char=97 ('a')" }
  274.         -re "$prompt $"                      { fail "set variable signed char=97 ('a')" }
  275.         timeout                              { fail "(timeout) set variable signed char=97 ('a')" }
  276.     }
  277.     }
  278.     -re "$prompt $"                              { fail "set variable signed char=97 ('a')" }
  279.     timeout                                      { fail "(timeout) set variable signed char=97 ('a')" }
  280. }                         
  281.  
  282.  
  283. send "set variable v_signed_char=126\n"
  284. expect {
  285.     -re "$prompt $"\
  286.     {
  287.     send "print v_signed_char\n"
  288.     expect {
  289.         -re ".\[0-9\]* = 126 \'~\'.*$prompt $"       { pass "set variable signed char=126 ('~')" }
  290.         -re "$prompt $"                      { fail "set variable signed char=126 ('~')" }
  291.         timeout                              { fail "(timeout) set variable signed char=126 ('~')" }
  292.     }
  293.     }
  294.     -re "$prompt $"                              { fail "set variable signed char=126 ('~')" }
  295.     timeout                                      { fail "(timeout) set variable signed char=126 ('~')" }
  296. }                         
  297.  
  298.  
  299. send "set variable v_signed_char=127\n"
  300. expect {
  301.     -re "$prompt $"\
  302.     {
  303.     send "print v_signed_char\n"
  304.     expect {
  305.         -re ".\[0-9\]* = 127 \'.177\'.*$prompt $"       { pass "set variable signed char=127 (8-bit)" }
  306.         -re "$prompt $"                      { fail "set variable signed char=127 (8-bit)" }
  307.         timeout                              { fail "(timeout) set variable signed char=127 (8-bit)" }
  308.     }
  309.     }
  310.     -re "$prompt $"                              { fail "set variable signed char=127 (8-bit)" }
  311.     timeout                                      { fail "(timeout) set variable signed char=127 (8-bit)" }
  312. }                         
  313.  
  314.  
  315. send "set variable v_signed_char=-1\n"
  316. expect {
  317.     -re "$prompt $"\
  318.     {
  319.     send "print v_signed_char\n"
  320.     expect {
  321.         -re ".\[0-9\]* = -1 \'.377\'.*$prompt $"       { pass "set variable signed char=-1 (-1)" }
  322.         -re "$prompt $"                      { fail "set variable signed char=-1 (minus)" }
  323.         timeout                              { fail "(timeout) set variable signed char=-1 (minus)" }
  324.     }
  325.     }
  326.     -re "$prompt $"                              { fail "set variable signed char=-1 (minus)" }
  327.     timeout                                      { fail "(timeout) set variable signed char=-1 (minus)" }
  328. }                         
  329.  
  330.  
  331. send "set variable v_signed_char=0xFF\n"
  332. expect {
  333.     -re "$prompt $"\
  334.     {
  335.     send "print v_signed_char\n"
  336.     expect {
  337.         -re ".\[0-9\]* = -1 \'.377\'.*$prompt $"       { pass "set variable signed char=0xFF (0xFF)" }
  338.         -re "$prompt $"                      { fail "set variable signed char=0xFF (hex)" }
  339.         timeout                              { fail "(timeout) set variable signed char=0xFF (hex)" }
  340.     }
  341.     }
  342.     -re "$prompt $"                              { fail "set variable signed char=0xFF (hex)" }
  343.     timeout                                      { fail "(timeout) set variable signed char=0xFF (hex)" }
  344. }                         
  345.  
  346.  
  347. #
  348. # test "set variable" for type "unsigned char"
  349. #
  350. send "set variable v_unsigned_char=0\n"
  351. expect {
  352.     -re "$prompt $"\
  353.     {
  354.     send "print v_unsigned_char\n"
  355.     expect {
  356.         -re ".\[0-9\]* = 0 \'.000\'.*$prompt $"       { pass "set variable unsigned char=0" }
  357.         -re "$prompt $"                      { fail "set variable unsigned char=0" }
  358.         timeout                              { fail "(timeout) set variable unsigned char=0" }
  359.     }
  360.     }
  361.     -re "$prompt $"                              { fail "set variable unsigned char=0" }
  362.     timeout                                      { fail "(timeout) set variable unsigned char=0" }
  363. }                         
  364.  
  365.  
  366. send "set variable v_unsigned_char=1\n"
  367. expect {
  368.     -re "$prompt $"\
  369.     {
  370.     send "print v_unsigned_char\n"
  371.     expect {
  372.         -re ".\[0-9\]* = 1 \'.001\'.*$prompt $"       { pass "set variable unsigned char=1" }
  373.         -re "$prompt $"                      { fail "set variable unsigned char=1" }
  374.         timeout                              { fail "(timeout) set variable unsigned char=1" }
  375.     }
  376.     }
  377.     -re "$prompt $"                              { fail "set variable unsigned char=1" }
  378.     timeout                                      { fail "(timeout) set variable unsigned char=1" }
  379. }                         
  380.  
  381.  
  382. send "set variable v_unsigned_char=27\n"
  383. expect {
  384.     -re "$prompt $"\
  385.     {
  386.     send "print v_unsigned_char\n"
  387.     expect {
  388.         -re ".\[0-9\]* = 27 \'.e\'.*$prompt $"       { pass "set variable unsigned char=27 (Esc)" }
  389.         -re "$prompt $"                      { fail "set variable unsigned char=27 (Esc)" }
  390.         timeout                              { fail "(timeout) set variable unsigned char=27 (Esc)" }
  391.     }
  392.     }
  393.     -re "$prompt $"                              { fail "set variable unsigned char=27 (Esc)" }
  394.     timeout                                      { fail "(timeout) set variable unsigned char=27 (Esc)" }
  395. }                         
  396.  
  397.  
  398. send "set variable v_unsigned_char=32\n"
  399. expect {
  400.     -re "$prompt $"\
  401.     {
  402.     send "print v_unsigned_char\n"
  403.     expect {
  404.         -re ".\[0-9\]* = 32 \' \'.*$prompt $"       { pass "set variable unsigned char=32 (SPC)" }
  405.         -re "$prompt $"                      { fail "set variable unsigned char=32 (SPC)" }
  406.         timeout                              { fail "(timeout) set variable unsigned char=32 (SPC)" }
  407.     }
  408.     }
  409.     -re "$prompt $"                              { fail "set variable unsigned char=32 (SPC)" }
  410.     timeout                                      { fail "(timeout) set variable unsigned char=32 (SPC)" }
  411. }                         
  412.  
  413.  
  414. send "set variable v_unsigned_char=65\n"
  415. expect {
  416.     -re "$prompt $"\
  417.     {
  418.     send "print v_unsigned_char\n"
  419.     expect {
  420.         -re ".\[0-9\]* = 65 \'A\'.*$prompt $"       { pass "set variable unsigned char=65 ('A')" }
  421.         -re "$prompt $"                      { fail "set variable unsigned char=65 ('A')" }
  422.         timeout                              { fail "(timeout) set variable unsigned char=65 ('A')" }
  423.     }
  424.     }
  425.     -re "$prompt $"                              { fail "set variable unsigned char=65 ('A')" }
  426.     timeout                                      { fail "(timeout) set variable unsigned char=65 ('A')" }
  427. }                         
  428.  
  429.  
  430. send "set variable v_unsigned_char=97\n"
  431. expect {
  432.     -re "$prompt $"\
  433.     {
  434.     send "print v_unsigned_char\n"
  435.     expect {
  436.         -re ".\[0-9\]* = 97 \'a\'.*$prompt $"       { pass "set variable unsigned char=97 ('a')" }
  437.         -re "$prompt $"                      { fail "set variable unsigned char=97 ('a')" }
  438.         timeout                              { fail "(timeout) set variable unsigned char=97 ('a')" }
  439.     }
  440.     }
  441.     -re "$prompt $"                              { fail "set variable unsigned char=97 ('a')" }
  442.     timeout                                      { fail "(timeout) set variable unsigned char=97 ('a')" }
  443. }                         
  444.  
  445.  
  446. send "set variable v_unsigned_char=126\n"
  447. expect {
  448.     -re "$prompt $"\
  449.     {
  450.     send "print v_unsigned_char\n"
  451.     expect {
  452.         -re ".\[0-9\]* = 126 \'~\'.*$prompt $"       { pass "set variable unsigned char=126 ('~')" }
  453.         -re "$prompt $"                      { fail "set variable unsigned char=126 ('~')" }
  454.         timeout                              { fail "(timeout) set variable unsigned char=126 ('~')" }
  455.     }
  456.     }
  457.     -re "$prompt $"                              { fail "set variable unsigned char=126 ('~')" }
  458.     timeout                                      { fail "(timeout) set variable unsigned char=126 ('~')" }
  459. }                         
  460.  
  461.  
  462. send "set variable v_unsigned_char=~0\n"
  463. expect {
  464.     -re "$prompt $"\
  465.     {
  466.     send "print v_unsigned_char\n"
  467.     expect {
  468.         -re ".\[0-9\]* = 255 \'.377\'.*$prompt $"       { pass "set variable unsigned char=255 (8-bit)" }
  469.         -re "$prompt $"                      { fail "set variable unsigned char=255 (8-bit)" }
  470.         timeout                              { fail "(timeout) set variable unsigned char=255 (8-bit)" }
  471.     }
  472.     }
  473.     -re "$prompt $"                              { fail "set variable unsigned char=255 (8-bit)" }
  474.     timeout                                      { fail "(timeout) set variable unsigned char=255 (8-bit)" }
  475. }                         
  476.  
  477.  
  478. #
  479. # test "set variable" for type "short"
  480. #
  481. send "set variable v_short=0\n"
  482. expect {
  483.     -re "$prompt $"\
  484.     {
  485.     send "print v_short\n"
  486.     expect {
  487.         -re ".\[0-9\]* = 0.*$prompt $"       { pass "set variable short=0" }
  488.         -re "$prompt $"                      { fail "set variable short=0" }
  489.         timeout                              { fail "(timeout) set variable short=0" }
  490.     }
  491.     }
  492.     -re "$prompt $"                              { fail "set variable short=0" }
  493.     timeout                                      { fail "(timeout) set variable short=0" }
  494. }                         
  495.  
  496.  
  497. send "set variable v_short=1\n"
  498. expect {
  499.     -re "$prompt $"\
  500.     {
  501.     send "print v_short\n"
  502.     expect {
  503.         -re ".\[0-9\]* = 1.*$prompt $"       { pass "set variable short=1" }
  504.         -re "$prompt $"                      { fail "set variable short=1" }
  505.         timeout                              { fail "(timeout) set variable short=1" }
  506.     }
  507.     }
  508.     -re "$prompt $"                              { fail "set variable short=1" }
  509.     timeout                                      { fail "(timeout) set variable short=1" }
  510. }                         
  511.  
  512.  
  513. send "set variable v_short=-1\n"
  514. expect {
  515.     -re "$prompt $"\
  516.     {
  517.     send "print v_short\n"
  518.     expect {
  519.         -re ".\[0-9\]* = -1.*$prompt $"       { pass "set variable short=-1 (minus)" }
  520.         -re "$prompt $"                      { fail "set variable short=-1 (minus)" }
  521.         timeout                              { fail "(timeout) set variable signed short=-1 (minus)" }
  522.     }
  523.     }
  524.     -re "$prompt $"                              { fail "set variable short=-1 (minus)" }
  525.     timeout                                      { fail "(timeout) set variable short=-1 (minus)" }
  526. }                         
  527.  
  528.  
  529. #
  530. # test "set variable" for type "signed short"
  531. #
  532. send "set variable v_signed_short=0\n"
  533. expect {
  534.     -re "$prompt $"\
  535.     {
  536.     send "print v_signed_short\n"
  537.     expect {
  538.         -re ".\[0-9\]* = 0.*$prompt $"       { pass "set variable signed short=0" }
  539.         -re "$prompt $"                      { fail "set variable signed short=0" }
  540.         timeout                              { fail "(timeout) set variable signed short=0" }
  541.     }
  542.     }
  543.     -re "$prompt $"                              { fail "set variable signed short=0" }
  544.     timeout                                      { fail "(timeout) set variable signed short=0" }
  545. }                         
  546.  
  547.  
  548. send "set variable v_signed_short=1\n"
  549. expect {
  550.     -re "$prompt $"\
  551.     {
  552.     send "print v_signed_short\n"
  553.     expect {
  554.         -re ".\[0-9\]* = 1.*$prompt $"       { pass "set variable signed short=1" }
  555.         -re "$prompt $"                      { fail "set variable signed short=1" }
  556.         timeout                              { fail "(timeout) set variable signed short=1" }
  557.     }
  558.     }
  559.     -re "$prompt $"                              { fail "set variable signed short=1" }
  560.     timeout                                      { fail "(timeout) set variable signed short=1" }
  561. }                         
  562.  
  563.  
  564. send "set variable v_signed_short=-1\n"
  565. expect {
  566.     -re "$prompt $"\
  567.     {
  568.     send "print v_signed_short\n"
  569.     expect {
  570.         -re ".\[0-9\]* = -1.*$prompt $"       { pass "set variable signed short=-1 (minus)" }
  571.         -re "$prompt $"                      { fail "set variable signed short=-1 (minus)" }
  572.         timeout                              { fail "(timeout) set variable signed short=-1 (minus)" }
  573.     }
  574.     }
  575.     -re "$prompt $"                              { fail "set variable signed short=-1 (minus)" }
  576.     timeout                                      { fail "(timeout) set variable signed short=-1 (minus)" }
  577. }                         
  578.  
  579.  
  580. #
  581. # test "set variable" for type "unsigned short"
  582. #
  583. send "set variable v_unsigned_short=0\n"
  584. expect {
  585.     -re "$prompt $"\
  586.     {
  587.     send "print v_unsigned_short\n"
  588.     expect {
  589.         -re ".\[0-9\]* = 0.*$prompt $"       { pass "set variable unsigned short=0" }
  590.         -re "$prompt $"                      { fail "set variable unsigned short=0" }
  591.         timeout                              { fail "(timeout) set variable unsigned short=0" }
  592.     }
  593.     }
  594.     -re "$prompt $"                              { fail "set variable unsigned short=0" }
  595.     timeout                                      { fail "(timeout) set variable unsigned short=0" }
  596. }                         
  597.  
  598.  
  599. send "set variable v_unsigned_short=1\n"
  600. expect {
  601.     -re "$prompt $"\
  602.     {
  603.     send "print v_unsigned_short\n"
  604.     expect {
  605.         -re ".\[0-9\]* = 1.*$prompt $"       { pass "set variable unsigned short=1" }
  606.         -re "$prompt $"                      { fail "set variable unsigned short=1" }
  607.         timeout                              { fail "(timeout) set variable unsigned short=1" }
  608.     }
  609.     }
  610.     -re "$prompt $"                              { fail "set variable unsigned short=1" }
  611.     timeout                                      { fail "(timeout) set variable unsigned short=1" }
  612. }                         
  613.  
  614.  
  615. send "set variable v_unsigned_short=~0\n"
  616. expect {
  617.     -re "$prompt $"\
  618.     {
  619.     send "print v_unsigned_short\n"
  620.     expect {
  621.         -re ".\[0-9\]* = 65535.*$prompt $"       { pass "set variable unsigned short=~0 (minus)" }
  622.         -re "$prompt $"                      { fail "set variable unsigned short=~0 (minus)" }
  623.         timeout                              { fail "(timeout)  set variable unsigned short=~0 (minus)" }
  624.     }
  625.     }
  626.     -re "$prompt $"                              { fail "set variable unsigned short=~0 (minus)" }
  627.     timeout                                      { fail "(timeout) set variable unsigned short=~0 (minus)" }
  628. }                         
  629.  
  630.  
  631. #
  632. # test "set variable" for type "int"
  633. #
  634. send "set variable v_int=0\n"
  635. expect {
  636.     -re "$prompt $"\
  637.     {
  638.     send "print v_int\n"
  639.     expect {
  640.         -re ".\[0-9\]* = 0.*$prompt $"       { pass "set variable int=0" }
  641.         -re "$prompt $"                      { fail "set variable int=0" }
  642.         timeout                              { fail "(timeout) set variable int=0" }
  643.     }
  644.     }
  645.     -re "$prompt $"                              { fail "set variable int=0" }
  646.     timeout                                      { fail "(timeout) set variable int=0" }
  647. }                         
  648.  
  649.  
  650. send "set variable v_int=1\n"
  651. expect {
  652.     -re "$prompt $"\
  653.     {
  654.     send "print v_int\n"
  655.     expect {
  656.         -re ".\[0-9\]* = 1.*$prompt $"       { pass "set variable int=1" }
  657.         -re "$prompt $"                      { fail "set variable int=1" }
  658.         timeout                              { fail "(timeout) set variable int=1" }
  659.     }
  660.     }
  661.     -re "$prompt $"                              { fail "set variable int=1" }
  662.     timeout                                      { fail "(timeout) set variable int=1" }
  663. }                         
  664.  
  665.  
  666. send "set variable v_int=-1\n"
  667. expect {
  668.     -re "$prompt $"\
  669.     {
  670.     send "print v_int\n"
  671.     expect {
  672.         -re ".\[0-9\]* = -1.*$prompt $"       { pass "set variable int=-1 (minus)" }
  673.         -re "$prompt $"                      { fail "set variable int=-1 (minus)" }
  674.         timeout                              { fail "(timeout) set variable signed int=-1 (minus)" }
  675.     }
  676.     }
  677.     -re "$prompt $"                              { fail "set variable int=-1 (minus)" }
  678.     timeout                                      { fail "(timeout) set variable int=-1 (minus)" }
  679. }                         
  680.  
  681.  
  682. #
  683. # test "set variable" for type "signed int"
  684. #
  685. send "set variable v_signed_int=0\n"
  686. expect {
  687.     -re "$prompt $"\
  688.     {
  689.     send "print v_signed_int\n"
  690.     expect {
  691.         -re ".\[0-9\]* = 0.*$prompt $"       { pass "set variable signed int=0" }
  692.         -re "$prompt $"                      { fail "set variable signed int=0" }
  693.         timeout                              { fail "(timeout) set variable signed int=0" }
  694.     }
  695.     }
  696.     -re "$prompt $"                              { fail "set variable signed int=0" }
  697.     timeout                                      { fail "(timeout) set variable signed int=0" }
  698. }                         
  699.  
  700.  
  701. send "set variable v_signed_int=1\n"
  702. expect {
  703.     -re "$prompt $"\
  704.     {
  705.     send "print v_signed_int\n"
  706.     expect {
  707.         -re ".\[0-9\]* = 1.*$prompt $"       { pass "set variable signed int=1" }
  708.         -re "$prompt $"                      { fail "set variable signed int=1" }
  709.         timeout                              { fail "(timeout) set variable signed int=1" }
  710.     }
  711.     }
  712.     -re "$prompt $"                              { fail "set variable signed int=1" }
  713.     timeout                                      { fail "(timeout) set variable signed int=1" }
  714. }                         
  715.  
  716.  
  717. send "set variable v_signed_int=-1\n"
  718. expect {
  719.     -re "$prompt $"\
  720.     {
  721.     send "print v_signed_int\n"
  722.     expect {
  723.         -re ".\[0-9\]* = -1.*$prompt $"       { pass "set variable signed int=-1 (minus)" }
  724.         -re "$prompt $"                      { fail "set variable signed int=-1 (minus)" }
  725.         timeout                              { fail "(timeout) set variable signed int=-1 (minus)" }
  726.     }
  727.     }
  728.     -re "$prompt $"                              { fail "set variable signed int=-1 (minus)" }
  729.     timeout                                      { fail "(timeout) set variable signed int=-1 (minus)" }
  730. }                         
  731.  
  732.  
  733. #
  734. # test "set variable" for type "unsigned int"
  735. #
  736. send "set variable v_unsigned_int=0\n"
  737. expect {
  738.     -re "$prompt $"\
  739.     {
  740.     send "print v_unsigned_int\n"
  741.     expect {
  742.         -re ".\[0-9\]* = 0.*$prompt $"       { pass "set variable unsigned int=0" }
  743.         -re "$prompt $"                      { fail "set variable unsigned int=0" }
  744.         timeout                              { fail "(timeout) set variable unsigned int=0" }
  745.     }
  746.     }
  747.     -re "$prompt $"                              { fail "set variable unsigned int=0" }
  748.     timeout                                      { fail "(timeout) set variable unsigned int=0" }
  749. }                         
  750.  
  751.  
  752. send "set variable v_unsigned_int=1\n"
  753. expect {
  754.     -re "$prompt $"\
  755.     {
  756.     send "print v_unsigned_int\n"
  757.     expect {
  758.         -re ".\[0-9\]* = 1.*$prompt $"       { pass "set variable unsigned int=1" }
  759.         -re "$prompt $"                      { fail "set variable unsigned int=1" }
  760.         timeout                              { fail "(timeout) set variable unsigned int=1" }
  761.     }
  762.     }
  763.     -re "$prompt $"                              { fail "set variable unsigned int=1" }
  764.     timeout                                      { fail "(timeout) set variable unsigned int=1" }
  765. }                         
  766.  
  767.  
  768. send "set variable v_unsigned_int=~0\n"
  769. expect {
  770.     -re "$prompt $"\
  771.     {
  772.     send "print v_unsigned_int\n"
  773.     expect {
  774.         -re ".\[0-9\]* = 4294967295.*$prompt $"       { pass "set variable unsigned int=~0 (minus)" }
  775.         -re "$prompt $"                      { fail "set variable unsigned int=~0 (minus)" }
  776.         timeout                              { fail "(timeout) set variable unsigned int=~0 (minus)" }
  777.     }
  778.     }
  779.     -re "$prompt $"                              { fail "set variable unsigned int=~0 (minus)" }
  780.     timeout                                      { fail "(timeout) set variable unsigned int=~0 (minus)" }
  781. }                         
  782.  
  783.  
  784. #
  785. # test "set variable" for type "long"
  786. #
  787. send "set variable v_long=0\n"
  788. expect {
  789.     -re "$prompt $"\
  790.     {
  791.     send "print v_long\n"
  792.     expect {
  793.         -re ".\[0-9\]* = 0.*$prompt $"       { pass "set variable long=0" }
  794.         -re "$prompt $"                      { fail "set variable long=0" }
  795.         timeout                              { fail "(timeout) set variable long=0" }
  796.     }
  797.     }
  798.     -re "$prompt $"                              { fail "set variable long=0" }
  799.     timeout                                      { fail "(timeout) set variable long=0" }
  800. }                         
  801.  
  802.  
  803. send "set variable v_long=1\n"
  804. expect {
  805.     -re "$prompt $"\
  806.     {
  807.     send "print v_long\n"
  808.     expect {
  809.         -re ".\[0-9\]* = 1.*$prompt $"       { pass "set variable long=1" }
  810.         -re "$prompt $"                      { fail "set variable long=1" }
  811.         timeout                              { fail "(timeout) set variable long=1" }
  812.     }
  813.     }
  814.     -re "$prompt $"                              { fail "set variable long=1" }
  815.     timeout                                      { fail "(timeout) set variable long=1" }
  816. }                         
  817.  
  818.  
  819. send "set variable v_long=-1\n"
  820. expect {
  821.     -re "$prompt $"\
  822.     {
  823.     send "print v_long\n"
  824.     expect {
  825.         -re ".\[0-9\]* = -1.*$prompt $"       { pass "set variable long=-1 (minus)" }
  826.         -re "$prompt $"                      { fail "set variable long=-1 (minus)" }
  827.         timeout                              { fail "(timeout) set variable signed long=-1 (minus)" }
  828.     }
  829.     }
  830.     -re "$prompt $"                              { fail "set variable long=-1 (minus)" }
  831.     timeout                                      { fail "(timeout) set variable long=-1 (minus)" }
  832. }                         
  833.  
  834.  
  835. #
  836. # test "set variable" for type "signed long"
  837. #
  838. send "set variable v_signed_long=0\n"
  839. expect {
  840.     -re "$prompt $"\
  841.     {
  842.     send "print v_signed_long\n"
  843.     expect {
  844.         -re ".\[0-9\]* = 0.*$prompt $"       { pass "set variable signed long=0" }
  845.         -re "$prompt $"                      { fail "set variable signed long=0" }
  846.         timeout                              { fail "(timeout) set variable signed long=0" }
  847.     }
  848.     }
  849.     -re "$prompt $"                              { fail "set variable signed long=0" }
  850.     timeout                                      { fail "(timeout) set variable signed long=0" }
  851. }                         
  852.  
  853.  
  854. send "set variable v_signed_long=1\n"
  855. expect {
  856.     -re "$prompt $"\
  857.     {
  858.     send "print v_signed_long\n"
  859.     expect {
  860.         -re ".\[0-9\]* = 1.*$prompt $"       { pass "set variable signed long=1" }
  861.         -re "$prompt $"                      { fail "set variable signed long=1" }
  862.         timeout                              { fail "(timeout) set variable signed long=1" }
  863.     }
  864.     }
  865.     -re "$prompt $"                              { fail "set variable signed long=1" }
  866.     timeout                                      { fail "(timeout) set variable signed long=1" }
  867. }                         
  868.  
  869.  
  870. send "set variable v_signed_long=-1\n"
  871. expect {
  872.     -re "$prompt $"\
  873.     {
  874.     send "print v_signed_long\n"
  875.     expect {
  876.         -re ".\[0-9\]* = -1.*$prompt $"       { pass "set variable signed long=-1 (minus)" }
  877.         -re "$prompt $"                      { fail "set variable signed long=-1 (minus)" }
  878.         timeout                              { fail "(timeout) set variable signed long=-1 (minus)" }
  879.     }
  880.     }
  881.     -re "$prompt $"                              { fail "set variable signed long=-1 (minus)" }
  882.     timeout                                      { fail "(timeout) set variable signed long=-1 (minus)" }
  883. }                         
  884.  
  885.  
  886. #
  887. # test "set variable" for type "unsigned long"
  888. #
  889. send "set variable v_unsigned_long=0\n"
  890. expect {
  891.     -re "$prompt $"\
  892.     {
  893.     send "print v_unsigned_long\n"
  894.     expect {
  895.         -re ".\[0-9\]* = 0.*$prompt $"       { pass "set variable unsigned long=0" }
  896.         -re "$prompt $"                      { fail "set variable unsigned long=0" }
  897.         timeout                              { fail "(timeout) set variable unsigned long=0" }
  898.     }
  899.     }
  900.     -re "$prompt $"                              { fail "set variable unsigned long=0" }
  901.     timeout                                      { fail "(timeout) set variable unsigned long=0" }
  902. }                         
  903.  
  904.  
  905. send "set variable v_unsigned_long=1\n"
  906. expect {
  907.     -re "$prompt $"\
  908.     {
  909.     send "print v_unsigned_long\n"
  910.     expect {
  911.         -re ".\[0-9\]* = 1.*$prompt $"       { pass "set variable unsigned long=1" }
  912.         -re "$prompt $"                      { fail "set variable unsigned long=1" }
  913.         timeout                              { fail "(timeout) set variable unsigned long=1" }
  914.     }
  915.     }
  916.     -re "$prompt $"                              { fail "set variable unsigned long=1" }
  917.     timeout                                      { fail "(timeout) set variable unsigned long=1" }
  918. }                         
  919.  
  920.  
  921. send "set variable v_unsigned_long=~0\n"
  922. expect {
  923.     -re "$prompt $"\
  924.     {
  925.     send "print v_unsigned_long\n"
  926.     expect {
  927.         -re ".\[0-9\]* = 4294967295.*$prompt $"       { pass "set variable unsigned long=~0 (minus)" }
  928.         -re "$prompt $"                      { fail "set variable unsigned long=~0 (minus)" }
  929.         timeout                              { fail "(timeout) set variable unsigned long=~0 (minus)" }
  930.     }
  931.     }
  932.     -re "$prompt $"                              { fail "set variable unsigned long=~0 (minus)" }
  933.     timeout                                      { fail "(timeout) set variable unsigned long=~0 (minus)" }
  934. }                         
  935.  
  936.  
  937. #
  938. # test "set variable" for type "float"
  939. #
  940. send "set variable v_float=0.0\n"
  941. expect {
  942.     -re "$prompt $"\
  943.     {
  944.     send "print v_float\n"
  945.     expect {
  946.         -re ".\[0-9\]* = 0.*$prompt $"       { pass "set variable float=0" }
  947.         -re "$prompt $"                      { fail "set variable float=0" }
  948.         timeout                              { fail "(timeout) set variable float=0" }
  949.     }
  950.     }
  951.     -re "$prompt $"                              { fail "set variable float=0" }
  952.     timeout                                      { fail "(timeout) set variable float=0" }
  953. }                         
  954.  
  955.  
  956. send "set variable v_float=1.0\n"
  957. expect {
  958.     -re "$prompt $"\
  959.     {
  960.     send "print v_float\n"
  961.     expect {
  962.         -re ".\[0-9\]* = 1.*$prompt $"       { pass "set variable float=1" }
  963.         -re "$prompt $"                      { fail "set variable float=1" }
  964.         timeout                              { fail "(timeout) set variable float=1" }
  965.     }
  966.     }
  967.     -re "$prompt $"                              { fail "set variable float=1" }
  968.     timeout                                      { fail "(timeout) set variable float=1" }
  969. }                         
  970.  
  971.  
  972. send "set variable v_float=-1.0\n"
  973. expect {
  974.     -re "$prompt $"\
  975.     {
  976.     send "print v_float\n"
  977.     expect {
  978.         -re ".\[0-9\]* = -1.*$prompt $"       { pass "set variable float=-1 (minus)" }
  979.         -re "$prompt $"                      { fail "set variable float=-1 (minus)" }
  980.         timeout                              { fail "(timeout) set variable signed float=-1 (minus)" }
  981.     }
  982.     }
  983.     -re "$prompt $"                              { fail "set variable float=-1 (minus)" }
  984.     timeout                                      { fail "(timeout) set variable float=-1 (minus)" }
  985. }                         
  986.  
  987.  
  988. #
  989. # test "set variable" for type "double"
  990. #
  991. send "set variable v_double=0.0\n"
  992. expect {
  993.     -re "$prompt $"\
  994.     {
  995.     send "print v_double\n"
  996.     expect {
  997.         -re ".\[0-9\]* = 0.*$prompt $"       { pass "set variable double=0" }
  998.         -re "$prompt $"                      { fail "set variable double=0" }
  999.         timeout                              { fail "(timeout) set variable double=0" }
  1000.     }
  1001.     }
  1002.     -re "$prompt $"                              { fail "set variable double=0" }
  1003.     timeout                                      { fail "(timeout) set variable double=0" }
  1004. }                         
  1005.  
  1006.  
  1007. send "set variable v_double=1.0\n"
  1008. expect {
  1009.     -re "$prompt $"\
  1010.     {
  1011.     send "print v_double\n"
  1012.     expect {
  1013.         -re ".\[0-9\]* = 1.*$prompt $"       { pass "set variable double=1" }
  1014.         -re "$prompt $"                      { fail "set variable double=1" }
  1015.         timeout                              { fail "(timeout) set variable double=1" }
  1016.     }
  1017.     }
  1018.     -re "$prompt $"                              { fail "set variable double=1" }
  1019.     timeout                                      { fail "(timeout) set variable double=1" }
  1020. }                         
  1021.  
  1022.  
  1023. send "set variable v_double=-1.0\n"
  1024. expect {
  1025.     -re "set.*$prompt $"\
  1026.     {
  1027.     send "print v_double\n"
  1028.     expect {
  1029.         -re "print.*.\[0-9\]* = -1.*$prompt $"       { pass "set variable double=-1 (minus)" }
  1030.         -re "$prompt $"                      { fail "set variable double=-1 (minus)" }
  1031.         timeout                              { fail "(timeout) set variable double=-1 (minus)" }
  1032.     }
  1033.     }
  1034.     -re "$prompt $"                              { fail "set variable double=-1 (minus)" }
  1035.     timeout                                      { fail "(timeout) set variable double=-1 (minus)" }
  1036. }                         
  1037.  
  1038.  
  1039. #
  1040. # test "set variable" for "char array[2]"
  1041. #
  1042. send "set variable v_char_array\[0\]='h'\n"
  1043. expect -re "$prompt $"
  1044. send "set variable v_char_array\[1\]='i'\n"
  1045. expect {
  1046.     -re "set.*$prompt $"\
  1047.     {
  1048.     send "print v_char_array\n"
  1049.     expect {
  1050.         -re "print.*.\[0-9\]* =.*\"hi\".*$prompt $"       { pass "set variable char array=\"hi\" (string)" }
  1051.         -re "$prompt $"                      { fail "set variable char array=\"hi\" (string)" }
  1052.         timeout                              { fail "(timeout) set variable char array=\"hi\" (string)" }
  1053.     }
  1054.     }
  1055.     -re "$prompt $"                              { fail "set variable char array=\"hi\" (string)" }
  1056.     timeout                                      { fail "(timeout) set variable char array=\"hi\" (string)" }
  1057. }                         
  1058.  
  1059.  
  1060. #
  1061. # test "set variable" for "signed char array[2]"
  1062. #
  1063. send "set variable v_signed_char_array\[0\]='h'\n"
  1064. expect -re "$prompt $"
  1065. send "set variable v_signed_char_array\[1\]='i'\n"
  1066. expect {
  1067.     -re "set.*$prompt $"\
  1068.     {
  1069.     send "print v_signed_char_array\n"
  1070.     expect {
  1071.         -re "print.*.\[0-9\]* =.*\"hi\".*$prompt $"       { pass "set variable signed char array=\"hi\" (string)" }
  1072.         -re "$prompt $"                      { fail "set variable signed char array=\"hi\" (string)" }
  1073.         timeout                              { fail "(timeout) set variable signed char array=\"hi\" (string)" }
  1074.     }
  1075.     }
  1076.     -re "$prompt $"                              { fail "set variable signed char array=\"hi\" (string)" }
  1077.     timeout                                      { fail "(timeout) set variable signed char array=\"hi\" (string)" }
  1078. }                         
  1079.  
  1080.  
  1081. #
  1082. # test "set variable" for "unsigned char array[2]"
  1083. #
  1084. send "set variable v_unsigned_char_array\[0\]='h'\n"
  1085. expect -re "$prompt $"
  1086. send "set variable v_unsigned_char_array\[1\]='i'\n"
  1087. expect {
  1088.     -re "set.*$prompt $"\
  1089.     {
  1090.     send "print v_unsigned_char_array\n"
  1091.     expect {
  1092.         -re "print.*.\[0-9\]* =.*\"hi\".*$prompt $"       { pass "set variable unsigned char array=\"hi\" (string)" }
  1093.         -re "$prompt $"                      { fail "set variable unsigned char array=\"hi\" (string)" }
  1094.         timeout                              { fail "(timeout) set variable unsigned char array=\"hi\" (string)" }
  1095.     }
  1096.     }
  1097.     -re "$prompt $"                              { fail "set variable unsigned char array=\"hi\" (string)" }
  1098.     timeout                                      { fail "(timeout) set variable unsigned char array=\"hi\" (string)" }
  1099. }                         
  1100.  
  1101.  
  1102. #
  1103. # test "set variable" for "short array[2]"
  1104. #
  1105. send "set variable v_short_array\[0\]=123\n"
  1106. expect -re "$prompt $"
  1107. send "set variable v_short_array\[1\]=-456\n"
  1108. expect {
  1109.     -re "set.*$prompt $"\
  1110.     {
  1111.     send "print v_short_array\n"
  1112.     expect {
  1113.         -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $"       { pass "set variable short array" }
  1114.         -re "$prompt $"                      { fail "set variable short array" }
  1115.         timeout                              { fail "(timeout) set variable short array" }
  1116.     }
  1117.     }
  1118.     -re "$prompt $"                              { fail "set variable short array" }
  1119.     timeout                                      { fail "(timeout) set variable short array" }
  1120. }                         
  1121.  
  1122.  
  1123. #
  1124. # test "set variable" for "signed short array[2]"
  1125. #
  1126. send "set variable v_signed_short_array\[0\]=123\n"
  1127. expect -re "$prompt $"
  1128. send "set variable v_signed_short_array\[1\]=-456\n"
  1129. expect {
  1130.     -re "set.*$prompt $"\
  1131.     {
  1132.     send "print v_signed_short_array\n"
  1133.     expect {
  1134.         -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $"       { pass "set variable signed short array" }
  1135.         -re "$prompt $"                      { fail "set variable signed short array" }
  1136.         timeout                              { fail "(timeout) set variable signed short array" }
  1137.     }
  1138.     }
  1139.     -re "$prompt $"                              { fail "set variable signed short array" }
  1140.     timeout                                      { fail "(timeout) set variable signed short array" }
  1141. }                         
  1142.  
  1143.  
  1144. #
  1145. # test "set variable" for "unsigned short array[2]"
  1146. #
  1147. send "set variable v_unsigned_short_array\[0\]=123\n"
  1148. expect -re "$prompt $"
  1149. send "set variable v_unsigned_short_array\[1\]=-456\n"
  1150. expect {
  1151.     -re "set.*$prompt $"\
  1152.     {
  1153.     send "print v_unsigned_short_array\n"
  1154.     expect {
  1155.         -re "print.*.\[0-9\]* =.*\{123,.*65080\}.*$prompt $"       { pass "set variable unsigned short array" }
  1156.         -re "$prompt $"                      { fail "set variable unsigned short array" }
  1157.         timeout                              { fail "(timeout) set variable unsigned short array" }
  1158.     }
  1159.     }
  1160.     -re "$prompt $"                              { fail "set variable unsigned short array" }
  1161.     timeout                                      { fail "(timeout) set variable unsigned short array" }
  1162. }                         
  1163.  
  1164.  
  1165. #
  1166. # test "set variable" for "int array[2]"
  1167. #
  1168. send "set variable v_int_array\[0\]=123\n"
  1169. expect -re "$prompt $"
  1170. send "set variable v_int_array\[1\]=-456\n"
  1171. expect {
  1172.     -re "set.*$prompt $"\
  1173.     {
  1174.     send "print v_int_array\n"
  1175.     expect {
  1176.         -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $"       { pass "set variable int array" }
  1177.         -re "$prompt $"                      { fail "set variable int array" }
  1178.         timeout                              { fail "(timeout) set variable int array" }
  1179.     }
  1180.     }
  1181.     -re "$prompt $"                              { fail "set variable int array" }
  1182.     timeout                                      { fail "(timeout) set variable int array" }
  1183. }                         
  1184.  
  1185.  
  1186. #
  1187. # test "set variable" for "signed int array[2]"
  1188. #
  1189. send "set variable v_signed_int_array\[0\]=123\n"
  1190. expect -re "$prompt $"
  1191. send "set variable v_signed_int_array\[1\]=-456\n"
  1192. expect {
  1193.     -re "set.*$prompt $"\
  1194.     {
  1195.     send "print v_signed_int_array\n"
  1196.     expect {
  1197.         -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $"       { pass "set variable signed int array" }
  1198.         -re "$prompt $"                      { fail "set variable signed int array" }
  1199.         timeout                              { fail "(timeout) set variable signed int array" }
  1200.     }
  1201.     }
  1202.     -re "$prompt $"                              { fail "set variable signed int array" }
  1203.     timeout                                      { fail "(timeout) set variable signed int array" }
  1204. }                         
  1205.  
  1206.  
  1207.  
  1208. #
  1209. # test "set variable" for "unsigned int array[2]"
  1210. #
  1211. send "set variable v_unsigned_int_array\[0\]=123\n"
  1212. expect -re "$prompt $"
  1213. send "set variable v_unsigned_int_array\[1\]=-456\n"
  1214. expect {
  1215.     -re "set.*$prompt $"\
  1216.     {
  1217.     send "print v_unsigned_int_array\n"
  1218.     expect {
  1219.         -re "print.*.\[0-9\]* =.*\{123,.*4294966840\}.*$prompt $"       { pass "set variable unsigned int array" }
  1220.         -re "$prompt $"                      { fail "set variable unsigned int array" }
  1221.         timeout                              { fail "(timeout) set variable unsigned int array" }
  1222.     }
  1223.     }
  1224.     -re "$prompt $"                              { fail "set variable unsigned int array" }
  1225.     timeout                                      { fail "(timeout) set variable unsigned int array" }
  1226. }                         
  1227.  
  1228.  
  1229. #
  1230. # test "set variable" for "long array[2]"
  1231. #
  1232. send "set variable v_long_array\[0\]=123\n"
  1233. expect -re "$prompt $"
  1234. send "set variable v_long_array\[1\]=-456\n"
  1235. expect {
  1236.     -re "set.*$prompt $"\
  1237.     {
  1238.     send "print v_long_array\n"
  1239.     expect {
  1240.         -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $"       { pass "set variable long array" }
  1241.         -re "$prompt $"                      { fail "set variable long array" }
  1242.         timeout                              { fail "(timeout) set variable long array" }
  1243.     }
  1244.     }
  1245.     -re "$prompt $"                              { fail "set variable long array" }
  1246.     timeout                                      { fail "(timeout) set variable long array" }
  1247. }                         
  1248.  
  1249.  
  1250. #
  1251. # test "set variable" for "signed long array[2]"
  1252. #
  1253. send "set variable v_signed_long_array\[0\]=123\n"
  1254. expect -re "$prompt $"
  1255. send "set variable v_signed_long_array\[1\]=-456\n"
  1256. expect {
  1257.     -re "set.*$prompt $"\
  1258.     {
  1259.     send "print v_signed_long_array\n"
  1260.     expect {
  1261.         -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $"       { pass "set variable signed long array" }
  1262.         -re "$prompt $"                      { fail "set variable signed long array" }
  1263.         timeout                              { fail "(timeout) set variable signed long array" }
  1264.     }
  1265.     }
  1266.     -re "$prompt $"                              { fail "set variable signed long array" }
  1267.     timeout                                      { fail "(timeout) set variable signed long array" }
  1268. }                         
  1269.  
  1270.  
  1271.  
  1272. #
  1273. # test "set variable" for "unsigned long array[2]"
  1274. #
  1275. send "set variable v_unsigned_long_array\[0\]=123\n"
  1276. expect -re "$prompt $"
  1277. send "set variable v_unsigned_long_array\[1\]=-456\n"
  1278. expect {
  1279.     -re "$prompt $"\
  1280.     {
  1281.     send "print v_unsigned_long_array\n"
  1282.     expect {
  1283.         -re "print.*.\[0-9\]* =.*\{123,.*4294966840\}.*$prompt $"       { pass "set variable unsigned long array" }
  1284.         -re "$prompt $"                      { fail "set variable unsigned long array" }
  1285.         timeout                              { fail "(timeout) set variable unsigned long array" }
  1286.     }
  1287.     }
  1288.     -re "$prompt $"                              { fail "set variable unsigned long array" }
  1289.     timeout                                      { fail "(timeout) set variable unsigned long array" }
  1290. }                         
  1291.  
  1292.  
  1293. #
  1294. # test "set variable" for "float array[2]"
  1295. #
  1296. send "set variable v_float_array\[0\]=123.0\n"
  1297. expect -re "$prompt $"
  1298. send "set variable v_float_array\[1\]=-456.0\n"
  1299. expect {
  1300.     -re "$prompt $"\
  1301.     {
  1302.     send "print v_float_array\n"
  1303.     expect {
  1304.         -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $"       { pass "set variable float array" }
  1305.         -re "$prompt $"                      { fail "set variable float array" }
  1306.         timeout                              { fail "(timeout) set variable float array" }
  1307.     }
  1308.     }
  1309.     -re "$prompt $"                              { fail "set variable float array" }
  1310.     timeout                                      { fail "(timeout) set variable float array" }
  1311. }                         
  1312.  
  1313.  
  1314. #
  1315. # test "set variable" for "double array[2]"
  1316. #
  1317. send "set variable v_double_array\[0\]=123.0\n"
  1318. expect -re "$prompt $"
  1319. send "set variable v_double_array\[1\]=-456.0\n"
  1320. expect {
  1321.     -re "$prompt $"\
  1322.     {
  1323.     send "print v_double_array\n"
  1324.     expect {
  1325.         -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $"       { pass "set variable double array" }
  1326.         -re "$prompt $"                      { fail "set variable double array" }
  1327.         timeout                              { fail "(timeout) set variable double array" }
  1328.     }
  1329.     }
  1330.     -re "$prompt $"                              { fail "set variable double array" }
  1331.     timeout                                      { fail "(timeout) set variable double array" }
  1332. }                         
  1333.  
  1334.  
  1335. #
  1336. # test "set variable" for type "char *"
  1337. #
  1338. send "set v_char_pointer=v_char_array\n"
  1339. expect -re "set.*$prompt $"
  1340. send "set variable *(v_char_pointer)='h'\n"
  1341. expect -re "set.*$prompt $"
  1342. send "set variable *(v_char_pointer+1)='i'\n"
  1343. expect {
  1344.     -re "set.*$prompt $" {
  1345.     send "print v_char_array\n"
  1346.     expect {
  1347.         -re "print.*.\[0-9\]* =.*\"hi\".*$prompt $" {
  1348.         send "print *(v_char_pointer+1)\n"
  1349.         expect {
  1350.             -re "print.*.\[0-9\]* = 105 \'i\'.*$prompt $"    { pass "set variable char pointer=\"hi\" (string)" }
  1351.             -re "$prompt $"                              { fail "set variable char pointer=\"hi\" (string)" }
  1352.             timeout                              { fail "(timeout) set variable char pointer=\"hi\" (string)" }
  1353.  
  1354.         }
  1355.         }
  1356.         -re "$prompt $"                              { fail "set variable char pointer=\"hi\" (string)" }
  1357.         timeout                              { fail "(timeout) set variable char pointer=\"hi\" (string)" }
  1358.     }
  1359.     }
  1360.     -re "$prompt $"                              { fail "set variable char pointer=\"hi\" (string)" }
  1361.     timeout                                      { fail "(timeout) set variable char pointer=\"hi\" (string)" }
  1362. }                         
  1363.  
  1364.  
  1365. #
  1366. # test "set variable" for type "signed char *"
  1367. #
  1368. send "set v_signed_char_pointer=v_signed_char_array\n"
  1369. expect -re "set.*$prompt $"
  1370. send "set variable *(v_signed_char_pointer)='h'\n"
  1371. expect -re "set.*$prompt $"
  1372. send "set variable *(v_signed_char_pointer+1)='i'\n"
  1373. expect {
  1374.     -re "set.*$prompt $" {
  1375.     send "print v_signed_char_array\n"
  1376.     expect {
  1377.         -re "print.*.\[0-9\]* =.*\"hi\".*$prompt $" {
  1378.         send "print *(v_signed_char_pointer+1)\n"
  1379.         expect {
  1380.             -re "print.*.\[0-9\]* = 105 \'i\'.*$prompt $"    { pass "set variable signed char pointer=\"hi\" (string)" }
  1381.             -re "$prompt $"                { fail "set variable signed char pointer=\"hi\" (string)" }
  1382.             timeout                              { fail "(timeout) set variable signed char pointer=\"hi\" (string)" }
  1383.  
  1384.         }
  1385.         }
  1386.         -re "$prompt $"                { fail "set variable signed char pointer=\"hi\" (string)" }
  1387.         timeout                              { fail "(timeout) set variable signed char pointer=\"hi\" (string)" }
  1388.     }
  1389.     }
  1390.     -re "$prompt $"                { fail "set variable signed char pointer=\"hi\" (string)" }
  1391.     timeout                                      { fail "(timeout) set variable signed char pointer=\"hi\" (string)" }
  1392. }                         
  1393.  
  1394.  
  1395. #
  1396. # test "set variable" for type "unsigned char *"
  1397. #
  1398. send "set v_unsigned_char_pointer=v_unsigned_char_array\n"
  1399. expect -re "set.*$prompt $"
  1400. send "set variable *(v_unsigned_char_pointer)='h'\n"
  1401. expect -re "set.*$prompt $"
  1402. send "set variable *(v_unsigned_char_pointer+1)='i'\n"
  1403. expect {
  1404.     -re "set.*$prompt $" {
  1405.     send "print v_unsigned_char_array\n"
  1406.     expect {
  1407.         -re "print.*.\[0-9\]* =.*\"hi\".*$prompt $" {
  1408.         send "print *(v_unsigned_char_pointer+1)\n"
  1409.         expect {
  1410.             -re "print.*.\[0-9\]* = 105 \'i\'.*$prompt $"    { pass "set variable unsigned char pointer=\"hi\" (string)" }
  1411.             -re "$prompt $"                { fail "set variable unsigned char pointer=\"hi\" (string)" }
  1412.             timeout                              { fail "(timeout) set variable unsigned char pointer=\"hi\" (string)" }
  1413.  
  1414.         }
  1415.         }
  1416.         -re "$prompt $"                { fail "set variable unsigned char pointer=\"hi\" (string)" }
  1417.         timeout                              { fail "(timeout) set variable unsigned char pointer=\"hi\" (string)" }
  1418.     }
  1419.     }
  1420.     -re "$prompt $"                { fail "set variable unsigned char pointer=\"hi\" (string)" }
  1421.     timeout                                      { fail "(timeout) set variable unsigned char pointer=\"hi\" (string)" }
  1422. }                         
  1423.  
  1424.  
  1425. #
  1426. # test "set variable" for type "short *"
  1427. #
  1428. send "set v_short_pointer=v_short_array\n"
  1429. expect -re "set.*$prompt $"
  1430. send "set variable *(v_short_pointer)=123\n"
  1431. expect -re "set.*$prompt $"
  1432. send "set variable *(v_short_pointer+1)=-456\n"
  1433. expect {
  1434.     -re "set.*$prompt $" {
  1435.     send "print v_short_array\n"
  1436.     expect {
  1437.         -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
  1438.         send "print *(v_short_pointer+1)\n"
  1439.         expect {
  1440.             -re "print.*.\[0-9\]* = -456.*$prompt $"    { pass "set variable short pointer" }
  1441.             -re "$prompt $"                      { fail "set variable short pointer" }
  1442.             timeout                              { fail "(timeout) set variable short pointer" }
  1443.  
  1444.         }
  1445.         }
  1446.         -re "$prompt $"                { fail "set variable short pointer" }
  1447.         timeout                              { fail "(timeout) set variable short pointer" }
  1448.     }
  1449.     }
  1450.     -re "$prompt $"                { fail "set variable short pointer" }
  1451.     timeout                                      { fail "(timeout) set variable short pointer" }
  1452. }                         
  1453.  
  1454.  
  1455. #
  1456. # test "set variable" for type "signed short *"
  1457. #
  1458. send "set v_signed_short_pointer=v_signed_short_array\n"
  1459. expect -re "set.*$prompt $"
  1460. send "set variable *(v_signed_short_pointer)=123\n"
  1461. expect -re "set.*$prompt $"
  1462. send "set variable *(v_signed_short_pointer+1)=-456\n"
  1463. expect {
  1464.     -re "set.*$prompt $" {
  1465.     send "print v_signed_short_array\n"
  1466.     expect {
  1467.         -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
  1468.         send "print *(v_signed_short_pointer+1)\n"
  1469.         expect {
  1470.             -re "print.*.\[0-9\]*.*=.*-456.*$prompt $"    { pass "set variable signed short pointer" }
  1471.             -re "$prompt $"                { fail "set variable signed short pointer (FIXME)" }
  1472.             timeout                              { fail "(timeout) set variable signed short pointer (FIXME)" }
  1473.  
  1474.         }
  1475.         }
  1476.         -re "$prompt $"                { fail "set variable signed short pointer (FIXME)" }
  1477.         timeout                              { fail "(timeout) set variable signed short pointer (FIXME)" }
  1478.     }
  1479.     }
  1480.     -re "$prompt $"                { fail "set variable signed short pointer (FIXME)" }
  1481.     timeout                                      { fail "(timeout) set variable signed short pointer (FIXME)" }
  1482. }                         
  1483.  
  1484.  
  1485. #
  1486. # test "set variable" for type "unsigned short *"
  1487. #
  1488. send "set v_unsigned_short_pointer=v_unsigned_short_array\n"
  1489. expect -re "set.*$prompt $"
  1490. send "set variable *(v_unsigned_short_pointer)=123\n"
  1491. expect -re "set.*$prompt $"
  1492. send "set variable *(v_unsigned_short_pointer+1)=-456\n"
  1493. expect {
  1494.     -re "set.*$prompt $" {
  1495.     send "print v_unsigned_short_array\n"
  1496.     expect {
  1497.         -re "print.*.\[0-9\]* =.*\{123,.*65080\}.*$prompt $" {
  1498.         send "print *(v_unsigned_short_pointer+1)\n"
  1499.         expect {
  1500.             -re "print.*.\[0-9\]* = 65080.*$prompt $"    { pass "set variable unsigned short pointer" }
  1501.             -re "$prompt $"                { fail "set variable unsigned short pointer (FIXME)" }
  1502.             timeout                              { fail "(timeout) set variable unsigned short pointer (FIXME)" }
  1503.  
  1504.         }
  1505.         }
  1506.         -re "$prompt $"                { fail "set variable unsigned short pointer (FIXME)" }
  1507.         timeout                              { fail "(timeout) set variable unsigned short pointer (FIXME)" }
  1508.     }
  1509.     }
  1510.     -re "$prompt $"                { fail "set variable unsigned short pointer (FIXME)" }
  1511.     timeout                                      { fail "(timeout) set variable unsigned short pointer (FIXME)" }
  1512. }                         
  1513.  
  1514.  
  1515. #
  1516. # test "set variable" for type "int *"
  1517. #
  1518. send "set v_int_pointer=v_int_array\n"
  1519. expect -re "set.*$prompt $"
  1520. send "set variable *(v_int_pointer)=123\n"
  1521. expect -re "set.*$prompt $"
  1522. send "set variable *(v_int_pointer+1)=-456\n"
  1523. expect {
  1524.     -re "set.*$prompt $" {
  1525.     send "print v_int_array\n"
  1526.     expect {
  1527.         -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
  1528.         send "print *(v_int_pointer+1)\n"
  1529.         expect {
  1530.             -re "print.*.\[0-9\]* = -456.*$prompt $"    { pass "set variable int pointer" }
  1531.             -re "$prompt $"                { fail "set variable int pointer" }
  1532.             timeout                              { fail "(timeout) set variable int pointer" }
  1533.  
  1534.         }
  1535.         }
  1536.         -re "$prompt $"                { fail "set variable int pointer" }
  1537.         timeout                              { fail "(timeout) set variable int pointer" }
  1538.     }
  1539.     }
  1540.     -re "$prompt $"                { fail "set variable int pointer" }
  1541.      timeout                                      { fail "(timeout) set variable int pointer" }
  1542. }                         
  1543.  
  1544.  
  1545. #
  1546. # test "set variable" for type "signed int *"
  1547. #
  1548. send "set v_signed_int_pointer=v_signed_int_array\n"
  1549. expect -re "set.*$prompt $"
  1550. send "set variable *(v_signed_int_pointer)=123\n"
  1551. expect -re "set.*$prompt $"
  1552. send "set variable *(v_signed_int_pointer+1)=-456\n"
  1553. expect {
  1554.     -re "set.*$prompt $" {
  1555.     send "print v_signed_int_array\n"
  1556.     expect {
  1557.         -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
  1558.         send "print *(v_signed_int_pointer+1)\n"
  1559.         expect {
  1560.             -re "print.*.\[0-9\]* = -456.*$prompt $"    { pass "set variable signed int pointer" }
  1561.             -re "$prompt $"                { fail "set variable signed int pointer" }
  1562.             timeout                              { fail "(timeout) set variable signed int pointer" }
  1563.  
  1564.         }
  1565.         }
  1566.         -re "$prompt $"                { fail "set variable signed int pointer" }
  1567.         timeout                              { fail "(timeout) set variable signed int pointer" }
  1568.     }
  1569.     }
  1570.     -re "$prompt $"                { fail "set variable signed int pointer" }
  1571.        timeout                                      { fail "(timeout) set variable signed int pointer" }
  1572. }                         
  1573.  
  1574.  
  1575. #
  1576. # test "set variable" for type "unsigned int *"
  1577. #
  1578. send "set v_unsigned_int_pointer=v_unsigned_int_array\n"
  1579. expect -re "set.*$prompt $"
  1580. send "set variable *(v_unsigned_int_pointer)=123\n"
  1581. expect -re "set.*$prompt $"
  1582. send "set variable *(v_unsigned_int_pointer+1)=-456\n"
  1583. expect {
  1584.     -re "set.*$prompt $" {
  1585.     send "print v_unsigned_int_array\n"
  1586.     expect {
  1587.         -re "print.*.\[0-9\]* =.*\{123,.*4294966840\}.*$prompt $" {
  1588.         send "print *(v_unsigned_int_pointer+1)\n"
  1589.         expect {
  1590.             -re "print.*.\[0-9\]* = 4294966840.*$prompt $"    { pass "set variable unsigned int pointer" }
  1591.             -re "$prompt $"                { fail "set variable unsigned int pointer" }
  1592.             timeout                              { fail "(timeout) set variable unsigned int pointer" }
  1593.  
  1594.         }
  1595.         }
  1596.         -re "$prompt $"                { fail "set variable unsigned int pointer" }
  1597.         timeout                              { fail "(timeout) set variable unsigned int pointer" }
  1598.     }
  1599.     }
  1600.     -re "$prompt $"                { fail "set variable unsigned int pointer" }
  1601.     timeout                                      { fail "(timeout) set variable unsigned int pointer" }
  1602. }                         
  1603.  
  1604.  
  1605. #
  1606. # test "set variable" for type "long *"
  1607. #
  1608. send "set v_long_pointer=v_long_array\n"
  1609. expect -re "set.*$prompt $"
  1610. send "set variable *(v_long_pointer)=123\n"
  1611. expect -re "set.*$prompt $"
  1612. send "set variable *(v_long_pointer+1)=-456\n"
  1613. expect {
  1614.     -re "set.*$prompt $" {
  1615.     send "print v_long_array\n"
  1616.     expect {
  1617.         -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
  1618.         send "print *(v_long_pointer+1)\n"
  1619.         expect {
  1620.             -re "print.*.\[0-9\]* = -456.*$prompt $"    { pass "set variable long pointer" }
  1621.             -re "$prompt $"                { fail "set variable long pointer" }
  1622.             timeout                              { fail "(timeout) set variable long pointer" }
  1623.  
  1624.         }
  1625.         }
  1626.         -re "$prompt $"                { fail "set variable long pointer" }
  1627.         timeout                              { fail "(timeout) set variable long pointer" }
  1628.     }
  1629.     }
  1630.     -re "$prompt $"                { fail "set variable long pointer" }
  1631.      timeout                                      { fail "(timeout) set variable long pointer" }
  1632. }                         
  1633.  
  1634.  
  1635. #
  1636. # test "set variable" for type "signed long *"
  1637. #
  1638. send "set v_signed_long_pointer=v_signed_long_array\n"
  1639. expect -re "set.*$prompt $"
  1640. send "set variable *(v_signed_long_pointer)=123\n"
  1641. expect -re "set.*$prompt $"
  1642. send "set variable *(v_signed_long_pointer+1)=-456\n"
  1643. expect {
  1644.     -re "set.*$prompt $" {
  1645.     send "print v_signed_long_array\n"
  1646.     expect {
  1647.         -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
  1648.         send "print *(v_signed_long_pointer+1)\n"
  1649.         expect {
  1650.             -re "print.*.\[0-9\]* = -456.*$prompt $"    { pass "set variable signed long pointer" }
  1651.             -re "$prompt $"                { fail "set variable signed long pointer" }
  1652.             timeout                              { fail "(timeout) set variable signed long pointer" }
  1653.  
  1654.         }
  1655.         }
  1656.         -re "$prompt $"                { fail "set variable signed long pointer" }
  1657.         timeout                              { fail "(timeout) set variable signed long pointer" }
  1658.     }
  1659.     }
  1660.     -re "$prompt $"                { fail "set variable signed long pointer" }
  1661.        timeout                                      { fail "(timeout) set variable signed long pointer" }
  1662. }                         
  1663.  
  1664.  
  1665. #
  1666. # test "set variable" for type "unsigned long *"
  1667. #
  1668. send "set v_unsigned_long_pointer=v_unsigned_long_array\n"
  1669. expect -re "set.*$prompt $"
  1670. send "set variable *(v_unsigned_long_pointer)=123\n"
  1671. expect -re "set.*$prompt $"
  1672. send "set variable *(v_unsigned_long_pointer+1)=-456\n"
  1673. expect {
  1674.     -re "set.*$prompt $" {
  1675.     send "print v_unsigned_long_array\n"
  1676.     expect {
  1677.         -re "print.*.\[0-9\]* =.*\{123,.*4294966840\}.*$prompt $" {
  1678.         send "print *(v_unsigned_long_pointer+1)\n"
  1679.         expect {
  1680.             -re "print.*.\[0-9\]* = 4294966840.*$prompt $"    { pass "set variable unsigned long pointer" }
  1681.             -re "$prompt $"                { fail "set variable unsigned long pointer" }
  1682.             timeout                              { fail "(timeout) set variable unsigned long pointer" }
  1683.  
  1684.         }
  1685.         }
  1686.         -re "$prompt $"                { fail "set variable unsigned long pointer" }
  1687.         timeout                              { fail "(timeout) set variable unsigned long pointer" }
  1688.     }
  1689.     }
  1690.     -re "$prompt $"                { fail "set variable unsigned long pointer" }
  1691.     timeout                                      { fail "(timeout) set variable unsigned long pointer" }
  1692. }                         
  1693.  
  1694.  
  1695. #
  1696. # test "set variable" for type "float *"
  1697. #
  1698. send "set v_float_pointer=v_float_array\n"
  1699. expect -re "set.*$prompt $"
  1700. send "set variable *(v_float_pointer)=123.0\n"
  1701. expect -re "set.*$prompt $"
  1702. send "set variable *(v_float_pointer+1)=-456.0\n"
  1703. expect {
  1704.     -re "set.*$prompt $" {
  1705.     send "print v_float_array\n"
  1706.     expect {
  1707.         -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
  1708.         send "print *(v_float_pointer+1)\n"
  1709.         expect {
  1710.             -re "print.*.\[0-9\]* = -456.*$prompt $"    { pass "set variable float pointer" }
  1711.             -re "$prompt $"                { fail "set variable float pointer" }
  1712.             timeout                              { fail "(timeout) set variable float pointer" }
  1713.  
  1714.         }
  1715.         }
  1716.         -re "$prompt $"                { fail "set variable float pointer" }
  1717.         timeout                              { fail "(timeout) set variable float pointer" }
  1718.     }
  1719.     }
  1720.     -re "$prompt $"                { fail "set variable float pointer" }
  1721.      timeout                                      { fail "(timeout) set variable float pointer" }
  1722. }                         
  1723.  
  1724.  
  1725. #
  1726. # test "set variable" for type "double *"
  1727. #
  1728. send "set v_double_pointer=v_double_array\n"
  1729. expect -re "set.*$prompt $"
  1730. send "set variable *(v_double_pointer)=123.0\n"
  1731. expect -re "set.*$prompt $"
  1732. send "set variable *(v_double_pointer+1)=-456.0\n"
  1733. expect {
  1734.     -re "set.*$prompt $" {
  1735.     send "print v_double_array\n"
  1736.     expect {
  1737.         -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
  1738.         send "print *(v_double_pointer+1)\n"
  1739.         expect {
  1740.             -re "print.*.\[0-9\]* = -456.*$prompt $"    { pass "set variable double pointer" }
  1741.             -re "$prompt $"                { fail "set variable double pointer" }
  1742.             timeout                              { fail "(timeout) set variable double pointer" }
  1743.  
  1744.         }
  1745.         }
  1746.         -re "$prompt $"                { fail "set variable double pointer" }
  1747.         timeout                              { fail "(timeout) set variable double pointer" }
  1748.     }
  1749.     }
  1750.     -re "$prompt $"                { fail "set variable double pointer" }
  1751.      timeout                                      { fail "(timeout) set variable double pointer" }
  1752. }                         
  1753.  
  1754.  
  1755. #
  1756. # test "set variable" for struct members
  1757. #
  1758. send "set variable v_struct1.v_char_member='h'\n"
  1759. expect {
  1760.     -re "set.*$prompt $"\
  1761.     {
  1762.     send "print v_struct1.v_char_member\n"
  1763.     expect {
  1764.         -re "print.*.\[0-9\]* = 104 \'h\'.*$prompt $"       { pass "set variable structure char member" }
  1765.         -re "$prompt $"                      { fail "set variable structure char member" }
  1766.         timeout                              { fail "(timeout) set variable structure char member" }
  1767.     }
  1768.     }
  1769.     -re "$prompt $"                              { fail "set variable structure char member" }
  1770.     timeout                                      { fail "(timeout) set variable structure char member" }
  1771. }                         
  1772.  
  1773.  
  1774. send "set variable v_struct1.v_short_member=1\n"
  1775. expect {
  1776.     -re "set.*$prompt $"\
  1777.     {
  1778.     send "print v_struct1.v_short_member\n"
  1779.     expect {
  1780.         -re "print.*.\[0-9\]* = 1.*$prompt $"       { pass "set variable structure short member" }
  1781.         -re "$prompt $"                      { fail "set variable structure short member" }
  1782.         timeout                              { fail "(timeout) set variable structure short member" }
  1783.     }
  1784.     }
  1785.     -re "$prompt $"                              { fail "set variable structure short member" }
  1786.     timeout                                      { fail "(timeout) set variable structure short member" }
  1787. }                         
  1788.  
  1789.  
  1790. send "set variable v_struct1.v_int_member=2\n"
  1791. expect {
  1792.     -re "set.*$prompt $"\
  1793.     {
  1794.     send "print v_struct1.v_int_member\n"
  1795.     expect {
  1796.         -re "print.*.\[0-9\]* = 2.*$prompt $"       { pass "set variable structure int member" }
  1797.         -re "$prompt $"                      { fail "set variable structure int member" }
  1798.         timeout                              { fail "(timeout) set variable structure int member" }
  1799.     }
  1800.     }
  1801.     -re "$prompt $"                              { fail "set variable structure int member" }
  1802.     timeout                                      { fail "(timeout) set variable structure int member" }
  1803. }                         
  1804.  
  1805.  
  1806. send "set variable v_struct1.v_long_member=3\n"
  1807. expect {
  1808.     -re "set.*$prompt $"\
  1809.     {
  1810.     send "print v_struct1.v_long_member\n"
  1811.     expect {
  1812.         -re "print.*.\[0-9\]* = 3.*$prompt $"       { pass "set variable structure long member" }
  1813.         -re "$prompt $"                      { fail "set variable structure long member" }
  1814.         timeout                              { fail "(timeout) set variable structure long member" }
  1815.     }
  1816.     }
  1817.     -re "$prompt $"                              { fail "set variable structure long member" }
  1818.     timeout                                      { fail "(timeout) set variable structure long member" }
  1819. }                         
  1820.  
  1821.  
  1822. send "set variable v_struct1.v_float_member=4.0\n"
  1823. expect {
  1824.     -re "set.*$prompt $"\
  1825.     {
  1826.     send "print v_struct1.v_float_member\n"
  1827.     expect {
  1828.         -re "print.*.\[0-9\]* = 4.*$prompt $"       { pass "set variable structure float member" }
  1829.         -re "$prompt $"                      { fail "set variable structure float member" }
  1830.         timeout                              { fail "(timeout) set variable structure float member" }
  1831.     }
  1832.     }
  1833.     -re "$prompt $"                              { fail "set variable structure float member" }
  1834.     timeout                                      { fail "(timeout) set variable structure float member" }
  1835. }                         
  1836.  
  1837.  
  1838. send "set variable v_struct1.v_double_member=5.0\n"
  1839. expect {
  1840.     -re "set.*$prompt $"\
  1841.     {
  1842.     send "print v_struct1.v_double_member\n"
  1843.     expect {
  1844.         -re "print.*.\[0-9\]* = 5.*$prompt $"       { pass "set variable structure double member" }
  1845.         -re "$prompt $"                      { fail "set variable structure double member" }
  1846.         timeout                              { fail "(timeout) set variable structure double member" }
  1847.     }
  1848.     }
  1849.     -re "$prompt $"                              { fail "set variable structure double member" }
  1850.     timeout                                      { fail "(timeout) set variable structure double member" }
  1851. }                         
  1852.  
  1853.  
  1854.  
  1855. send "print v_struct1\n"
  1856. expect {
  1857.     -re "print.*.\[0-9\]* = \{.*v_char_member = 104 \'h\',.*v_short_member = 1,.*v_int_member = 2,.*\
  1858. v_long_member = 3,.*v_float_member = 4,.*v_double_member = 5.*\}.*$prompt $"\
  1859.                                      { pass "set print structure" }
  1860.     -re "$prompt $"                      { fail "set print structure" }
  1861.     timeout                              { fail "(timeout) set print structure" }
  1862. }
  1863.  
  1864. if [istarget "a29k-*-udi"] then {
  1865.     # FIXME: If PR 2415 is fixed, this is not needed.
  1866.     gdb_target_udi
  1867. }
  1868.