This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: How do I get regexp from expect at gdb_expect?
On Fri, Jan 28, 2005 at 07:09:15PM -0800, Paul Hilfinger wrote:
>
> > 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...
Thanks, I did see that, however, I think there is a problem because I'm
calling a Tcl function called 'gdb_expect', instead of expect. I don't
know how that change's the situation.
Bob Rossi