Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Andreas Schwab <schwab@linux-m68k.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 2/2] [gdb/testsuite] Make gdb.threads/inf-thr-count.exp more readable
Date: Fri, 18 Apr 2025 12:47:13 +0200	[thread overview]
Message-ID: <f34e440f-25aa-4822-b69b-0321c4e9b390@suse.de> (raw)
In-Reply-To: <87r01pg655.fsf@linux-m68k.org>

On 4/18/25 11:39, Andreas Schwab wrote:
> On Apr 18 2025, Tom de Vries wrote:
> 
>> +    set re_int [string_to_regexp "-"]?$::decimal
> 
> Why do you need to use string_to_regexp for such a simple string?
> 

Hi Andreas,

thanks for the review.

Indeed, [string_to_regexp "-"] == "-", I didn't realize that.

I guess that using {[-]} comes from problems when using the minus at the 
start of a regexp:
...
% puts [regexp {-} {-}]
bad option "-": must be -all, -about, -indices, -inline, -expanded, 
-line, -linestop, -lineanchor, -nocase, -start, or --
% puts [regexp {[-]} {-}]
1
%
...
while this also works:
...
% puts [regexp {\-} {-}]
1
...

So perhaps string_to_regexp should also escape "-" to fix this failure:
...
set re [string_to_regexp "-"]
gdb_assert { [eval regexp $re "-"] }
...

Thanks,
- Tom

  reply	other threads:[~2025-04-18 10:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-18  9:23 [PATCH 0/2] [gdb/testsuite] Fixes in gdb.threads/inf-thr-count.exp Tom de Vries
2025-04-18  9:23 ` [PATCH 1/2] [gdb/testsuite] Fix timeout " Tom de Vries
2025-04-18  9:23 ` [PATCH 2/2] [gdb/testsuite] Make gdb.threads/inf-thr-count.exp more readable Tom de Vries
2025-04-18  9:39   ` Andreas Schwab
2025-04-18 10:47     ` Tom de Vries [this message]
2025-04-18 16:57       ` Tom Tromey
2025-05-02  8:37         ` Tom de Vries
2025-05-02  8:31       ` Tom de Vries

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=f34e440f-25aa-4822-b69b-0321c4e9b390@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=schwab@linux-m68k.org \
    /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