GDB (xrefs)
Classes | Macros | Functions | Variables
/tmp/gdb-8.1/gdb/psymtab.c File Reference
#include "defs.h"
#include "symtab.h"
#include "psympriv.h"
#include "objfiles.h"
#include "block.h"
#include "filenames.h"
#include "source.h"
#include "addrmap.h"
#include "gdbtypes.h"
#include "bcache.h"
#include "ui-out.h"
#include "command.h"
#include "readline/readline.h"
#include "gdb_regex.h"
#include "dictionary.h"
#include "language.h"
#include "cp-support.h"
#include "gdbcmd.h"
#include <algorithm>
#include <set>

Go to the source code of this file.

Classes

struct  psymbol_bcache
 
struct  dump_psymtab_addrmap_data
 

Macros

#define ALL_OBJFILE_PSYMTABS_REQUIRED(objfile, p)
 
#define ALL_PSYMTABS(objfile, p)
 

Functions

static struct partial_symbolmatch_partial_symbol (struct objfile *, struct partial_symtab *, int, const char *, domain_enum, symbol_name_match_type, symbol_compare_ftype *)
 
static struct partial_symbollookup_partial_symbol (struct objfile *, struct partial_symtab *, const char *, int, domain_enum)
 
static const char * psymtab_to_fullname (struct partial_symtab *ps)
 
static struct partial_symbolfind_pc_sect_psymbol (struct objfile *, struct partial_symtab *, CORE_ADDR, struct obj_section *)
 
static void fixup_psymbol_section (struct partial_symbol *psym, struct objfile *objfile)
 
static struct compunit_symtabpsymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst)
 
struct objfilerequire_partial_symbols (struct objfile *objfile, int verbose)
 
static bool partial_map_expand_apply (struct objfile *objfile, const char *name, const char *real_path, struct partial_symtab *pst, gdb::function_view< bool(symtab *)> callback)
 
static bool psym_map_symtabs_matching_filename (struct objfile *objfile, const char *name, const char *real_path, gdb::function_view< bool(symtab *)> callback)
 
static struct partial_symtabfind_pc_sect_psymtab_closer (struct objfile *objfile, CORE_ADDR pc, struct obj_section *section, struct partial_symtab *pst, struct bound_minimal_symbol msymbol)
 
static struct partial_symtabfind_pc_sect_psymtab (struct objfile *objfile, CORE_ADDR pc, struct obj_section *section, struct bound_minimal_symbol msymbol)
 
static struct compunit_symtabpsym_find_pc_sect_compunit_symtab (struct objfile *objfile, struct bound_minimal_symbol msymbol, CORE_ADDR pc, struct obj_section *section, int warn_if_readin)
 
static struct compunit_symtabpsym_lookup_symbol (struct objfile *objfile, int block_index, const char *name, const domain_enum domain)
 
static bool psymbol_name_matches (partial_symbol *psym, const lookup_name_info &lookup_name)
 
static gdb::unique_xmalloc_ptr< char > psymtab_search_name (const char *name)
 
static void psym_relocate (struct objfile *objfile, const struct section_offsets *new_offsets, const struct section_offsets *delta)
 
static struct symtabpsym_find_last_source_symtab (struct objfile *ofp)
 
static void psym_forget_cached_source_info (struct objfile *objfile)
 
static void print_partial_symbols (struct gdbarch *gdbarch, struct partial_symbol **p, int count, const char *what, struct ui_file *outfile)
 
static void dump_psymtab (struct objfile *objfile, struct partial_symtab *psymtab, struct ui_file *outfile)
 
static void psym_print_stats (struct objfile *objfile)
 
static void psym_dump (struct objfile *objfile)
 
static void psym_expand_symtabs_for_function (struct objfile *objfile, const char *func_name)
 
static void psym_expand_all_symtabs (struct objfile *objfile)
 
static void psym_expand_symtabs_with_fullname (struct objfile *objfile, const char *fullname)
 
static void psym_map_symbol_filenames (struct objfile *objfile, symbol_filename_ftype *fun, void *data, int need_fullname)
 
static int map_block (const char *name, domain_enum domain, struct objfile *objfile, struct block *block, int(*callback)(struct block *, struct symbol *, void *), void *data, symbol_name_match_type match)
 
