GDB (xrefs)

Classes | Macros | Functions | Variables
/tmp/gdb-8.1/gdb/solib-darwin.c File Reference
`#include "defs.h"`
`#include "symtab.h"`
`#include "bfd.h"`
`#include "symfile.h"`
`#include "objfiles.h"`
`#include "gdbcore.h"`
`#include "target.h"`
`#include "inferior.h"`
`#include "regcache.h"`
`#include "gdbthread.h"`
`#include "gdb_bfd.h"`
`#include "solist.h"`
`#include "solib.h"`
`#include "solib-svr4.h"`
`#include "bfd-target.h"`
`#include "elf-bfd.h"`
`#include "exec.h"`
`#include "auxv.h"`
`#include "mach-o.h"`
`#include "mach-o/external.h"`

Go to the source code of this file.

## Classes
struct | gdb_dyld_image_info
struct | gdb_dyld_all_image_infos
struct | darwin_info
struct | lm_info_darwin

## Macros
#define | DYLD_VERSION_MIN 1
#define | DYLD_VERSION_MAX 15

## Functions
static void | darwin_pspace_data_cleanup (struct program_space *pspace, void *arg)
static struct darwin_info * | get_darwin_info (void)
static int | darwin_dyld_version_ok (const struct darwin_info *info)
static void | darwin_load_image_infos (struct darwin_info *info)
static CORE_ADDR | lookup_symbol_from_bfd (bfd *abfd, const char *symname)
static char * | find_program_interpreter (void)
static int | open_symbol_file_object (int from_tty)
static struct so_list * | darwin_current_sos (void)
static CORE_ADDR | darwin_validate_exec_header (CORE_ADDR load_addr)
static CORE_ADDR | darwin_read_exec_load_addr_from_dyld (struct darwin_info *info)
static CORE_ADDR | darwin_read_exec_load_addr_at_init (struct darwin_info *info)
static int | darwin_in_dynsym_resolve_code (CORE_ADDR pc)
static gdb_bfd_ref_ptr | gdb_bfd_mach_o_fat_extract (bfd *abfd, bfd_format format, const bfd_arch_info_type *arch)
static void | darwin_solib_get_all_image_info_addr_at_init (struct darwin_info *info)
static void | darwin_solib_read_all_image_info_addr (struct darwin_info *info)
static void | darwin_solib_create_inferior_hook (int from_tty)
static void | darwin_clear_solib (void)
static void | darwin_free_so (struct so_list *so)
static void | darwin_relocate_section_addresses (struct so_list *so, struct target_section *sec)
static struct block_symbol | darwin_lookup_lib_symbol (struct objfile *objfile, const char *name, const domain_enum domain)
static gdb_bfd_ref_ptr | darwin_bfd_open (char *pathname)
void | _initialize_darwin_solib (void)

## Variables
static const struct program_space_data * | solib_darwin_pspace_data
struct target_so_ops | darwin_so_ops

## Macro Definition Documentation

## ◆ DYLD_VERSION_MAX

#define DYLD_VERSION_MAX 15

Definition at line 70 of file solib-darwin.c.

Referenced by darwin_dyld_version_ok().

## ◆ DYLD_VERSION_MIN

#define DYLD_VERSION_MIN 1

Definition at line 69 of file solib-darwin.c.

Referenced by darwin_dyld_version_ok().

## Function Documentation

## ◆ _initialize_darwin_solib()

void _initialize_darwin_solib | ( | void |  | ) |

Definition at line 652 of file solib-darwin.c.

References target_so_ops::bfd_open, target_so_ops::clear_solib, target_so_ops::current_sos, darwin_bfd_open(), darwin_clear_solib(), darwin_current_sos(), darwin_free_so(), darwin_in_dynsym_resolve_code(), darwin_lookup_lib_symbol(), darwin_pspace_data_cleanup(), darwin_relocate_section_addresses(), darwin_so_ops, darwin_solib_create_inferior_hook(), target_so_ops::free_so, target_so_ops::in_dynsym_resolve_code, target_so_ops::lookup_lib_global_symbol, target_so_ops::open_symbol_file_object, open_symbol_file_object(), target_so_ops::relocate_section_addresses, target_so_ops::solib_create_inferior_hook, and solib_darwin_pspace_data.

## ◆ darwin_bfd_open()

static gdb_bfd_ref_ptr darwin_bfd_open | ( | char * | pathname | ) |
| static

Definition at line 620 of file solib-darwin.c.

References _, error(), gdb_bfd_mach_o_fat_extract(), gdbarch_bfd_arch_info(), gdb::ref_ptr< T, Policy >::get(), perror_with_name(), solib_bfd_fopen(), solib_find(), target_gdbarch(), and xfree().

Referenced by _initialize_darwin_solib().

## ◆ darwin_clear_solib()

static void darwin_clear_solib | ( | void |  | ) |
| static

