This moves the gdb_regex convenience class to gdbsupport.
        gcore.c \
        gdb-demangle.c \
        gdb_bfd.c \
-       gdb_regex.c \
        gdbtypes.c \
        gmp-utils.c \
        gnu-v2-abi.c \
        gdb_curses.h \
        gdb_expat.h \
        gdb_proc_service.h \
-       gdb_regex.h \
        gdb_select.h \
        gdb-stabs.h \
        gdb_vfork.h \
 
 
 #include "defs.h"
 #include <ctype.h>
-#include "gdb_regex.h"
+#include "gdbsupport/gdb_regex.h"
 #include "frame.h"
 #include "symtab.h"
 #include "gdbtypes.h"
 
 #include <ctype.h>
 #include "auto-load.h"
 #include "progspace.h"
-#include "gdb_regex.h"
+#include "gdbsupport/gdb_regex.h"
 #include "ui-out.h"
 #include "filenames.h"
 #include "command.h"
 
 #include "probe.h"
 #include "objfiles.h"
 #include "cp-abi.h"
-#include "gdb_regex.h"
+#include "gdbsupport/gdb_regex.h"
 #include "cp-support.h"
 #include "location.h"
 #include "cli/cli-decode.h"
 
 #include "valprint.h"
 #include "jit.h"
 #include "parser-defs.h"
-#include "gdb_regex.h"
+#include "gdbsupport/gdb_regex.h"
 #include "probe.h"
 #include "cli/cli-utils.h"
 #include "stack.h"
 
 #include "target.h"    /* For baud_rate, remote_debug and remote_timeout.  */
 #include "gdbsupport/gdb_wait.h"       /* For shell escape implementation.  */
 #include "gdbcmd.h"
-#include "gdb_regex.h" /* Used by apropos_command.  */
+#include "gdbsupport/gdb_regex.h"      /* Used by apropos_command.  */
 #include "gdb_vfork.h"
 #include "linespec.h"
 #include "expression.h"
 
 #include "defs.h"
 #include "symtab.h"
 #include <ctype.h>
-#include "gdb_regex.h"
+#include "gdbsupport/gdb_regex.h"
 #include "completer.h"
 #include "ui-out.h"
 #include "cli/cli-cmds.h"
 
 
 /* Include the public interfaces.  */
 #include "command.h"
-#include "gdb_regex.h"
+#include "gdbsupport/gdb_regex.h"
 #include "cli-script.h"
 #include "completer.h"
 #include "gdbsupport/intrusive_list.h"
 
+++ /dev/null
-/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include "defs.h"
-#include "gdb_regex.h"
-#include "gdbsupport/def-vector.h"
-
-compiled_regex::compiled_regex (const char *regex, int cflags,
-                               const char *message)
-{
-  gdb_assert (regex != NULL);
-  gdb_assert (message != NULL);
-
-  int code = regcomp (&m_pattern, regex, cflags);
-  if (code != 0)
-    {
-      size_t length = regerror (code, &m_pattern, NULL, 0);
-      gdb::def_vector<char> err (length);
-
-      regerror (code, &m_pattern, err.data (), length);
-      error (("%s: %s"), message, err.data ());
-    }
-}
-
-compiled_regex::~compiled_regex ()
-{
-  regfree (&m_pattern);
-}
-
-int
-compiled_regex::exec (const char *string, size_t nmatch,
-                     regmatch_t pmatch[], int eflags) const
-{
-  return regexec (&m_pattern, string, nmatch, pmatch, eflags);
-}
-
-int
-compiled_regex::search (const char *string,
-                       int length, int start, int range,
-                       struct re_registers *regs)
-{
-  return re_search (&m_pattern, string, length, start, range, regs);
-}
 
+++ /dev/null
-/* Portable <regex.h>.
-   Copyright (C) 2000-2022 Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef GDB_REGEX_H
-#define GDB_REGEX_H 1
-
-# include "xregex.h"
-
-/* A compiled regex.  This is mainly a wrapper around regex_t.  The
-   the constructor throws on regcomp error and the destructor is
-   responsible for calling regfree.  The former means that it's not
-   possible to create an instance of compiled_regex that isn't
-   compiled, hence the name.  */
-class compiled_regex
-{
-public:
-  /* Compile a regexp and throw an exception on error, including
-     MESSAGE.  REGEX and MESSAGE must not be NULL.  */
-  compiled_regex (const char *regex, int cflags,
-                 const char *message)
-    ATTRIBUTE_NONNULL (2) ATTRIBUTE_NONNULL (4);
-
-  ~compiled_regex ();
-
-  DISABLE_COPY_AND_ASSIGN (compiled_regex);
-
-  /* Wrapper around ::regexec.  */
-  int exec (const char *string,
-           size_t nmatch, regmatch_t pmatch[],
-           int eflags) const;
-
-  /* Wrapper around ::re_search.  (Not const because re_search's
-     regex_t parameter isn't either.)  */
-  int search (const char *string, int size, int startpos,
-             int range, struct re_registers *regs);
-
-private:
-  /* The compiled pattern.  */
-  regex_t m_pattern;
-};
-
-#endif /* not GDB_REGEX_H */
 
 #include "objfiles.h"
 #include "infcall.h"
 #include "gdbcmd.h"
