aboutsummaryrefslogtreecommitdiff
path: root/gdb/utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/utils.h')
-rw-r--r--gdb/utils.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/gdb/utils.h b/gdb/utils.h
index d32114e..d9dbaec 100644
--- a/gdb/utils.h
+++ b/gdb/utils.h
@@ -24,6 +24,7 @@
#include "exceptions.h"
#include "common/scoped_restore.h"
#include <chrono>
+#include <string>
extern void initialize_utils (void);
@@ -140,6 +141,22 @@ extern void substitute_path_component (std::string &str,
const std::string &from,
const std::string &to);
+/* Concatenate an arbitrary number of path elements. Adds and removes
+ directory separators as needed.
+
+ concat_path (/first, second) => /first/second
+ concat_path (first, second) => first/second
+ concat_path (first/, second) => first/second
+ concat_path (first, /second) => first/second
+ concat_path (first/, /second) => first/second
+ concat_path (target:, second) => target:second
+ */
+
+extern std::string _concat_path (std::initializer_list<std::string> args,
+ std::string dir_separator);
+
+#define concat_path(...) _concat_path ({__VA_ARGS__}, SLASH_STRING)
+
char *ldirname (const char *filename);
extern int count_path_elements (const char *path);