GDB (xrefs)
Classes | Macros | Functions | Variables
/tmp/gdb-8.1/gdb/dbxread.c File Reference
#include "defs.h"
#include "gdb_obstack.h"
#include <sys/stat.h>
#include "symtab.h"
#include "breakpoint.h"
#include "target.h"
#include "gdbcore.h"
#include "libaout.h"
#include "filenames.h"
#include "objfiles.h"
#include "buildsym.h"
#include "stabsread.h"
#include "gdb-stabs.h"
#include "demangle.h"
#include "complaints.h"
#include "cp-abi.h"
#include "cp-support.h"
#include "psympriv.h"
#include "block.h"
#include "aout/aout64.h"
#include "aout/stab_gnu.h"

Go to the source code of this file.

Classes

struct  symloc
 
struct  header_file_location
 

Macros

#define LDSYMOFF(p)   (((struct symloc *)((p)->read_symtab_private))->ldsymoff)
 
#define LDSYMLEN(p)   (((struct symloc *)((p)->read_symtab_private))->ldsymlen)
 
#define SYMLOC(p)   ((struct symloc *)((p)->read_symtab_private))
 
#define SYMBOL_SIZE(p)   (SYMLOC(p)->symbol_size)
 
#define SYMBOL_OFFSET(p)   (SYMLOC(p)->symbol_offset)
 
#define STRING_OFFSET(p)   (SYMLOC(p)->string_offset)
 
#define FILE_STRING_OFFSET(p)   (SYMLOC(p)->file_string_offset)
 
#define PST_LANGUAGE(p)   (SYMLOC(p)->pst_language)
 
#define DBX_STRINGTAB_SIZE_SIZE   sizeof(long) /* FIXME */
 
#define STRING_TABLE_OFFSET   (sym_bfd->origin + obj_str_filepos (sym_bfd))
 
#define SYMBOL_TABLE_OFFSET   (sym_bfd->origin + obj_sym_filepos (sym_bfd))
 
#define INTERNALIZE_SYMBOL(intern, extern, abfd)
 
#define COFF_STABS_SYMBOL_SIZE   12 /* XXX FIXME XXX */
 
#define ELF_STABS_SYMBOL_SIZE   12 /* XXX FIXME XXX */
 

Functions

static void unknown_symtype_complaint (const char *arg1)
 
static void lbrac_mismatch_complaint (int arg1)
 
static void repeated_header_complaint (const char *arg1, int arg2)
 
static void find_text_range (bfd *sym_bfd, struct objfile *objfile)
 
static void read_ofile_symtab (struct objfile *, struct partial_symtab *)
 
static void dbx_read_symtab (struct partial_symtab *self, struct objfile *objfile)
 
static void dbx_psymtab_to_symtab_1 (struct objfile *, struct partial_symtab *)
 
static void read_dbx_symtab (minimal_symbol_reader &, struct objfile *)
 
static void free_bincl_list (struct objfile *)
 
static struct partial_symtabfind_corresponding_bincl_psymtab (const char *, int)
 
static void add_bincl_to_list (struct partial_symtab *, const char *, int)
 
static void init_bincl_list (int, struct objfile *)
 
static const char * dbx_next_symbol_text (struct objfile *)
 
static void fill_symbuf (bfd *)
 
static void dbx_symfile_init (struct objfile *)
 
static void dbx_new_init (struct objfile *)
 
static void dbx_symfile_read (struct objfile *, symfile_add_flags)
 
static void dbx_symfile_finish (struct objfile *)
 
static void record_minimal_symbol (minimal_symbol_reader &, const char *, CORE_ADDR, int, struct objfile *)
 
static void add_new_header_file (const char *, int)
 
static void add_old_header_file (const char *, int)
 
static void add_this_object_header_file (int)
 
static struct partial_symtabstart_psymtab (struct objfile *, const char *, CORE_ADDR, int, std::vector< partial_symbol *> &, std::vector< partial_symbol *> &)
 
void free_header_files (void)
 
void init_header_files (void)
 
static void dbx_free_symfile_info (struct objfile *objfile, void *arg)
 