static void psym_map_matching_symbols (struct objfile *objfile, const char *name, domain_enum domain, int global, int(*callback)(struct block *, struct symbol *, void *), void *data, symbol_name_match_type match, symbol_compare_ftype *ordered_compare)
 
static bool recursively_search_psymtabs (struct partial_symtab *ps, struct objfile *objfile, enum search_domain domain, const lookup_name_info &lookup_name, gdb::function_view< expand_symtabs_symbol_matcher_ftype > sym_matcher)
 
static void psym_expand_symtabs_matching (struct objfile *objfile, gdb::function_view< expand_symtabs_file_matcher_ftype > file_matcher, const lookup_name_info &lookup_name_in, gdb::function_view< expand_symtabs_symbol_matcher_ftype > symbol_matcher, gdb::function_view< expand_symtabs_exp_notify_ftype > expansion_notify, enum search_domain domain)
 
static int psym_has_symbols (struct objfile *objfile)
 
static void psym_fill_psymbol_map (struct objfile *objfile, struct partial_symtab *psymtab, std::set< CORE_ADDR > *seen_addrs, const std::vector< partial_symbol *> &symbols, int start, int length)
 
static compunit_symtabpsym_find_compunit_symtab_by_address (struct objfile *objfile, CORE_ADDR address)
 
static void sort_pst_symbols (struct objfile *objfile, struct partial_symtab *pst)
 
struct partial_symtabstart_psymtab_common (struct objfile *objfile, const char *filename, CORE_ADDR textlow, std::vector< partial_symbol *> &global_psymbols, std::vector< partial_symbol *> &static_psymbols)
 
void end_psymtab_common (struct objfile *objfile, struct partial_symtab *pst)
 
static unsigned long psymbol_hash (const void *addr, int length)
 
static int psymbol_compare (const void *addr1, const void *addr2, int length)
 
struct psymbol_bcachepsymbol_bcache_init (void)
 
void psymbol_bcache_free (struct psymbol_bcache *bcache)
 
struct bcachepsymbol_bcache_get_bcache (struct psymbol_bcache *bcache)
 
static struct partial_symbolpsymbol_bcache_full (struct partial_symbol *sym, struct psymbol_bcache *bcache, int *added)
 
static struct partial_symboladd_psymbol_to_bcache (const char *name, int namelength, int copy_name, domain_enum domain, enum address_class theclass, CORE_ADDR coreaddr, enum language language, struct objfile *objfile, int *added)
 
static void append_psymbol_to_list (std::vector< partial_symbol *> *list, struct partial_symbol *psym, struct objfile *objfile)
 
void add_psymbol_to_list (const char *name, int namelength, int copy_name, domain_enum domain, enum address_class theclass, std::vector< partial_symbol *> *list, CORE_ADDR coreaddr, enum language language, struct objfile *objfile)
 
void init_psymbol_list (struct objfile *objfile, int total_symbols)
 
struct partial_symtaballocate_psymtab (const char *filename, struct objfile *objfile)
 
void discard_psymtab (struct objfile *objfile, struct partial_symtab *pst)
 
static int dump_psymtab_addrmap_1 (void *datap, CORE_ADDR start_addr, void *obj)
 
static void dump_psymtab_addrmap (struct objfile *objfile, struct partial_symtab *psymtab, struct ui_file *outfile)
 
static void maintenance_print_psymbols (const char *args, int from_tty)
 
static void maintenance_info_psymtabs (const char *regexp, int from_tty)
 
static void maintenance_check_psymtabs (const char *ignore, int from_tty)
 
void _initialize_psymtab (void)
 

Variables

const struct quick_symbol_functions psym_functions
 

Macro Definition Documentation

◆ ALL_OBJFILE_PSYMTABS_REQUIRED

#define ALL_OBJFILE_PSYMTABS_REQUIRED (   objfile,
 
)

◆ ALL_PSYMTABS

#define ALL_PSYMTABS (   objfile,
 
)
Value:
ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, p)
#define ALL_OBJFILES(obj)
Definition: objfiles.h:582

Definition at line 127 of file psymtab.c.

Referenced by maintenance_check_psymtabs().

Function Documentation

◆ _initialize_psymtab()

void _initialize_psymtab ( void  )

◆ add_psymbol_to_bcache()

static struct partial_symbol* add_psymbol_to_bcache ( const char *  name,
int  namelength,
int  copy_name,
domain_enum  domain,
enum address_class  theclass,
CORE_ADDR  coreaddr,
enum language  language,
struct objfile objfile,
int *  added 
)
static

