GDB (xrefs)
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
/tmp/gdb-13.1/gdb/stabsread.c File Reference
#include "defs.h"
#include "bfd.h"
#include "gdbsupport/gdb_obstack.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "expression.h"
#include "symfile.h"
#include "objfiles.h"
#include "aout/stab_gnu.h"
#include "libaout.h"
#include "aout/aout64.h"
#include "gdb-stabs.h"
#include "buildsym-legacy.h"
#include "complaints.h"
#include "demangle.h"
#include "gdb-demangle.h"
#include "language.h"
#include "target-float.h"
#include "c-lang.h"
#include "cp-abi.h"
#include "cp-support.h"
#include <ctype.h>
#include "stabsread.h"

Go to the source code of this file.

Classes

struct  stabs_nextfield
 
struct  next_fnfieldlist
 
struct  stab_field_info
 
struct  nat
 
struct  ref_map
 

Macros

#define STABS_CONTINUE(pp, objfile)
 
#define INITIAL_TYPE_VECTOR_LENGTH   160
 
#define VISIBILITY_PRIVATE   '0' /* Stabs character for private field */
 
#define VISIBILITY_PROTECTED   '1' /* Stabs character for protected fld */
 
#define VISIBILITY_PUBLIC   '2' /* Stabs character for public field */
 
#define VISIBILITY_IGNORE   '9' /* Optimized out or zero length */
 
#define MAX_CHUNK_REFS   100
 
#define REF_CHUNK_SIZE   (MAX_CHUNK_REFS * sizeof (struct ref_map))
 
#define REF_MAP_SIZE(ref_chunk)   ((ref_chunk) * REF_CHUNK_SIZE)
 
#define NUMBER_RECOGNIZED   34
 

Functions

static void read_one_struct_field (struct stab_field_info *, const char **, const char *, struct type *, struct objfile *)
 
static struct typedbx_alloc_type (int[2], struct objfile *)
 
static long read_huge_number (const char **, int, int *, int)
 
static struct typeerror_type (const char **, struct objfile *)
 
static void patch_block_stabs (struct pending *, struct pending_stabs *, struct objfile *)
 
static void fix_common_block (struct symbol *, CORE_ADDR)
 
static int read_type_number (const char **, int *)
 
static struct typeread_type (const char **, struct objfile *)
 
static struct typeread_range_type (const char **, int[2], int, struct objfile *)
 
static struct typeread_sun_builtin_type (const char **, int[2], struct objfile *)
 
static struct typeread_sun_floating_type (const char **, int[2], struct objfile *)
 
static struct typeread_enum_type (const char **, struct type *, struct objfile *)
 
static struct typers6000_builtin_type (int, struct objfile *)
 
static int read_member_functions (struct stab_field_info *, const char **, struct type *, struct objfile *)
 
static int read_struct_fields (struct stab_field_info *, const char **, struct type *, struct objfile *)
 
static int read_baseclasses (struct stab_field_info *, const char **, struct type *, struct objfile *)
 
static int read_tilde_fields (struct stab_field_info *, const char **, struct type *, struct objfile *)
 
static int attach_fn_fields_to_type (struct stab_field_info *, struct type *)
 
static int attach_fields_to_type (struct stab_field_info *, struct type *, struct objfile *)
 
static struct typeread_struct_type (const char **, struct type *, enum type_code, struct objfile *)
 
static struct typeread_array_type (const char **, struct type *, struct objfile *)
 
static struct fieldread_args (const char **, int, struct objfile *, int *, int *)
 
static void add_undefined_type (struct type *, int[2])
 
static int read_cpp_abbrev (struct stab_field_info *, const char **, struct type *, struct objfile *)
 
static const char * find_name_end (const char *name)
 
static int process_reference (const char **string)
 
void stabsread_clear_cache (void)
 
static void invalid_cpp_abbrev_complaint (const char *arg1)
 
static void reg_value_complaint (int regnum, int num_regs, const char *sym)
 
static void stabs_general_complaint (const char *arg1)
 
static struct type ** dbx_lookup_type (int typenums[2], struct objfile *objfile)
 