static void stabs_seek (int sym_offset)
 
static void do_free_bincl_list_cleanup (void *objfile)
 
static struct cleanupmake_cleanup_free_bincl_list (struct objfile *objfile)
 
static const char * set_namestring (struct objfile *objfile, const struct internal_nlist *nlist)
 
static CORE_ADDR find_stab_function_addr (const char *namestring, const char *filename, struct objfile *objfile)
 
static void function_outside_compilation_unit_complaint (const char *arg1)
 
struct partial_symtabdbx_end_psymtab (struct objfile *objfile, struct partial_symtab *pst, const char **include_list, int num_includes, int capping_symbol_offset, CORE_ADDR capping_text, struct partial_symtab **dependency_list, int number_dependencies, int textlow_not_set)
 
static void cp_set_block_scope (const struct symbol *symbol, struct block *block, struct obstack *obstack)
 
void process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name, const struct section_offsets *section_offsets, struct objfile *objfile, enum language language)
 
void coffstab_build_psymtabs (struct objfile *objfile, CORE_ADDR textaddr, unsigned int textsize, struct stab_section_list *stabsects, file_ptr stabstroffset, unsigned int stabstrsize)
 
void elfstab_build_psymtabs (struct objfile *objfile, asection *stabsect, file_ptr stabstroffset, unsigned int stabstrsize)
 
void stabsect_build_psymtabs (struct objfile *objfile, char *stab_name, char *stabstr_name, char *text_name)
 
void _initialize_dbxread (void)
 

Variables

const struct objfile_data * dbx_objfile_data_key
 
static struct objfiledbxread_objfile
 
static enum language psymtab_language = language_unknown
 
static bfd * symfile_bfd
 
static unsigned symbol_size
 
static unsigned symbol_table_offset
 
static unsigned string_table_offset
 
static unsigned int file_string_table_offset
 
static unsigned int next_file_string_table_offset
 
static int symfile_relocatable = 0
 
static CORE_ADDR lowest_text_address
 
static int has_line_numbers
 
static struct header_file_locationbincl_list
 
static struct header_file_locationnext_bincl
 
static int bincls_allocated
 
static struct external_nlist symbuf [4096]
 
static int symbuf_idx
 
static int symbuf_end
 
static const char * last_function_name
 
static char * stringtab_global
 
static struct stab_section_listsymbuf_sections
 
static unsigned int symbuf_left
 
static unsigned int symbuf_read
 
static bfd_byte * stabs_data
 
static const struct sym_fns aout_sym_fns
 

Macro Definition Documentation

◆ COFF_STABS_SYMBOL_SIZE

#define COFF_STABS_SYMBOL_SIZE   12 /* XXX FIXME XXX */

Referenced by coffstab_build_psymtabs().

◆ DBX_STRINGTAB_SIZE_SIZE

#define DBX_STRINGTAB_SIZE_SIZE   sizeof(long) /* FIXME */

Definition at line 582 of file dbxread.c.

Referenced by dbx_symfile_init().

◆ ELF_STABS_SYMBOL_SIZE

#define ELF_STABS_SYMBOL_SIZE   12 /* XXX FIXME XXX */

Referenced by elfstab_build_psymtabs().

◆ FILE_STRING_OFFSET

#define FILE_STRING_OFFSET (   p)    (SYMLOC(p)->file_string_offset)

Definition at line 103 of file dbxread.c.

Referenced by dbx_psymtab_to_symtab_1(), and start_psymtab().

◆ INTERNALIZE_SYMBOL

#define INTERNALIZE_SYMBOL (   intern,
  extern,
  abfd 
)
Value:
{ \
(intern).n_strx = bfd_h_get_32 (abfd, (extern)->e_strx); \
(intern).n_type = bfd_h_get_8 (abfd, (extern)->e_type); \
(intern).n_other = 0; \
(intern).n_desc = bfd_h_get_16 (abfd, (extern)->e_desc); \
if (bfd_get_sign_extend_vma (abfd)) \
(intern).n_value = bfd_h_get_signed_32 (abfd, (extern)->e_value); \
else \
(intern).n_value = bfd_h_get_32 (abfd, (extern)->e_value); \
}

