aboutsummaryrefslogtreecommitdiff
path: root/gdb/build-id.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2018-03-08 18:56:23 -0500
committerSimon Marchi <simon.marchi@ericsson.com>2018-03-08 18:56:23 -0500
commita8dbfd5853e3a5f7f2a3ca817e96d9e0759061a2 (patch)
tree6afc9df31bdc7097c42d1b0b8d0c994ba354e626 /gdb/build-id.c
parente6a58aa8a70c7fd17d9930e7df8d158a7e3c8c8e (diff)
downloadgdb-a8dbfd5853e3a5f7f2a3ca817e96d9e0759061a2.zip
gdb-a8dbfd5853e3a5f7f2a3ca817e96d9e0759061a2.tar.gz
gdb-a8dbfd5853e3a5f7f2a3ca817e96d9e0759061a2.tar.bz2
Make find_separate_debug_file* return std::string
This patch makes the find_separate_debug_file* functions return std::string, which allows to get rid of some manual memory management and one cleanup. gdb/ChangeLog: * build-id.c (find_separate_debug_file_by_buildid): Return std::string. * build-id.h (find_separate_debug_file_by_buildid): Return std::string. * coffread.c (coff_symfile_read): Adjust to std::string. * elfread.c (elf_symfile_read): Adjust to std::string. * symfile.c (separate_debug_file_exists): Change parameter to std::string. (find_separate_debug_file): Return std::string. (find_separate_debug_file_by_debuglink): Return std::string. * symfile.h (find_separate_debug_file_by_debuglink): Return std::string.
Diffstat (limited to 'gdb/build-id.c')
-rw-r--r--gdb/build-id.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gdb/build-id.c b/gdb/build-id.c
index 57d98c9..a5d4e67 100644
--- a/gdb/build-id.c
+++ b/gdb/build-id.c
@@ -136,7 +136,7 @@ build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id)
/* See build-id.h. */
-char *
+std::string
find_separate_debug_file_by_buildid (struct objfile *objfile)
{
const struct bfd_build_id *build_id;
@@ -157,7 +157,8 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
warning (_("\"%s\": separate debug info file has no debug info"),
bfd_get_filename (abfd.get ()));
else if (abfd != NULL)
- return xstrdup (bfd_get_filename (abfd.get ()));
+ return std::string (bfd_get_filename (abfd.get ()));
}
- return NULL;
+
+ return std::string ();
}