GDB (xrefs)
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
coffread.c File Reference
#include "defs.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "demangle.h"
#include "breakpoint.h"
#include "bfd.h"
#include "gdbsupport/gdb_obstack.h"
#include <ctype.h>
#include "coff/internal.h"
#include "libcoff.h"
#include "objfiles.h"
#include "buildsym-legacy.h"
#include "stabsread.h"
#include "complaints.h"
#include "target.h"
#include "block.h"
#include "dictionary.h"
#include "dwarf2/public.h"
#include "coff-pe-read.h"
#include "build-id.h"

Go to the source code of this file.

Classes

struct  coff_symfile_info
 
struct  coff_symbol
 
struct  coff_find_targ_sec_arg
 

Macros

#define EXTERNAL_NAME(string, abfd)
 
#define SDB_TYPE(type)   (BTYPE(type) | (type & N_TMASK))
 
#define N_BTMASK   local_n_btmask
 
#define N_BTSHFT   local_n_btshft
 
#define N_TMASK   local_n_tmask
 
#define N_TSHIFT   local_n_tshift
 
#define INITIAL_TYPE_VECTOR_LENGTH   160
 
#define L_LNNO32(lp)   ((lp)->l_lnno)
 

Functions

void stabsread_clear_cache (void)
 
static struct typecoff_read_struct_type (int, int, int, struct objfile *)
 
static struct typedecode_base_type (struct coff_symbol *, unsigned int, union internal_auxent *, struct objfile *)
 
static struct typedecode_type (struct coff_symbol *, unsigned int, union internal_auxent *, struct objfile *)
 
static struct typedecode_function_type (struct coff_symbol *, unsigned int, union internal_auxent *, struct objfile *)
 
static struct typecoff_read_enum_type (int, int, int, struct objfile *)
 
static struct symbolprocess_coff_symbol (struct coff_symbol *, union internal_auxent *, struct objfile *)
 
static void patch_opaque_types (struct symtab *)
 
static void enter_linenos (file_ptr, int, int, struct objfile *)
 
static int init_lineno (bfd *, file_ptr, file_ptr, gdb::unique_xmalloc_ptr< char > *)
 
static char * getsymname (struct internal_syment *)
 
static const char * coff_getfilename (union internal_auxent *)
 
static int init_stringtab (bfd *, file_ptr, gdb::unique_xmalloc_ptr< char > *)
 
static void read_one_sym (struct coff_symbol *, struct internal_syment *, union internal_auxent *)
 
static void coff_symtab_read (minimal_symbol_reader &, file_ptr, unsigned int, struct objfile *)
 
static void coff_locate_sections (bfd *abfd, asection *sectp, void *csip)
 
static int cs_to_section (struct coff_symbol *, struct objfile *)
 
static void find_targ_sec (bfd *abfd, asection *sect, void *obj)
 
static struct bfd_section * cs_to_bfd_section (struct coff_symbol *cs, struct objfile *objfile)
 
static CORE_ADDR cs_section_address (struct coff_symbol *, bfd *)
 
static struct type ** coff_lookup_type (int index)
 
static struct typecoff_alloc_type (int index)
 
static void coff_start_compunit_symtab (struct objfile *objfile, const char *name)
 
static void complete_symtab (const char *name, CORE_ADDR start_addr, unsigned int size)
 
static void coff_end_compunit_symtab (struct objfile *objfile)
 
static int is_import_fixup_symbol (struct coff_symbol *cs, enum minimal_symbol_type type)
 
static struct minimal_symbolrecord_minimal_symbol (minimal_symbol_reader &reader, struct coff_symbol *cs, unrelocated_addr address, enum minimal_symbol_type type, int section, struct objfile *objfile)
 
static void coff_symfile_init (struct objfile *objfile)
 
static void find_linenos (bfd *abfd, struct bfd_section *asect, void *vpinfo)
 
