Re: [patch/rfc] Rewrite "structs" testcase

Michael Elizabeth Chastain
2003-11-08T01:05:58Z

The results are:

PASS FAIL
gcc 2.95.3 -gdwarf-2 544 40
gcc 2.95.3 -gstabs+ 544 40
gcc 3.3.2 -gdwarf-2 540 44
gcc 3.3.2 -gstabs+ 544 40

The problem is in this code:

# Now force a return. Be careful to only produce one PASS/FAIL.
send_gdb "return foo${n}\n"
gdb_expect {
-re "Make fun${n} return now.*y or n. $" {
send_gdb "y\n"
gdb_expect {
-re "L${n} *= fun${n}.*${gdb_prompt} $" {
# Need to step off the function call
gdb_test "next" "L.* *= fun.*" "${test}"
}
-re "${gdb_prompt} $" {
pass "${test}"
}
timeout {
fail "${test} (timeout)"
}
}
}
}

First there are duplicate "${test}" names in the output,
and some of them PASS and some of them FAIL. Confusion!

The real problem is what to do when the notorious
"location at which to store the function's return value is unknown"
happens. If that message happens, perhaps it is a KFAIL because
gdb cannot do what the user asked. Or perhaps it is okay because
a message was printed. I'm leaning towards the KFAIL, myself.

But the next bit of code:

# Finally check that the value returned ended up in "L${n}".
setup_fails ${fails} gdb/1444
gdb_test "p/c L${n}" " = [foo ${n}]" "${test}"

If "location unknown" has occurred, then it's not even worthwhile
to execute this at all. Once gdb has informed the user about
"location unknown" then there should be no expectation on the
part of the user that the return value will get stored into memory.

Maybe gdb needs to print an additional message to make it
more clear to the user:

The location at which to store the function's return value is unknown.
If you continue, the return value that you specified will be ignored.
Make fun1 return now? (y or n) y

Then in the test script, if you get "location unknown", issue a KFAIL
(or do whatever) and skip a test or two.

I put up a tarball here:

ftp://ftp.shout.net/pub/users/mec/gdb/2003-11-06.tar.gz

(The filename is lame because I made 2003-11-06-2 yesterday).

Michael C