diff options
Diffstat (limited to 'gdb/dwarf2')
-rw-r--r-- | gdb/dwarf2/dwz.c | 2 | ||||
-rw-r--r-- | gdb/dwarf2/index-cache.c | 10 | ||||
-rw-r--r-- | gdb/dwarf2/read.c | 10 |
3 files changed, 11 insertions, 11 deletions
diff --git a/gdb/dwarf2/dwz.c b/gdb/dwarf2/dwz.c index f9d5db6..5e963d5 100644 --- a/gdb/dwarf2/dwz.c +++ b/gdb/dwarf2/dwz.c @@ -118,7 +118,7 @@ dwz_search_other_debugdirs (std::string &filename, bfd_byte *buildid, gdb_bfd_ref_ptr dwz_bfd; std::vector<gdb::unique_xmalloc_ptr<char>> debugdir_vec - = dirnames_to_char_ptr_vec (debug_file_directory); + = dirnames_to_char_ptr_vec (debug_file_directory.c_str ()); for (const gdb::unique_xmalloc_ptr<char> &debugdir : debugdir_vec) { diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c index c3decf1..f439b37 100644 --- a/gdb/dwarf2/index-cache.c +++ b/gdb/dwarf2/index-cache.c @@ -37,7 +37,7 @@ static bool debug_index_cache = false; /* The index cache directory, used for "set/show index-cache directory". */ -static char *index_cache_directory = NULL; +static std::string index_cache_directory; /* See dwarf-index.cache.h. */ index_cache global_index_cache; @@ -290,9 +290,9 @@ set_index_cache_directory_command (const char *arg, int from_tty, cmd_list_element *element) { /* Make sure the index cache directory is absolute and tilde-expanded. */ - gdb::unique_xmalloc_ptr<char> abs (gdb_abspath (index_cache_directory)); - xfree (index_cache_directory); - index_cache_directory = abs.release (); + gdb::unique_xmalloc_ptr<char> abs + = gdb_abspath (index_cache_directory.c_str ()); + index_cache_directory = abs.get (); global_index_cache.set_directory (index_cache_directory); } @@ -325,7 +325,7 @@ _initialize_index_cache () std::string cache_dir = get_standard_cache_dir (); if (!cache_dir.empty ()) { - index_cache_directory = xstrdup (cache_dir.c_str ()); + index_cache_directory = cache_dir; global_index_cache.set_directory (std::move (cache_dir)); } else diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 2d4ca08..214810d 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -12134,10 +12134,10 @@ try_open_dwop_file (dwarf2_per_objfile *per_objfile, gdb::unique_xmalloc_ptr<char> search_path_holder; if (search_cwd) { - if (*debug_file_directory != '\0') + if (!debug_file_directory.empty ()) { search_path_holder.reset (concat (".", dirname_separator_string, - debug_file_directory, + debug_file_directory.c_str (), (char *) NULL)); search_path = search_path_holder.get (); } @@ -12145,7 +12145,7 @@ try_open_dwop_file (dwarf2_per_objfile *per_objfile, search_path = "."; } else - search_path = debug_file_directory; + search_path = debug_file_directory.c_str (); /* Add the path for the executable binary to the list of search paths. */ std::string objfile_dir = ldirname (objfile_name (per_objfile->objfile)); @@ -12216,7 +12216,7 @@ open_dwo_file (dwarf2_per_objfile *per_objfile, /* That didn't work, try debug-file-directory, which, despite its name, is a list of paths. */ - if (*debug_file_directory == '\0') + if (debug_file_directory.empty ()) return NULL; return try_open_dwop_file (per_objfile, file_name, @@ -12545,7 +12545,7 @@ open_dwp_file (dwarf2_per_objfile *per_objfile, const char *file_name) [IWBN if the dwp file name was recorded in the executable, akin to .gnu_debuglink, but that doesn't exist yet.] Strip the directory from FILE_NAME and search again. */ - if (*debug_file_directory != '\0') + if (!debug_file_directory.empty ()) { /* Don't implicitly search the current directory here. If the user wants to search "." to handle this case, |