Definition at line 822 of file dbxread.c.

Referenced by dbx_next_symbol_text(), read_dbx_symtab(), and read_ofile_symtab().

◆ LDSYMLEN

#define LDSYMLEN (   p)    (((struct symloc *)((p)->read_symtab_private))->ldsymlen)

◆ LDSYMOFF

#define LDSYMOFF (   p)    (((struct symloc *)((p)->read_symtab_private))->ldsymoff)

Definition at line 97 of file dbxread.c.

Referenced by dbx_end_psymtab(), read_ofile_symtab(), and start_psymtab().

◆ PST_LANGUAGE

#define PST_LANGUAGE (   p)    (SYMLOC(p)->pst_language)

Definition at line 104 of file dbxread.c.

Referenced by read_ofile_symtab(), and start_psymtab().

◆ STRING_OFFSET

#define STRING_OFFSET (   p)    (SYMLOC(p)->string_offset)

Definition at line 102 of file dbxread.c.

Referenced by start_psymtab().

◆ STRING_TABLE_OFFSET

#define STRING_TABLE_OFFSET   (sym_bfd->origin + obj_str_filepos (sym_bfd))

Referenced by dbx_symfile_init().

◆ SYMBOL_OFFSET

#define SYMBOL_OFFSET (   p)    (SYMLOC(p)->symbol_offset)

Definition at line 101 of file dbxread.c.

Referenced by dbx_psymtab_to_symtab_1(), and start_psymtab().

◆ SYMBOL_SIZE

#define SYMBOL_SIZE (   p)    (SYMLOC(p)->symbol_size)

Definition at line 100 of file dbxread.c.

Referenced by dbx_psymtab_to_symtab_1(), and start_psymtab().

◆ SYMBOL_TABLE_OFFSET

#define SYMBOL_TABLE_OFFSET   (sym_bfd->origin + obj_sym_filepos (sym_bfd))

Referenced by dbx_symfile_init().

◆ SYMLOC

#define SYMLOC (   p)    ((struct symloc *)((p)->read_symtab_private))

Definition at line 99 of file dbxread.c.

Function Documentation

◆ _initialize_dbxread()

void _initialize_dbxread ( void  )

◆ add_bincl_to_list()

static void add_bincl_to_list ( struct partial_symtab pst,
const char *  name,
int  instance 
)
static

◆ add_new_header_file()

static void add_new_header_file ( const char *  name,
int  instance 
)
static

◆ add_old_header_file()

static void add_old_header_file ( const char *  name,
int  instance 
)
static

◆ add_this_object_header_file()

static void add_this_object_header_file ( int  i)
static

◆ coffstab_build_psymtabs()

void coffstab_build_psymtabs ( struct objfile objfile,
CORE_ADDR  textaddr,
unsigned int  textsize,
struct stab_section_list stabsects,
file_ptr  stabstroffset,
unsigned int  stabstrsize 
)

◆ cp_set_block_scope()

static void cp_set_block_scope ( const struct symbol symbol,
struct block block,
struct obstack *  obstack 
)
static

Definition at line 2461 of file dbxread.c.

References block_set_scope(), cp_entire_prefix_len(), name, and SYMBOL_DEMANGLED_NAME.

Referenced by process_one_symbol().

◆ dbx_end_psymtab()

struct partial_symtab* dbx_end_psymtab ( struct objfile objfile,
struct partial_symtab pst,
const char **  include_list,
int  num_includes,
int  capping_symbol_offset,
CORE_ADDR  capping_text,
struct partial_symtab **  dependency_list,
int  number_dependencies,
int  textlow_not_set 
)

◆ dbx_free_symfile_info()

static void dbx_free_symfile_info ( struct objfile objfile,
void *  arg 
)
static

◆ dbx_new_init()

static void dbx_new_init ( struct objfile ignore)
static

Definition at line 561 of file dbxread.c.

References buildsym_new_init(), init_header_files(), and stabsread_new_init().

◆ dbx_next_symbol_text()

static const char * dbx_next_symbol_text ( struct objfile objfile)
static

◆ dbx_psymtab_to_symtab_1()

