From a22a215fa848bb479bef5a1aa64ccabe3a4c8c69 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Wed, 14 May 2025 17:08:52 +0200 Subject: [PATCH] gdb: rename ldirname to gdb_ldirname It conflicts with the ldirname function that will be added in the next libiberty sync. --- gdb/corelow.c | 4 ++-- gdb/darwin-nat.c | 2 +- gdb/dwarf2/dwz.c | 2 +- gdb/dwarf2/read.c | 6 +++--- gdb/python/python.c | 2 +- gdb/symtab.c | 2 +- gdb/utils.c | 2 +- gdb/utils.h | 2 +- gdb/xml-syscall.c | 2 +- gdb/xml-tdesc.c | 2 +- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/gdb/corelow.c b/gdb/corelow.c index 45187816d78..127400eabaa 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -957,7 +957,7 @@ locate_exec_from_corefile_exec_context (bfd *cbfd, execbfd = open_and_check_build_id (exec_name); else { - std::string p = (ldirname (bfd_get_filename (cbfd)) + std::string p = (gdb_ldirname (bfd_get_filename (cbfd)) + '/' + exec_name); execbfd = open_and_check_build_id (p.c_str ()); @@ -971,7 +971,7 @@ locate_exec_from_corefile_exec_context (bfd *cbfd, if (execbfd == nullptr) { const char *base_name = lbasename (exec_name); - std::string p = (ldirname (bfd_get_filename (cbfd)) + std::string p = (gdb_ldirname (bfd_get_filename (cbfd)) + '/' + base_name); execbfd = open_and_check_build_id (p.c_str ()); diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c index 6bc0e4f8e7a..ffbf949fe79 100644 --- a/gdb/darwin-nat.c +++ b/gdb/darwin-nat.c @@ -1853,7 +1853,7 @@ copy_shell_to_cache (const char *shell, const std::string &new_name) error (_("Could not open shell (%s) for reading: %s"), shell, safe_strerror (errno)); - std::string new_dir = ldirname (new_name.c_str ()); + std::string new_dir = gdb_ldirname (new_name.c_str ()); if (!mkdir_recursive (new_dir.c_str ())) error (_("Could not make cache directory \"%s\": %s"), new_dir.c_str (), safe_strerror (errno)); diff --git a/gdb/dwarf2/dwz.c b/gdb/dwarf2/dwz.c index 59fe8e4886b..1aa0d035d22 100644 --- a/gdb/dwarf2/dwz.c +++ b/gdb/dwarf2/dwz.c @@ -343,7 +343,7 @@ dwz_file::read_dwz_file (dwarf2_per_objfile *per_objfile) { gdb::unique_xmalloc_ptr abs = gdb_realpath (per_bfd->filename ()); - filename = ldirname (abs.get ()) + SLASH_STRING + filename; + filename = gdb_ldirname (abs.get ()) + SLASH_STRING + filename; } /* First try the file name given in the section. If that doesn't diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 891e10f6e81..75e13159c64 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -5859,7 +5859,7 @@ find_file_and_directory (struct die_info *die, struct dwarf2_cu *cu) && res.get_name () != nullptr && IS_ABSOLUTE_PATH (res.get_name ())) { - res.set_comp_dir (ldirname (res.get_name ())); + res.set_comp_dir (gdb_ldirname (res.get_name ())); res.set_name (make_unique_xstrdup (lbasename (res.get_name ()))); } @@ -7434,7 +7434,7 @@ try_open_dwop_file (dwarf2_per_bfd *per_bfd, const char *file_name, int is_dwp, search_path = per_bfd->captured_debug_dir.c_str (); /* Add the path for the executable binary to the list of search paths. */ - std::string objfile_dir = ldirname (per_bfd->filename ()); + std::string objfile_dir = gdb_ldirname (per_bfd->filename ()); search_path_holder.reset (concat (objfile_dir.c_str (), dirname_separator_string, search_path, nullptr)); @@ -7807,7 +7807,7 @@ open_and_init_dwp_file (dwarf2_per_objfile *per_objfile) struct objfile *backlink = objfile->separate_debug_objfile_backlink; const char *backlink_basename = lbasename (backlink->original_name); - dwp_name = ldirname (objfile->original_name) + SLASH_STRING + backlink_basename; + dwp_name = gdb_ldirname (objfile->original_name) + SLASH_STRING + backlink_basename; } else dwp_name = objfile->original_name; diff --git a/gdb/python/python.c b/gdb/python/python.c index 24cb511c3d5..7c3d0d104b5 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -2446,7 +2446,7 @@ py_initialize () /foo/lib/pythonX.Y/... This must be done before calling Py_Initialize. */ gdb::unique_xmalloc_ptr progname - (concat (ldirname (python_libdir.c_str ()).c_str (), SLASH_STRING, "bin", + (concat (gdb_ldirname (python_libdir.c_str ()).c_str (), SLASH_STRING, "bin", SLASH_STRING, "python", (char *) NULL)); { diff --git a/gdb/symtab.c b/gdb/symtab.c index 313aa5ffa00..febd04176db 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -4492,7 +4492,7 @@ info_sources_filter::matches (const char *fullname) const switch (m_match_type) { case match_on::DIRNAME: - dirname = ldirname (fullname); + dirname = gdb_ldirname (fullname); to_match = dirname.c_str (); break; case match_on::BASENAME: diff --git a/gdb/utils.c b/gdb/utils.c index 7b0c8127583..8d9f0033225 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -3333,7 +3333,7 @@ gdb_argv_as_array_view_test () argument. */ std::string -ldirname (const char *filename) +gdb_ldirname (const char *filename) { std::string dirname; const char *base = lbasename (filename); diff --git a/gdb/utils.h b/gdb/utils.h index a8834cf4bc2..b37e8f7d7a1 100644 --- a/gdb/utils.h +++ b/gdb/utils.h @@ -133,7 +133,7 @@ private: extern int gdb_filename_fnmatch (const char *pattern, const char *string, int flags); -std::string ldirname (const char *filename); +std::string gdb_ldirname (const char *filename); extern int count_path_elements (const char *path); diff --git a/gdb/xml-syscall.c b/gdb/xml-syscall.c index fe0ea2b75a0..b58fe5d0d2f 100644 --- a/gdb/xml-syscall.c +++ b/gdb/xml-syscall.c @@ -319,7 +319,7 @@ xml_init_syscalls_info (const char *filename) if (!full_file) return NULL; - const std::string dirname = ldirname (filename); + const std::string dirname = gdb_ldirname (filename); auto fetch_another = [&dirname] (const char *name) { return xml_fetch_content_from_file (name, dirname.c_str ()); diff --git a/gdb/xml-tdesc.c b/gdb/xml-tdesc.c index 6c095afa699..2f213dc973d 100644 --- a/gdb/xml-tdesc.c +++ b/gdb/xml-tdesc.c @@ -670,7 +670,7 @@ file_read_description_xml (const char *filename) return NULL; } - const std::string dirname = ldirname (filename); + const std::string dirname = gdb_ldirname (filename); auto fetch_another = [&dirname] (const char *name) { return xml_fetch_content_from_file (name, dirname.c_str ()); -- 2.39.5