Definition at line 570 of file solib-darwin.c.

References darwin_info::all_image, darwin_info::all_image_addr, get_darwin_info(), and gdb_dyld_all_image_infos::version.

Referenced by _initialize_darwin_solib().

## ◆ darwin_current_sos()

static struct so_list* darwin_current_sos | ( | void |  | ) |
| static

Definition at line 233 of file solib-darwin.c.

References darwin_info::all_image, builtin_type::builtin_data_ptr, builtin_type(), gdb_dyld_all_image_infos::count, darwin_dyld_version_ok(), darwin_load_image_infos(), discard_cleanups(), extract_typed_address(), extract_unsigned_integer(), gdbarch_byte_order(), get_darwin_info(), gdb_dyld_all_image_infos::info, lm_info_darwin::lm_addr, so_list::lm_info, make_cleanup(), so_list::next, so_list::so_name, SO_NAME_MAX_PATH_SIZE, so_list::so_original_name, target_gdbarch(), target_read_memory(), target_read_string(), TYPE_LENGTH, XCNEW, and xfree().

Referenced by _initialize_darwin_solib().

## ◆ darwin_dyld_version_ok()

static int darwin_dyld_version_ok | ( | const struct darwin_info * | info | ) |
| static

Definition at line 113 of file solib-darwin.c.

References darwin_info::all_image, DYLD_VERSION_MAX, DYLD_VERSION_MIN, and gdb_dyld_all_image_infos::version.

Referenced by darwin_current_sos(), darwin_load_image_infos(), and darwin_solib_create_inferior_hook().

## ◆ darwin_free_so()

static void darwin_free_so | ( | struct so_list * | so | ) |
| static

Definition at line 579 of file solib-darwin.c.

References so_list::lm_info.

Referenced by _initialize_darwin_solib().

## ◆ darwin_in_dynsym_resolve_code()

static int darwin_in_dynsym_resolve_code | ( | CORE_ADDR | pc | ) |
| static

Definition at line 412 of file solib-darwin.c.

Referenced by _initialize_darwin_solib().

## ◆ darwin_load_image_infos()

static void darwin_load_image_infos | ( | struct darwin_info * | info | ) |
| static

Definition at line 122 of file solib-darwin.c.

References darwin_info::all_image, darwin_info::all_image_addr, builtin_type::builtin_data_ptr, builtin_type(), gdb_dyld_all_image_infos::count, darwin_dyld_version_ok(), extract_typed_address(), extract_unsigned_integer(), gdb_assert, gdbarch_byte_order(), gdb_dyld_all_image_infos::info, memset(), gdb_dyld_all_image_infos::notifier, target_gdbarch(), target_read_memory(), TYPE_LENGTH, and gdb_dyld_all_image_infos::version.

Referenced by darwin_current_sos(), and darwin_solib_create_inferior_hook().

## ◆ darwin_lookup_lib_symbol()

static struct block_symbol darwin_lookup_lib_symbol | ( | struct objfile * | objfile,
|  | const char * | name,
|  | const domain_enum | domain
| ) |  |
| static

Definition at line 612 of file solib-darwin.c.

Referenced by _initialize_darwin_solib().

## ◆ darwin_pspace_data_cleanup()

static void darwin_pspace_data_cleanup | ( | struct program_space * | pspace,
|  | void * | arg
| ) |  |
| static

Definition at line 86 of file solib-darwin.c.

References xfree().

Referenced by _initialize_darwin_solib().

## ◆ darwin_read_exec_load_addr_at_init()

static CORE_ADDR darwin_read_exec_load_addr_at_init | ( | struct darwin_info * | info | ) |
| static

Definition at line 384 of file solib-darwin.c.

References gdbarch::byte_order, darwin_validate_exec_header(), extract_unsigned_integer(), gdbarch_addr_bit(), gdbarch_byte_order(), gdbarch_sp_regnum(), get_current_regcache(), REG_VALID, regcache_cooked_read_unsigned(), target_gdbarch(), and target_read_memory().

Referenced by darwin_solib_create_inferior_hook().

## ◆ darwin_read_exec_load_addr_from_dyld()

static CORE_ADDR darwin_read_exec_load_addr_from_dyld | ( | struct darwin_info * | info | ) |
| static

Definition at line 354 of file solib-darwin.c.

References darwin_info::all_image, builtin_type::builtin_data_ptr, builtin_type(), gdb_dyld_all_image_infos::count, darwin_validate_exec_header(), extract_typed_address(), gdb_dyld_all_image_infos::info, target_gdbarch(), target_read_memory(), and TYPE_LENGTH.

Referenced by darwin_solib_create_inferior_hook().

## ◆ darwin_relocate_section_addresses()

static void darwin_relocate_section_addresses | ( | struct so_list * | so,
|  | struct target_section * | sec
| ) |  |
| static

Definition at line 590 of file solib-darwin.c.