static void dbx_psymtab_to_symtab_1 ( struct objfile objfile,
struct partial_symtab pst 
)
static

◆ dbx_read_symtab()

static void dbx_read_symtab ( struct partial_symtab self,
struct objfile objfile 
)
static

◆ dbx_symfile_finish()

static void dbx_symfile_finish ( struct objfile objfile)
static

Definition at line 700 of file dbxread.c.

References free_header_files().

◆ dbx_symfile_init()

static void dbx_symfile_init ( struct objfile objfile)
static

◆ dbx_symfile_read()

static void dbx_symfile_read ( struct objfile objfile,
symfile_add_flags  symfile_flags 
)
static

◆ do_free_bincl_list_cleanup()

static void do_free_bincl_list_cleanup ( void *  objfile)
static

Definition at line 919 of file dbxread.c.

References free_bincl_list().

Referenced by make_cleanup_free_bincl_list().

◆ elfstab_build_psymtabs()

void elfstab_build_psymtabs ( struct objfile objfile,
asection *  stabsect,
file_ptr  stabstroffset,
unsigned int  stabstrsize 
)

◆ fill_symbuf()

static void fill_symbuf ( bfd *  sym_bfd)
static

◆ find_corresponding_bincl_psymtab()

static struct partial_symtab * find_corresponding_bincl_psymtab ( const char *  name,
int  instance 
)
static

◆ find_stab_function_addr()

static CORE_ADDR find_stab_function_addr ( const char *  namestring,
const char *  filename,
struct objfile objfile 
)
static

◆ find_text_range()

static void find_text_range ( bfd *  sym_bfd,
struct objfile objfile 
)
static

Definition at line 196 of file dbxread.c.

References _, DBX_TEXT_ADDR, DBX_TEXT_SIZE, and error().

Referenced by elfstab_build_psymtabs().

◆ free_bincl_list()

static void free_bincl_list ( struct objfile objfile)
static

Definition at line 912 of file dbxread.c.

References bincl_list, bincls_allocated, and xfree().

Referenced by do_free_bincl_list_cleanup().

◆ free_header_files()

void free_header_files ( void  )

◆ function_outside_compilation_unit_complaint()

static void function_outside_compilation_unit_complaint ( const char *  arg1)
static

Definition at line 1000 of file dbxread.c.

References _, complaint, and symfile_complaints.

Referenced by read_dbx_symtab().

◆ init_bincl_list()

static void init_bincl_list ( int  number,
struct objfile objfile 
)
static

Definition at line 864 of file dbxread.c.

References bincl_list, bincls_allocated, next_bincl, and XNEWVEC.

Referenced by read_dbx_symtab().

◆ init_header_files()

void init_header_files ( void  )

◆ lbrac_mismatch_complaint()

static void lbrac_mismatch_complaint ( int  arg1)
static

Definition at line 171 of file dbxread.c.

References _, complaint, and symfile_complaints.

Referenced by process_one_symbol().

◆ make_cleanup_free_bincl_list()

static struct cleanup* make_cleanup_free_bincl_list ( struct objfile objfile)
static

Definition at line 925 of file dbxread.c.

References do_free_bincl_list_cleanup(), and make_cleanup().

Referenced by read_dbx_symtab().

◆ process_one_symbol()

void process_one_symbol ( int  type,
int  desc,
CORE_ADDR  valu,
const char *  name,
const struct section_offsets section_offsets,
struct objfile objfile,
enum language language   
)

◆ read_dbx_symtab()

static void read_dbx_symtab ( minimal_symbol_reader reader,
struct objfile objfile 
)
static

Definition at line 1012 of file dbxread.c.

