GDB (xrefs)
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
gdb_bfd.c File Reference
#include "defs.h"
#include "gdb_bfd.h"
#include "ui-out.h"
#include "gdbcmd.h"
#include "hashtab.h"
#include "gdbsupport/filestuff.h"
#include "target.h"
#include "gdbsupport/fileio.h"
#include "inferior.h"
#include "cli/cli-style.h"
#include <unordered_map>

Go to the source code of this file.

Classes

struct  gdb_bfd_section_data
 
struct  gdb_bfd_data
 
struct  gdb_bfd_cache_search
 
struct  target_buffer
 
struct  target_fileio_stream
 
struct  bfd_inferior_data
 

Macros

#define bfd_cache_debug_printf(fmt, ...)    debug_prefixed_printf_cond (debug_bfd_cache, "bfd-cache", fmt, ##__VA_ARGS__)
 
#define AMBIGUOUS_MESS1   ".\nMatching formats:"
 
#define AMBIGUOUS_MESS2    ".\nUse \"set gnutarget format-name\" to specify the format."
 

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)
 
gdb_bfd_ref_ptr gdb_bfd_open_from_target_memory (CORE_ADDR addr, ULONGEST size, const char *target)
 
static target_fileio_streamgdb_bfd_iovec_fileio_open (struct bfd *abfd, inferior *inf, bool warn_if_slow)
 
static void gdb_bfd_close_warning (const char *name, const char *reason)
 
static void gdb_bfd_init_data (struct bfd *abfd, struct stat *st)
 
gdb_bfd_ref_ptr gdb_bfd_open (const char *name, const char *target, int fd, bool warn_if_slow)
 
static void free_one_bfd_section (asection *sectp)
 
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_byte * gdb_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, gdb_iovec_opener_ftype open_fn)
 
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_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)
 
bool gdb_bfd_get_full_section_contents (bfd *abfd, asection *section, gdb::byte_vector *contents)
 
std::string gdb_bfd_errmsg (bfd_error_type error_tag, char **matching)
 
static int print_one_bfd (void **slot, void *data)
 
static void maintenance_info_bfds (const char *arg, int from_tty)
 
static struct bfd_inferior_dataget_bfd_inferior_data (struct inferior *inf)
 
static unsigned long increment_bfd_error_count (std::string str)
 
static void ATTRIBUTE_PRINTF (1, 0)
 
void _initialize_gdb_bfd ()
 

Variables

static htab_t all_bfds
 
static htab_t gdb_bfd_cache
 
static bool bfd_sharing = true
 
static bool debug_bfd_cache
 
static const registry< inferior >::key< bfd_inferior_databfd_inferior_data_key
 
static bfd_error_handler_type default_bfd_error_handler
 

Macro Definition Documentation

◆ AMBIGUOUS_MESS1

#define AMBIGUOUS_MESS1   ".\nMatching formats:"

Definition at line 1045 of file gdb_bfd.c.

Referenced by gdb_bfd_errmsg().

◆ AMBIGUOUS_MESS2

#define AMBIGUOUS_MESS2    ".\nUse \"set gnutarget format-name\" to specify the format."

Definition at line 1046 of file gdb_bfd.c.

Referenced by gdb_bfd_errmsg().

◆ bfd_cache_debug_printf

