This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Fully anchor mi_gdb_test expected results.
On Thu, Aug 04, 2005 at 04:37:04PM -0400, Bob Rossi wrote:
> > proc string_to_regexp {str} {
> > set result $str
> > regsub -all {[]*+.|()^$\[]} $str {\\&} result
> > return $result
> > }
>
> This doesn't seem to work for the " character.
>
> Here's the input to string_to_regexp,
> 555-break-insert -t "\"basics.c\":28"
>
> Here's the output,
> 555-break-insert -t "\"basics\.c\":28"
>
> Here is what I need to pass the test (which I hand wrote),
> -break-insert -t \"\\\\\"basics.c\\\\\":28\"
>
> It's a little odd. The quote needs to be escaped once, which makes
> perfect sense to me. The \ char needs to be escaped with 3 back slashes,
> to make a total of 4. This is a little odd to me. Is that what
> string_to_regexp does?
>
> Any ideas?
Replace this:
regsub -all {[]*+.|()^$\[]} $str {\\&} result
with this:
regsub -all {[]*+.|()^$\[\\]} $str {\\&} result
i.e. add two backslashes before the closing break. Then does it work?
--
Daniel Jacobowitz
CodeSourcery, LLC