References _, add_bincl_to_list(), add_psymbol_to_list(), ANOFFSET, complaint, cp_canonicalize_string(), dbx_end_psymtab(), dbx_next_symbol_text(), DBX_STRINGTAB, DBX_SYMCOUNT, DBX_TEXT_ADDR, DBX_TEXT_SIZE, deduce_language_from_filename(), partial_symtab::dirname, do_cleanups(), error(), file_string_table_offset, partial_symtab::filename, fill_symbuf(), find_corresponding_bincl_psymtab(), find_stab_function_addr(), fprintf_unfiltered(), function_outside_compilation_unit_complaint(), gdb_stderr, gdbarch_sofun_address_maybe_missing(), gdbarch_static_transform_name(), gdbarch_static_transform_name_p(), get_objfile_arch(), objfile::global_psymbols, has_line_numbers, hex_string(), init_bincl_list(), INTERNALIZE_SYMBOL, language_c, language_cplus, language_unknown, last_function_name, LOC_BLOCK, LOC_CONST, LOC_STATIC, LOC_TYPEDEF, lowest_text_address, make_cleanup_free_bincl_list(), name, next_file_string_table_offset, next_symbol_text, next_symbol_text_func, objfile::obfd, OBJSTAT, processing_acc_compilation, psymtab_language, QUIT, record_minimal_symbol(), objfile::sect_index_data, SECT_OFF_BSS, SECT_OFF_RODATA, SECT_OFF_TEXT, objfile::section_offsets, set_last_source_file(), set_namestring(), start_psymtab(), objfile::static_psymbols, string, stringtab_global, STRUCT_DOMAIN, symbol_size, symbuf, symbuf_end, symbuf_idx, symfile_bfd, symfile_complaints, symnum, partial_symtab::texthigh, partial_symtab::textlow, unknown_symtype_complaint(), VAR_DOMAIN, xfree(), and xmalloc().

Referenced by dbx_symfile_read().

◆ read_ofile_symtab()

static void read_ofile_symtab ( struct objfile objfile,
struct partial_symtab pst 
)
static

◆ record_minimal_symbol()

static void record_minimal_symbol ( minimal_symbol_reader reader,
const char *  name,
CORE_ADDR  address,
int  type,
struct objfile objfile 
)
static

◆ repeated_header_complaint()

static void repeated_header_complaint ( const char *  arg1,
int  arg2 
)
static

Definition at line 178 of file dbxread.c.

References _, complaint, and symfile_complaints.

Referenced by add_old_header_file(), and find_corresponding_bincl_psymtab().

◆ set_namestring()

static const char* set_namestring ( struct objfile objfile,
const struct internal_nlist *  nlist 
)
static

◆ stabs_seek()

static void stabs_seek ( int  sym_offset)
static

Definition at line 811 of file dbxread.c.

References SEEK_CUR, stabs_data, symbuf_left, symbuf_read, and symfile_bfd.

Referenced by read_ofile_symtab().

◆ stabsect_build_psymtabs()

void stabsect_build_psymtabs ( struct objfile objfile,
char *  stab_name,
char *  stabstr_name,
char *  text_name 
)

◆ start_psymtab()

static struct partial_symtab * start_psymtab ( struct objfile objfile,
const char *  filename,
CORE_ADDR  textlow,
int  ldsymoff,
std::vector< partial_symbol *> &  global_psymbols,
std::vector< partial_symbol *> &  static_psymbols 
)
static

◆ unknown_symtype_complaint()

static void unknown_symtype_complaint ( const char *  arg1)
static

Definition at line 165 of file dbxread.c.

References _, complaint, and symfile_complaints.

Referenced by process_one_symbol(), and read_dbx_symtab().

Variable Documentation

◆ aout_sym_fns

const struct sym_fns aout_sym_fns
static
Initial value:
=
{
NULL,
NULL,
NULL,
}
struct symfile_segment_data * default_symfile_segments(bfd *abfd)
Definition: symfile.c:785
static void dbx_symfile_init(struct objfile *)
Definition: dbxread.c:585
bfd_byte * default_symfile_relocate(struct objfile *objfile, asection *sectp, bfd_byte *buf)
Definition: symfile.c:3625
static void dbx_symfile_finish(struct objfile *)
Definition: dbxread.c:700
const struct quick_symbol_functions psym_functions
Definition: psymtab.c:1541
static void dbx_symfile_read(struct objfile *, symfile_add_flags)
Definition: dbxread.c:516
void default_symfile_offsets(struct objfile *objfile, const struct section_addr_info *addrs)
Definition: symfile.c:695
static void dbx_new_init(struct objfile *)
Definition: dbxread.c:561