References target_section::addr, so_list::addr_high, so_list::addr_low, target_section::endaddr, if(), lm_info_darwin::lm_addr, and so_list::lm_info.

Referenced by _initialize_darwin_solib().

## ◆ darwin_solib_create_inferior_hook()

static void darwin_solib_create_inferior_hook | ( | int | from_tty | ) |
| static

Definition at line 514 of file solib-darwin.c.

References _, darwin_info::all_image, darwin_info::all_image_addr, gdb_dyld_all_image_infos::count, create_solib_event_breakpoint(), darwin_dyld_version_ok(), darwin_load_image_infos(), darwin_read_exec_load_addr_at_init(), darwin_read_exec_load_addr_from_dyld(), darwin_solib_get_all_image_info_addr_at_init(), darwin_solib_read_all_image_info_addr(), exec_bfd, get_darwin_info(), gdb_dyld_all_image_infos::notifier, objfile_rebase(), symfile_objfile, target_gdbarch(), gdb_dyld_all_image_infos::version, and warning().

Referenced by _initialize_darwin_solib().

## ◆ darwin_solib_get_all_image_info_addr_at_init()

static void darwin_solib_get_all_image_info_addr_at_init | ( | struct darwin_info * | info | ) |
| static

Definition at line 442 of file solib-darwin.c.

References darwin_info::all_image_addr, current_inferior(), find_program_interpreter(), gdb_bfd_mach_o_fat_extract(), gdb_bfd_open(), gdbarch_bfd_arch_info(), gdb::ref_ptr< T, Policy >::get(), get_current_regcache(), gnutarget, interp_name(), lookup_symbol_from_bfd(), regcache_read_pc(), gdb::ref_ptr< T, Policy >::release(), and target_gdbarch().

Referenced by darwin_solib_create_inferior_hook().

## ◆ darwin_solib_read_all_image_info_addr()

static void darwin_solib_read_all_image_info_addr | ( | struct darwin_info * | info | ) |
| static

Definition at line 491 of file solib-darwin.c.

References darwin_info::all_image_addr, builtin_type::builtin_data_ptr, builtin_type(), current_target, extract_unsigned_integer(), target_gdbarch(), TARGET_OBJECT_DARWIN_DYLD_INFO, target_read(), and TYPE_LENGTH.

Referenced by darwin_solib_create_inferior_hook().

## ◆ darwin_validate_exec_header()

static CORE_ADDR darwin_validate_exec_header | ( | CORE_ADDR | load_addr | ) |
| static

Definition at line 324 of file solib-darwin.c.

References extract_unsigned_integer(), gdbarch_byte_order(), target_gdbarch(), and target_read_memory().

Referenced by darwin_read_exec_load_addr_at_init(), and darwin_read_exec_load_addr_from_dyld().

## ◆ find_program_interpreter()

static char* find_program_interpreter | ( | void |  | ) |
| static

Definition at line 201 of file solib-darwin.c.

References exec_bfd.

Referenced by darwin_solib_get_all_image_info_addr_at_init().

## ◆ gdb_bfd_mach_o_fat_extract()

static gdb_bfd_ref_ptr gdb_bfd_mach_o_fat_extract | ( | bfd * | abfd,
|  | bfd_format | format,
|  | const bfd_arch_info_type * | arch
| ) |  |
| static

Definition at line 422 of file solib-darwin.c.

References gdb_bfd_mark_parent(), and gdb_bfd_ref().

Referenced by darwin_bfd_open(), and darwin_solib_get_all_image_info_addr_at_init().

## ◆ get_darwin_info()

static struct darwin_info* get_darwin_info | ( | void |  | ) |
| static

Definition at line 95 of file solib-darwin.c.

References current_program_space, solib_darwin_pspace_data, and XCNEW.

Referenced by darwin_clear_solib(), darwin_current_sos(), and darwin_solib_create_inferior_hook().

## ◆ lookup_symbol_from_bfd()

static CORE_ADDR lookup_symbol_from_bfd | ( | bfd * | abfd,
|  | const char * | symname
| ) |  |
| static

Definition at line 165 of file solib-darwin.c.

References xfree(), and xmalloc().

Referenced by darwin_solib_get_all_image_info_addr_at_init().

## ◆ open_symbol_file_object()

static int open_symbol_file_object | ( | int | from_tty | ) |
| static

Definition at line 225 of file solib-darwin.c.

Referenced by _initialize_darwin_solib().

## Variable Documentation

## ◆ darwin_so_ops

struct target_so_ops darwin_so_ops

Definition at line 649 of file solib-darwin.c.

Referenced by _initialize_darwin_solib(), i386_darwin_init_abi(), and x86_darwin_init_abi_64().

## ◆ solib_darwin_pspace_data

const struct program_space_data* solib_darwin_pspace_data
| static

Definition at line 83 of file solib-darwin.c.

Referenced by _initialize_darwin_solib(), and get_darwin_info().