static void coff_read_minsyms (file_ptr symtab_offset, unsigned int nsyms, struct objfile *objfile)
 
static void coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
 
static void coff_new_init (struct objfile *ignore)
 
static void coff_symfile_finish (struct objfile *objfile)
 
static void patch_type (struct type *type, struct type *real_type)
 
static int coff_reg_to_regnum (struct symbol *sym, struct gdbarch *gdbarch)
 
void _initialize_coffread ()
 

Variables

static struct objfilecoffread_objfile
 
static const registry< objfile >::key< coff_symfile_infocoff_objfile_data_key
 
static CORE_ADDR current_source_start_addr
 
static CORE_ADDR current_source_end_addr
 
static bfd * nlist_bfd_global
 
static int nlist_nsyms_global
 
static char * temp_sym
 
static char * temp_aux
 
static unsigned local_n_btmask
 
static unsigned local_n_btshft
 
static unsigned local_n_tmask
 
static unsigned local_n_tshift
 
static unsigned local_linesz
 
static unsigned local_symesz
 
static unsigned local_auxesz
 
static int pe_file
 
static struct symbolopaque_type_chain [HASHSIZE]
 
static struct type ** type_vector
 
static int type_vector_length
 
static char * linetab = NULL
 
static file_ptr linetab_offset
 
static file_ptr linetab_size
 
static char * stringtab = NULL
 
static long stringtab_length = 0
 
static bfd * symfile_bfd
 
static const struct symbol_register_ops coff_register_funcs
 
static int coff_register_index
 
static const struct sym_fns coff_sym_fns
 

Macro Definition Documentation

◆ EXTERNAL_NAME

#define EXTERNAL_NAME ( string,
abfd )
Value:
(*string != '\0' && *string == bfd_get_symbol_leading_char (abfd) \
? string + 1 : string)

Definition at line 66 of file coffread.c.

Referenced by coff_read_enum_type(), coff_read_struct_type(), and process_coff_symbol().

◆ INITIAL_TYPE_VECTOR_LENGTH

#define INITIAL_TYPE_VECTOR_LENGTH   160

Definition at line 155 of file coffread.c.

Referenced by coff_symtab_read().

◆ L_LNNO32

#define L_LNNO32 ( lp)    ((lp)->l_lnno)

Definition at line 1408 of file coffread.c.

Referenced by enter_linenos().

◆ N_BTMASK

#define N_BTMASK   local_n_btmask

Definition at line 107 of file coffread.c.

Referenced by decode_type().

◆ N_BTSHFT

#define N_BTSHFT   local_n_btshft

Definition at line 108 of file coffread.c.

◆ N_TMASK

#define N_TMASK   local_n_tmask

Definition at line 109 of file coffread.c.

◆ N_TSHIFT

#define N_TSHIFT   local_n_tshift

Definition at line 110 of file coffread.c.

◆ SDB_TYPE

#define SDB_TYPE ( type)    (BTYPE(type) | (type & N_TMASK))

Definition at line 75 of file coffread.c.

Referenced by coff_symtab_read(), and read_one_sym().

Function Documentation

◆ _initialize_coffread()

void _initialize_coffread ( )

Definition at line 2175 of file coffread.c.

Referenced by initialize_all_files().

◆ coff_alloc_type()

static struct type * coff_alloc_type ( int index)
static

◆ coff_end_compunit_symtab()

static void coff_end_compunit_symtab ( struct objfile * objfile)
static

◆ coff_getfilename()

static const char * coff_getfilename ( union internal_auxent * aux_entry)
static

Definition at line 1346 of file coffread.c.

References stringtab.

Referenced by coff_symtab_read().

◆ coff_locate_sections()

static void coff_locate_sections ( bfd * abfd,
asection * sectp,
void * csip )
static

◆ coff_lookup_type()

static struct type ** coff_lookup_type ( int index)
static

Definition at line 323 of file coffread.c.

References type_vector, type_vector_length, and xrealloc().