static struct typedbx_init_float_type (struct objfile *objfile, int bits)
 
void ref_add (int refnum, struct symbol *sym, const char *stabs, CORE_ADDR value)
 
struct symbolref_search (int refnum)
 
int symbol_reference_defined (const char **string)
 
static int stab_reg_to_regnum (struct symbol *sym, struct gdbarch *gdbarch)
 
struct symboldefine_symbol (CORE_ADDR valu, const char *string, int desc, int type, struct objfile *objfile)
 
static char * stabs_method_name_from_physname (const char *physname)
 
static void complain_about_struct_wipeout (struct type *type)
 
static void set_length_in_type_chain (struct type *type)
 
void common_block_start (const char *name, struct objfile *objfile)
 
void common_block_end (struct objfile *objfile)
 
static void add_undefined_type_noname (struct type *type, int typenums[2])
 
static void add_undefined_type_1 (struct type *type)
 
static void cleanup_undefined_types_noname (struct objfile *objfile)
 
static void cleanup_undefined_types_1 (void)
 
void cleanup_undefined_stabs_types (struct objfile *objfile)
 
void scan_file_globals (struct objfile *objfile)
 
void stabsread_init (void)
 
void stabsread_new_init (void)
 
void start_stabs (void)
 
void end_stabs (void)
 
void finish_global_stabs (struct objfile *objfile)
 
int hashname (const char *name)
 
void _initialize_stabsread ()
 

Variables

unsigned int symnum
 
const char *(* next_symbol_text_func )(struct objfile *)
 
unsigned char processing_gcc_compilation
 
int within_function
 
struct symbolglobal_sym_chain [HASHSIZE]
 
struct pending_stabsglobal_stabs
 
int previous_stab_code
 
int * this_object_header_files
 
int n_this_object_header_files
 
int n_allocated_this_object_header_files
 
static const char vptr_name [] = "_vptr$"
 
static const char vb_name [] = "_vb$"
 
static struct type ** undef_types
 
static int undef_types_allocated
 
static int undef_types_length
 
static struct symbolcurrent_symbol = NULL
 
static struct natnoname_undefs
 
static int noname_undefs_allocated
 
static int noname_undefs_length
 
static struct type ** type_vector
 
static int type_vector_length
 
static struct ref_mapref_map
 
static int ref_count = 0
 
static int ref_chunk = 0
 
static const struct symbol_register_ops stab_register_funcs
 
static int stab_register_index
 
static int stab_regparm_index
 
static const registry< objfile >::key< struct type *, gdb::noop_deleter< struct type * > > rs6000_builtin_type_data
 
static struct pendingcommon_block
 
static int common_block_i
 
static char * common_block_name
 

Macro Definition Documentation

◆ INITIAL_TYPE_VECTOR_LENGTH

#define INITIAL_TYPE_VECTOR_LENGTH   160

Definition at line 237 of file stabsread.c.

◆ MAX_CHUNK_REFS

#define MAX_CHUNK_REFS   100

Definition at line 513 of file stabsread.c.

◆ NUMBER_RECOGNIZED

#define NUMBER_RECOGNIZED   34

◆ REF_CHUNK_SIZE

#define REF_CHUNK_SIZE   (MAX_CHUNK_REFS * sizeof (struct ref_map))

Definition at line 514 of file stabsread.c.

◆ REF_MAP_SIZE

#define REF_MAP_SIZE (   ref_chunk)    ((ref_chunk) * REF_CHUNK_SIZE)

Definition at line 515 of file stabsread.c.

◆ STABS_CONTINUE

#define STABS_CONTINUE (   pp,
  objfile 
)
Value:
do { \
if (**(pp) == '\\' || (**(pp) == '?' && (*(pp))[1] == '\0')) \
} while (0)
#define next_symbol_text(objfile)
Definition: stabsread.h:39

Definition at line 216 of file stabsread.c.

◆ VISIBILITY_IGNORE

#define VISIBILITY_IGNORE   '9' /* Optimized out or zero length */

Definition at line 501 of file stabsread.c.