-#include "gdb_regex.h"
+#include "gdbsupport/gdb_regex.h"
 #include "gdbsupport/enum-flags.h"
 #include "gdbsupport/gdb_optional.h"
 #include "gcore.h"
 
 #include "psymtab.h"
 #include "solib.h"
 #include "solist.h"
-#include "gdb_regex.h"
+#include "gdbsupport/gdb_regex.h"
 
 /* Return to the client the absolute path and line number of the 
    current file being executed.  */
 
 #include "gdbcore.h"
 #include "gdbcmd.h"
 #include "frame.h"
-#include "gdb_regex.h"
+#include "gdbsupport/gdb_regex.h"
 #include "regcache.h"
 #include "block.h"
 #include "infcall.h"
 
 #include "progspace.h"
 #include "filenames.h"
 #include "linespec.h"
-#include "gdb_regex.h"
+#include "gdbsupport/gdb_regex.h"
 #include "frame.h"
 #include "arch-utils.h"
 #include "value.h"
 
 #include "defs.h"
 #include "producer.h"
 #include "gdbsupport/selftest.h"
-#include "gdb_regex.h"
+#include "gdbsupport/gdb_regex.h"
 
 /* See producer.h.  */
 
 
 #include "ui-out.h"
 #include "command.h"
 #include "readline/tilde.h"
-#include "gdb_regex.h"
+#include "gdbsupport/gdb_regex.h"
 #include "dictionary.h"
 #include "language.h"
 #include "cp-support.h"
 
 #include "charset.h"
 #include "cp-support.h"
 #include "gdbsupport/gdb_obstack.h"
-#include "gdb_regex.h"
+#include "gdbsupport/gdb_regex.h"
 #include "rust-lang.h"
 #include "parser-defs.h"
 #include "gdbsupport/selftest.h"
 
 #include "source.h"
 #include "filenames.h"
 #include "fnmatch.h"
-#include "gdb_regex.h"
+#include "gdbsupport/gdb_regex.h"
 #include "gdbsupport/gdb_optional.h"
 #include <list>
 #include "cli/cli-style.h"
 
 #include "command.h"
 #include "target.h"
 #include "frame.h"
-#include "gdb_regex.h"
+#include "gdbsupport/gdb_regex.h"
 #include "inferior.h"
 #include "gdbsupport/environ.h"
 #include "language.h"
 
 #include <sys/types.h>
 #include <fcntl.h>
 #include "gdbcore.h"
-#include "gdb_regex.h"
+#include "gdbsupport/gdb_regex.h"
 #include "symfile.h"
 #include "objfiles.h"
 #include "annotate.h"
 
 #include "language.h"
 #include "bcache.h"
 #include "block.h"
-#include "gdb_regex.h"
+#include "gdbsupport/gdb_regex.h"
 #include <sys/stat.h>
 #include "dictionary.h"
 #include "typeprint.h"
 
 #include "symfile.h"
 #include "objfiles.h"
 #include "gdbcmd.h"
-#include "gdb_regex.h"
+#include "gdbsupport/gdb_regex.h"
 #include "expression.h"
 #include "language.h"
 #include "demangle.h"
 
 #include "gdbsupport/gdb_vecs.h"
 #include "gdbtypes.h"
 #include "gdbsupport/gdb_obstack.h"
-#include "gdb_regex.h"
+#include "gdbsupport/gdb_regex.h"
 #include "gdbsupport/enum-flags.h"
 #include "gdbsupport/function-view.h"
 #include "gdbsupport/gdb_optional.h"
 
 #include "annotate.h"
 #include "cli/cli-decode.h"
 #include "cli/cli-option.h"
-#include "gdb_regex.h"
+#include "gdbsupport/gdb_regex.h"
 #include "cli/cli-utils.h"
 #include "thread-fsm.h"
 #include "tid-parse.h"
 
 
 #include "defs.h"
 #include "ui-style.h"
-#include "gdb_regex.h"
+#include "gdbsupport/gdb_regex.h"
 
 /* A regular expression that is used for matching ANSI terminal escape
    sequences.  */
 
 #include <chrono>
 
 #include "interps.h"
-#include "gdb_regex.h"
+#include "gdbsupport/gdb_regex.h"
 #include "gdbsupport/job-control.h"
 #include "gdbsupport/selftest.h"
 #include "gdbsupport/gdb_optional.h"
 
 #include "gdbcmd.h"
 #include "block.h"
 #include "valprint.h"
-#include "gdb_regex.h"
+#include "gdbsupport/gdb_regex.h"
 
 #include "varobj.h"
 #include "gdbthread.h"
 
     gdb-dlfcn.cc \
     gdb-hashtab.cc \
     gdb_obstack.cc \
+    gdb_regex.cc \
     gdb_tilde_expand.cc \
     gdb_wait.cc \
     gdb_vecs.cc \
 
        environ.$(OBJEXT) errors.$(OBJEXT) event-loop.$(OBJEXT) \
        fileio.$(OBJEXT) filestuff.$(OBJEXT) format.$(OBJEXT) \
        gdb-dlfcn.$(OBJEXT) gdb-hashtab.$(OBJEXT) \