◆ add_psymbol_to_list()

void add_psymbol_to_list ( const char *  name,
int  namelength,
int  copy_name,
domain_enum  domain,
enum address_class  theclass,
std::vector< partial_symbol *> *  list,
CORE_ADDR  coreaddr,
enum language language  ,
struct objfile objfile 
)

◆ allocate_psymtab()

struct partial_symtab* allocate_psymtab ( const char *  filename,
struct objfile objfile 
)

◆ append_psymbol_to_list()

static void append_psymbol_to_list ( std::vector< partial_symbol *> *  list,
struct partial_symbol psym,
struct objfile objfile 
)
static

Definition at line 1742 of file psymtab.c.

References OBJSTAT.

Referenced by add_psymbol_to_list().

◆ discard_psymtab()

void discard_psymtab ( struct objfile objfile,
struct partial_symtab pst 
)

◆ dump_psymtab()

static void dump_psymtab ( struct objfile objfile,
struct partial_symtab psymtab,
struct ui_file outfile 
)
static

◆ dump_psymtab_addrmap()

static void dump_psymtab_addrmap ( struct objfile objfile,
struct partial_symtab psymtab,
struct ui_file outfile 
)
static

◆ dump_psymtab_addrmap_1()

static int dump_psymtab_addrmap_1 ( void *  datap,
CORE_ADDR  start_addr,
void *  obj 
)
static

◆ end_psymtab_common()

void end_psymtab_common ( struct objfile objfile,
struct partial_symtab pst 
)

◆ find_pc_sect_psymbol()

static struct partial_symbol * find_pc_sect_psymbol ( struct objfile objfile,
struct partial_symtab psymtab,
CORE_ADDR  pc,
struct obj_section section 
)
static

◆ find_pc_sect_psymtab()

static struct partial_symtab* find_pc_sect_psymtab ( struct objfile objfile,
CORE_ADDR  pc,
struct obj_section section,
struct bound_minimal_symbol  msymbol 
)
static

◆ find_pc_sect_psymtab_closer()

static struct partial_symtab* find_pc_sect_psymtab_closer ( struct objfile objfile,
CORE_ADDR  pc,
struct obj_section section,
struct partial_symtab pst,
struct bound_minimal_symbol  msymbol 
)
static

◆ fixup_psymbol_section()

static void fixup_psymbol_section ( struct partial_symbol psym,
struct objfile objfile 
)
static

◆ init_psymbol_list()

void init_psymbol_list ( struct objfile objfile,
int  total_symbols 
)

◆ lookup_partial_symbol()

static struct partial_symbol * lookup_partial_symbol ( struct objfile objfile,
struct partial_symtab pst,
const char *  name,
int  global,
domain_enum  domain 
)
static

◆ maintenance_check_psymtabs()

static void maintenance_check_psymtabs ( const char *  ignore,
int  from_tty 
)
static

◆ maintenance_info_psymtabs()

static void maintenance_info_psymtabs ( const char *  regexp,
int  from_tty 
)
static

◆ maintenance_print_psymbols()

static void maintenance_print_psymbols ( const char *  args,
int  from_tty 
)
static

◆ map_block()

static int map_block ( const char *  name,
domain_enum  domain,
struct objfile objfile,
struct block block,
int(*)(struct block *, struct symbol *, void *)  callback,
void *  data,
symbol_name_match_type  match 
)
static

◆ match_partial_symbol()

static struct partial_symbol * match_partial_symbol ( struct objfile objfile,
struct partial_symtab pst,
int  global,
const char *  name,
domain_enum  domain,
symbol_name_match_type  match_type,
symbol_compare_ftype ordered_compare 
)
static

◆ partial_map_expand_apply()

static bool partial_map_expand_apply ( struct objfile objfile,
const char *  name,
const char *  real_path,
struct partial_symtab pst,
gdb::function_view< bool(symtab *)>  callback 
)
static

◆ print_partial_symbols()

static void print_partial_symbols ( struct gdbarch gdbarch,
struct partial_symbol **  p,
int  count,
const char *  what,
struct ui_file outfile 
)
static

◆ psym_dump()

static void psym_dump ( struct objfile objfile)
static

◆ psym_expand_all_symtabs()

static void psym_expand_all_symtabs ( struct objfile objfile)
static

Definition at line 1119 of file psymtab.c.

