diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/compile/compile.c | 4 | ||||
-rw-r--r-- | gdb/corelow.c | 2 | ||||
-rw-r--r-- | gdb/dwarf2/index-cache.c | 4 | ||||
-rw-r--r-- | gdb/main.c | 7 | ||||
-rw-r--r-- | gdb/objfiles.c | 4 | ||||
-rw-r--r-- | gdb/source.c | 19 | ||||
-rw-r--r-- | gdb/top.c | 10 | ||||
-rw-r--r-- | gdb/tracefile-tfile.c | 2 |
8 files changed, 21 insertions, 31 deletions
diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c index 2a1f0f1..5cbb341 100644 --- a/gdb/compile/compile.c +++ b/gdb/compile/compile.c @@ -297,8 +297,8 @@ compile_file_command (const char *args, int from_tty) error (_("You must provide a filename for this command.")); args = skip_spaces (args); - gdb::unique_xmalloc_ptr<char> abspath = gdb_abspath (args); - std::string buffer = string_printf ("#include \"%s\"\n", abspath.get ()); + std::string abspath = gdb_abspath (args); + std::string buffer = string_printf ("#include \"%s\"\n", abspath.c_str ()); eval_compile_command (NULL, buffer.c_str (), scope, NULL); } diff --git a/gdb/corelow.c b/gdb/corelow.c index a23dc81..8c33fb7 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -469,7 +469,7 @@ core_target_open (const char *arg, int from_tty) gdb::unique_xmalloc_ptr<char> filename (tilde_expand (arg)); if (strlen (filename.get ()) != 0 && !IS_ABSOLUTE_PATH (filename.get ())) - filename = gdb_abspath (filename.get ()); + filename = make_unique_xstrdup (gdb_abspath (filename.get ()).c_str ()); flags = O_BINARY | O_LARGEFILE; if (write_files) diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c index 18e60cb..fb827e0 100644 --- a/gdb/dwarf2/index-cache.c +++ b/gdb/dwarf2/index-cache.c @@ -298,9 +298,7 @@ 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.c_str ()); - index_cache_directory = abs.get (); + index_cache_directory = gdb_abspath (index_cache_directory.c_str ()); global_index_cache.set_directory (index_cache_directory); } @@ -133,12 +133,7 @@ set_gdb_data_directory (const char *new_datadir) "../foo" and "../foo" doesn't exist then we'll record $(pwd)/../foo which isn't canonical, but that's ok. */ if (!IS_ABSOLUTE_PATH (gdb_datadir.c_str ())) - { - gdb::unique_xmalloc_ptr<char> abs_datadir - = gdb_abspath (gdb_datadir.c_str ()); - - gdb_datadir = abs_datadir.get (); - } + gdb_datadir = gdb_abspath (gdb_datadir.c_str ()); } /* Relocate a file or directory. PROGNAME is the name by which gdb diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 0c71e0b..849c6d7 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -331,7 +331,7 @@ objfile::objfile (bfd *abfd, const char *name, objfile_flags flags_) objfile_alloc_data (this); - gdb::unique_xmalloc_ptr<char> name_holder; + std::string name_holder; if (name == NULL) { gdb_assert (abfd == NULL); @@ -344,7 +344,7 @@ objfile::objfile (bfd *abfd, const char *name, objfile_flags flags_) else { name_holder = gdb_abspath (name); - expanded_name = name_holder.get (); + expanded_name = name_holder.c_str (); } original_name = obstack_strdup (&objfile_obstack, expanded_name); diff --git a/gdb/source.c b/gdb/source.c index e901657..9d9ff4b 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -537,15 +537,15 @@ add_path (const char *dirname, char **which_path, int parse_separators) for (const gdb::unique_xmalloc_ptr<char> &name_up : dir_vec) { - char *name = name_up.get (); + const char *name = name_up.get (); char *p; struct stat st; - gdb::unique_xmalloc_ptr<char> new_name_holder; + std::string new_name_holder; /* Spaces and tabs will have been removed by buildargv(). NAME is the start of the directory. P is the '\0' following the end. */ - p = name + strlen (name); + p = name_up.get () + strlen (name); while (!(IS_DIR_SEPARATOR (*name) && p <= name + 1) /* "/" */ #ifdef HAVE_DOS_BASED_FILE_SYSTEM @@ -589,16 +589,18 @@ add_path (const char *dirname, char **which_path, int parse_separators) if (name[0] == '\0') goto skip_dup; if (name[0] == '~') - new_name_holder.reset (tilde_expand (name)); + new_name_holder + = gdb::unique_xmalloc_ptr<char[]> (tilde_expand (name)).get (); #ifdef HAVE_DOS_BASED_FILE_SYSTEM else if (IS_ABSOLUTE_PATH (name) && p == name + 2) /* "d:" => "d:." */ - new_name_holder.reset (concat (name, ".", (char *) NULL)); + new_name_holder = std::string (name) + "."; #endif else if (!IS_ABSOLUTE_PATH (name) && name[0] != '$') new_name_holder = gdb_abspath (name); else - new_name_holder.reset (savestring (name, p - name)); - name = new_name_holder.get (); + new_name_holder = std::string (name, p - name); + + name = new_name_holder.c_str (); /* Unless it's a variable, check existence. */ if (name[0] != '$') @@ -950,7 +952,8 @@ done: else if ((opts & OPF_RETURN_REALPATH) != 0) *filename_opened = gdb_realpath (filename); else - *filename_opened = gdb_abspath (filename); + *filename_opened + = make_unique_xstrdup (gdb_abspath (filename).c_str ()); } errno = last_errno; @@ -2167,12 +2167,7 @@ set_history_filename (const char *args, that was read. */ if (!history_filename.empty () && !IS_ABSOLUTE_PATH (history_filename.c_str ())) - { - gdb::unique_xmalloc_ptr<char> temp - (gdb_abspath (history_filename.c_str ())); - - history_filename = temp.get (); - } + history_filename = gdb_abspath (history_filename.c_str ()); } /* Whether we're in quiet startup mode. */ @@ -2444,7 +2439,6 @@ _initialize_top () const char *fname = ".gdb_history"; #endif - gdb::unique_xmalloc_ptr<char> temp (gdb_abspath (fname)); - history_filename = temp.get (); + history_filename = gdb_abspath (fname); } } diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c index 1072363..f84ad2f 100644 --- a/gdb/tracefile-tfile.c +++ b/gdb/tracefile-tfile.c @@ -471,7 +471,7 @@ tfile_target_open (const char *arg, int from_tty) gdb::unique_xmalloc_ptr<char> filename (tilde_expand (arg)); if (!IS_ABSOLUTE_PATH (filename.get ())) - filename = gdb_abspath (filename.get ()); + filename = make_unique_xstrdup (gdb_abspath (filename.get ()).c_str ()); flags = O_BINARY | O_LARGEFILE; flags |= O_RDONLY; |