This is the mail archive of the gdb-patches@sourceware.org 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: [PATCH][TEST-CASE][DOC] Implementation of pipe to pass GDB's command output to a shell command.


On Sat, 03 Sep 2011 11:21:19 +0200, Abhijit Halder wrote:
> >> + Â Âregsub -all {\$[0-9]+} $fdata {} pattern
> >> + Â Âif ![string match $pattern " = 120 'x'\n"] then {
> >
> > Instead of regsub + string match just:
> > Â Âif ![string match "* = 120 'x'\n" $fdata] then {
> >
> The intention was to eliminate only numeric patterns here.
> Instead if I used "if ![string match "* = 120 'x'\n" $fdata] then {"
> following pattern will also match:
> $junk = 120 'x'
> that I did not want.

It is currently a common practice to match this kind of pattern just from
` = ' upwards such as:
gdb_test "p callme ()" " = 42"
etc. everywhere in the testsuite.

But if you want to match the initial $number part such as in
gdb_test "print test1.test" "\\$\[0-9\]* = true" "simple object, const bool"
then it is more simple by:
    if ![regexp {^\$[0-9]+ = 120 'x'\n$} $fdata] then {


Thanks,
Jan


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