References ALL_OBJFILE_PSYMTABS_REQUIRED, and psymtab_to_symtab().

◆ psym_expand_symtabs_for_function()

static void psym_expand_symtabs_for_function ( struct objfile objfile,
const char *  func_name 
)
static

◆ psym_expand_symtabs_matching()

static void psym_expand_symtabs_matching ( struct objfile objfile,
gdb::function_view< expand_symtabs_file_matcher_ftype file_matcher,
const lookup_name_info lookup_name_in,
gdb::function_view< expand_symtabs_symbol_matcher_ftype symbol_matcher,
gdb::function_view< expand_symtabs_exp_notify_ftype expansion_notify,
enum search_domain  domain 
)
static

◆ psym_expand_symtabs_with_fullname()

static void psym_expand_symtabs_with_fullname ( struct objfile objfile,
const char *  fullname 
)
static

◆ psym_fill_psymbol_map()

static void psym_fill_psymbol_map ( struct objfile objfile,
struct partial_symtab psymtab,
std::set< CORE_ADDR > *  seen_addrs,
const std::vector< partial_symbol *> &  symbols,
int  start,
int  length 
)
static

◆ psym_find_compunit_symtab_by_address()

static compunit_symtab* psym_find_compunit_symtab_by_address ( struct objfile objfile,
CORE_ADDR  address 
)
static

◆ psym_find_last_source_symtab()

static struct symtab* psym_find_last_source_symtab ( struct objfile ofp)
static

◆ psym_find_pc_sect_compunit_symtab()

static struct compunit_symtab* psym_find_pc_sect_compunit_symtab ( struct objfile objfile,
struct bound_minimal_symbol  msymbol,
CORE_ADDR  pc,
struct obj_section section,
int  warn_if_readin 
)
static

◆ psym_forget_cached_source_info()

static void psym_forget_cached_source_info ( struct objfile objfile)
static

Definition at line 873 of file psymtab.c.

References ALL_OBJFILE_PSYMTABS_REQUIRED, partial_symtab::fullname, and xfree().

◆ psym_has_symbols()

static int psym_has_symbols ( struct objfile objfile)
static

Definition at line 1458 of file psymtab.c.

References objfile::psymtabs.

◆ psym_lookup_symbol()

static struct compunit_symtab* psym_lookup_symbol ( struct objfile objfile,
int  block_index,
const char *  name,
const domain_enum  domain 
)
static

◆ psym_map_matching_symbols()

static void psym_map_matching_symbols ( struct objfile objfile,
const char *  name,
domain_enum  domain,
int  global,
int(*)(struct block *, struct symbol *, void *)  callback,
void *  data,
symbol_name_match_type  match,
symbol_compare_ftype ordered_compare 
)
static

◆ psym_map_symbol_filenames()

static void psym_map_symbol_filenames ( struct objfile objfile,
symbol_filename_ftype fun,
void *  data,
int  need_fullname 
)
static

◆ psym_map_symtabs_matching_filename()

static bool psym_map_symtabs_matching_filename ( struct objfile objfile,
const char *  name,
const char *  real_path,
gdb::function_view< bool(symtab *)>  callback 
)
static

◆ psym_print_stats()

static void psym_print_stats ( struct objfile objfile)
static

Definition at line 1054 of file psymtab.c.

References _, ALL_OBJFILE_PSYMTABS_REQUIRED, printf_filtered(), and cleanup_check::ps.

◆ psym_relocate()

static void psym_relocate ( struct objfile objfile,
const struct section_offsets new_offsets,
const struct section_offsets delta 
)
static

◆ psymbol_bcache_free()

void psymbol_bcache_free ( struct psymbol_bcache bcache)

Definition at line 1674 of file psymtab.c.

References bcache_xfree(), and xfree().

Referenced by reread_symbols(), and objfile::~objfile().

◆ psymbol_bcache_full()

static struct partial_symbol* psymbol_bcache_full ( struct partial_symbol sym,
struct psymbol_bcache bcache,
int *  added 
)
static

Definition at line 1697 of file psymtab.c.

References bcache_full().

Referenced by add_psymbol_to_bcache().

◆ psymbol_bcache_get_bcache()

struct bcache* psymbol_bcache_get_bcache ( struct psymbol_bcache bcache)

Definition at line 1686 of file psymtab.c.

Referenced by print_objfile_statistics(), and print_symbol_bcache_statistics().

