GDB (xrefs)
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
dbxread.c File Reference
#include "defs.h"
#include "gdbsupport/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-legacy.h"
#include "stabsread.h"
#include "gdb-stabs.h"
#include "demangle.h"
#include "complaints.h"
#include "cp-abi.h"
#include "cp-support.h"
#include "c-lang.h"
#include "psymtab.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 *, legacy_psymtab *)
 
static void dbx_read_symtab (legacy_psymtab *self, struct objfile *objfile)
 
static void dbx_expand_psymtab (legacy_psymtab *, struct objfile *)
 
static void read_dbx_symtab (minimal_symbol_reader &, psymtab_storage *, struct objfile *)
 
static legacy_psymtabfind_corresponding_bincl_psymtab (const char *, int)
 
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 *, unrelocated_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 legacy_psymtabstart_psymtab (psymtab_storage *, struct objfile *, const char *, unrelocated_addr, int)
 
void free_header_files (void)
 
void init_header_files (void)
 
static void stabs_seek (int sym_offset)
 
static const char * set_namestring (struct objfile *objfile, const struct internal_nlist *nlist)
 
static struct bound_minimal_symbol find_stab_function (const char *namestring, const char *filename, struct objfile *objfile)
 
static void function_outside_compilation_unit_complaint (const char *arg1)
 
legacy_psymtabdbx_end_psymtab (struct objfile *objfile, psymtab_storage *partial_symtabs, legacy_psymtab *pst, const char **include_list, int num_includes, int capping_symbol_offset, unrelocated_addr capping_text, legacy_psymtab **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 section_offsets &section_offsets, struct objfile *objfile, enum language language)
 
void coffstab_build_psymtabs (struct objfile *objfile, CORE_ADDR textaddr, unsigned int textsize, const std::vector< asection * > &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 ()
 

Variables

const registry< objfile >::key< dbx_symfile_infodbx_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 unsigned char processing_acc_compilation
 
static unrelocated_addr lowest_text_address
 
static int has_line_numbers
 
static std::vector< struct header_file_location > * bincl_list
 
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 const std::vector< asection * > * symbuf_sections
 
static size_t sect_idx
 
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 */

◆ DBX_STRINGTAB_SIZE_SIZE

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

Definition at line 581 of file dbxread.c.

Referenced by dbx_symfile_init().

◆ ELF_STABS_SYMBOL_SIZE

#define ELF_STABS_SYMBOL_SIZE   12 /* XXX FIXME XXX */

◆ FILE_STRING_OFFSET

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

Definition at line 99 of file dbxread.c.

Referenced by dbx_expand_psymtab(), 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 816 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)

Definition at line 94 of file dbxread.c.

Referenced by dbx_end_psymtab(), dbx_expand_psymtab(), dbx_read_symtab(), and read_ofile_symtab().

◆ LDSYMOFF

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

Definition at line 93 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 100 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 98 of file dbxread.c.

Referenced by start_psymtab().

◆ STRING_TABLE_OFFSET

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

◆ SYMBOL_OFFSET

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

Definition at line 97 of file dbxread.c.

Referenced by dbx_expand_psymtab(), and start_psymtab().

◆ SYMBOL_SIZE

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

Definition at line 96 of file dbxread.c.

Referenced by dbx_expand_psymtab(), and start_psymtab().

◆ SYMBOL_TABLE_OFFSET

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

◆ SYMLOC

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

Definition at line 95 of file dbxread.c.

Function Documentation

◆ _initialize_dbxread()

void _initialize_dbxread ( )

Definition at line 3241 of file dbxread.c.

Referenced by initialize_all_files().

◆ 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,
const std::vector< asection * > & 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

◆ dbx_end_psymtab()

legacy_psymtab * dbx_end_psymtab ( struct objfile * objfile,
psymtab_storage * partial_symtabs,
legacy_psymtab * pst,
const char ** include_list,
int num_includes,
int capping_symbol_offset,
unrelocated_addr capping_text,
legacy_psymtab ** dependency_list,
int number_dependencies,
int textlow_not_set )

◆ dbx_expand_psymtab()

static void dbx_expand_psymtab ( legacy_psymtab * pst,
struct objfile * objfile )
static

◆ dbx_new_init()

static void dbx_new_init ( struct objfile * ignore)
static

Definition at line 561 of file dbxread.c.

References init_header_files(), and stabsread_new_init().

◆ dbx_next_symbol_text()

static const char * dbx_next_symbol_text ( struct objfile * objfile)
static

◆ dbx_read_symtab()

static void dbx_read_symtab ( legacy_psymtab * self,
struct objfile * objfile )
static

◆ dbx_symfile_finish()

static void dbx_symfile_finish ( struct objfile * objfile)
static

Definition at line 697 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

◆ 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 legacy_psymtab * find_corresponding_bincl_psymtab ( const char * name,
int instance )
static

Definition at line 860 of file dbxread.c.

References bincl_list, name, repeated_header_complaint(), and symnum.

Referenced by read_dbx_symtab().

◆ find_stab_function()

static struct bound_minimal_symbol find_stab_function ( const char * namestring,
const char * filename,
struct objfile * objfile )
static

Definition at line 895 of file dbxread.c.

References lookup_minimal_symbol(), and bound_minimal_symbol::minsym.

Referenced by process_one_symbol(), and read_dbx_symtab().

