aboutsummaryrefslogtreecommitdiff
path: root/gdb/utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/utils.h')
-rw-r--r--gdb/utils.h27
1 files changed, 19 insertions, 8 deletions
diff --git a/gdb/utils.h b/gdb/utils.h
index 90c8012..b37e8f7 100644
--- a/gdb/utils.h
+++ b/gdb/utils.h
@@ -1,5 +1,5 @@
/* I/O, string, cleanup, and other random utilities for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -16,8 +16,8 @@
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 UTILS_H
-#define UTILS_H
+#ifndef GDB_UTILS_H
+#define GDB_UTILS_H
#include <chrono>
@@ -133,10 +133,7 @@ private:
extern int gdb_filename_fnmatch (const char *pattern, const char *string,
int flags);
-extern void substitute_path_component (char **stringp, const char *from,
- const char *to);
-
-std::string ldirname (const char *filename);
+std::string gdb_ldirname (const char *filename);
extern int count_path_elements (const char *path);
@@ -371,6 +368,20 @@ assign_return_if_changed (T &lval, const T &val)
return true;
}
+/* ARG is an argument string as passed to a GDB command which is expected
+ to contain a single, possibly quoted, filename argument. Extract the
+ filename and return it as a string. If the filename is quoted then the
+ quotes will have been removed. If the filename is not quoted then any
+ escaping within the filename will have been removed.
+
+ If there is any content in ARG after the filename then an error will be
+ thrown complaining about the extra content.
+
+ If there is no filename in ARG, or if ARG is nullptr, then an empty
+ string will be returned. */
+
+extern std::string extract_single_filename_arg (const char *arg);
+
/* A class that can be used to intercept warnings. A class is used
here, rather than a gdb::function_view because it proved difficult
to use a function view in conjunction with ATTRIBUTE_PRINTF in a
@@ -472,4 +483,4 @@ private:
std::vector<string_file> m_warnings;
};
-#endif /* UTILS_H */
+#endif /* GDB_UTILS_H */