Referenced by coff_alloc_type().

◆ coff_new_init()

static void coff_new_init ( struct objfile * ignore)
static

Definition at line 754 of file coffread.c.

◆ coff_read_enum_type()

static struct type * coff_read_enum_type ( int index,
int length,
int lastsym,
struct objfile * objfile )
static

◆ coff_read_minsyms()

static void coff_read_minsyms ( file_ptr symtab_offset,
unsigned int nsyms,
struct objfile * objfile )
static

◆ coff_read_struct_type()

static struct type * coff_read_struct_type ( int index,
int length,
int lastsym,
struct objfile * objfile )
static

◆ coff_reg_to_regnum()

static int coff_reg_to_regnum ( struct symbol * sym,
struct gdbarch * gdbarch )
static

Definition at line 1531 of file coffread.c.

References gdbarch_sdb_reg_to_regnum(), and symbol::value_longest().

◆ coff_start_compunit_symtab()

static void coff_start_compunit_symtab ( struct objfile * objfile,
const char * name )
static

◆ coff_symfile_finish()

static void coff_symfile_finish ( struct objfile * objfile)
static

Definition at line 765 of file coffread.c.

References stabsread_clear_cache().

◆ coff_symfile_init()

static void coff_symfile_init ( struct objfile * objfile)
static

Definition at line 484 of file coffread.c.

References coff_objfile_data_key.

◆ coff_symfile_read()

static void coff_symfile_read ( struct objfile * objfile,
symfile_add_flags symfile_flags )
static

◆ coff_symtab_read()

static void coff_symtab_read ( minimal_symbol_reader & reader,
file_ptr symtab_offset,
unsigned int nsyms,
struct objfile * objfile )
static

◆ complete_symtab()

static void complete_symtab ( const char * name,
CORE_ADDR start_addr,
unsigned int size )
static

◆ cs_section_address()

static CORE_ADDR cs_section_address ( struct coff_symbol * cs,
bfd * abfd )
static

Definition at line 301 of file coffread.c.

References coff_symbol::c_secnum, and find_targ_sec().

Referenced by read_one_sym().

◆ cs_to_bfd_section()

static struct bfd_section * cs_to_bfd_section ( struct coff_symbol * cs,
struct objfile * objfile )
static

Definition at line 274 of file coffread.c.

References coff_symbol::c_secnum, find_targ_sec(), and objfile::obfd.

Referenced by coff_symtab_read(), and cs_to_section().

◆ cs_to_section()

static int cs_to_section ( struct coff_symbol * cs,
struct objfile * objfile )
static

◆ decode_base_type()

static struct type * decode_base_type ( struct coff_symbol * cs,
unsigned int c_type,
union internal_auxent * aux,
struct objfile * objfile )
static

◆ decode_function_type()

static struct type * decode_function_type ( struct coff_symbol * cs,
unsigned int c_type,
union internal_auxent * aux,
struct objfile * objfile )
static

Definition at line 1805 of file coffread.c.

References coff_symbol::c_naux, and decode_type().

Referenced by process_coff_symbol().

◆ decode_type()

static struct type * decode_type ( struct coff_symbol * cs,
unsigned int c_type,
union internal_auxent * aux,
struct objfile * objfile )
static

◆ enter_linenos()

static void enter_linenos ( file_ptr file_offset,
int first_line,
int last_line,
struct objfile * objfile )
static

◆ find_linenos()

static void find_linenos ( bfd * abfd,
struct bfd_section * asect,
void * vpinfo )
static

Definition at line 495 of file coffread.c.

References local_linesz, coff_symfile_info::min_lineno_offset, and size.

Referenced by coff_symfile_read().

◆ find_targ_sec()

static void find_targ_sec ( bfd * abfd,
asection * sect,
void * obj )
static

Definition at line 264 of file coffread.c.

Referenced by cs_section_address(), and cs_to_bfd_section().

◆ getsymname()

