summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2022-01-01 11:31:47 -0700
committerTom Tromey <tom@tromey.com>2022-01-18 10:14:43 -0700
commitd322d6d69df61a1af481de7e50359c3d92c0de14 (patch)
treed62d224c341e948e5712623d79648ea77ea23f0f /gdb
parent0589ca4e7ba9b8d60599706b57be22c007c1f4fa (diff)
Move gdb_regex to gdbsupport
This moves the gdb_regex convenience class to gdbsupport.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/Makefile.in2
-rw-r--r--gdb/ada-lang.c2
-rw-r--r--gdb/auto-load.c2
-rw-r--r--gdb/break-catch-throw.c2
-rw-r--r--gdb/breakpoint.c2
-rw-r--r--gdb/cli/cli-cmds.c2
-rw-r--r--gdb/cli/cli-decode.c2
-rw-r--r--gdb/cli/cli-decode.h2
-rw-r--r--gdb/gdb_regex.c57
-rw-r--r--gdb/gdb_regex.h57
-rw-r--r--gdb/linux-tdep.c2
-rw-r--r--gdb/mi/mi-cmd-file.c2
-rw-r--r--gdb/objc-lang.c2
-rw-r--r--gdb/probe.c2
-rw-r--r--gdb/producer.c2
-rw-r--r--gdb/psymtab.c2
-rw-r--r--gdb/rust-parse.c2
-rw-r--r--gdb/skip.c2
-rw-r--r--gdb/solib.c2
-rw-r--r--gdb/source.c2
-rw-r--r--gdb/symmisc.c2
-rw-r--r--gdb/symtab.c2
-rw-r--r--gdb/symtab.h2
-rw-r--r--gdb/thread.c2
-rw-r--r--gdb/ui-style.c2
-rw-r--r--gdb/utils.c2
-rw-r--r--gdb/varobj.c2
27 files changed, 24 insertions, 140 deletions
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index ce9f1ad441..2d9b2a7649 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1074,7 +1074,6 @@ COMMON_SFILES = \
gcore.c \
gdb-demangle.c \
gdb_bfd.c \
- gdb_regex.c \
gdbtypes.c \
gmp-utils.c \
gnu-v2-abi.c \
@@ -1316,7 +1315,6 @@ HFILES_NO_SRCDIR = \
gdb_curses.h \
gdb_expat.h \
gdb_proc_service.h \
- gdb_regex.h \
gdb_select.h \
gdb-stabs.h \
gdb_vfork.h \
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index b88b27b55b..a39c1fdee6 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -20,7 +20,7 @@
#include "defs.h"
#include <ctype.h>
-#include "gdb_regex.h"
+#include "gdbsupport/gdb_regex.h"
#include "frame.h"
#include "symtab.h"
#include "gdbtypes.h"
diff --git a/gdb/auto-load.c b/gdb/auto-load.c
index 98b1373d57..680b87936b 100644
--- a/gdb/auto-load.c
+++ b/gdb/auto-load.c
@@ -21,7 +21,7 @@
#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"
diff --git a/gdb/break-catch-throw.c b/gdb/break-catch-throw.c
index 5d17854d9a..d34e5f9ee5 100644
--- a/gdb/break-catch-throw.c
+++ b/gdb/break-catch-throw.c
@@ -33,7 +33,7 @@
#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"
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index c7d7573162..e969ef367b 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -56,7 +56,7 @@
#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"
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index e62e7a9331..563f29067c 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -24,7 +24,7 @@
#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"
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 7266fb36d0..c8cd95620a 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -18,7 +18,7 @@
#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"
diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h
index ed75d3dfc1..658142d338 100644
--- a/gdb/cli/cli-decode.h
+++ b/gdb/cli/cli-decode.h
@@ -23,7 +23,7 @@
/* 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"
diff --git a/gdb/gdb_regex.c b/gdb/gdb_regex.c
deleted file mode 100644
index f4d23cf346..0000000000
--- a/gdb/gdb_regex.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* 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);
-}
diff --git a/gdb/gdb_regex.h b/gdb/gdb_regex.h
deleted file mode 100644
index 1b31f5bdda..0000000000
--- a/gdb/gdb_regex.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* 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 */
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 4b69121e4d..1b48b7fef2 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -36,7 +36,7 @@
#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"
diff --git a/gdb/mi/mi-cmd-file.c b/gdb/mi/mi-cmd-file.c
index 8fdcf891cf..23c6d7021e 100644
--- a/gdb/mi/mi-cmd-file.c
+++ b/gdb/mi/mi-cmd-file.c
@@ -28,7 +28,7 @@
#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. */
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index 787e8d647e..72470144ab 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -37,7 +37,7 @@
#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"
diff --git a/gdb/probe.c b/gdb/probe.c
index 689b5f022e..278b36c3ce 100644
--- a/gdb/probe.c
+++ b/gdb/probe.c
@@ -27,7 +27,7 @@
#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"
diff --git a/gdb/producer.c b/gdb/producer.c
index ba6e021b94..ef1dd93afb 100644
--- a/gdb/producer.c
+++ b/gdb/producer.c
@@ -20,7 +20,7 @@
#include "defs.h"
#include "producer.h"
#include "gdbsupport/selftest.h"
-#include "gdb_regex.h"
+#include "gdbsupport/gdb_regex.h"
/* See producer.h. */
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 9db8a7aeba..406b3b3ccc 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -29,7 +29,7 @@
#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"
diff --git a/gdb/rust-parse.c b/gdb/rust-parse.c
index a3969fe4fa..31a1ee3b38 100644
--- a/gdb/rust-parse.c
+++ b/gdb/rust-parse.c
@@ -23,7 +23,7 @@
#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"
diff --git a/gdb/skip.c b/gdb/skip.c
index 3308252cb4..62825cbdda 100644
--- a/gdb/skip.c
+++ b/gdb/skip.c
@@ -33,7 +33,7 @@
#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"
diff --git a/gdb/solib.c b/gdb/solib.c
index 56b86614a1..b9b1d03718 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -29,7 +29,7 @@
#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"
diff --git a/gdb/source.c b/gdb/source.c
index ab5cfc5a9d..9cfc18b811 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -31,7 +31,7 @@
#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"
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 3b5c3a07fc..2f4a076c35 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -30,7 +30,7 @@
#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"
diff --git a/gdb/symtab.c b/gdb/symtab.c
index cf9f6cec34..9fc96d7baa 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -27,7 +27,7 @@
#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"
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 740c7ed8c7..55d1b772c4 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -27,7 +27,7 @@
#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"
diff --git a/gdb/thread.c b/gdb/thread.c
index 0f9fbe325b..611be3f463 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -40,7 +40,7 @@
#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"
diff --git a/gdb/ui-style.c b/gdb/ui-style.c
index 253e796d57..f1a5b8c410 100644
--- a/gdb/ui-style.c
+++ b/gdb/ui-style.c
@@ -18,7 +18,7 @@
#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. */
diff --git a/gdb/utils.c b/gdb/utils.c
index bda3b7b5f0..8489d3fec0 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -63,7 +63,7 @@
#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"
diff --git a/gdb/varobj.c b/gdb/varobj.c
index b59ddc1e77..3aec027a5b 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -23,7 +23,7 @@
#include "gdbcmd.h"
#include "block.h"
#include "valprint.h"
-#include "gdb_regex.h"
+#include "gdbsupport/gdb_regex.h"
#include "varobj.h"
#include "gdbthread.h"