◆ find_text_range()

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

Definition at line 198 of file dbxread.c.

References DBX_TEXT_ADDR, and DBX_TEXT_SIZE.

Referenced by elfstab_build_psymtabs().

◆ 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 940 of file dbxread.c.

References complaint.

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 175 of file dbxread.c.

References complaint.

Referenced by process_one_symbol().

◆ process_one_symbol()

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

◆ read_dbx_symtab()

static void read_dbx_symtab ( minimal_symbol_reader & reader,
psymtab_storage * partial_symtabs,
struct objfile * objfile )
static

Definition at line 951 of file dbxread.c.

References partial_symtab::add_psymbol(), objfile::arch(), bincl_list, c_canonicalize_name(), 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, file_string_table_offset, partial_symtab::filename, fill_symbuf(), find_corresponding_bincl_psymtab(), find_stab_function(), function_outside_compilation_unit_complaint(), gdb_printf(), gdb_stderr, gdbarch_sofun_address_maybe_missing(), GLOBAL, has_line_numbers, INTERNALIZE_SYMBOL, language_c, language_cplus, language_unknown, last_function_name, LOC_BLOCK, LOC_CONST, LOC_STATIC, LOC_TYPEDEF, lowest_text_address, bound_minimal_symbol::minsym, name, next_file_string_table_offset, next_symbol_text, next_symbol_text_func, objfile::obfd, bound_minimal_symbol::objfile, objfile::objfile_obstack, OBJSTAT, processing_acc_compilation, psymtab_language, QUIT, record_minimal_symbol(), objfile::sect_index_data, SECT_OFF_BSS, SECT_OFF_RODATA, SECT_OFF_TEXT, set_last_source_file(), set_namestring(), partial_symtab::set_text_high(), partial_symtab::set_text_low(), start_psymtab(), STATIC, stringtab_global, STRUCT_DOMAIN, symbol_size, symbuf, symbuf_end, symbuf_idx, symfile_bfd, symnum, unknown_symtype_complaint(), minimal_symbol::unrelocated_address(), partial_symtab::unrelocated_text_high(), partial_symtab::unrelocated_text_low(), and VAR_DOMAIN.

Referenced by dbx_symfile_read().

◆ read_ofile_symtab()

static void read_ofile_symtab ( struct objfile * objfile,
legacy_psymtab * pst )
static

◆ record_minimal_symbol()

static void record_minimal_symbol ( minimal_symbol_reader & reader,
const char * name,
unrelocated_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 181 of file dbxread.c.

References complaint.

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 804 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 legacy_psymtab * start_psymtab ( psymtab_storage * partial_symtabs,
struct objfile * objfile,
const char * filename,
unrelocated_addr textlow,
int ldsymoff )
static

◆ unknown_symtype_complaint()

static void unknown_symtype_complaint ( const char * arg1)
static

Definition at line 169 of file dbxread.c.

References complaint.

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,
}
static void dbx_new_init(struct objfile *)
Definition dbxread.c:561
static void dbx_symfile_init(struct objfile *)
Definition dbxread.c:584
static void dbx_symfile_finish(struct objfile *)
Definition dbxread.c:697
static void dbx_symfile_read(struct objfile *, symfile_add_flags)
Definition dbxread.c:519
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 3226 of file dbxread.c.

◆ bincl_list

std::vector<struct header_file_location>* bincl_list
static

Definition at line 258 of file dbxread.c.

Referenced by find_corresponding_bincl_psymtab(), and read_dbx_symtab().

◆ dbx_objfile_data_key

const registry<objfile>::key<dbx_symfile_info> dbx_objfile_data_key

◆ dbxread_objfile

struct objfile* dbxread_objfile
static

Definition at line 105 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 164 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 727 of file dbxread.c.

Referenced by dbx_end_psymtab(), and read_dbx_symtab().

◆ lowest_text_address

unrelocated_addr lowest_text_address
static

Definition at line 159 of file dbxread.c.

Referenced by read_dbx_symtab(), and record_minimal_symbol().

◆ next_file_string_table_offset

unsigned int next_file_string_table_offset
static

Definition at line 136 of file dbxread.c.

Referenced by read_dbx_symtab().

◆ processing_acc_compilation

unsigned char processing_acc_compilation
static

◆ psymtab_language

enum language psymtab_language = language_unknown
static

Definition at line 109 of file dbxread.c.

Referenced by read_dbx_symtab(), and start_psymtab().

◆ sect_idx

size_t sect_idx
static

Definition at line 742 of file dbxread.c.

Referenced by coffstab_build_psymtabs(), and fill_symbuf().

◆ stabs_data

bfd_byte* stabs_data
static

Definition at line 748 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 127 of file dbxread.c.

Referenced by start_psymtab().

◆ stringtab_global

char* stringtab_global
static

Definition at line 736 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 123 of file dbxread.c.

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

◆ symbuf

struct external_nlist symbuf[4096]
static

Definition at line 721 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 723 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 722 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

const std::vector<asection *>* symbuf_sections
static

Definition at line 741 of file dbxread.c.

Referenced by coffstab_build_psymtabs(), and fill_symbuf().

◆ symfile_bfd

bfd* symfile_bfd
static

Definition at line 113 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 142 of file dbxread.c.

Referenced by dbx_symfile_read(), and process_one_symbol().