static char * getsymname ( struct internal_syment * symbol_entry)
static

Definition at line 1320 of file coffread.c.

References stringtab, and stringtab_length.

Referenced by coff_symtab_read(), and read_one_sym().

◆ init_lineno()

static int init_lineno ( bfd * abfd,
file_ptr offset,
file_ptr size,
gdb::unique_xmalloc_ptr< char > * storage )
static

Definition at line 1379 of file coffread.c.

References linetab, linetab_offset, linetab_size, local_linesz, size, and xmalloc().

Referenced by coff_symfile_read().

◆ init_stringtab()

static int init_stringtab ( bfd * abfd,
file_ptr offset,
gdb::unique_xmalloc_ptr< char > * storage )
static

Definition at line 1279 of file coffread.c.

References stringtab, stringtab_length, symfile_bfd, and xmalloc().

Referenced by coff_symfile_read().

◆ is_import_fixup_symbol()

static int is_import_fixup_symbol ( struct coff_symbol * cs,
enum minimal_symbol_type type )
static

Definition at line 418 of file coffread.c.

References coff_symbol::c_name, coff_symbol::c_type, and mst_text.

Referenced by record_minimal_symbol().

◆ patch_opaque_types()

static void patch_opaque_types ( struct symtab * s)
static

◆ patch_type()

static void patch_type ( struct type * type,
struct type * real_type )
static

◆ process_coff_symbol()

static struct symbol * process_coff_symbol ( struct coff_symbol * cs,
union internal_auxent * aux,
struct objfile * objfile )
static

◆ read_one_sym()

static void read_one_sym ( struct coff_symbol * cs,
struct internal_syment * sym,
union internal_auxent * aux )
static

◆ record_minimal_symbol()

static struct minimal_symbol * record_minimal_symbol ( minimal_symbol_reader & reader,
struct coff_symbol * cs,
unrelocated_addr address,
enum minimal_symbol_type type,
int section,
struct objfile * objfile )
static

◆ stabsread_clear_cache()

void stabsread_clear_cache ( void )
extern

Definition at line 530 of file stabsread.c.

References ref_chunk, and ref_count.

Referenced by coff_symfile_finish().

Variable Documentation

◆ coff_objfile_data_key

const registry<objfile>::key<coff_symfile_info> coff_objfile_data_key
static

Definition at line 63 of file coffread.c.

Referenced by coff_symfile_init(), and coff_symfile_read().

◆ coff_register_funcs

const struct symbol_register_ops coff_register_funcs
static
Initial value:
= {
}
static int coff_reg_to_regnum(struct symbol *sym, struct gdbarch *gdbarch)
Definition coffread.c:1531

Definition at line 1536 of file coffread.c.

◆ coff_register_index

int coff_register_index
static

Definition at line 1542 of file coffread.c.

Referenced by process_coff_symbol().

◆ coff_sym_fns

const struct sym_fns coff_sym_fns
static
Initial value:
=
{
NULL,
NULL,
}
static void coff_new_init(struct objfile *ignore)
Definition coffread.c:754
static void coff_symfile_finish(struct objfile *objfile)
Definition coffread.c:765
static void coff_symfile_init(struct objfile *objfile)
Definition coffread.c:484
static void coff_symfile_read(struct objfile *objfile, symfile_add_flags symfile_flags)
Definition coffread.c:606
void default_symfile_offsets(struct objfile *objfile, const section_addr_info &addrs)
Definition symfile.c:625
symfile_segment_data_up default_symfile_segments(bfd *abfd)
Definition symfile.c:711
bfd_byte * default_symfile_relocate(struct objfile *objfile, asection *sectp, bfd_byte *buf)
Definition symfile.c:3595

Definition at line 2152 of file coffread.c.

◆ coffread_objfile

struct objfile* coffread_objfile
static

Definition at line 47 of file coffread.c.

Referenced by coff_alloc_type(), coff_symtab_read(), and read_one_sym().

