diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2018-03-08 18:56:23 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2018-03-08 18:56:23 -0500 |
commit | a8dbfd5853e3a5f7f2a3ca817e96d9e0759061a2 (patch) | |
tree | 6afc9df31bdc7097c42d1b0b8d0c994ba354e626 /gdb/elfread.c | |
parent | e6a58aa8a70c7fd17d9930e7df8d158a7e3c8c8e (diff) | |
download | gdb-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/elfread.c')
-rw-r--r-- | gdb/elfread.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/gdb/elfread.c b/gdb/elfread.c index 103b214..2607890 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -1259,17 +1259,16 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) && objfile->separate_debug_objfile == NULL && objfile->separate_debug_objfile_backlink == NULL) { - gdb::unique_xmalloc_ptr<char> debugfile - (find_separate_debug_file_by_buildid (objfile)); + std::string debugfile = find_separate_debug_file_by_buildid (objfile); - if (debugfile == NULL) - debugfile.reset (find_separate_debug_file_by_debuglink (objfile)); + if (debugfile.empty ()) + debugfile = find_separate_debug_file_by_debuglink (objfile); - if (debugfile != NULL) + if (!debugfile.empty ()) { - gdb_bfd_ref_ptr abfd (symfile_bfd_open (debugfile.get ())); + gdb_bfd_ref_ptr abfd (symfile_bfd_open (debugfile.c_str ())); - symbol_file_add_separate (abfd.get (), debugfile.get (), + symbol_file_add_separate (abfd.get (), debugfile.c_str (), symfile_flags, objfile); } } |