forked from Imagelibrary/binutils-gdb
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.
This commit is contained in:
committed by
Simon Marchi
parent
e6a58aa8a7
commit
a8dbfd5853
@@ -733,20 +733,17 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
|
||||
/* Try to add separate debug file if no symbols table found. */
|
||||
if (!objfile_has_partial_symbols (objfile))
|
||||
{
|
||||
char *debugfile;
|
||||
std::string debugfile = find_separate_debug_file_by_buildid (objfile);
|
||||
|
||||
debugfile = find_separate_debug_file_by_buildid (objfile);
|
||||
|
||||
if (debugfile == NULL)
|
||||
if (debugfile.empty ())
|
||||
debugfile = find_separate_debug_file_by_debuglink (objfile);
|
||||
make_cleanup (xfree, debugfile);
|
||||
|
||||
if (debugfile)
|
||||
if (!debugfile.empty ())
|
||||
{
|
||||
gdb_bfd_ref_ptr abfd (symfile_bfd_open (debugfile));
|
||||
gdb_bfd_ref_ptr abfd (symfile_bfd_open (debugfile.c_str ()));
|
||||
|
||||
symbol_file_add_separate (abfd.get (), debugfile, symfile_flags,
|
||||
objfile);
|
||||
symbol_file_add_separate (abfd.get (), debugfile.c_str (),
|
||||
symfile_flags, objfile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user