◆ current_source_end_addr

CORE_ADDR current_source_end_addr
static

Definition at line 81 of file coffread.c.

Referenced by coff_end_compunit_symtab(), and complete_symtab().

◆ current_source_start_addr

CORE_ADDR current_source_start_addr
static

Definition at line 80 of file coffread.c.

Referenced by coff_end_compunit_symtab(), and complete_symtab().

◆ linetab

char* linetab = NULL
static

Definition at line 157 of file coffread.c.

Referenced by coff_symfile_read(), enter_linenos(), and init_lineno().

◆ linetab_offset

file_ptr linetab_offset
static

Definition at line 158 of file coffread.c.

Referenced by enter_linenos(), and init_lineno().

◆ linetab_size

file_ptr linetab_size
static

Definition at line 159 of file coffread.c.

Referenced by enter_linenos(), and init_lineno().

◆ local_auxesz

unsigned local_auxesz
static

Definition at line 119 of file coffread.c.

Referenced by coff_symfile_read(), and read_one_sym().

◆ local_linesz

unsigned local_linesz
static

Definition at line 117 of file coffread.c.

Referenced by coff_symfile_read(), enter_linenos(), find_linenos(), and init_lineno().

◆ local_n_btmask

unsigned local_n_btmask
static

Definition at line 102 of file coffread.c.

Referenced by coff_symfile_read().

◆ local_n_btshft

unsigned local_n_btshft
static

Definition at line 103 of file coffread.c.

Referenced by coff_symfile_read().

◆ local_n_tmask

unsigned local_n_tmask
static

Definition at line 104 of file coffread.c.

Referenced by coff_symfile_read().

◆ local_n_tshift

unsigned local_n_tshift
static

Definition at line 105 of file coffread.c.

Referenced by coff_symfile_read().

◆ local_symesz

unsigned local_symesz
static

Definition at line 118 of file coffread.c.

Referenced by coff_symfile_read(), and read_one_sym().

◆ nlist_bfd_global

bfd* nlist_bfd_global
static

Definition at line 86 of file coffread.c.

Referenced by coff_symtab_read(), and read_one_sym().

◆ nlist_nsyms_global

int nlist_nsyms_global
static

Definition at line 87 of file coffread.c.

Referenced by coff_read_enum_type(), coff_read_struct_type(), and coff_symtab_read().

◆ opaque_type_chain

struct symbol* opaque_type_chain[HASHSIZE]
static

Definition at line 128 of file coffread.c.

Referenced by coff_symtab_read(), patch_opaque_types(), and process_coff_symbol().

◆ pe_file

int pe_file
static

Definition at line 123 of file coffread.c.

Referenced by coff_read_minsyms(), coff_symfile_read(), coff_symtab_read(), and read_one_sym().

◆ stringtab

char* stringtab = NULL
static

Definition at line 161 of file coffread.c.

Referenced by coff_getfilename(), coff_symfile_read(), getsymname(), and init_stringtab().

◆ stringtab_length

long stringtab_length = 0
static

Definition at line 162 of file coffread.c.

Referenced by getsymname(), and init_stringtab().

◆ symfile_bfd

bfd* symfile_bfd
static

Definition at line 601 of file coffread.c.

Referenced by coff_symfile_read(), enter_linenos(), init_stringtab(), and read_one_sym().

◆ temp_aux

char* temp_aux
static

Definition at line 94 of file coffread.c.

Referenced by coff_symfile_read(), and read_one_sym().

◆ temp_sym

char* temp_sym
static

Definition at line 93 of file coffread.c.

Referenced by coff_symfile_read(), and read_one_sym().

◆ type_vector

struct type** type_vector
static

Definition at line 146 of file coffread.c.

Referenced by coff_lookup_type(), and coff_symtab_read().

◆ type_vector_length

int type_vector_length
static

Definition at line 150 of file coffread.c.

Referenced by coff_lookup_type(), and coff_symtab_read().