gdb: allocate symfile_segment_data with new
- Allocate this structure with new instead of XNEW, use a unique pointer
to manage its lifetime.
- Change a few functions to return a unique pointer instead of a
plain pointer.
- Change free_symfile_segment_data to be symfile_segment_data's
destructor.
gdb/ChangeLog:
* symfile.h (struct symfile_segment_data): Initialize fields.
<~symfile_segment_data>: Add.
(symfile_segment_data_up): New.
(struct sym_fns) <sym_segments>: Return a
symfile_segment_data_up.
(default_symfile_segments): Return a symfile_segment_data_up.
(free_symfile_segment_data): Remove.
(get_symfile_segment_data): Return a symfile_segment_data_up.
* symfile.c (default_symfile_segments): Likewise.
(get_symfile_segment_data): Likewise.
(free_symfile_segment_data): Remove.
(symfile_find_segment_sections): Update.
* elfread.c (elf_symfile_segments): Return a
symfile_segment_data_up.
* remote.c (remote_target::get_offsets): Update.
* solib-target.c (solib_target_relocate_section_addresses):
Update.
* symfile-debug.c (debug_sym_segments): Return a
symfile_segment_data_up.