gdb_expect and default{} vs timeout{}

Fernando Nasser fnasser@redhat.com
Thu Feb 15 22:53:00 GMT 2001


Andrew Cagney wrote:
> 
> Hello,
> 
> This is kind of a dejagnu question.  In pthreads.exp there is the code:
> 
>     gdb_expect {
>         ....
>         default {
>             fail "continue to bkpt at common_routine in thread 2
> (default)"
>         }
>         timeout {
>             fail "continue to bkpt at common_routine in thread 2
> (timeout)"
>         }
>     }
> 
> what I don't understand is the purpose that both of these serve.  If
> there is a default, will the timeout action ever occure?
> 

Sorry for the delay.

You are right, this is sort of weird.  

"default" is equivalent to `"eof" or "timeout"'.

If you want to do the same thing in both "eof" and "timeout" conditions,
then use "default" instead (just to save typing).

I don't think the code above, although redundant, will cause any harm. 
Probably the default clause will take precedence for being specified
first, so the timeout clause is never used.


-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9



More information about the Gdb mailing list