aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2024-06-19 11:12:28 +0100
committerAndrew Burgess <aburgess@redhat.com>2024-06-27 15:15:25 +0100
commit88aad97c21de7a39f8e63467674ef936b3e9a86d (patch)
tree0e16dd7c4311ff0af6108ff717a182b4de618740 /gdbsupport
parent973563710c2f7c184fb6769e1b1d0fc5f3f181f5 (diff)
downloadgdb-88aad97c21de7a39f8e63467674ef936b3e9a86d.zip
gdb-88aad97c21de7a39f8e63467674ef936b3e9a86d.tar.gz
gdb-88aad97c21de7a39f8e63467674ef936b3e9a86d.tar.bz2
gdb: add overloads of gdb_abspath
Add two overloads of gdb_abspath, one which takes std::string and one which takes gdb::unique_xmalloc_ptr<char>, then make use of these overloads throughout GDB and gdbserver. There should be no user visible changes after this commit. Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdbsupport')
-rw-r--r--gdbsupport/pathstuff.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/gdbsupport/pathstuff.h b/gdbsupport/pathstuff.h
index 170a2c5..a61ce23 100644
--- a/gdbsupport/pathstuff.h
+++ b/gdbsupport/pathstuff.h
@@ -56,6 +56,22 @@ extern std::string gdb_realpath_keepfile (const char *filename);
extern std::string gdb_abspath (const char *path);
+/* Overload of gdb_abspath which takes std::string. */
+
+static inline std::string
+gdb_abspath (const std::string &path)
+{
+ return gdb_abspath (path.c_str ());
+}
+
+/* Overload of gdb_abspath which takes gdb::unique_xmalloc_ptr<char>. */
+
+static inline std::string
+gdb_abspath (const gdb::unique_xmalloc_ptr<char> &path)
+{
+ return gdb_abspath (path.get ());
+}
+
/* If the path in CHILD is a child of the path in PARENT, return a
pointer to the first component in the CHILD's pathname below the
PARENT. Otherwise, return NULL. */