◆ VISIBILITY_PRIVATE

#define VISIBILITY_PRIVATE   '0' /* Stabs character for private field */

Definition at line 498 of file stabsread.c.

◆ VISIBILITY_PROTECTED

#define VISIBILITY_PROTECTED   '1' /* Stabs character for protected fld */

Definition at line 499 of file stabsread.c.

◆ VISIBILITY_PUBLIC

#define VISIBILITY_PUBLIC   '2' /* Stabs character for public field */

Definition at line 500 of file stabsread.c.

Function Documentation

◆ _initialize_stabsread()

void _initialize_stabsread ( )

Definition at line 4743 of file stabsread.c.

Referenced by initialize_all_files().

◆ add_undefined_type()

static void add_undefined_type ( struct type type,
int  typenums[2] 
)
static

Definition at line 4376 of file stabsread.c.

References add_undefined_type_1(), add_undefined_type_noname(), and type::name().

Referenced by read_type().

◆ add_undefined_type_1()

static void add_undefined_type_1 ( struct type type)
static

Definition at line 4350 of file stabsread.c.

References undef_types, undef_types_allocated, undef_types_length, and xrealloc().

Referenced by add_undefined_type().

◆ add_undefined_type_noname()

static void add_undefined_type_noname ( struct type type,
int  typenums[2] 
)
static

◆ attach_fields_to_type()

static int attach_fields_to_type ( struct stab_field_info fip,
struct type type,
struct objfile objfile 
)
static

◆ attach_fn_fields_to_type()

static int attach_fn_fields_to_type ( struct stab_field_info fip,
struct type type 
)
static

◆ cleanup_undefined_stabs_types()

void cleanup_undefined_stabs_types ( struct objfile objfile)

◆ cleanup_undefined_types_1()

static void cleanup_undefined_types_1 ( void  )
static

◆ cleanup_undefined_types_noname()

static void cleanup_undefined_types_noname ( struct objfile objfile)
static

◆ common_block_end()

void common_block_end ( struct objfile objfile)

◆ common_block_start()

void common_block_start ( const char *  name,
struct objfile objfile 
)

◆ complain_about_struct_wipeout()

static void complain_about_struct_wipeout ( struct type type)
static

Definition at line 3341 of file stabsread.c.

References type::code(), complaint, name, and type::name().

Referenced by read_struct_type(), and set_length_in_type_chain().

◆ dbx_alloc_type()

static struct type * dbx_alloc_type ( int  typenums[2],
struct objfile objfile 
)
static

Definition at line 345 of file stabsread.c.

References alloc_type(), and dbx_lookup_type().

Referenced by read_type().

◆ dbx_init_float_type()

static struct type * dbx_init_float_type ( struct objfile objfile,
int  bits 
)
static

◆ dbx_lookup_type()

static struct type ** dbx_lookup_type ( int  typenums[2],
struct objfile objfile 
)
static

◆ define_symbol()

struct symbol * define_symbol ( CORE_ADDR  valu,
const char *  string,
int  desc,
int  type,
struct objfile objfile 
)

Definition at line 649 of file stabsread.c.

