summaryrefslogtreecommitdiff
path: root/bfd/mach-o.c
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2011-12-13 14:02:17 +0000
committerTristan Gingold <gingold@adacore.com>2011-12-13 14:02:17 +0000
commita0bb6f35256efa92da14cadb1062ee0b087141ab (patch)
treedfd83d5233d61aacda382c4858496294afec2e37 /bfd/mach-o.c
parent7b14c9428defdd2779a958b55d593b22bd1586ac (diff)
downloadbinutils-redhat-a0bb6f35256efa92da14cadb1062ee0b087141ab.tar.gz
2011-12-13 Shinichiro Hamaji <shinichiro.hamaji@gmail.com>
* dwarf2.c (bfd_dwarf2_cleanup_debug_info): Accept stash as an argument like other functions to support formats other than ELF. * elf-bfd.h (bfd_dwarf2_cleanup_debug_info): Move to bfd-in.h. * elf.c (_bfd_elf_close_and_cleanup): Pass dwarf2_find_line_info in tdata as a parameter. * libbfd-in.h (bfd_dwarf2_cleanup_debug_info): Move from elf-bfd.h. * libbfd.h (bfd_dwarf2_cleanup_debug_info): Regenerate. * mach-o-target.c (bfd_mach_o_close_and_cleanup): Remove the fallback macro. (bfd_mach_o_find_nearest_line): Likewise. * mach-o.c (bfd_mach_o_find_nearest_line): Add the definition which calls _bfd_dwarf2_find_nearest_line. (bfd_mach_o_close_and_cleanup): Likewise. * mach-o.h (mach_o_data_struct): Add dwarf2_find_line_info. (bfd_mach_o_find_nearest_line): Add declaration. (bfd_mach_o_close_and_cleanup): Add declaration.
Diffstat (limited to 'bfd/mach-o.c')
-rw-r--r--bfd/mach-o.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/bfd/mach-o.c b/bfd/mach-o.c
index 0a614c30ce..54edd079a0 100644
--- a/bfd/mach-o.c
+++ b/bfd/mach-o.c
@@ -3480,6 +3480,38 @@ bfd_mach_o_core_file_failing_signal (bfd *abfd ATTRIBUTE_UNUSED)
return 0;
}
+bfd_boolean
+bfd_mach_o_find_nearest_line (bfd *abfd,
+ asection *section,
+ asymbol **symbols,
+ bfd_vma offset,
+ const char **filename_ptr,
+ const char **functionname_ptr,
+ unsigned int *line_ptr)
+{
+ bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
+ /* TODO: Handle executables and dylibs by using dSYMs. */
+ if (mdata->header.filetype != BFD_MACH_O_MH_OBJECT)
+ return FALSE;
+ if (_bfd_dwarf2_find_nearest_line (abfd, dwarf_debug_sections,
+ section, symbols, offset,
+ filename_ptr, functionname_ptr,
+ line_ptr, 0,
+ &mdata->dwarf2_find_line_info))
+ return TRUE;
+ return FALSE;
+}
+
+bfd_boolean
+bfd_mach_o_close_and_cleanup (bfd *abfd)
+{
+ bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
+ if (bfd_get_format (abfd) == bfd_object && mdata != NULL)
+ _bfd_dwarf2_cleanup_debug_info (abfd, &mdata->dwarf2_find_line_info);
+
+ return _bfd_generic_close_and_cleanup (abfd);
+}
+
#define bfd_mach_o_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
#define bfd_mach_o_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup