Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Bob Rossi <bob@brasko.net>
To: gdb-patches@sources.redhat.com
Subject: Re: Fully anchor mi_gdb_test expected results.
Date: Thu, 04 Aug 2005 20:37:00 -0000	[thread overview]
Message-ID: <20050804203704.GA4472@white> (raw)
In-Reply-To: <20050804143238.GA11996@nevyn.them.org>

On Thu, Aug 04, 2005 at 10:32:38AM -0400, Daniel Jacobowitz wrote:
> On Thu, Aug 04, 2005 at 10:26:01AM -0400, Bob Rossi wrote:
> > > >   which simply allows any data at the beggining of the match. So I could
> > > >   easily modify an MI command to output "HAHAHA, YOU CAN'T TEST ME", as
> > > >   the first thing it outputs, and it would go unnoticed in the
> > > >   testsuite. Probably the reason this could not have been done before is
> > > >   because the MI input command was being echo'd back, and it would be
> > > >   complicated to match that data.
> > > 
> > > I am suggesting anchoring the pattern with a copy of what you expect to
> > > be echoed.  We already have code to escape a string into a regex.  We
> > > know what we sent to GDB.
> > 
> > I originally tried this, but failed because I did *not* know how to
> > escape a string into a regex. Is there a function written that does
> > this? I'll try it. 
> 
> # Given an input string, adds backslashes as needed to create a
> # regexp that will match the string.
> 
> 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?

Thanks,
Bob Rossi


  reply	other threads:[~2005-08-04 20:37 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-04  2:50 Bob Rossi
2005-08-04  4:11 ` Daniel Jacobowitz
2005-08-04 14:09   ` Bob Rossi
2005-08-04 14:18     ` Daniel Jacobowitz
2005-08-04 14:26       ` Bob Rossi
2005-08-04 14:33         ` Daniel Jacobowitz
2005-08-04 20:37           ` Bob Rossi [this message]
2005-08-04 20:48             ` Bob Rossi
2005-08-04 20:58               ` Daniel Jacobowitz
2005-08-04 21:17                 ` Bob Rossi
2005-08-04 20:57             ` Daniel Jacobowitz
2005-08-04 21:18               ` Bob Rossi
2005-08-04 22:40                 ` Bob Rossi
2005-08-04 22:43                   ` Daniel Jacobowitz
2005-08-04 23:50                     ` Bob Rossi
2005-09-18  1:32                       ` Daniel Jacobowitz
2005-09-18  2:10                         ` Bob Rossi
2005-09-21  1:26                         ` Bob Rossi
2005-09-26  1:42                           ` Daniel Jacobowitz
2005-09-27 22:41                             ` Bob Rossi
2005-08-04 14:34         ` Bob Rossi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050804203704.GA4472@white \
    --to=bob@brasko.net \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox