gdb: rename ldirname to gdb_ldirname

It conflicts with the ldirname function that will be added in the next
libiberty sync.
This commit is contained in:
Andreas Schwab
2025-05-14 17:08:52 +02:00
parent d1851edfe9
commit a22a215fa8
10 changed files with 13 additions and 13 deletions

View File

@@ -957,7 +957,7 @@ locate_exec_from_corefile_exec_context (bfd *cbfd,
execbfd = open_and_check_build_id (exec_name); execbfd = open_and_check_build_id (exec_name);
else else
{ {
std::string p = (ldirname (bfd_get_filename (cbfd)) std::string p = (gdb_ldirname (bfd_get_filename (cbfd))
+ '/' + '/'
+ exec_name); + exec_name);
execbfd = open_and_check_build_id (p.c_str ()); execbfd = open_and_check_build_id (p.c_str ());
@@ -971,7 +971,7 @@ locate_exec_from_corefile_exec_context (bfd *cbfd,
if (execbfd == nullptr) if (execbfd == nullptr)
{ {
const char *base_name = lbasename (exec_name); 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); + base_name);
execbfd = open_and_check_build_id (p.c_str ()); execbfd = open_and_check_build_id (p.c_str ());

View File

@@ -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"), error (_("Could not open shell (%s) for reading: %s"),
shell, safe_strerror (errno)); 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 ())) if (!mkdir_recursive (new_dir.c_str ()))
error (_("Could not make cache directory \"%s\": %s"), error (_("Could not make cache directory \"%s\": %s"),
new_dir.c_str (), safe_strerror (errno)); new_dir.c_str (), safe_strerror (errno));

View File

@@ -343,7 +343,7 @@ dwz_file::read_dwz_file (dwarf2_per_objfile *per_objfile)
{ {
gdb::unique_xmalloc_ptr<char> abs = gdb_realpath (per_bfd->filename ()); gdb::unique_xmalloc_ptr<char> 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 /* First try the file name given in the section. If that doesn't

View File

@@ -5859,7 +5859,7 @@ find_file_and_directory (struct die_info *die, struct dwarf2_cu *cu)
&& res.get_name () != nullptr && res.get_name () != nullptr
&& IS_ABSOLUTE_PATH (res.get_name ())) && 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 ()))); 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 (); search_path = per_bfd->captured_debug_dir.c_str ();
/* Add the path for the executable binary to the list of search paths. */ /* 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 (), search_path_holder.reset (concat (objfile_dir.c_str (),
dirname_separator_string, dirname_separator_string,
search_path, nullptr)); 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; struct objfile *backlink = objfile->separate_debug_objfile_backlink;
const char *backlink_basename = lbasename (backlink->original_name); 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 else
dwp_name = objfile->original_name; dwp_name = objfile->original_name;

View File

@@ -2446,7 +2446,7 @@ py_initialize ()
/foo/lib/pythonX.Y/... /foo/lib/pythonX.Y/...
This must be done before calling Py_Initialize. */ This must be done before calling Py_Initialize. */
gdb::unique_xmalloc_ptr<char> progname gdb::unique_xmalloc_ptr<char> 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)); SLASH_STRING, "python", (char *) NULL));
{ {

View File

@@ -4492,7 +4492,7 @@ info_sources_filter::matches (const char *fullname) const
switch (m_match_type) switch (m_match_type)
{ {
case match_on::DIRNAME: case match_on::DIRNAME:
dirname = ldirname (fullname); dirname = gdb_ldirname (fullname);
to_match = dirname.c_str (); to_match = dirname.c_str ();
break; break;
case match_on::BASENAME: case match_on::BASENAME:

View File

@@ -3333,7 +3333,7 @@ gdb_argv_as_array_view_test ()
argument. */ argument. */
std::string std::string
ldirname (const char *filename) gdb_ldirname (const char *filename)
{ {
std::string dirname; std::string dirname;
const char *base = lbasename (filename); const char *base = lbasename (filename);

View File

@@ -133,7 +133,7 @@ private:
extern int gdb_filename_fnmatch (const char *pattern, const char *string, extern int gdb_filename_fnmatch (const char *pattern, const char *string,
int flags); int flags);
std::string ldirname (const char *filename); std::string gdb_ldirname (const char *filename);
extern int count_path_elements (const char *path); extern int count_path_elements (const char *path);

View File

@@ -319,7 +319,7 @@ xml_init_syscalls_info (const char *filename)
if (!full_file) if (!full_file)
return NULL; return NULL;
const std::string dirname = ldirname (filename); const std::string dirname = gdb_ldirname (filename);
auto fetch_another = [&dirname] (const char *name) auto fetch_another = [&dirname] (const char *name)
{ {
return xml_fetch_content_from_file (name, dirname.c_str ()); return xml_fetch_content_from_file (name, dirname.c_str ());

View File

@@ -670,7 +670,7 @@ file_read_description_xml (const char *filename)
return NULL; return NULL;
} }
const std::string dirname = ldirname (filename); const std::string dirname = gdb_ldirname (filename);
auto fetch_another = [&dirname] (const char *name) auto fetch_another = [&dirname] (const char *name)
{ {
return xml_fetch_content_from_file (name, dirname.c_str ()); return xml_fetch_content_from_file (name, dirname.c_str ());