Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* gdb_expect and default{} vs timeout{}
@ 2001-02-14 21:36 Andrew Cagney
  2001-02-15 22:53 ` Fernando Nasser
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2001-02-14 21:36 UTC (permalink / raw)
  To: GDB Discussion

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?

	Andrew


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gdb_expect and default{} vs timeout{}
  2001-02-14 21:36 gdb_expect and default{} vs timeout{} Andrew Cagney
@ 2001-02-15 22:53 ` Fernando Nasser
  2001-02-16  8:45   ` Andrew Cagney
  0 siblings, 1 reply; 4+ messages in thread
From: Fernando Nasser @ 2001-02-15 22:53 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: GDB Discussion

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gdb_expect and default{} vs timeout{}
  2001-02-15 22:53 ` Fernando Nasser
@ 2001-02-16  8:45   ` Andrew Cagney
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Cagney @ 2001-02-16  8:45 UTC (permalink / raw)
  To: Fernando Nasser; +Cc: GDB Discussion

Fernando Nasser wrote:

> Sorry for the delay.

This is definitly far from urgent.  Thanks for the answer :-)

> 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).

Ah! OK.

> 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.

Yes, that is what I saw.  I was getting the default case rather than
timeout case printed when a timeout occured.

	Andrew


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gdb_expect and default{} vs timeout{}
@ 2001-02-14 21:48 Michael Elizabeth Chastain
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Elizabeth Chastain @ 2001-02-14 21:48 UTC (permalink / raw)
  To: ac131313, gdb

> If there is a default, will the timeout action ever occure?

It looks like default and timeout are synonyms.

  # dejagnu/lib/remote.exp
  # proc remote_expect
  if { ${x} == "eof" } {
      set save_next 1;
  } elseif { ${x} == "default" || ${x} == "timeout" } {
      if { $error_sect == "" } {
          set save_next 1;
      }
  }

All I know is what I see in the source.  I don't know why.

Michael


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-02-16  8:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-14 21:36 gdb_expect and default{} vs timeout{} Andrew Cagney
2001-02-15 22:53 ` Fernando Nasser
2001-02-16  8:45   ` Andrew Cagney
2001-02-14 21:48 Michael Elizabeth Chastain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox