static void darwin_solib_create_inferior_hook (int from_tty) { struct darwin_info *info = get_darwin_info (); CORE_ADDR load_addr; info->all_image_addr = 0; darwin_solib_read_all_image_info_addr (info); if (info->all_image_addr == 0) darwin_solib_get_all_image_info_addr_at_init (info); if (info->all_image_addr == 0) return; darwin_load_image_infos (info); if (!darwin_dyld_version_ok (info)) { warning (_("unhandled dyld version (%d)"), info->all_image.version); return; } /* Add the breakpoint which is hit by dyld when the list of solib is modified. */ create_solib_event_breakpoint (target_gdbarch (), info->all_image.notifier); if (info->all_image.count != 0) { /* Possible relocate the main executable (PIE). */ load_addr = darwin_read_exec_load_addr_from_dyld (info); } else { /* Possible issue: Do not break on the notifier if dyld is not initialized (deduced from count == 0). In that case, dyld hasn't relocated itself and the notifier may point to a wrong address. */ load_addr = darwin_read_exec_load_addr_at_init (info); } if (load_addr != 0 && symfile_objfile != NULL) { CORE_ADDR vmaddr; /* Find the base address of the executable. */ vmaddr = bfd_mach_o_get_base_address (exec_bfd); /* Relocate. */ if (vmaddr != load_addr) objfile_rebase (symfile_objfile, load_addr - vmaddr); } }
static void darwin_solib_create_inferior_hook (int from_tty) { struct darwin_info *info = get_darwin_info (); CORE_ADDR load_addr; info->all_image_addr = 0; darwin_solib_read_all_image_info_addr (info); if (info->all_image_addr == 0) darwin_solib_get_all_image_info_addr_at_init (info); if (info->all_image_addr == 0) return; darwin_load_image_infos (info); if (!darwin_dyld_version_ok (info)) { warning (_("unhandled dyld version (%d)"), info->all_image.version); return; } create_solib_event_breakpoint (target_gdbarch (), info->all_image.notifier); /* Possible relocate the main executable (PIE). */ load_addr = darwin_read_exec_load_addr (info); if (load_addr != 0 && symfile_objfile != NULL) { CORE_ADDR vmaddr; /* Find the base address of the executable. */ vmaddr = bfd_mach_o_get_base_address (exec_bfd); /* Relocate. */ if (vmaddr != load_addr) objfile_rebase (symfile_objfile, load_addr - vmaddr); } }