References symbol::aclass(), add_symbol_to_list(), objfile::arch(), objfile_type::builtin_double, objfile_type::builtin_int, c_canonicalize_name(), type::code(), complaint, general_symbol_info::compute_and_set_names(), cp_canonicalize_string(), cp_scan_for_anonymous_namespaces(), create_array_type(), create_static_range_type(), current_symbol, error_type(), type::field(), find_name_end(), gdbarch_believe_pcc_promotion(), gdbarch_byte_order(), gdbarch_int_bit(), gdbarch_stabs_argument_has_addr(), get_buildsym_compunit(), get_current_subfile(), get_file_symbols(), get_global_symbols(), get_local_symbols(), global_sym_chain, hashname(), symbol::is_argument(), is_cplus_marker(), type::is_unsigned(), subfile::language, general_symbol_info::language(), language_ada, language_c, language_cplus, language_pascal, type::length(), general_symbol_info::linkage_name(), LOC_ARG, LOC_BLOCK, LOC_CONST, LOC_CONST_BYTES, LOC_LABEL, LOC_LOCAL, LOC_REF_ARG, LOC_REGISTER, LOC_REGPARM_ADDR, LOC_STATIC, LOC_TYPEDEF, lookup_function_type(), lookup_pointer_type(), name, type::name(), pending::nsyms, objfile::objfile_obstack, objfile::per_bfd, processing_gcc_compilation, read_type(), symbol::set_aclass_index(), symbol::set_domain(), type::set_fields(), symbol::set_is_argument(), type::set_is_prototyped(), general_symbol_info::set_language(), symbol::set_line(), general_symbol_info::set_linkage_name(), field::set_name(), type::set_name(), type::set_num_fields(), field::set_type(), symbol::set_type(), symbol::set_value_address(), symbol::set_value_bytes(), symbol::set_value_chain(), symbol::set_value_longest(), stab_register_index, stab_regparm_index, STRUCT_DOMAIN, pending::symbol, target_float_from_string(), symbol::type(), TYPE_ALLOC, TYPE_BASECLASS, TYPE_BASECLASS_NAME, TYPE_FIELD_ARTIFICIAL, TYPE_N_BASECLASSES, symbol::value_longest(), VAR_DOMAIN, vtbl_ptr_name, and within_function.

Referenced by process_one_symbol(), process_xcoff_symbol(), and read_xcoff_symtab().

◆ end_stabs()

void end_stabs ( void  )

◆ error_type()

static struct type * error_type ( const char **  pp,
struct objfile objfile 
)
static

◆ find_name_end()

static const char * find_name_end ( const char *  name)
static

Definition at line 4707 of file stabsread.c.

References name.

Referenced by define_symbol().

◆ finish_global_stabs()

void finish_global_stabs ( struct objfile objfile)

◆ fix_common_block()

static void fix_common_block ( struct symbol sym,
CORE_ADDR  valu 
)
static

◆ hashname()

int hashname ( const char *  name)

◆ invalid_cpp_abbrev_complaint()

static void invalid_cpp_abbrev_complaint ( const char *  arg1)
static

Definition at line 176 of file stabsread.c.

References complaint.

Referenced by read_cpp_abbrev().

◆ patch_block_stabs()

static void patch_block_stabs ( struct pending symbols,
struct pending_stabs stabs,
struct objfile objfile 
)
static

◆ process_reference()

static int process_reference ( const char **  string)
static

Definition at line 575 of file stabsread.c.

Referenced by symbol_reference_defined().

◆ read_args()

static struct field * read_args ( const char **  pp,
int  end,
struct objfile objfile,
int *  nargsp,
int *  varargsp 
)
static

Definition at line 4171 of file stabsread.c.

References code, complaint, read_type(), set_type(), and STABS_CONTINUE.

Referenced by read_type().

◆ read_array_type()

static struct type * read_array_type ( const char **  pp,
struct type type,
struct objfile objfile 
)
static

◆ read_baseclasses()

static int read_baseclasses ( struct stab_field_info fip,
const char **  pp,
struct type type,
struct objfile objfile 
)
static

◆ read_cpp_abbrev()

static int read_cpp_abbrev ( struct stab_field_info fip,
const char **  pp,
struct type type,
struct objfile objfile 
)
static

◆ read_enum_type()

static struct type * read_enum_type ( const char **  pp,
struct type type,
struct objfile objfile 
)
static

◆ read_huge_number()

static long read_huge_number ( const char **  pp,
int  end,
int *  bits,
int  twos_complement_bits 
)
static

◆ read_member_functions()

static int read_member_functions ( struct stab_field_info fip,
const char **  pp,
struct type type,
struct objfile objfile 
)
static

◆ read_one_struct_field()

static void read_one_struct_field ( struct stab_field_info fip,
const char **  pp,
const char *  p,
struct type type,
struct objfile objfile 
)
static

◆ read_range_type()

static struct type * read_range_type ( const char **  pp,
int  typenums[2],
int  type_size,
struct objfile objfile 
)
static

