This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: gdb_expect and default{} vs timeout{}


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]