GDB (xrefs)
Classes | Macros | Typedefs | Functions | Variables
/tmp/gdb-7.10/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))
 

Typedefs

typedef bfd * bfdp
 

Functions

 DEF_VEC_P (bfdp)
 
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)
 
struct bfd * 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)
 
bfd * gdb_bfd_fopen (const char *filename, const char *target, const char *mode, int fd)
 
bfd * gdb_bfd_openr (const char *filename, const char *target)
 
bfd * gdb_bfd_openw (const char *filename, const char *target)
 
bfd * 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)
 
bfd * gdb_bfd_openr_next_archived_file (bfd *archive, bfd *previous)
 
void gdb_bfd_record_inclusion (bfd *includer, bfd *includee)
 
bfd * 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 (char *arg, int from_tty)
 
void _initialize_gdb_bfd (void)
 

Variables

static htab_t all_bfds
 
static htab_t gdb_bfd_cache
 
initialize_file_ftype _initialize_gdb_bfd
 

Macro Definition Documentation

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

Definition at line 96 of file gdb_bfd.c.

#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().

Typedef Documentation

typedef bfd* bfdp

Definition at line 37 of file gdb_bfd.c.

Function Documentation

void _initialize_gdb_bfd ( void  )
DEF_VEC_P ( bfdp  )
static int eq_bfd ( const void *  a,
const void *  b 
)
static

Definition at line 132 of file gdb_bfd.c.

References gdb_bfd_cache_search::filename, gdb_bfd_data::mtime, and gdb_bfd_cache_search::mtime.

Referenced by gdb_bfd_open().

static int fileio_errno_to_host ( int  errnum)
static
static void free_one_bfd_section ( bfd *  abfd,
asection *  sectp,
void *  ignore 
)
static
static int gdb_bfd_close_or_warn ( struct bfd *  abfd)
static

Definition at line 420 of file gdb_bfd.c.

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

Referenced by gdb_bfd_unref().

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

Definition at line 658 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().

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

Definition at line 789 of file gdb_bfd.c.

References gdb_bfd_ref().

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

Definition at line 675 of file gdb_bfd.c.

References gdb_bfd_ref().

Referenced by core_open(), and exec_file_attach().

int gdb_bfd_has_target_filename ( struct bfd *  abfd)

Definition at line 153 of file gdb_bfd.c.

References is_target_filename().

Referenced by solib_bfd_fopen(), and symfile_bfd_open().

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

Definition at line 281 of file gdb_bfd.c.

References target_fileio_close(), and xfree().

Referenced by gdb_bfd_open().

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

Definition at line 300 of file gdb_bfd.c.

References fileio_errno_to_host(), and target_fileio_fstat().

Referenced by gdb_bfd_open().

static void* gdb_bfd_iovec_fileio_open ( struct bfd *  abfd,
void *  inferior 
)
static
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 246 of file gdb_bfd.c.

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

Referenced by gdb_bfd_open().

const gdb_byte* gdb_bfd_map_section ( asection *  sectp,
bfd_size_type *  size 
)
void gdb_bfd_mark_parent ( bfd *  child,
bfd *  parent 
)
struct bfd* gdb_bfd_open ( const char *  name,
const char *  target,
int  fd 
)
bfd* gdb_bfd_openr ( const char *  filename,
const char *  target 
)

Definition at line 689 of file gdb_bfd.c.

References gdb_bfd_ref().

Referenced by bfd_openr_with_cleanup(), and macho_check_dsym().

bfd* 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 
)
bfd* gdb_bfd_openr_next_archived_file ( bfd *  archive,
bfd *  previous 
)

Definition at line 764 of file gdb_bfd.c.

References gdb_bfd_mark_parent().

Referenced by macho_symfile_read_all_oso(), and solib_aix_bfd_open().

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

Definition at line 702 of file gdb_bfd.c.

References gdb_bfd_ref().

Referenced by bfd_openw_with_cleanup(), and create_gcore_bfd().

void gdb_bfd_record_inclusion ( bfd *  includer,
bfd *  includee 
)

Definition at line 777 of file gdb_bfd.c.

References gdb_bfd_ref(), and VEC_safe_push.

Referenced by dwarf2_get_dwz_file(), and try_open_dwop_file().

void gdb_bfd_ref ( struct bfd *  abfd)
int gdb_bfd_requires_relocations ( bfd *  abfd)

Definition at line 832 of file gdb_bfd.c.

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

Referenced by get_objfile_bfd_data().

int gdb_bfd_section_index ( bfd *  abfd,
asection *  section 
)
void gdb_bfd_unref ( struct bfd *  abfd)
gdb_static_assert ( ARRAY_SIZE(_bfd_std_section)  = =4)
static int get_file_crc ( bfd *  abfd,
unsigned long *  file_crc_return 
)
static

Definition at line 623 of file gdb_bfd.c.

References _, SEEK_SET, and warning().

Referenced by gdb_bfd_crc().

static struct gdb_bfd_section_data* get_section_descriptor ( asection *  section)
static

Definition at line 529 of file gdb_bfd.c.

Referenced by gdb_bfd_map_section().

static hashval_t hash_bfd ( const void *  b)
static

Definition at line 120 of file gdb_bfd.c.

Referenced by gdb_bfd_open().

int is_target_filename ( const char *  name)
static void maintenance_info_bfds ( char *  arg,
int  from_tty 
)
static
static int print_one_bfd ( void **  slot,
void *  data 
)
static

Variable Documentation

initialize_file_ftype _initialize_gdb_bfd
htab_t all_bfds
static

Definition at line 60 of file gdb_bfd.c.

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

htab_t gdb_bfd_cache
static

Definition at line 103 of file gdb_bfd.c.

Referenced by gdb_bfd_open(), and gdb_bfd_unref().