◆ read_struct_fields()

static int read_struct_fields ( struct stab_field_info fip,
const char **  pp,
struct type type,
struct objfile objfile 
)
static

◆ read_struct_type()

static struct type * read_struct_type ( const char **  pp,
struct type type,
enum type_code type_code  ,
struct objfile objfile 
)
static

◆ read_sun_builtin_type()

static struct type * read_sun_builtin_type ( const char **  pp,
int  typenums[2],
struct objfile objfile 
)
static

◆ read_sun_floating_type()

static struct type * read_sun_floating_type ( const char **  pp,
int  typenums[2],
struct objfile objfile 
)
static

Definition at line 3749 of file stabsread.c.

References dbx_init_float_type(), error_type(), init_complex_type(), and read_huge_number().

Referenced by read_type().

◆ read_tilde_fields()

static int read_tilde_fields ( struct stab_field_info fip,
const char **  pp,
struct type type,
struct objfile objfile 
)
static

◆ read_type()

static struct type * read_type ( const char **  pp,
struct objfile objfile 
)
static

◆ read_type_number()

static int read_type_number ( const char **  pp,
int *  typenums 
)
static

Definition at line 473 of file stabsread.c.

References read_huge_number().

Referenced by read_range_type(), and read_type().

◆ ref_add()

void ref_add ( int  refnum,
struct symbol sym,
const char *  stabs,
CORE_ADDR  value 
)

◆ ref_search()

struct symbol * ref_search ( int  refnum)

Definition at line 564 of file stabsread.c.

References ref_count, and ref_map::sym.

Referenced by process_one_symbol().

◆ reg_value_complaint()

static void reg_value_complaint ( int  regnum,
int  num_regs,
const char *  sym 
)
static

Definition at line 182 of file stabsread.c.

References complaint, and regnum.

Referenced by stab_reg_to_regnum().

◆ rs6000_builtin_type()

static struct type * rs6000_builtin_type ( int  typenum,
struct objfile objfile 
)
static

◆ scan_file_globals()

void scan_file_globals ( struct objfile objfile)

◆ set_length_in_type_chain()

static void set_length_in_type_chain ( struct type type)
static

◆ stab_reg_to_regnum()

static int stab_reg_to_regnum ( struct symbol sym,
struct gdbarch gdbarch 
)
static

◆ stabs_general_complaint()

static void stabs_general_complaint ( const char *  arg1)
static

Definition at line 189 of file stabsread.c.

References complaint.

Referenced by read_one_struct_field().

◆ stabs_method_name_from_physname()

static char * stabs_method_name_from_physname ( const char *  physname)
static

Definition at line 2200 of file stabsread.c.

References complaint, and method_name_from_physname().

Referenced by read_member_functions().

◆ stabsread_clear_cache()

void stabsread_clear_cache ( void  )

Definition at line 529 of file stabsread.c.

References ref_chunk, and ref_count.

Referenced by coff_symfile_finish().

◆ stabsread_init()

void stabsread_init ( void  )

Definition at line 4647 of file stabsread.c.

Referenced by dbx_expand_psymtab(), and xcoff_expand_psymtab().

◆ stabsread_new_init()

void stabsread_new_init ( void  )

◆ start_stabs()

void start_stabs ( void  )

◆ symbol_reference_defined()

int symbol_reference_defined ( const char **  string)

Definition at line 600 of file stabsread.c.

References process_reference().

Referenced by process_one_symbol().

Variable Documentation

◆ common_block

struct pending* common_block
static

Definition at line 4223 of file stabsread.c.

Referenced by common_block_end().

◆ common_block_i

int common_block_i
static

Definition at line 4224 of file stabsread.c.

Referenced by common_block_end(), and common_block_start().

◆ common_block_name

char* common_block_name
static

Definition at line 4229 of file stabsread.c.

Referenced by common_block_end(), common_block_start(), and start_stabs().

◆ current_symbol

struct symbol* current_symbol = NULL
static

Definition at line 199 of file stabsread.c.

Referenced by define_symbol().

◆ global_stabs

struct pending_stabs* global_stabs

