How do I get regexp from expect at gdb_expect?
Paul Hilfinger
hilfingr@EECS.Berkeley.EDU
Sat Jan 29 03:09:00 GMT 2005
> Hi,
>
> I'm using expect with GDB and I've come across a problem. For instance,
> say I have,
>
> gdb_expect $tmt {
> -re "(Ending remote debugging.*$mi_gdb_prompt\[ \]*$)" {
> # at this point, how do I get the string that matched the above
> # regex?
> }
> }
> }
Here is some relevant documentation:
Upon matching a pattern (or eof or full_buffer), any
matching and previously unmatched output is saved in
the variable expect_out(buffer) [as in $expect_out(buffer)].
Up to 9 regexp sub-
string matches are saved in the variables
expect_out(1,string) through expect_out(9,string). If
the -indices flag is used before a pattern, the start-
ing and ending indices (in a form suitable for lrange)
of the 10 strings are stored in the variables
expect_out(X,start) and expect_out(X,end) where X is a
digit, corresponds to the substring position in the
buffer. 0 refers to strings which matched the entire
pattern...
P. Hilfinger
More information about the Gdb
mailing list