Definition at line 3298 of file dbxread.c.

Referenced by _initialize_dbxread().

◆ bincl_list

struct header_file_location* bincl_list
static

◆ bincls_allocated

int bincls_allocated
static

Definition at line 249 of file dbxread.c.

Referenced by add_bincl_to_list(), free_bincl_list(), and init_bincl_list().

◆ dbx_objfile_data_key

const struct objfile_data* dbx_objfile_data_key

◆ dbxread_objfile

struct objfile* dbxread_objfile
static

Definition at line 109 of file dbxread.c.

Referenced by add_new_header_file(), add_old_header_file(), and read_ofile_symtab().

◆ file_string_table_offset

unsigned int file_string_table_offset
static

◆ has_line_numbers

int has_line_numbers
static

Definition at line 160 of file dbxread.c.

Referenced by dbx_end_psymtab(), and read_dbx_symtab().

◆ last_function_name

const char* last_function_name
static

Definition at line 735 of file dbxread.c.

Referenced by dbx_end_psymtab(), and read_dbx_symtab().

◆ lowest_text_address

CORE_ADDR lowest_text_address
static

Definition at line 155 of file dbxread.c.

Referenced by read_dbx_symtab(), and record_minimal_symbol().

◆ next_bincl

struct header_file_location * next_bincl
static

Definition at line 248 of file dbxread.c.

Referenced by add_bincl_to_list(), find_corresponding_bincl_psymtab(), and init_bincl_list().

◆ next_file_string_table_offset

unsigned int next_file_string_table_offset
static

Definition at line 140 of file dbxread.c.

Referenced by read_dbx_symtab().

◆ psymtab_language

enum language psymtab_language = language_unknown
static

Definition at line 113 of file dbxread.c.

Referenced by read_dbx_symtab(), and start_psymtab().

◆ stabs_data

bfd_byte* stabs_data
static

Definition at line 755 of file dbxread.c.

Referenced by dbx_read_symtab(), elfstab_build_psymtabs(), fill_symbuf(), and stabs_seek().

◆ string_table_offset

unsigned string_table_offset
static

Definition at line 131 of file dbxread.c.

Referenced by start_psymtab().

◆ stringtab_global

char* stringtab_global
static

Definition at line 744 of file dbxread.c.

Referenced by dbx_next_symbol_text(), read_dbx_symtab(), and read_ofile_symtab().

◆ symbol_size

unsigned symbol_size
static

◆ symbol_table_offset

unsigned symbol_table_offset
static

Definition at line 127 of file dbxread.c.

Referenced by dbx_symfile_read(), fill_symbuf(), and start_psymtab().

◆ symbuf

struct external_nlist symbuf[4096]
static

Definition at line 729 of file dbxread.c.

Referenced by dbx_next_symbol_text(), fill_symbuf(), read_dbx_symtab(), and read_ofile_symtab().

◆ symbuf_end

int symbuf_end
static

Definition at line 731 of file dbxread.c.

Referenced by dbx_next_symbol_text(), fill_symbuf(), read_dbx_symtab(), and read_ofile_symtab().

◆ symbuf_idx

int symbuf_idx
static

Definition at line 730 of file dbxread.c.

Referenced by dbx_next_symbol_text(), fill_symbuf(), read_dbx_symtab(), and read_ofile_symtab().

◆ symbuf_left

unsigned int symbuf_left
static

◆ symbuf_read

unsigned int symbuf_read
static

◆ symbuf_sections

struct stab_section_list* symbuf_sections
static

Definition at line 749 of file dbxread.c.

Referenced by coffstab_build_psymtabs(), and fill_symbuf().

◆ symfile_bfd

bfd* symfile_bfd
static

Definition at line 117 of file dbxread.c.

Referenced by dbx_next_symbol_text(), read_dbx_symtab(), read_ofile_symtab(), and stabs_seek().

◆ symfile_relocatable

int symfile_relocatable = 0
static

Definition at line 146 of file dbxread.c.

Referenced by dbx_symfile_read(), and process_one_symbol().