#define bfd_cache_debug_printf ( fmt,
... )    debug_prefixed_printf_cond (debug_bfd_cache, "bfd-cache", fmt, ##__VA_ARGS__)

Definition at line 147 of file gdb_bfd.c.

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

Function Documentation

◆ _initialize_gdb_bfd()

void _initialize_gdb_bfd ( )

Definition at line 1175 of file gdb_bfd.c.

Referenced by initialize_all_files().

◆ ATTRIBUTE_PRINTF()

static void ATTRIBUTE_PRINTF ( 1 ,
0  )
static

Definition at line 1154 of file gdb_bfd.c.

References increment_bfd_error_count().

◆ eq_bfd()

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

◆ free_one_bfd_section()

static void free_one_bfd_section ( asection * sectp)
static

◆ gdb_bfd_close_or_warn()

static int gdb_bfd_close_or_warn ( struct bfd * abfd)
static

Definition at line 600 of file gdb_bfd.c.

References free_one_bfd_section(), gdb_bfd_close_warning(), gdb_bfd_sections(), and name.

Referenced by gdb_bfd_unref().

◆ gdb_bfd_close_warning()

static void gdb_bfd_close_warning ( const char * name,
const char * reason )
static

Definition at line 404 of file gdb_bfd.c.

References name.

Referenced by gdb_bfd_close_or_warn(), and target_fileio_stream::~target_fileio_stream().

◆ 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 842 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_errmsg()

std::string gdb_bfd_errmsg ( bfd_error_type error_tag,
char ** matching )

◆ gdb_bfd_fopen()

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

Definition at line 859 of file gdb_bfd.c.

Referenced by core_target_open(), and exec_file_attach().

◆ gdb_bfd_get_full_section_contents()

bool gdb_bfd_get_full_section_contents ( bfd * abfd,
asection * section,
gdb::byte_vector * contents )

Definition at line 1034 of file gdb_bfd.c.

Referenced by gdb_bfd_read_elf_soname(), and is_linked_with_cygwin_dll().

◆ gdb_bfd_has_target_filename()

int gdb_bfd_has_target_filename ( struct bfd * abfd)

Definition at line 215 of file gdb_bfd.c.

References is_target_filename().

◆ gdb_bfd_init_data()

static void gdb_bfd_init_data ( struct bfd * abfd,
struct stat * st )
static

Definition at line 451 of file gdb_bfd.c.

References all_bfds, and gdb_bfd_data::gdb_bfd_data().

Referenced by gdb_bfd_open(), and gdb_bfd_ref().

◆ gdb_bfd_iovec_fileio_open()

static target_fileio_stream * gdb_bfd_iovec_fileio_open ( struct bfd * abfd,
inferior * inf,
bool warn_if_slow )
static

Definition at line 345 of file gdb_bfd.c.

References is_target_filename(), target_fileio_open(), and TARGET_SYSROOT_PREFIX.

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,
bool warn_if_slow )

◆ gdb_bfd_open_from_target_memory()

gdb_bfd_ref_ptr gdb_bfd_open_from_target_memory ( CORE_ADDR addr,
ULONGEST size,
const char * target )

Definition at line 301 of file gdb_bfd.c.

References gdb_bfd_openr_iovec(), and size.

Referenced by jit_bfd_try_read_symtab().

◆ gdb_bfd_openr()

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

Definition at line 873 of file gdb_bfd.c.

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,
gdb_iovec_opener_ftype open_fn )

◆ gdb_bfd_openr_next_archived_file()

gdb_bfd_ref_ptr gdb_bfd_openr_next_archived_file ( bfd * archive,
bfd * previous )

Definition at line 956 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 883 of file gdb_bfd.c.

Referenced by bfd_openw_or_error(), and create_gcore_bfd().

◆ gdb_bfd_record_inclusion()

void gdb_bfd_record_inclusion ( bfd * includer,
bfd * includee )

◆ gdb_bfd_ref()

void gdb_bfd_ref ( struct bfd * abfd)

◆ gdb_bfd_requires_relocations()

int gdb_bfd_requires_relocations ( bfd * abfd)

◆ 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_bfd_inferior_data()

static struct bfd_inferior_data * get_bfd_inferior_data ( struct inferior * inf)
static

Definition at line 1125 of file gdb_bfd.c.

References bfd_inferior_data_key, and registry< T >::get().

Referenced by increment_bfd_error_count().

◆ get_file_crc()

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

Definition at line 807 of file gdb_bfd.c.

References SEEK_SET.

Referenced by gdb_bfd_crc().

◆ get_section_descriptor()

static struct gdb_bfd_section_data * get_section_descriptor ( asection * section)
static

Definition at line 706 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 178 of file gdb_bfd.c.

Referenced by gdb_bfd_open().

◆ increment_bfd_error_count()

static unsigned long increment_bfd_error_count ( std::string str)
static

◆ 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 151 of file gdb_bfd.c.

References gdb_printf().

◆ 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 135 of file gdb_bfd.c.

References gdb_printf().

Variable Documentation

◆ all_bfds

htab_t all_bfds
static

Definition at line 58 of file gdb_bfd.c.

Referenced by gdb_bfd_init_data(), gdb_bfd_unref(), and maintenance_info_bfds().

◆ bfd_inferior_data_key

const registry<inferior>::key<bfd_inferior_data> bfd_inferior_data_key
static

Definition at line 1119 of file gdb_bfd.c.

Referenced by get_bfd_inferior_data().

◆ bfd_sharing

bool bfd_sharing = true
static

Definition at line 133 of file gdb_bfd.c.

Referenced by gdb_bfd_open().

◆ debug_bfd_cache

bool debug_bfd_cache
static

Definition at line 143 of file gdb_bfd.c.

◆ default_bfd_error_handler

bfd_error_handler_type default_bfd_error_handler
static

Definition at line 1148 of file gdb_bfd.c.

◆ gdb_bfd_cache

htab_t gdb_bfd_cache
static

Definition at line 128 of file gdb_bfd.c.

Referenced by gdb_bfd_open(), and gdb_bfd_unref().