GDB (xrefs)
Classes | Macros | Functions | Variables
/tmp/gdb-8.1/gdb/gdb_bfd.c File Reference
#include "defs.h"
#include "gdb_bfd.h"
#include "ui-out.h"
#include "gdbcmd.h"
#include "hashtab.h"
#include "filestuff.h"
#include "vec.h"
#include <sys/mman.h>
#include "target.h"
#include "gdb/fileio.h"
#include "inferior.h"

Go to the source code of this file.

Classes

struct  gdb_bfd_section_data
 
struct  gdb_bfd_data
 
struct  gdb_bfd_cache_search
 

Macros

#define MAP_FAILED   ((void *) -1)
 
#define GDB_BFD_DATA_ACCESSOR(ABFD)   ((struct gdb_bfd_data *) bfd_usrdata (ABFD))
 

Functions

static void show_bfd_sharing (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
 
static void show_bfd_cache_debug (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
 
static hashval_t hash_bfd (const void *b)
 
static int eq_bfd (const void *a, const void *b)
 
int is_target_filename (const char *name)
 
int gdb_bfd_has_target_filename (struct bfd *abfd)
 
static int fileio_errno_to_host (int errnum)
 
static void * gdb_bfd_iovec_fileio_open (struct bfd *abfd, void *inferior)
 
static file_ptr gdb_bfd_iovec_fileio_pread (struct bfd *abfd, void *stream, void *buf, file_ptr nbytes, file_ptr offset)
 
static int gdb_bfd_iovec_fileio_close (struct bfd *abfd, void *stream)
 
static int gdb_bfd_iovec_fileio_fstat (struct bfd *abfd, void *stream, struct stat *sb)
 
gdb_bfd_ref_ptr gdb_bfd_open (const char *name, const char *target, int fd)
 
static void free_one_bfd_section (bfd *abfd, asection *sectp, void *ignore)
 
static int gdb_bfd_close_or_warn (struct bfd *abfd)
 
void gdb_bfd_ref (struct bfd *abfd)
 
void gdb_bfd_unref (struct bfd *abfd)
 
static struct gdb_bfd_section_dataget_section_descriptor (asection *section)
 
const gdb_bytegdb_bfd_map_section (asection *sectp, bfd_size_type *size)
 
static int get_file_crc (bfd *abfd, unsigned long *file_crc_return)
 
int gdb_bfd_crc (struct bfd *abfd, unsigned long *crc_out)
 
gdb_bfd_ref_ptr gdb_bfd_fopen (const char *filename, const char *target, const char *mode, int fd)
 
gdb_bfd_ref_ptr gdb_bfd_openr (const char *filename, const char *target)
 
gdb_bfd_ref_ptr gdb_bfd_openw (const char *filename, const char *target)
 
gdb_bfd_ref_ptr gdb_bfd_openr_iovec (const char *filename, const char *target, void *(*open_func)(struct bfd *nbfd, void *open_closure), void *open_closure, file_ptr(*pread_func)(struct bfd *nbfd, void *stream, void *buf, file_ptr nbytes, file_ptr offset), int(*close_func)(struct bfd *nbfd, void *stream), int(*stat_func)(struct bfd *abfd, void *stream, struct stat *sb))
 
void gdb_bfd_mark_parent (bfd *child, bfd *parent)
 
gdb_bfd_ref_ptr gdb_bfd_openr_next_archived_file (bfd *archive, bfd *previous)
 
void gdb_bfd_record_inclusion (bfd *includer, bfd *includee)
 
gdb_bfd_ref_ptr gdb_bfd_fdopenr (const char *filename, const char *target, int fd)
 
 gdb_static_assert (ARRAY_SIZE(_bfd_std_section)==4)
 
int gdb_bfd_section_index (bfd *abfd, asection *section)
 
int gdb_bfd_count_sections (bfd *abfd)
 
int gdb_bfd_requires_relocations (bfd *abfd)
 
static int print_one_bfd (void **slot, void *data)
 
static void maintenance_info_bfds (const char *arg, int from_tty)
 
void _initialize_gdb_bfd (void)
 

Variables

static htab_t all_bfds
 
static htab_t gdb_bfd_cache
 
static int bfd_sharing = 1
 
static unsigned int debug_bfd_cache
 

Macro Definition Documentation

◆ GDB_BFD_DATA_ACCESSOR

#define GDB_BFD_DATA_ACCESSOR (   ABFD)    ((struct gdb_bfd_data *) bfd_usrdata (ABFD))

Definition at line 128 of file gdb_bfd.c.

◆ MAP_FAILED

#define MAP_FAILED   ((void *) -1)

Definition at line 30 of file gdb_bfd.c.

Referenced by gdb_bfd_map_section(), and linux_ptrace_test_ret_to_nx().

Function Documentation

◆ _initialize_gdb_bfd()

void _initialize_gdb_bfd ( void  )

◆ eq_bfd()

static int eq_bfd ( const void *  a,
const void *  b 
)
static

◆ fileio_errno_to_host()

static int fileio_errno_to_host ( int  errnum)
static

◆ free_one_bfd_section()

static void free_one_bfd_section ( bfd *  abfd,
asection *  sectp,
void *  ignore 
)
static

◆ gdb_bfd_close_or_warn()

static int gdb_bfd_close_or_warn ( struct bfd *  abfd)
static

Definition at line 504 of file gdb_bfd.c.

References _, free_one_bfd_section(), name, and warning().

Referenced by gdb_bfd_unref().

◆ gdb_bfd_count_sections()

int gdb_bfd_count_sections ( bfd *  abfd)

◆ gdb_bfd_crc()

int gdb_bfd_crc ( struct bfd *  abfd,
unsigned long *  crc_out 
)

Definition at line 756 of file gdb_bfd.c.

References gdb_bfd_data::crc, gdb_bfd_data::crc_computed, and get_file_crc().

Referenced by separate_debug_file_exists().

◆ gdb_bfd_fdopenr()

gdb_bfd_ref_ptr gdb_bfd_fdopenr ( const char *  filename,
const char *  target,
int  fd 
)

Definition at line 874 of file gdb_bfd.c.

References new_bfd_ref().

◆ gdb_bfd_fopen()

gdb_bfd_ref_ptr gdb_bfd_fopen ( const char *  filename,
const char *  target,
const char *  mode,
int  fd 
)

Definition at line 773 of file gdb_bfd.c.

References new_bfd_ref().

Referenced by core_open(), and exec_file_attach().

◆ gdb_bfd_has_target_filename()

int gdb_bfd_has_target_filename ( struct bfd *  abfd)

Definition at line 216 of file gdb_bfd.c.

References is_target_filename().

Referenced by solib_bfd_fopen(), and symfile_bfd_open().

◆ gdb_bfd_iovec_fileio_close()

static int gdb_bfd_iovec_fileio_close ( struct bfd *  abfd,
void *  stream 
)
static

Definition at line 344 of file gdb_bfd.c.

References target_fileio_close(), and xfree().

Referenced by gdb_bfd_open().

◆ gdb_bfd_iovec_fileio_fstat()

static int gdb_bfd_iovec_fileio_fstat ( struct bfd *  abfd,
void *  stream,
struct stat *  sb 
)
static

Definition at line 363 of file gdb_bfd.c.

References fileio_errno_to_host(), and target_fileio_fstat().

Referenced by gdb_bfd_open().

◆ gdb_bfd_iovec_fileio_open()

static void* gdb_bfd_iovec_fileio_open ( struct bfd *  abfd,
void *  inferior 
)
static

◆ gdb_bfd_iovec_fileio_pread()

static file_ptr gdb_bfd_iovec_fileio_pread ( struct bfd *  abfd,
void *  stream,
void *  buf,
file_ptr  nbytes,
file_ptr  offset 
)
static

Definition at line 309 of file gdb_bfd.c.

References fileio_errno_to_host(), offset, QUIT, and target_fileio_pread().

Referenced by gdb_bfd_open().

◆ gdb_bfd_map_section()

const gdb_byte* gdb_bfd_map_section ( asection *  sectp,
bfd_size_type *  size 
)

◆ gdb_bfd_mark_parent()

void gdb_bfd_mark_parent ( bfd *  child,
bfd *  parent 
)

◆ gdb_bfd_open()

gdb_bfd_ref_ptr gdb_bfd_open ( const char *  name,
const char *  target,
int  fd 
)

◆ gdb_bfd_openr()

gdb_bfd_ref_ptr gdb_bfd_openr ( const char *  filename,
const char *  target 
)

Definition at line 784 of file gdb_bfd.c.

References new_bfd_ref().

Referenced by bfd_openr_or_error(), and macho_check_dsym().

◆ gdb_bfd_openr_iovec()

gdb_bfd_ref_ptr gdb_bfd_openr_iovec ( const char *  filename,
const char *  target,
void *(*)(struct bfd *nbfd, void *open_closure)  open_func,
void *  open_closure,
file_ptr(*)(struct bfd *nbfd, void *stream, void *buf, file_ptr nbytes, file_ptr offset pread_func,
int(*)(struct bfd *nbfd, void *stream)  close_func,
int(*)(struct bfd *abfd, void *stream, struct stat *sb)  stat_func 
)

◆ gdb_bfd_openr_next_archived_file()

gdb_bfd_ref_ptr gdb_bfd_openr_next_archived_file ( bfd *  archive,
bfd *  previous 
)

Definition at line 850 of file gdb_bfd.c.

References gdb_bfd_mark_parent().

Referenced by macho_symfile_read_all_oso(), and solib_aix_bfd_open().

◆ gdb_bfd_openw()

gdb_bfd_ref_ptr gdb_bfd_openw ( const char *  filename,
const char *  target 
)

Definition at line 794 of file gdb_bfd.c.

References new_bfd_ref().

Referenced by bfd_openw_or_error(), and create_gcore_bfd().

◆ gdb_bfd_record_inclusion()

void gdb_bfd_record_inclusion ( bfd *  includer,
bfd *  includee 
)

Definition at line 863 of file gdb_bfd.c.

References gdb_bfd_data::included_bfds, and new_bfd_ref().

Referenced by dwarf2_get_dwz_file(), and try_open_dwop_file().

◆ gdb_bfd_ref()

void gdb_bfd_ref ( struct bfd *  abfd)

◆ gdb_bfd_requires_relocations()

int gdb_bfd_requires_relocations ( bfd *  abfd)

Definition at line 914 of file gdb_bfd.c.

References gdb_bfd_data::needs_relocations, and gdb_bfd_data::relocation_computed.

Referenced by get_objfile_bfd_data().

◆ gdb_bfd_section_index()

int gdb_bfd_section_index ( bfd *  abfd,
asection *  section 
)

◆ gdb_bfd_unref()

void gdb_bfd_unref ( struct bfd *  abfd)

◆ gdb_static_assert()

gdb_static_assert ( ARRAY_SIZE(_bfd_std_section)  = =4)

◆ get_file_crc()

static int get_file_crc ( bfd *  abfd,
unsigned long *  file_crc_return 
)
static

Definition at line 721 of file gdb_bfd.c.

References _, SEEK_SET, and warning().

Referenced by gdb_bfd_crc().

◆ get_section_descriptor()

static struct gdb_bfd_section_data* get_section_descriptor ( asection *  section)
static

Definition at line 625 of file gdb_bfd.c.

Referenced by gdb_bfd_map_section().

◆ hash_bfd()

static hashval_t hash_bfd ( const void *  b)
static

Definition at line 179 of file gdb_bfd.c.

Referenced by gdb_bfd_open().

◆ is_target_filename()

int is_target_filename ( const char *  name)

◆ maintenance_info_bfds()

static void maintenance_info_bfds ( const char *  arg,
int  from_tty 
)
static

◆ print_one_bfd()

static int print_one_bfd ( void **  slot,
void *  data 
)
static

◆ show_bfd_cache_debug()

static void show_bfd_cache_debug ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  value 
)
static

Definition at line 152 of file gdb_bfd.c.

References _, and fprintf_filtered().

Referenced by _initialize_gdb_bfd().

◆ show_bfd_sharing()

static void show_bfd_sharing ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  value 
)
static

Definition at line 142 of file gdb_bfd.c.

References _, and fprintf_filtered().

Referenced by _initialize_gdb_bfd().

Variable Documentation

◆ all_bfds

htab_t all_bfds
static

Definition at line 57 of file gdb_bfd.c.

Referenced by _initialize_gdb_bfd(), gdb_bfd_ref(), gdb_bfd_unref(), and maintenance_info_bfds().

◆ bfd_sharing

int bfd_sharing = 1
static

Definition at line 140 of file gdb_bfd.c.

Referenced by _initialize_gdb_bfd(), and gdb_bfd_open().

◆ debug_bfd_cache

unsigned int debug_bfd_cache
static

Definition at line 150 of file gdb_bfd.c.

Referenced by _initialize_gdb_bfd(), gdb_bfd_open(), gdb_bfd_ref(), and gdb_bfd_unref().

◆ gdb_bfd_cache

htab_t gdb_bfd_cache
static

Definition at line 135 of file gdb_bfd.c.

Referenced by gdb_bfd_open(), and gdb_bfd_unref().