◆ psymbol_bcache_init()

struct psymbol_bcache* psymbol_bcache_init ( void  )

Definition at line 1663 of file psymtab.c.

References bcache(), bcache_xmalloc(), psymbol_compare(), psymbol_hash(), and XCNEW.

Referenced by reread_symbols().

◆ psymbol_compare()

static int psymbol_compare ( const void *  addr1,
const void *  addr2,
int  length 
)
static

◆ psymbol_hash()

static unsigned long psymbol_hash ( const void *  addr,
int  length 
)
static

◆ psymbol_name_matches()

static bool psymbol_name_matches ( partial_symbol psym,
const lookup_name_info lookup_name 
)
static

◆ psymtab_search_name()

static gdb::unique_xmalloc_ptr<char> psymtab_search_name ( const char *  name)
static

◆ psymtab_to_fullname()

static const char * psymtab_to_fullname ( struct partial_symtab ps)
static

◆ psymtab_to_symtab()

static struct compunit_symtab * psymtab_to_symtab ( struct objfile objfile,
struct partial_symtab pst 
)
static

◆ recursively_search_psymtabs()

static bool recursively_search_psymtabs ( struct partial_symtab ps,
struct objfile objfile,
enum search_domain  domain,
const lookup_name_info lookup_name,
gdb::function_view< expand_symtabs_symbol_matcher_ftype sym_matcher 
)
static

◆ require_partial_symbols()

struct objfile* require_partial_symbols ( struct objfile objfile,
int  verbose 
)

◆ sort_pst_symbols()

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

◆ start_psymtab_common()

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

Variable Documentation

◆ psym_functions

const struct quick_symbol_functions psym_functions
Initial value:
=
{
}
static void psym_expand_all_symtabs(struct objfile *objfile)
Definition: psymtab.c:1119
static struct compunit_symtab * psym_find_pc_sect_compunit_symtab(struct objfile *objfile, struct bound_minimal_symbol msymbol, CORE_ADDR pc, struct obj_section *section, int warn_if_readin)
Definition: psymtab.c:382
static int psym_has_symbols(struct objfile *objfile)
Definition: psymtab.c:1458
static void psym_relocate(struct objfile *objfile, const struct section_offsets *new_offsets, const struct section_offsets *delta)
Definition: psymtab.c:802
static compunit_symtab * psym_find_compunit_symtab_by_address(struct objfile *objfile, CORE_ADDR address)
Definition: psymtab.c:1494
static void psym_forget_cached_source_info(struct objfile *objfile)
Definition: psymtab.c:873
static void psym_dump(struct objfile *objfile)
Definition: psymtab.c:1072
static void psym_map_symbol_filenames(struct objfile *objfile, symbol_filename_ftype *fun, void *data, int need_fullname)
Definition: psymtab.c:1157
static void psym_expand_symtabs_matching(struct objfile *objfile, gdb::function_view< expand_symtabs_file_matcher_ftype > file_matcher, const lookup_name_info &lookup_name_in, gdb::function_view< expand_symtabs_symbol_matcher_ftype > symbol_matcher, gdb::function_view< expand_symtabs_exp_notify_ftype > expansion_notify, enum search_domain domain)
Definition: psymtab.c:1393
static void psym_expand_symtabs_for_function(struct objfile *objfile, const char *func_name)
Definition: psymtab.c:1097
static bool psym_map_symtabs_matching_filename(struct objfile *objfile, const char *name, const char *real_path, gdb::function_view< bool(symtab *)> callback)
Definition: psymtab.c:164
static struct symtab * psym_find_last_source_symtab(struct objfile *ofp)
Definition: psymtab.c:834
static void psym_map_matching_symbols(struct objfile *objfile, const char *name, domain_enum domain, int global, int(*callback)(struct block *, struct symbol *, void *), void *data, symbol_name_match_type match, symbol_compare_ftype *ordered_compare)
Definition: psymtab.c:1267
static void psym_expand_symtabs_with_fullname(struct objfile *objfile, const char *fullname)
Definition: psymtab.c:1133
static void psym_print_stats(struct objfile *objfile)
Definition: psymtab.c:1054
static struct compunit_symtab * psym_lookup_symbol(struct objfile *objfile, int block_index, const char *name, const domain_enum domain)
Definition: psymtab.c:506

Definition at line 1541 of file psymtab.c.