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]
Other format: [Raw text]

Re: How do I get regexp from expect at gdb_expect?


 > 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


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