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.t15 / funcargs.exp < prev    next >
Encoding:
Text File  |  1993-05-12  |  43.2 KB  |  1,359 lines

  1. # Copyright (C) 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 Fred Fish. (fnf@cygnus.com)
  19.  
  20. if $tracelevel then {
  21.     strace $tracelevel
  22. }
  23.  
  24. set prms_id 0
  25. set bug_id 0
  26.  
  27. set binfile "gdbme"
  28. set srcfile $binfile.c
  29.  
  30. if ![file exists $objdir/$subdir/$binfile] then {
  31.     error "$objdir/$subdir/$binfile does not exist."
  32.     continue
  33. }
  34.  
  35. #
  36. # Locate actual args; integral types.
  37. #
  38.  
  39. proc integral_args {} {
  40.     global prompt
  41.     global det_file
  42.  
  43.     delete_breakpoints
  44.  
  45.     send "break call0a\n" ; expect -re ".*$prompt $"
  46.     send "break call0b\n" ; expect -re ".*$prompt $"
  47.     send "break call0c\n" ; expect -re ".*$prompt $"
  48.     send "break call0d\n" ; expect -re ".*$prompt $"
  49.     send "break call0e\n" ; expect -re ".*$prompt $"
  50.  
  51.     # Run; should stop at call0a and print actual arguments.
  52.     # The mips prologue stuff is broken, and mishandles this.
  53.     setup_xfail "mips-*-*"
  54.     # The a29k fails all of these tests, perhaps because the prologue
  55.     # code is broken.
  56.     setup_xfail "a29k-*-udi"
  57.     send "run\n"
  58.     expect {
  59.     -re "The program .* has been started already.* \(y or n\) $" {
  60.         send "y\n"
  61.         continue -expect
  62.     }
  63.     -re ".* call0a \(c=97 'a', s=1, i=2, l=3\) .*$prompt $" {}
  64.     -re "$prompt $"  { fail "run to call0a" ; return }
  65.     timeout { fail "(timeout) run to call0a" ; return }
  66.     }
  67.  
  68.     # Print each arg as a double check to see if we can print
  69.     # them here as well as with backtrace.
  70.  
  71.     send "print c\n"
  72.     expect {
  73.     -re ".* = 97 'a'\r\n$prompt $" {}
  74.     -re "$prompt $" { fail "print c" ; return }
  75.     timeout { fail "(timeout) print c" ; return }
  76.     }
  77.     send "print s\n"
  78.     expect {
  79.     -re ".* = 1\r\n$prompt $" {}
  80.     -re "$prompt $" { fail "print s" ; return }
  81.     timeout { fail "(timeout) print s" ; return }
  82.     }
  83.     send "print i\n"
  84.     expect {
  85.     -re ".* = 2\r\n$prompt $" {}
  86.     -re "$prompt $" { fail "print i" ; return }
  87.     timeout { fail "(timeout) print i" ; return }
  88.     }
  89.     send "print l\n"
  90.     expect {
  91.     -re ".* = 3\r\n$prompt $" {}
  92.     -re "$prompt $" { fail "print l" ; return }
  93.     timeout { fail "(timeout) print l" ; return }
  94.     }
  95.  
  96.     # Continue; should stop at call0b and print actual arguments.
  97.  
  98.     send "cont\n"
  99.     expect {
  100.     -re ".* call0b \(s=1, i=2, l=3, c=97 'a'\) .*$prompt $" {}
  101.     -re "$prompt $" { fail "continue to call0b" ; return }
  102.     timeout { fail "(timeout) continue to call0b" ; return }
  103.     }
  104.  
  105.     # Continue; should stop at call0c and print actual arguments.
  106.  
  107.     send "cont\n"
  108.     expect {
  109.     -re ".* call0c \(i=2, l=3, c=97 'a', s=1\) .*$prompt $" {}
  110.     -re "$prompt $" { fail "continue to call0c" ; return }
  111.     timeout { fail "(timeout) continue to call0c" ; return }
  112.     }
  113.  
  114.     # Continue; should stop at call0d and print actual arguments.
  115.  
  116.     send "cont\n"
  117.     expect {
  118.     -re ".* call0d \(l=3, c=97 'a', s=1, i=2\) .*$prompt $" {}
  119.     -re "$prompt $" { fail "continue to call0d" ; return }
  120.     timeout { fail "(timeout) continue to call0d" ; return }
  121.     }
  122.  
  123.     # Continue; should stop at call0e and print actual arguments.
  124.  
  125.     send "cont\n"
  126.     expect {
  127.     -re ".* call0e \(c1=97 'a', l=3, c2=97 'a', i=2, c3=97 'a', s=1, c4=97 'a', c5=97 'a'\) .*$prompt $" {}
  128.     -re "$prompt $" { fail "continue to call0e" ; return }
  129.     timeout { fail "(timeout) continue to call0e" ; return }
  130.     }
  131.  
  132.     pass "locate actual args, signed integral types"
  133. }
  134.  
  135. #
  136. # Locate actual args; unsigned integral types.
  137. #
  138.  
  139. proc unsigned_integral_args {} {
  140.     global prompt
  141.     global det_file
  142.  
  143.     delete_breakpoints
  144.  
  145.     send "break call1a\n" ; expect -re ".*$prompt $"
  146.     send "break call1b\n" ; expect -re ".*$prompt $"
  147.     send "break call1c\n" ; expect -re ".*$prompt $"
  148.     send "break call1d\n" ; expect -re ".*$prompt $"
  149.     send "break call1e\n" ; expect -re ".*$prompt $"
  150.  
  151.     # Run; should stop at call1a and print actual arguments.
  152.     # The mips prologue stuff is broken, and mishandles this.
  153.     setup_xfail "mips-*-*"
  154.     # The a29k fails all of these tests, perhaps because the prologue
  155.     # code is broken.
  156.     setup_xfail "a29k-*-udi"
  157.     send "run\n"
  158.     expect {
  159.     -re "The program .* has been started already.* \(y or n\) $" {
  160.         send "y\n"
  161.         continue -expect
  162.     }
  163.     -re ".* call1a \(uc=98 'b', us=6, ui=7, ul=8\) .*$prompt $" {}
  164.     -re "$prompt $" { fail "run to call1a" ; return }
  165.     timeout { fail "(timeout) run to call1a" ; return }
  166.     }
  167.  
  168.     # Print each arg as a double check to see if we can print
  169.     # them here as well as with backtrace.
  170.  
  171.     send "print uc\n"
  172.     expect {
  173.     -re ".* = 98 'b'\r\n$prompt $" {}
  174.     -re "$prompt $" { fail "print uc" ; return }
  175.     timeout { fail "(timeout) print uc" ; return }
  176.     }
  177.     send "print us\n"
  178.     expect {
  179.     -re ".* = 6\r\n$prompt $" {}
  180.     -re "$prompt $" { fail "print us" ; return }
  181.     timeout { fail "(timeout) print us" ; return }
  182.     }
  183.     send "print ui\n"
  184.     expect {
  185.     -re ".* = 7\r\n$prompt $" {}
  186.     -re "$prompt $" { fail "print ui" ; return }
  187.     timeout { fail "(timeout) print ui" ; return }
  188.     }
  189.     send "print ul\n"
  190.     expect {
  191.     -re ".* = 8\r\n$prompt $" {}
  192.     -re "$prompt $" { fail "print ul" ; return }
  193.     timeout { fail "(timeout) print ul" ; return }
  194.     }
  195.     
  196.     # Continue; should stop at call1b and print actual arguments.
  197.  
  198.     send "cont\n"
  199.     expect {
  200.     -re ".* call1b \(us=6, ui=7, ul=8, uc=98 'b'\) .*$prompt $" {}
  201.     -re "$prompt $" { fail "continue to call1b" ; return }
  202.     timeout { fail "(timeout) continue to call1b" ; return }
  203.     }
  204.  
  205.     # Continue; should stop at call1c and print actual arguments.
  206.  
  207.     send "cont\n"
  208.     expect {
  209.     -re ".* call1c \(ui=7, ul=8, uc=98 'b', us=6\) .*$prompt $" {}
  210.     -re "$prompt $" { fail "continue to call1c" ; return }
  211.     timeout { fail "(timeout) continue to call1c" ; return }
  212.     }
  213.  
  214.     # Continue; should stop at call1d and print actual arguments.
  215.  
  216.     send "cont\n"
  217.     expect {
  218.     -re ".* call1d \(ul=8, uc=98 'b', us=6, ui=7\) .*$prompt $" {}
  219.     -re "$prompt $" { fail "continue to call1d" ; return }
  220.     timeout { fail "(timeout) continue to call1d" ; return }
  221.     }
  222.  
  223.     # Continue; should stop at call1e and print actual arguments.
  224.  
  225.     send "cont\n"
  226.     expect {
  227.     -re ".* call1e \(uc1=98 'b', ul=8, uc2=98 'b', ui=7, uc3=98 'b', us=6, uc4=98 'b', uc5=98 'b'\) .*$prompt $" {}
  228.     -re "$prompt $" { fail "continue to call1e" ; return }
  229.     timeout { fail "(timeout) continue to call1e" ; return }
  230.     }
  231.  
  232.     pass "locate actual args, unsigned integral types"
  233. }
  234.  
  235. #
  236. # Locate actual args; integrals mixed with floating point.
  237. #
  238.  
  239. proc float_and_integral_args {} {
  240.     global prompt
  241.     global det_file
  242.  
  243.     delete_breakpoints
  244.  
  245.     send "break call2a\n" ; expect -re ".*$prompt $"
  246.     send "break call2b\n" ; expect -re ".*$prompt $"
  247.     send "break call2c\n" ; expect -re ".*$prompt $"
  248.     send "break call2d\n" ; expect -re ".*$prompt $"
  249.     send "break call2e\n" ; expect -re ".*$prompt $"
  250.     send "break call2f\n" ; expect -re ".*$prompt $"
  251.     send "break call2g\n" ; expect -re ".*$prompt $"
  252.     send "break call2h\n" ; expect -re ".*$prompt $"
  253.     send "break call2i\n" ; expect -re ".*$prompt $"
  254.  
  255.     # Run; should stop at call2a and print actual arguments.
  256.  
  257.     setup_xfail "i960-*-*" 1813
  258.     # The mips prologue stuff is broken, and mishandles this.
  259.     setup_xfail "mips-*-*"
  260.     # The a29k fails all of these tests, perhaps because the prologue
  261.     # code is broken.
  262.     setup_xfail "a29k-*-udi"
  263.     send "run\n"
  264.     expect {
  265.     -re "The program .* has been started already.* \(y or n\) $" {
  266.         send "y\n"
  267.         continue -expect
  268.     }
  269.     -re ".* call2a \(c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5\) .*$prompt $" {}
  270.     -re "$prompt $" { fail "run to call2a" ; return }
  271.     timeout { fail "(timeout) run to call2a" ; return }
  272.     }
  273.  
  274.     # Print each arg as a double check to see if we can print
  275.  
  276.     send "print c\n"
  277.     expect {
  278.     -re ".* = 97 'a'\r\n$prompt $" {}
  279.     -re "$prompt $" { fail "print c" ; return }
  280.     timeout { fail "(timeout) print c" ; return }
  281.     }
  282.     send "print f1\n"
  283.     expect {
  284.     -re ".* = 4\r\n$prompt $" {}
  285.     -re "$prompt $" { fail "print f1" ; return }
  286.     timeout { fail "(timeout) print f1" ; return }
  287.     }
  288.     send "print s\n"
  289.     expect {
  290.     -re ".* = 1\r\n$prompt $" {}
  291.     -re "$prompt $" { fail "print s" ; return }
  292.     timeout { fail "(timeout) print s" ; return }
  293.     }
  294.     send "print d1\n"
  295.     expect {
  296.     -re ".* = 5\r\n$prompt $" {}
  297.     -re "$prompt $" { fail "print d1" ; return }
  298.     timeout { fail "(timeout) print d1" ; return }
  299.     }
  300.     send "print i\n"
  301.     expect {
  302.     -re ".* = 2\r\n$prompt $" {}
  303.     -re "$prompt $" { fail "print i" ; return }
  304.     timeout { fail "(timeout) print i" ; return }
  305.     }
  306.     send "print f2\n"
  307.     expect {
  308.     -re ".* = 4\r\n$prompt $" {}
  309.     -re "$prompt $" { fail "print f2" ; return }
  310.     timeout { fail "(timeout) print f2" ; return }
  311.     }
  312.     send "print l\n"
  313.     expect {
  314.     -re ".* = 3\r\n$prompt $" {}
  315.     -re "$prompt $" { fail "print l" ; return }
  316.     timeout { fail "(timeout) print l" ; return }
  317.     }
  318.     send "print d2\n"
  319.     expect {
  320.     -re ".* = 5\r\n$prompt $" {}
  321.     -re "$prompt $" { fail "print d2" ; return }
  322.     timeout { fail "(timeout) print d2" ; return }
  323.     }
  324.  
  325.     # Continue; should stop at call2b and print actual arguments.
  326.  
  327.     send "cont\n"
  328.     expect {
  329.     -re ".* call2b \(f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5, c=97 'a'\) .*$prompt $" {}
  330.     -re "$prompt $" { fail "continue to call2b" ; return }
  331.     timeout { fail "(timeout) continue to call2b" ; return }
  332.     }
  333.  
  334.     # Continue; should stop at call2c and print actual arguments.
  335.  
  336.     send "cont\n"
  337.     expect {
  338.     -re ".* call2c \(s=1, d1=5, i=2, f2=4, l=3, d2=5, c=97 'a', f1=4\) .*$prompt $" {}
  339.     -re "$prompt $" { fail "continue to call2c" ; return }
  340.     timeout { fail "(timeout) continue to call2c" ; return }
  341.     }
  342.  
  343.     # Continue; should stop at call2d and print actual arguments.
  344.  
  345.     send "cont\n"
  346.     expect {
  347.     -re ".* call2d \(d1=5, i=2, f2=4, l=3, d2=5, c=97 'a', f1=4, s=1\) .*$prompt $" {}
  348.     -re "$prompt $" { fail "continue to call2d" ; return }
  349.     timeout { fail "(timeout) continue to call2d" ; return }
  350.     }
  351.  
  352.     # Continue; should stop at call2e and print actual arguments.
  353.  
  354.     send "cont\n"
  355.     expect {
  356.     -re ".* call2e \(i=2, f2=4, l=3, d2=5, c=97 'a', f1=4, s=1, d1=5\) .*$prompt $" {}
  357.     -re "$prompt $" { fail "continue to call2e" ; return }
  358.     timeout { fail "(timeout) continue to call2e" ; return }
  359.     }
  360.  
  361.     # Continue; should stop at call2f and print actual arguments.
  362.  
  363.     send "cont\n"
  364.     expect {
  365.     -re ".* call2f \(f2=4, l=3, d2=5, c=97 'a', f1=4, s=1, d1=5, i=2\) .*$prompt $" {}
  366.     -re "$prompt $" { fail "continue to call2f" ; return }
  367.     timeout { fail "(timeout) continue to call2f" ; return }
  368.     }
  369.  
  370.     # Continue; should stop at call2g and print actual arguments.
  371.  
  372.     send "cont\n"
  373.     expect {
  374.     -re ".* call2g \(l=3, d2=5, c=97 'a', f1=4, s=1, d1=5, i=2, f2=4\) .*$prompt $" {}
  375.     -re "$prompt $" { fail "continue to call2g" ; return }
  376.     timeout { fail "(timeout) continue to call2g" ; return }
  377.     }
  378.  
  379.     # Continue; should stop at call2h and print actual arguments.
  380.  
  381.     send "cont\n"
  382.     expect {
  383.     -re ".* call2h \(d2=5, c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3\) .*$prompt $" {}
  384.     -re "$prompt $" { fail "continue to call2h" ; return }
  385.     timeout { fail "(timeout) continue to call2h" ; return }
  386.     }
  387.  
  388.     # Continue; should stop at call2i and print actual arguments.
  389.  
  390.     send "cont\n"
  391.     expect {
  392.     -re ".* call2i \(c1=97 'a', f1=4, c2=97 'a', c3=97 'a', d1=5, c4=97 'a', c5=97 'a', c6=97 'a', f2=4, s=1, c7=97 'a', d2=5\) .*$prompt $" {}
  393.     -re "$prompt $" { fail "continue to call2i" ; return }
  394.     timeout { fail "(timeout) continue to call2i" ; return }
  395.     }
  396.  
  397.     pass "locate actual args, mixed integral and float types"
  398. }
  399.  
  400. #
  401. # Locate actual args; dereference pointers to ints and floats.
  402. #
  403.  
  404. proc pointer_args {} {
  405.     global prompt
  406.     global hex
  407.     global det_file
  408.  
  409.     delete_breakpoints
  410.  
  411.     send "break call3a\n" ; expect -re ".*$prompt $"
  412.     send "break call3b\n" ; expect -re ".*$prompt $"
  413.     send "break call3c\n" ; expect -re ".*$prompt $"
  414.  
  415.     # Run; should stop at call3a and print actual arguments.
  416.     # Try dereferencing the arguments.
  417.  
  418.     # The mips prologue stuff is broken, and mishandles this.
  419.     setup_xfail "mips-*-*"
  420.     send "run\n"
  421.     # The a29k fails all of these tests, perhaps because the prologue
  422.     # code is broken.
  423.     setup_xfail "a29k-*-udi"
  424.     expect {
  425.     -re "The program .* has been started already.* \(y or n\) $" {
  426.         send "y\n"
  427.         continue -expect
  428.     }
  429.     -re ".* call3a \(cp=$hex \"a\", sp=$hex, ip=$hex, lp=$hex\) .*$prompt $" {}
  430.     -re "$prompt $" { fail "run to call3a" ; return }
  431.     timeout { fail "(timeout) run to call3a" ; return }
  432.     }
  433.  
  434.     send "print *cp\n"
  435.     expect {
  436.     -re ".* = 97 'a'\r\n$prompt $" {}
  437.     -re "$prompt $" { fail "print *cp" ; return }
  438.     timeout { fail "(timeout) print *cp" ; return }
  439.     }
  440.     send "print *sp\n"
  441.     expect {
  442.     -re ".* = 1\r\n$prompt $" {}
  443.     -re "$prompt $" { fail "print *sp" ; return }
  444.     timeout { fail "(timeout) print *sp" ; return }
  445.     }
  446.     send "print *ip\n"
  447.     expect {
  448.     -re ".* = 2\r\n$prompt $" {}
  449.     -re "$prompt $" { fail "print *ip" ; return }
  450.     timeout { fail "(timeout) print *ip" ; return }
  451.     }
  452.     send "print *lp\n"
  453.     expect {
  454.     -re ".* = 3\r\n$prompt $" {}
  455.     -re "$prompt $" { fail "print *lp" ; return }
  456.     timeout { fail "(timeout) print *lp" ; return }
  457.     }
  458.  
  459.     # Continue; should stop at call3b and print actual arguments.
  460.     # Try dereferencing the arguments.
  461.  
  462.     send "cont\n"
  463.     expect {
  464.     -re ".* call3b \(ucp=$hex \"b\", usp=$hex, uip=$hex, ulp=$hex\) .*$prompt $" {}
  465.     -re "$prompt $" { fail "continue to call3b" ; return }
  466.     timeout { fail "(timeout) continue to call3b" ; return }
  467.     }
  468.  
  469.     send "print *ucp\n"
  470.     expect {
  471.     -re ".* = 98 'b'\r\n$prompt $" {}
  472.     -re "$prompt $" { fail "print *ucp" ; return }
  473.     timeout { fail "(timeout) print *ucp" ; return }
  474.     }
  475.     send "print *usp\n"
  476.     expect {
  477.     -re ".* = 6\r\n$prompt $" {}
  478.     -re "$prompt $" { fail "print *usp" ; return }
  479.     timeout { fail "(timeout) print *usp" ; return }
  480.     }
  481.     send "print *uip\n"
  482.     expect {
  483.     -re ".* = 7\r\n$prompt $" {}
  484.     -re "$prompt $" { fail "print *uip" ; return }
  485.     timeout { fail "(timeout) print *uip" ; return }
  486.     }
  487.     send "print *ulp\n"
  488.     expect {
  489.     -re ".* = 8\r\n$prompt $" {}
  490.     -re "$prompt $" { fail "print *ulp" ; return }
  491.     timeout { fail "(timeout) print *ulp" ; return }
  492.     }
  493.  
  494.     # Continue; should stop at call3c and print actual arguments.
  495.     # Try dereferencing the arguments.
  496.  
  497.     send "cont\n"
  498.     expect {
  499.     -re ".* call3c \(fp=$hex, dp=$hex\) .*$prompt $" {}
  500.     -re "$prompt $" { fail "continue to call3c" ; return }
  501.     timeout { fail "(timeout) continue to call3c" ; return }
  502.     }
  503.  
  504.     send "print *fp\n"
  505.     expect {
  506.     -re ".* = 4\r\n$prompt $" {}
  507.     -re "$prompt $" { fail "print *fp" ; return }
  508.     timeout { fail "(timeout) print *fp" ; return }
  509.     }
  510.     send "print *dp\n"
  511.     expect {
  512.     -re ".* = 5\r\n$prompt $" {}
  513.     -re "$prompt $" { fail "print *dp" ; return }
  514.     timeout { fail "(timeout) print *dp" ; return }
  515.     }
  516.  
  517.     pass "locate actual args, pointer types"
  518. }
  519.  
  520. #
  521. # Locate actual args; structures and unions passed by reference.
  522. #
  523.  
  524. proc structs_by_reference {} {
  525.     global prompt
  526.     global hex
  527.     global det_file
  528.  
  529.     delete_breakpoints
  530.  
  531.     send "break call4a\n" ; expect -re ".*$prompt $"
  532.     send "break call4b\n" ; expect -re ".*$prompt $"
  533.  
  534.     # Run; should stop at call4a and print actual arguments.
  535.     # Try dereferencing the arguments.
  536.  
  537.     # The a29k fails all of these tests, perhaps because the prologue
  538.     # code is broken.
  539.     setup_xfail "a29k-*-udi"
  540.     send "run\n"
  541.     expect {
  542.     -re "The program .* has been started already.* \(y or n\) $" {
  543.         send "y\n"
  544.         continue -expect
  545.     }
  546.     -re ".* call4a \(stp=$hex\) .*$prompt $" {}
  547.     -re "$prompt $" { fail "run to call4a" ; return }
  548.     timeout { fail "(timeout) run to call4a" ; return }
  549.     }
  550.  
  551.     # The mips prologue stuff is broken, and mishandles this.
  552.     setup_xfail "mips-*-*"
  553.     send "print *stp\n"
  554.     expect {
  555.     -re ".* = \{s1 = 101, s2 = 102\}\r\n$prompt $" {}
  556.     -re "$prompt $" { fail "print *stp" ; return }
  557.     timeout { fail "(timeout) print *stp" ; return }
  558.     }
  559.  
  560.     # Continue; should stop at call4b and print actual arguments.
  561.     # Try dereferencing the arguments.
  562.  
  563.     send "cont\n"
  564.     expect {
  565.     -re ".* call4b \(unp=$hex\) .*$prompt $" {}
  566.     -re "$prompt $" { fail "continue to call4b" ; return }
  567.     timeout { fail "(timeout) continue to call4b" ; return }
  568.     }
  569.  
  570.     send "print *unp\n"
  571.     expect {
  572.     -re ".* = \{u1 = 1, u2 = 1\}\r\n$prompt $" {}
  573.     -re "$prompt $" { fail "print *unp" ; return }
  574.     timeout { fail "(timeout) print *unp" ; return }
  575.     }
  576.  
  577.     pass "locate actual args, structs/unions passed by reference"
  578. }
  579.  
  580. #
  581. # Locate actual args; structures and unions passed by value.
  582. #
  583.  
  584. proc structs_by_value {} {
  585.     global prompt
  586.     global hex
  587.     global det_file
  588.  
  589.     delete_breakpoints
  590.  
  591.     send "break call5a\n" ; expect -re ".*$prompt $"
  592.     send "break call5b\n" ; expect -re ".*$prompt $"
  593.  
  594.     # Run; should stop at call5a and print actual arguments.
  595.     # Try dereferencing the arguments.
  596.  
  597.     # The mips prologue stuff is broken, and mishandles this.
  598.     setup_xfail "mips-*-*"
  599.     # The a29k fails all of these tests, perhaps because the prologue
  600.     # code is broken.
  601.     setup_xfail "a29k-*-udi"
  602.     send "run\n"
  603.     expect {
  604.     -re "The program .* has been started already.* \(y or n\) $" {
  605.         send "y\n"
  606.         continue -expect
  607.     }
  608.     -re ".* call5a \(st=\{s1 = 101, s2 = 102\}\) .*$prompt $" {}
  609.     -re "$prompt $" { fail "run to call5a" ; return }
  610.     timeout { fail "(timeout) run to call5a" ; return }
  611.     }
  612.  
  613.     send "print st\n"
  614.     expect {
  615.     -re ".* = \{s1 = 101, s2 = 102\}\r\n$prompt $" {}
  616.     -re "$prompt $" { fail "print st" ; return }
  617.     timeout { fail "(timeout) print st" ; return }
  618.     }
  619.  
  620.     # Continue; should stop at call5b and print actual arguments.
  621.     # Try dereferencing the arguments.
  622.  
  623.     send "cont\n"
  624.     expect {
  625.     -re ".* call5b \(un=\{u1 = 2, u2 = 2\}\) .*$prompt $" {}
  626.     -re "$prompt $" { fail "continue to call5b" ; return }
  627.     timeout { fail "(timeout) continue to call5b" ; return }
  628.     }
  629.  
  630.     send "print un\n"
  631.     expect {
  632.     -re ".* = \{u1 = 2, u2 = 2\}\r\n$prompt $" {}
  633.     -re "$prompt $" { fail "print un" ; return }
  634.     timeout { fail "(timeout) print un" ; return }
  635.     }
  636.  
  637.     pass "locate actual args, structs/unions passed by value"
  638. }
  639.  
  640. #
  641. # Locate actual args; discard, shuffle, and call
  642. #
  643.  
  644. proc discard_and_shuffle {} {
  645.     global prompt
  646.     global hex
  647.     global decimal
  648.     global det_file
  649.  
  650.     delete_breakpoints
  651.  
  652.     send "break call6a\n" ; expect -re ".*$prompt $"
  653.     send "break call6b\n" ; expect -re ".*$prompt $"
  654.     send "break call6c\n" ; expect -re ".*$prompt $"
  655.     send "break call6d\n" ; expect -re ".*$prompt $"
  656.     send "break call6e\n" ; expect -re ".*$prompt $"
  657.     send "break call6f\n" ; expect -re ".*$prompt $"
  658.     send "break call6g\n" ; expect -re ".*$prompt $"
  659.     send "break call6h\n" ; expect -re ".*$prompt $"
  660.     send "break call6i\n" ; expect -re ".*$prompt $"
  661.     send "break call6j\n" ; expect -re ".*$prompt $"
  662.     send "break call6k\n" ; expect -re ".*$prompt $"
  663.  
  664.     # Run; should stop at call6a and print actual arguments.
  665.     # Print backtrace.
  666.  
  667.     # The a29k fails all of these tests, perhaps because the prologue
  668.     # code is broken.
  669.     setup_xfail "a29k-*-udi"
  670.     send "run\n"
  671.     expect {
  672.     -re "The program .* has been started already.* \(y or n\) $" {
  673.         send "y\n"
  674.         continue -expect
  675.     }
  676.     -re ".*Breakpoint $decimal, call6a .*$prompt $" {}
  677.     -re "$prompt $" { fail "run to call6a" ; return }
  678.     timeout { fail "(timeout) run to call6a" ; return }
  679.     }
  680.  
  681.     send "backtrace 100\n"
  682.     expect {
  683.     -re "backtrace 100\r
  684. .* call6a \(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  685. .* main \(\) .*\r
  686. $prompt $" {}
  687.     -re "$prompt $" { fail "backtrace from call6a" ; return }
  688.     timeout { fail "(timeout) backtrace from call6a" ; return }
  689.     }
  690.  
  691.     # Continue; should stop at call6b and print actual arguments.
  692.     # Print backtrace.
  693.  
  694.     send "continue\n"
  695.     expect {
  696.     -re ".*Breakpoint $decimal, call6b .*$prompt $" {}
  697.     -re "$prompt $" { fail "continue to call6b" ; return }
  698.     timeout { fail "(timeout) continue to call6b" ; return }
  699.     }
  700.  
  701.     send "backtrace 100\n"
  702.     expect {
  703.     -re "backtrace 100\r
  704. .* call6b \(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  705. .* call6a \(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  706. .* main \(\) .*\r
  707. $prompt $" {}
  708.     -re "$prompt $" { fail "backtrace from call6b" ; return }
  709.     timeout { fail "(timeout) backtrace from call6b" ; return }
  710.     }
  711.  
  712.     # Continue; should stop at call6c and print actual arguments.
  713.     # Print backtrace.
  714.  
  715.     send "continue\n"
  716.     expect {
  717.     -re ".*Breakpoint $decimal, call6c .*$prompt $" {}
  718.     -re "$prompt $" { fail "continue to call6c" ; return }
  719.     timeout { fail "(timeout) continue to call6c" ; return }
  720.     }
  721.  
  722.     send "backtrace 100\n"
  723.     expect {
  724.     -re "backtrace 100\r
  725. .* call6c \(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  726. .* call6b \(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  727. .* call6a \(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  728. .* main \(\) .*\r
  729. $prompt $" {}
  730.     -re "$prompt $" { fail "backtrace from call6c" ; return }
  731.     timeout { fail "(timeout) backtrace from call6c" ; return }
  732.     }
  733.  
  734.     # Continue; should stop at call6d and print actual arguments.
  735.     # Print backtrace.
  736.  
  737.     send "continue\n"
  738.     expect {
  739.     -re ".*Breakpoint $decimal, call6d .*$prompt $" {}
  740.     -re "$prompt $" { fail "continue to call6d" ; return }
  741.     timeout { fail "(timeout) continue to call6d" ; return }
  742.     }
  743.  
  744.     send "backtrace 100\n"
  745.     expect {
  746.     -re "backtrace 100\r
  747. .* call6d \(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  748. .* call6c \(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  749. .* call6b \(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  750. .* call6a \(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  751. .* main \(\) .*\r
  752. $prompt $" {}
  753.     -re "$prompt $" { fail "backtrace from call6d" ; return }
  754.     timeout { fail "(timeout) backtrace from call6d" ; return }
  755.     }
  756.  
  757.     # Continue; should stop at call6e and print actual arguments.
  758.     # Print backtrace.
  759.  
  760.     send "continue\n"
  761.     expect {
  762.     -re ".*Breakpoint $decimal, call6e .*$prompt $" {}
  763.     -re "$prompt $" { fail "continue to call6e" ; return }
  764.     timeout { fail "(timeout) continue to call6e" ; return }
  765.     }
  766.  
  767.     send "backtrace 100\n"
  768.     expect {
  769.     -re "backtrace 100\r
  770. .* call6e \(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  771. .* call6d \(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  772. .* call6c \(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  773. .* call6b \(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  774. .* call6a \(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  775. .* main \(\) .*\r
  776. $prompt $" {}
  777.     -re "$prompt $" { fail "backtrace from call6e" ; return }
  778.     timeout { fail "(timeout) backtrace from call6e" ; return }
  779.     }
  780.  
  781.     # Continue; should stop at call6f and print actual arguments.
  782.     # Print backtrace.
  783.  
  784.     send "continue\n"
  785.     expect {
  786.     -re ".*Breakpoint $decimal, call6f .*$prompt $" {}
  787.     -re "$prompt $" { fail "continue to call6f" ; return }
  788.     timeout { fail "(timeout) continue to call6f" ; return }
  789.     }
  790.  
  791.     send "backtrace 100\n"
  792.     expect {
  793.     -re "backtrace 100\r
  794. .* call6f \(d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  795. .* call6e \(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  796. .* call6d \(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  797. .* call6c \(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  798. .* call6b \(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  799. .* call6a \(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  800. .* main \(\) .*\r
  801. $prompt $" {}
  802.     -re "$prompt $" { fail "backtrace from call6f" ; return }
  803.     timeout { fail "(timeout) backtrace from call6f" ; return }
  804.     }
  805.  
  806.     # Continue; should stop at call6g and print actual arguments.
  807.     # Print backtrace.
  808.  
  809.     send "continue\n"
  810.     expect {
  811.     -re ".*Breakpoint $decimal, call6g .*$prompt $" {}
  812.     -re "$prompt $" { fail "continue to call6g" ; return }
  813.     timeout { fail "(timeout) continue to call6g" ; return }
  814.     }
  815.  
  816.     send "backtrace 100\n"
  817.     expect {
  818.     -re "backtrace 100\r
  819. .* call6g \(uc=98 'b', us=6, ui=7, ul=8\) .*\r
  820. .* call6f \(d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  821. .* call6e \(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  822. .* call6d \(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  823. .* call6c \(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  824. .* call6b \(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  825. .* call6a \(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  826. .* main \(\) .*\r
  827. $prompt $" {}
  828.     -re "$prompt $" { fail "backtrace from call6g" ; return }
  829.     timeout { fail "(timeout) backtrace from call6g" ; return }
  830.     }
  831.  
  832.     # Continue; should stop at call6h and print actual arguments.
  833.     # Print backtrace.
  834.  
  835.     send "continue\n"
  836.     expect {
  837.     -re ".*Breakpoint $decimal, call6h .*$prompt $" {}
  838.     -re "$prompt $" { fail "continue to call6h" ; return }
  839.     timeout { fail "(timeout) continue to call6h" ; return }
  840.     }
  841.  
  842.     send "backtrace 100\n"
  843.     expect {
  844.     -re "backtrace 100\r
  845. .* call6h \(us=6, ui=7, ul=8\) .*\r
  846. .* call6g \(uc=98 'b', us=6, ui=7, ul=8\) .*\r
  847. .* call6f \(d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  848. .* call6e \(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  849. .* call6d \(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  850. .* call6c \(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  851. .* call6b \(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  852. .* call6a \(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  853. .* main \(\) .*\r
  854. $prompt $" {}
  855.     -re "$prompt $" { fail "backtrace from call6h" ; return }
  856.     timeout { fail "(timeout) backtrace from call6h" ; return }
  857.     }
  858.  
  859.     # Continue; should stop at call6i and print actual arguments.
  860.     # Print backtrace.
  861.  
  862.     send "continue\n"
  863.     expect {
  864.     -re ".*Breakpoint $decimal, call6i .*$prompt $" {}
  865.     -re "$prompt $" { fail "continue to call6i" ; return }
  866.     timeout { fail "(timeout) continue to call6i" ; return }
  867.     }
  868.  
  869.     send "backtrace 100\n"
  870.     expect {
  871.     -re "backtrace 100\r
  872. .* call6i \(ui=7, ul=8\) .*\r
  873. .* call6h \(us=6, ui=7, ul=8\) .*\r
  874. .* call6g \(uc=98 'b', us=6, ui=7, ul=8\) .*\r
  875. .* call6f \(d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  876. .* call6e \(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  877. .* call6d \(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  878. .* call6c \(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  879. .* call6b \(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  880. .* call6a \(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  881. .* main \(\) .*\r
  882. $prompt $" {}
  883.     -re "$prompt $" { fail "backtrace from call6i" ; return }
  884.     timeout { fail "(timeout) backtrace from call6i" ; return }
  885.     }
  886.  
  887.     # Continue; should stop at call6j and print actual arguments.
  888.     # Print backtrace.
  889.  
  890.     send "continue\n"
  891.     expect {
  892.     -re ".*Breakpoint $decimal, call6j .*$prompt $" {}
  893.     -re "$prompt $" { fail "continue to call6j" ; return }
  894.     timeout { fail "(timeout) continue to call6j" ; return }
  895.     }
  896.  
  897.     send "backtrace 100\n"
  898.     expect {
  899.     -re "backtrace 100\r
  900. .* call6j \(ul=8\) .*\r
  901. .* call6i \(ui=7, ul=8\) .*\r
  902. .* call6h \(us=6, ui=7, ul=8\) .*\r
  903. .* call6g \(uc=98 'b', us=6, ui=7, ul=8\) .*\r
  904. .* call6f \(d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  905. .* call6e \(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  906. .* call6d \(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  907. .* call6c \(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  908. .* call6b \(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  909. .* call6a \(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  910. .* main \(\) .*\r
  911. $prompt $" {}
  912.     -re "$prompt $" { fail "backtrace from call6j" ; return }
  913.     timeout { fail "(timeout) backtrace from call6j" ; return }
  914.     }
  915.  
  916.     # Continue; should stop at call6k and print actual arguments.
  917.     # Print backtrace.
  918.     # This fails on i960-*-vxworks because gdb gets confused by
  919.     # breakpoints on adjacent instructions.
  920.     setup_xfail "i960-*-vxworks" 1786
  921.     send "continue\n"
  922.     expect {
  923.     -re ".*Breakpoint $decimal, call6k .*$prompt $" {}
  924.     -re "$prompt $" { fail "continue to call6k"; return }
  925.     timeout { fail "(timeout) continue to call6k"; return }
  926.     }
  927.  
  928.     send "backtrace 100\n"
  929.     expect {
  930.     -re "backtrace 100\r
  931. .* call6k \(\) .*\r
  932. .* call6j \(ul=8\) .*\r
  933. .* call6i \(ui=7, ul=8\) .*\r
  934. .* call6h \(us=6, ui=7, ul=8\) .*\r
  935. .* call6g \(uc=98 'b', us=6, ui=7, ul=8\) .*\r
  936. .* call6f \(d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  937. .* call6e \(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  938. .* call6d \(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  939. .* call6c \(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  940. .* call6b \(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  941. .* call6a \(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\) .*\r
  942. .* main \(\) .*\r
  943. $prompt $" {}
  944.     -re "$prompt $" { fail "backtrace from call6k" ; return }
  945.     timeout { fail "(timeout) backtrace from call6k" ; return }
  946.     }
  947.  
  948.     pass "locate actual args, discard, shuffle, and call"
  949. }
  950.  
  951. #
  952. # Locate actual args; shuffle round robin and call
  953. #
  954.  
  955. proc shuffle_round_robin {} {
  956.     global prompt
  957.     global hex
  958.     global decimal
  959.     global det_file
  960.  
  961.     delete_breakpoints
  962.  
  963.     send "break call7a\n" ; expect -re ".*$prompt $"
  964.     send "break call7b\n" ; expect -re ".*$prompt $"
  965.     send "break call7c\n" ; expect -re ".*$prompt $"
  966.     send "break call7d\n" ; expect -re ".*$prompt $"
  967.     send "break call7e\n" ; expect -re ".*$prompt $"
  968.     send "break call7f\n" ; expect -re ".*$prompt $"
  969.     send "break call7g\n" ; expect -re ".*$prompt $"
  970.     send "break call7h\n" ; expect -re ".*$prompt $"
  971.     send "break call7i\n" ; expect -re ".*$prompt $"
  972.     send "break call7j\n" ; expect -re ".*$prompt $"
  973.     send "break call7k\n" ; expect -re ".*$prompt $"
  974.  
  975.     # Run; should stop at call7a and print actual arguments.
  976.     # Print backtrace.
  977.  
  978.     # The a29k fails all of these tests, perhaps because the prologue
  979.     # code is broken.
  980.     setup_xfail "a29k-*-udi"
  981.     send "run\n"
  982.     expect {
  983.     -re "The program .* has been started already.* \(y or n\) $" {
  984.         send "y\n"
  985.         continue -expect
  986.     }
  987.     -re ".*Breakpoint $decimal, call7a .*$prompt $" {}
  988.     -re "$prompt $" { fail "run to call7a" ; return }
  989.     timeout { fail "(timeout) run to call7a" ; return }
  990.     }
  991.  
  992.     setup_xfail "i960-*-*" 1813
  993.     send "backtrace 100\n"
  994.     expect {
  995.     -re "backtrace 100\r
  996. .* call7a \(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\) .*\r
  997. .* main \(\) .*\r
  998. $prompt $" {}
  999.     -re "$prompt $" { fail "backtrace from call7a" ; return }
  1000.     timeout { fail "(timeout) backtrace from call7a" ; return }
  1001.     }
  1002.  
  1003.     # Continue; should stop at call7b and print actual arguments.
  1004.     # Print backtrace.
  1005.  
  1006.     send "continue\n"
  1007.     expect {
  1008.     -re ".*Breakpoint $decimal, call7b .*$prompt $" {}
  1009.     -re "$prompt $" { fail "continue to call7b" ; return }
  1010.     timeout { fail "(timeout) continue to call7b" ; return }
  1011.     }
  1012.  
  1013.     send "backtrace 100\n"
  1014.     expect {
  1015.     -re "backtrace 100\r
  1016. .* call7b \(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\) .*\r
  1017. .* call7a \(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\) .*\r
  1018. .* main \(\) .*\r
  1019. $prompt $" {}
  1020.     -re "$prompt $" { fail "backtrace from call7b" ; return }
  1021.     timeout { fail "(timeout) backtrace from call7b" ; return }
  1022.     }
  1023.  
  1024.     # Continue; should stop at call7c and print actual arguments.
  1025.     # Print backtrace.
  1026.  
  1027.     send "continue\n"
  1028.     expect {
  1029.     -re ".*Breakpoint $decimal, call7c .*$prompt $" {}
  1030.     -re "$prompt $" { fail "continue to call7c" ; return }
  1031.     timeout { fail "(timeout) continue to call7c" ; return }
  1032.     }
  1033.  
  1034.     send "backtrace 100\n"
  1035.     expect {
  1036.     -re "backtrace 100\r
  1037. .* call7c \(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\) .*\r
  1038. .* call7b \(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\) .*\r
  1039. .* call7a \(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\) .*\r
  1040. .* main \(\) .*\r
  1041. $prompt $" {}
  1042.     -re "$prompt $" { fail "backtrace from call7c" ; return }
  1043.     timeout { fail "(timeout) backtrace from call7c" ; return }
  1044.     }
  1045.  
  1046.     # Continue; should stop at call7d and print actual arguments.
  1047.     # Print backtrace.
  1048.  
  1049.     send "continue\n"
  1050.     expect {
  1051.     -re ".*Breakpoint $decimal, call7d .*$prompt $" {}
  1052.     -re "$prompt $" { fail "continue to call7d" ; return }
  1053.     timeout { fail "(timeout) continue to call7d" ; return }
  1054.     }
  1055.  
  1056.     send "backtrace 100\n"
  1057.     expect {
  1058.     -re "backtrace 100\r
  1059. .* call7d \(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\) .*\r
  1060. .* call7c \(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\) .*\r
  1061. .* call7b \(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\) .*\r
  1062. .* call7a \(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\) .*\r
  1063. .* main \(\) .*\r
  1064. $prompt $" {}
  1065.     -re "$prompt $" { fail "backtrace from call7d" ; return }
  1066.     timeout { fail "(timeout) backtrace from call7d" ; return }
  1067.     }
  1068.  
  1069.     # Continue; should stop at call7e and print actual arguments.
  1070.     # Print backtrace.
  1071.  
  1072.     send "continue\n"
  1073.     expect {
  1074.     -re "Breakpoint $decimal, call7e .*$prompt $" {}
  1075.     -re "$prompt $" { fail "continue to call7e" ; return }
  1076.     timeout { fail "(timeout) continue to call7e" ; return }
  1077.     }
  1078.  
  1079.     send "backtrace 100\n"
  1080.     expect {
  1081.     -re "backtrace 100\r
  1082. .* call7e \(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\) .*\r
  1083. .* call7d \(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\) .*\r
  1084. .* call7c \(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\) .*\r
  1085. .* call7b \(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\) .*\r
  1086. .* call7a \(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\) .*\r
  1087. .* main \(\) .*\r
  1088. $prompt $" {}
  1089.     -re "$prompt $" { fail "backtrace from call7e" ; return }
  1090.     timeout { fail "(timeout) backtrace from call7e" ; return }
  1091.     }
  1092.  
  1093.     # Continue; should stop at call7f and print actual arguments.
  1094.     # Print backtrace.
  1095.  
  1096.     send "continue\n"
  1097.     expect {
  1098.     -re ".*Breakpoint $decimal, call7f .*$prompt $" {}
  1099.     -re "$prompt $" { fail "continue to call7f" ; return }
  1100.     timeout { fail "(timeout) continue to call7f" ; return }
  1101.     }
  1102.  
  1103.     send "backtrace 100\n"
  1104.     expect {
  1105.     -re "backtrace 100\r
  1106. .* call7f \(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\) .*\r
  1107. .* call7e \(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\) .*\r
  1108. .* call7d \(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\) .*\r
  1109. .* call7c \(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\) .*\r
  1110. .* call7b \(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\) .*\r
  1111. .* call7a \(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\) .*\r
  1112. .* main \(\) .*\r
  1113. $prompt $" {}
  1114.     -re "$prompt $" { fail "backtrace from call7f" ; return }
  1115.     timeout { fail "(timeout) backtrace from call7f" ; return }
  1116.     }
  1117.  
  1118.     # Continue; should stop at call7g and print actual arguments.
  1119.     # Print backtrace.
  1120.  
  1121.     send "continue\n"
  1122.     expect {
  1123.     -re ".*Breakpoint $decimal, call7g .*$prompt $" {}
  1124.     -re "$prompt $" { fail "continue to call7g" ; return }
  1125.     timeout { fail "(timeout) continue to call7g" ; return }
  1126.     }
  1127.  
  1128.     send "backtrace 100\n"
  1129.     expect {
  1130.     -re "backtrace 100\r
  1131. .* call7g \(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\) .*\r
  1132. .* call7f \(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\) .*\r
  1133. .* call7e \(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\) .*\r
  1134. .* call7d \(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\) .*\r
  1135. .* call7c \(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\) .*\r
  1136. .* call7b \(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\) .*\r
  1137. .* call7a \(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\) .*\r
  1138. .* main \(\) .*\r
  1139. $prompt $" {}
  1140.     -re "$prompt $" { fail "backtrace from call7g" ; return }
  1141.     timeout { fail "(timeout) backtrace from call7g" ; return }
  1142.     }
  1143.  
  1144.     # Continue; should stop at call7h and print actual arguments.
  1145.     # Print backtrace.
  1146.  
  1147.     send "continue\n"
  1148.     expect {
  1149.     -re ".*Breakpoint $decimal, call7h .*$prompt $" {}
  1150.     -re "$prompt $" { fail "continue to call7h" ; return }
  1151.     timeout { fail "(timeout) continue to call7h" ; return }
  1152.     }
  1153.  
  1154.     send "backtrace 100\n"
  1155.     expect {
  1156.     -re "backtrace 100\r
  1157. .* call7h \(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\) .*\r
  1158. .* call7g \(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\) .*\r
  1159. .* call7f \(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\) .*\r
  1160. .* call7e \(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\) .*\r
  1161. .* call7d \(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\) .*\r
  1162. .* call7c \(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\) .*\r
  1163. .* call7b \(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\) .*\r
  1164. .* call7a \(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\) .*\r
  1165. .* main \(\) .*\r
  1166. $prompt $" {}
  1167.     -re "$prompt $" { fail "backtrace from call7h" ; return }
  1168.     timeout { fail "(timeout) backtrace from call7h" ; return }
  1169.     }
  1170.  
  1171.     # Continue; should stop at call7i and print actual arguments.
  1172.     # Print backtrace.
  1173.  
  1174.     send "continue\n"
  1175.     expect {
  1176.     -re ".*Breakpoint $decimal, call7i .*$prompt $" {}
  1177.     -re "$prompt $" { fail "continue to call7i" ; return }
  1178.     timeout { fail "(timeout) continue to call7i" ; return }
  1179.     }
  1180.  
  1181.     send "backtrace 100\n"
  1182.     expect {
  1183.     -re "backtrace 100\r
  1184. .* call7i \(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\) .*\r
  1185. .* call7h \(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\) .*\r
  1186. .* call7g \(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\) .*\r
  1187. .* call7f \(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\) .*\r
  1188. .* call7e \(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\) .*\r
  1189. .* call7d \(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\) .*\r
  1190. .* call7c \(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\) .*\r
  1191. .* call7b \(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\) .*\r
  1192. .* call7a \(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\) .*\r
  1193. .* main \(\) .*\r
  1194. $prompt $" {}
  1195.     -re "$prompt $" { fail "backtrace from call7i" ; return }
  1196.     timeout { fail "(timeout) backtrace from call7i" ; return }
  1197.     }
  1198.  
  1199.     # Continue; should stop at call7j and print actual arguments.
  1200.     # Print backtrace.
  1201.  
  1202.     send "continue\n"
  1203.     expect {
  1204.     -re ".*Breakpoint $decimal, call7j .*$prompt $" {}
  1205.     -re "$prompt $" { fail "continue to call7j" ; return }
  1206.     timeout { fail "(timeout) continue to call7j" ; return }
  1207.     }
  1208.  
  1209.     send "backtrace 100\n"
  1210.     expect {
  1211.     -re "backtrace 100\r
  1212. .* call7j \(ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\) .*\r
  1213. .* call7i \(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\) .*\r
  1214. .* call7h \(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\) .*\r
  1215. .* call7g \(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\) .*\r
  1216. .* call7f \(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\) .*\r
  1217. .* call7e \(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\) .*\r
  1218. .* call7d \(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\) .*\r
  1219. .* call7c \(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\) .*\r
  1220. .* call7b \(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\) .*\r
  1221. .* call7a \(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\) .*\r
  1222. .* main \(\) .*\r
  1223. $prompt $" {}
  1224.     -re "$prompt $" { fail "backtrace from call7j" ; return }
  1225.     timeout { fail "(timeout) backtrace from call7j" ; return }
  1226.     }
  1227.  
  1228.     # Continue; should stop at call7k and print actual arguments.
  1229.     # Print backtrace.
  1230.  
  1231.     send "continue\n"
  1232.     expect {
  1233.     -re ".*Breakpoint $decimal, call7k .*$prompt $" {}
  1234.     -re "$prompt $" { fail "continue to call7k" ; return }
  1235.     timeout { fail "(timeout) continue to call7k" ; return }
  1236.     }
  1237.  
  1238.     send "backtrace 100\n"
  1239.     expect {
  1240.     -re "backtrace 100\r
  1241. .* call7k \(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\) .*\r
  1242. .* call7j \(ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\) .*\r
  1243. .* call7i \(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\) .*\r
  1244. .* call7h \(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\) .*\r
  1245. .* call7g \(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\) .*\r
  1246. .* call7f \(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\) .*\r
  1247. .* call7e \(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\) .*\r
  1248. .* call7d \(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\) .*\r
  1249. .* call7c \(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\) .*\r
  1250. .* call7b \(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\) .*\r
  1251. .* call7a \(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\) .*\r
  1252. .* main \(\) .*\r
  1253. $prompt $" {}
  1254.     -re "$prompt $" { fail "backtrace from call7k" ; return }
  1255.     timeout { fail "(timeout) backtrace from call7k" ; return }
  1256.     }
  1257.  
  1258.     pass "locate actual args, shuffle round robin and call"
  1259. }
  1260.  
  1261. #
  1262. # Locate actual args; recursive passing of structs by value
  1263. #
  1264.  
  1265. proc recursive_structs_by_value {} {
  1266.     global prompt
  1267.     global hex
  1268.     global decimal
  1269.     global det_file
  1270.  
  1271.     delete_breakpoints
  1272.  
  1273.     send "break hitbottom\n" ; expect -re ".*$prompt $"
  1274.  
  1275.     # Run; should stop at hitbottom and print actual arguments.
  1276.     # Print backtrace.
  1277.  
  1278.     send "run\n"
  1279.     expect {
  1280.     -re "The program .* has been started already.* \(y or n\) $" {
  1281.         send "y\n"
  1282.         continue -expect
  1283.     }
  1284.     -re ".*Breakpoint $decimal, hitbottom .*$prompt $" {}
  1285.     -re "$prompt $" { fail "run to hitbottom" ; return }
  1286.     timeout { fail "(timeout) run to hitbottom" ; return }
  1287.     }
  1288.  
  1289.     # The a29k fails all of these tests, perhaps because the prologue
  1290.     # code is broken.
  1291.     setup_xfail "a29k-*-udi"
  1292.     send "backtrace 100\n"
  1293.     expect {
  1294.     -re "backtrace 100\r
  1295. .* hitbottom \(\) .*\r
  1296. .* recurse \(a=\{s = 0, i = 0, l = 0\}, depth=0\) .*\r
  1297. .* recurse \(a=\{s = 1, i = 1, l = 1\}, depth=1\) .*\r
  1298. .* recurse \(a=\{s = 2, i = 2, l = 2\}, depth=2\) .*\r
  1299. .* recurse \(a=\{s = 3, i = 3, l = 3\}, depth=3\) .*\r
  1300. .* recurse \(a=\{s = 4, i = 4, l = 4\}, depth=4\) .*\r
  1301. .* test_struct_args \(\) .*\r
  1302. .* main \(\) .*\r
  1303. $prompt $" {}
  1304.     -re "$prompt $" { fail "recursive passing of structs by value" ; return }
  1305.     timeout { fail "(timeout) recursive passing of structs by value" ; return }
  1306.     }
  1307.  
  1308.     pass "locate actual args, recursive structs by value"
  1309. }
  1310.  
  1311. proc funcargs_a29k_reload { } {
  1312.     global objdir
  1313.     global subdir
  1314.     global binfile
  1315.  
  1316.     if [istarget "a29k-*-udi"] then {
  1317.     # FIXME: If PR 2415 is fixed, this is not needed.
  1318.     gdb_target_udi
  1319.     gdb_load $objdir/$subdir/$binfile
  1320.     }
  1321. }
  1322.  
  1323. # Start with a fresh gdb.
  1324.  
  1325. gdb_exit
  1326. gdb_start
  1327. gdb_reinitialize_dir $srcdir/$subdir
  1328. gdb_load $objdir/$subdir/$binfile
  1329.  
  1330. set oldtimeout $timeout
  1331. set timeout 120
  1332.  
  1333. integral_args
  1334. funcargs_a29k_reload
  1335. unsigned_integral_args
  1336. funcargs_a29k_reload
  1337. float_and_integral_args
  1338. funcargs_a29k_reload
  1339. pointer_args
  1340. funcargs_a29k_reload
  1341. structs_by_reference
  1342. funcargs_a29k_reload
  1343. structs_by_value
  1344. funcargs_a29k_reload
  1345. discard_and_shuffle
  1346. funcargs_a29k_reload
  1347. shuffle_round_robin
  1348. funcargs_a29k_reload
  1349. recursive_structs_by_value
  1350.  
  1351. if [istarget "a29k-*-udi"] then {
  1352.     # FIXME: If PR 2415 is fixed, this is not needed.
  1353.     gdb_target_udi
  1354. }
  1355.  
  1356. set timeout $oldtimeout
  1357.