Definition at line 58 of file stabsread.c.

Referenced by finish_global_stabs(), process_xcoff_symbol(), and start_stabs().

◆ global_sym_chain

struct symbol* global_sym_chain[HASHSIZE]

◆ n_allocated_this_object_header_files

int n_allocated_this_object_header_files

Definition at line 62 of file stabsread.c.

Referenced by add_this_object_header_file(), free_header_files(), and init_header_files().

◆ n_this_object_header_files

int n_this_object_header_files

Definition at line 61 of file stabsread.c.

Referenced by add_this_object_header_file(), dbx_lookup_type(), and start_stabs().

◆ next_symbol_text_func

const char *(* next_symbol_text_func) (struct objfile *) ( struct objfile )

◆ noname_undefs

struct nat* noname_undefs
static

Definition at line 211 of file stabsread.c.

Referenced by add_undefined_type_noname(), and cleanup_undefined_types_noname().

◆ noname_undefs_allocated

int noname_undefs_allocated
static

Definition at line 212 of file stabsread.c.

Referenced by add_undefined_type_noname().

◆ noname_undefs_length

int noname_undefs_length
static

Definition at line 213 of file stabsread.c.

Referenced by add_undefined_type_noname(), and cleanup_undefined_types_noname().

◆ previous_stab_code

int previous_stab_code

Definition at line 59 of file stabsread.c.

Referenced by end_stabs(), mdebug_expand_psymtab(), and process_one_symbol().

◆ processing_gcc_compilation

unsigned char processing_gcc_compilation

◆ ref_chunk

int ref_chunk = 0
static

Definition at line 523 of file stabsread.c.

Referenced by ref_add(), and stabsread_clear_cache().

◆ ref_count

int ref_count = 0
static

Definition at line 520 of file stabsread.c.

Referenced by ref_add(), ref_search(), and stabsread_clear_cache().

◆ ref_map

struct ref_map* ref_map
static

Definition at line 517 of file stabsread.c.

◆ rs6000_builtin_type_data

const registry<objfile>::key<struct type *, gdb::noop_deleter<struct type *> > rs6000_builtin_type_data
static

Definition at line 2029 of file stabsread.c.

Referenced by rs6000_builtin_type().

◆ stab_register_funcs

const struct symbol_register_ops stab_register_funcs
static
Initial value:
= {
}
static int stab_reg_to_regnum(struct symbol *sym, struct gdbarch *gdbarch)
Definition: stabsread.c:624

Definition at line 639 of file stabsread.c.

◆ stab_register_index

int stab_register_index
static

Definition at line 645 of file stabsread.c.

Referenced by define_symbol().

◆ stab_regparm_index

int stab_regparm_index
static

Definition at line 646 of file stabsread.c.

Referenced by define_symbol().

◆ symnum

unsigned int symnum

◆ this_object_header_files

int* this_object_header_files

◆ type_vector

struct type** type_vector
static

Definition at line 228 of file stabsread.c.

Referenced by dbx_lookup_type(), end_stabs(), and start_stabs().

◆ type_vector_length

int type_vector_length
static

Definition at line 232 of file stabsread.c.

Referenced by dbx_lookup_type(), end_stabs(), and start_stabs().

◆ undef_types

struct type** undef_types
static

Definition at line 196 of file stabsread.c.

Referenced by add_undefined_type_1(), and cleanup_undefined_types_1().

◆ undef_types_allocated

int undef_types_allocated
static

Definition at line 197 of file stabsread.c.

Referenced by add_undefined_type_1().

◆ undef_types_length

int undef_types_length
static

Definition at line 198 of file stabsread.c.

Referenced by add_undefined_type_1(), and cleanup_undefined_types_1().

◆ vb_name

const char vb_name[] = "_vb$"
static

Definition at line 173 of file stabsread.c.

Referenced by read_cpp_abbrev().

◆ vptr_name

const char vptr_name[] = "_vptr$"
static

Definition at line 172 of file stabsread.c.

Referenced by read_cpp_abbrev(), and read_tilde_fields().

◆ within_function

int within_function