-       gdb_obstack.$(OBJEXT) gdb_tilde_expand.$(OBJEXT) \
-       gdb_wait.$(OBJEXT) gdb_vecs.$(OBJEXT) job-control.$(OBJEXT) \
-       netstuff.$(OBJEXT) new-op.$(OBJEXT) pathstuff.$(OBJEXT) \
-       print-utils.$(OBJEXT) ptid.$(OBJEXT) rsp-low.$(OBJEXT) \
-       run-time-clock.$(OBJEXT) safe-strerror.$(OBJEXT) \
-       scoped_mmap.$(OBJEXT) search.$(OBJEXT) signals.$(OBJEXT) \
-       signals-state-save-restore.$(OBJEXT) tdesc.$(OBJEXT) \
-       thread-pool.$(OBJEXT) xml-utils.$(OBJEXT) $(am__objects_1)
+       gdb_obstack.$(OBJEXT) gdb_regex.$(OBJEXT) \
+       gdb_tilde_expand.$(OBJEXT) gdb_wait.$(OBJEXT) \
+       gdb_vecs.$(OBJEXT) job-control.$(OBJEXT) netstuff.$(OBJEXT) \
+       new-op.$(OBJEXT) pathstuff.$(OBJEXT) print-utils.$(OBJEXT) \
+       ptid.$(OBJEXT) rsp-low.$(OBJEXT) run-time-clock.$(OBJEXT) \
+       safe-strerror.$(OBJEXT) scoped_mmap.$(OBJEXT) search.$(OBJEXT) \
+       signals.$(OBJEXT) signals-state-save-restore.$(OBJEXT) \
+       tdesc.$(OBJEXT) thread-pool.$(OBJEXT) xml-utils.$(OBJEXT) \
+       $(am__objects_1)
 libgdbsupport_a_OBJECTS = $(am_libgdbsupport_a_OBJECTS)
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
     gdb-dlfcn.cc \
     gdb-hashtab.cc \
     gdb_obstack.cc \
+    gdb_regex.cc \
     gdb_tilde_expand.cc \
     gdb_wait.cc \
     gdb_vecs.cc \
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdb-dlfcn.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdb-hashtab.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdb_obstack.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdb_regex.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdb_tilde_expand.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdb_vecs.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdb_wait.Po@am__quote@
 
--- /dev/null
+/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include "defs.h"
+#include "gdb_regex.h"
+#include "gdbsupport/def-vector.h"
+
+compiled_regex::compiled_regex (const char *regex, int cflags,
+                               const char *message)
+{
+  gdb_assert (regex != NULL);
+  gdb_assert (message != NULL);
+
+  int code = regcomp (&m_pattern, regex, cflags);
+  if (code != 0)
+    {
+      size_t length = regerror (code, &m_pattern, NULL, 0);
+      gdb::def_vector<char> err (length);
+
+      regerror (code, &m_pattern, err.data (), length);
+      error (("%s: %s"), message, err.data ());
+    }
+}
+
+compiled_regex::~compiled_regex ()
+{
+  regfree (&m_pattern);
+}
+
+int
+compiled_regex::exec (const char *string, size_t nmatch,
+                     regmatch_t pmatch[], int eflags) const
+{
+  return regexec (&m_pattern, string, nmatch, pmatch, eflags);
+}
+
+int
+compiled_regex::search (const char *string,
+                       int length, int start, int range,
+                       struct re_registers *regs)
+{
+  return re_search (&m_pattern, string, length, start, range, regs);
+}
 
--- /dev/null
+/* Portable <regex.h>.
+   Copyright (C) 2000-2022 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef GDB_REGEX_H
+#define GDB_REGEX_H 1
+
+# include "xregex.h"
+
+/* A compiled regex.  This is mainly a wrapper around regex_t.  The
+   the constructor throws on regcomp error and the destructor is
+   responsible for calling regfree.  The former means that it's not
+   possible to create an instance of compiled_regex that isn't
+   compiled, hence the name.  */
+class compiled_regex
+{
+public:
+  /* Compile a regexp and throw an exception on error, including
+     MESSAGE.  REGEX and MESSAGE must not be NULL.  */
+  compiled_regex (const char *regex, int cflags,
+                 const char *message)
+    ATTRIBUTE_NONNULL (2) ATTRIBUTE_NONNULL (4);
+
+  ~compiled_regex ();
+
+  DISABLE_COPY_AND_ASSIGN (compiled_regex);
+
+  /* Wrapper around ::regexec.  */
+  int exec (const char *string,
+           size_t nmatch, regmatch_t pmatch[],
+           int eflags) const;
+
+  /* Wrapper around ::re_search.  (Not const because re_search's
+     regex_t parameter isn't either.)  */
+  int search (const char *string, int size, int startpos,
+             int range, struct re_registers *regs);
+
+private:
+  /* The compiled pattern.  */
+  regex_t m_pattern;
+};
+
+#endif /* not GDB_REGEX_H */