Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: mec.gnu@mindspring.com (Michael Elizabeth Chastain)
To: drow@false.org, mec.gnu@mindspring.com
Cc: cagney@gnu.org, gdb-patches@sources.redhat.com, jimb@redhat.com,
	keiths@redhat.com
Subject: Re: RFA: patch to fix gdb/1680
Date: Sat, 19 Jun 2004 02:44:00 -0000	[thread overview]
Message-ID: <20040619024408.318754B104@berman.michael-chastain.com> (raw)

The problem is not with tcl, but with expect.

I built two stacks of tcl+expect+dejagnu:

  'released stack' -- all the packages from their ftp sites.
  This is what I normally use.

  'sourceware stack' -- the versions from sourceware.
  This is what Jim B normally uses.

Here is a version table:

	    released  sourceware
  tcl       8.4.6     8.4.1 (nearly)
  expect    5.41      5.26 + patches, dated 1998-06-15
  dejagnu   1.4.4     1.4.3 (nearly)

Both TCL and Expect have their own copies of the Henry Spencer regular
expression code ("HSREC" for short).  You can see this coming: "re-usable
code re-used to hell".

When I use the 'released' stack, the regular expressions in question
get interpreted by TCL's copy of HSREC.  This is a modern
R.E. compiler with support for braces like "[abc]{1,2}".  It chokes on:

	".. = {0, 0.25, 0.5, 0.75}.*" \

The TCL 8.4.6 and TCL 8.4.1 versions of HSREC are nearly identical,
(they better be because they are both 8.4.X).  They both choke on this.

However, with the sourceware stack, the TCL 8.4.1 HSREC is not even
used!  Instead, expect 5.26 uses its own HSREC.  This is from 1998,
and does not implement '{1,2}' count modifiers.

So we have to write r.e.'s that work with both versions of HSREC.  We
must be doing this right most of the time, because I don't see huge
ERROR blotches in the files I've sampled from gdb-testers@ .

Another question.  How about all those r.e's in gdb.cp such as:

  # gdb.cp/userdef.exp
  \\$[0-9]* = {x = -2, y = -2}

As Daniel J surmised, the HSREC lexer really does have code to
distinguish between "{0,2}" and "{x=0,y=2}".  I watched this code
getting called:

  case CHR('{'):
    ...
    if (ATEOS() || !iscdigit(*v->now)) {
      NOTE(REG_UBRACES);
      NOTE(REG_UUNSPEC);
      RETV(PLAIN,c);
    } else {
      NOTE(REG_UBOUNDS);
      INTOCON(L_EBND);
      RET('{');
    }

So I predict that this regular expression in i386-sse.exp would work fine
with both T+E+D stacks, because it will fool the lexer:

  ".. = {\[$r\], $r.25, $r.5, $r.75}."

And indeed this code works with both sourceware T+E+D and released T+E+D.
Of course, I don't want to see that code in the actual test script;
that was just a test.

I guess it's my job to write doco on "how to write a test script",
including all these quirks of regular expressions.  Sigh.

And finally, this patch is still approved:

  ".. = \\{$r, $r.25, $r.5, $r.75\\}."

Michael C


             reply	other threads:[~2004-06-19  2:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-19  2:44 Michael Elizabeth Chastain [this message]
2004-06-19  6:25 ` Joel Brobecker
  -- strict thread matches above, loose matches on Subject: below --
2004-06-21  2:44 Michael Elizabeth Chastain
     [not found] <1087626323.4926.ezmlm@sources.redhat.com>
2004-06-20 22:37 ` Jim Ingham
2004-06-19  6:31 Michael Elizabeth Chastain
2004-06-21  5:00 ` Jim Blandy
2004-06-18 23:38 Michael Elizabeth Chastain
2004-06-18 20:25 Michael Elizabeth Chastain
2004-06-18 20:33 ` Daniel Jacobowitz
2004-06-18 19:43 Michael Elizabeth Chastain
2004-06-18 19:18 Michael Elizabeth Chastain
2004-06-18 19:35 ` Andrew Cagney
2004-06-18 19:42 ` Daniel Jacobowitz
2004-06-18 19:56   ` Andrew Cagney
2004-06-18 20:00     ` Daniel Jacobowitz
2004-06-18 22:20   ` Jim Blandy
2004-06-18 22:51     ` Andreas Schwab
2004-06-19  6:15       ` Jim Blandy
2004-06-18 18:25 Michael Elizabeth Chastain
2004-06-18 18:10 Jim Blandy
2004-06-18 18:42 ` Daniel Jacobowitz

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=20040619024408.318754B104@berman.michael-chastain.com \
    --to=mec.gnu@mindspring.com \
    --cc=cagney@gnu.org \
    --cc=drow@false.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=jimb@redhat.com \
    --cc=keiths@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