GDB (xrefs)
Classes | Defines | Typedefs | Enumerations | Functions | Variables
/home/stan/gdb/src/gdb/symfile.c File Reference
#include "defs.h"
#include "arch-utils.h"
#include "bfdlink.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "gdbcore.h"
#include "frame.h"
#include "target.h"
#include "value.h"
#include "symfile.h"
#include "objfiles.h"
#include "source.h"
#include "gdbcmd.h"
#include "breakpoint.h"
#include "language.h"
#include "complaints.h"
#include "demangle.h"
#include "inferior.h"
#include "regcache.h"
#include "filenames.h"
#include "gdb-stabs.h"
#include "gdb_obstack.h"
#include "completer.h"
#include "bcache.h"
#include "hashtab.h"
#include "readline/readline.h"
#include "gdb_assert.h"
#include "block.h"
#include "observer.h"
#include "exec.h"
#include "parser-defs.h"
#include "varobj.h"
#include "elf-bfd.h"
#include "solib.h"
#include "remote.h"
#include "stack.h"
#include "gdb_bfd.h"
#include "cli/cli-utils.h"
#include <sys/types.h>
#include <fcntl.h>
#include "gdb_string.h"
#include "gdb_stat.h"
#include <ctype.h>
#include <time.h>
#include <sys/time.h>
#include "psymtab.h"

Go to the source code of this file.

Classes

struct  registered_sym_fns
struct  place_section_arg
struct  load_section_data
struct  load_progress_data
struct  load_progress_section_data
struct  filename_language

Defines

#define DEBUG_SUBDIRECTORY   ".debug"

Typedefs

typedef struct objfileobjfilep

Enumerations

enum  ovly_index { VMA, SIZE, LMA, MAPPED }

Functions

static void clear_symtab_users_cleanup (void *ignore)
static void load_command (char *, int)
static void symbol_file_add_main_1 (const char *args, int from_tty, int flags)
static void add_symbol_file_command (char *, int)
static struct sym_fnsfind_sym_fns (bfd *)
static void decrement_reading_symtab (void *)
static void overlay_invalidate_all (void)
static void overlay_auto_command (char *, int)
static void overlay_manual_command (char *, int)
static void overlay_off_command (char *, int)
static void overlay_load_command (char *, int)
static void overlay_command (char *, int)
static void simple_free_overlay_table (void)
static void read_target_long_array (CORE_ADDR, unsigned int *, int, int, enum bfd_endian)
static int simple_read_overlay_table (void)
static int simple_overlay_update_1 (struct obj_section *)
static void add_filename_language (char *ext, enum language lang)
static void info_ext_lang_command (char *args, int from_tty)
static void init_filename_language_table (void)
static void symfile_find_segment_sections (struct objfile *objfile)
void _initialize_symfile (void)
 DEF_VEC_O (registered_sym_fns)
static VEC (registered_sym_fns)
struct cleanupincrement_reading_symtab (void)
void find_lowest_section (bfd *abfd, asection *sect, void *obj)
struct section_addr_infoalloc_section_addr_info (size_t num_sections)
struct section_addr_infobuild_section_addr_info_from_section_table (const struct target_section *start, const struct target_section *end)
static struct section_addr_infobuild_section_addr_info_from_bfd (bfd *abfd)
struct section_addr_infobuild_section_addr_info_from_objfile (const struct objfile *objfile)
void free_section_addr_info (struct section_addr_info *sap)
static void init_objfile_sect_indices (struct objfile *objfile)
static void place_section (bfd *abfd, asection *sect, void *obj)
void relative_addr_info_to_section_offsets (struct section_offsets *section_offsets, int num_sections, const struct section_addr_info *addrs)
static const char * addr_section_name (const char *s)
static int addrs_section_compar (const void *ap, const void *bp)
static struct other_sections ** addrs_section_sort (struct section_addr_info *addrs)
void addr_info_make_relative (struct section_addr_info *addrs, bfd *abfd)
void default_symfile_offsets (struct objfile *objfile, const struct section_addr_info *addrs)
struct symfile_segment_datadefault_symfile_segments (bfd *abfd)
static void read_symbols (struct objfile *objfile, int add_flags)
static void init_entry_point_info (struct objfile *objfile)
static void syms_from_objfile_1 (struct objfile *objfile, struct section_addr_info *addrs, int add_flags)
static void syms_from_objfile (struct objfile *objfile, struct section_addr_info *addrs, int add_flags)
void new_symfile_objfile (struct objfile *objfile, int add_flags)
static struct objfilesymbol_file_add_with_addrs (bfd *abfd, const char *name, int add_flags, struct section_addr_info *addrs, int flags, struct objfile *parent)
void symbol_file_add_separate (bfd *bfd, const char *name, int symfile_flags, struct objfile *objfile)
struct objfilesymbol_file_add_from_bfd (bfd *abfd, const char *name, int add_flags, struct section_addr_info *addrs, int flags, struct objfile *parent)
struct objfilesymbol_file_add (const char *name, int add_flags, struct section_addr_info *addrs, int flags)
void symbol_file_add_main (const char *args, int from_tty)
void symbol_file_clear (int from_tty)
static int separate_debug_file_exists (const char *name, unsigned long crc, struct objfile *parent_objfile)
static void show_debug_file_directory (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static char * find_separate_debug_file (const char *dir, const char *canon_dir, const char *debuglink, unsigned long crc32, struct objfile *objfile)
static void terminate_after_last_dir_separator (char *path)
char * find_separate_debug_file_by_debuglink (struct objfile *objfile)
void symbol_file_command (char *args, int from_tty)
void set_initial_language (void)
bfd * gdb_bfd_open_maybe_remote (const char *name)
bfd * symfile_bfd_open (const char *cname)
int get_section_index (struct objfile *objfile, char *section_name)
void add_symtab_fns (enum bfd_flavour flavour, const struct sym_fns *sf)
static void add_section_size_callback (bfd *abfd, asection *asec, void *data)
static void load_progress (ULONGEST bytes, void *untyped_arg)
static void load_section_callback (bfd *abfd, asection *asec, void *data)
static void clear_memory_write_data (void *arg)
void generic_load (char *args, int from_tty)
void print_transfer_performance (struct ui_file *stream, unsigned long data_count, unsigned long write_count, const struct timeval *start_time, const struct timeval *end_time)
 DEF_VEC_P (objfilep)
void reread_symbols (void)
static void show_ext_args (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static void set_ext_lang_command (char *args, int from_tty, struct cmd_list_element *e)
enum language deduce_language_from_filename (const char *filename)
struct symtaballocate_symtab (const char *filename, struct objfile *objfile)
void clear_symtab_users (int add_flags)
int section_is_overlay (struct obj_section *section)
int section_is_mapped (struct obj_section *osect)
CORE_ADDR pc_in_unmapped_range (CORE_ADDR pc, struct obj_section *section)
CORE_ADDR pc_in_mapped_range (CORE_ADDR pc, struct obj_section *section)
static int sections_overlap (struct obj_section *a, struct obj_section *b)
CORE_ADDR overlay_unmapped_address (CORE_ADDR pc, struct obj_section *section)
CORE_ADDR overlay_mapped_address (CORE_ADDR pc, struct obj_section *section)
CORE_ADDR symbol_overlayed_address (CORE_ADDR address, struct obj_section *section)
struct obj_sectionfind_pc_overlay (CORE_ADDR pc)
struct obj_sectionfind_pc_mapped_section (CORE_ADDR pc)
static void list_overlays_command (char *args, int from_tty)
static void map_overlay_command (char *args, int from_tty)
static void unmap_overlay_command (char *args, int from_tty)
void simple_overlay_update (struct obj_section *osect)
static void symfile_dummy_outputs (bfd *abfd, asection *sectp, void *dummy)
bfd_byte * default_symfile_relocate (struct objfile *objfile, asection *sectp, bfd_byte *buf)
bfd_byte * symfile_relocate_debug_section (struct objfile *objfile, asection *sectp, bfd_byte *buf)
struct symfile_segment_dataget_symfile_segment_data (bfd *abfd)
void free_symfile_segment_data (struct symfile_segment_data *data)
int symfile_map_offsets_to_segments (bfd *abfd, const struct symfile_segment_data *data, struct section_offsets *offsets, int num_segment_bases, const CORE_ADDR *segment_bases)

Variables

int(* deprecated_ui_load_progress_hook )(const char *section, unsigned long num)
void(* deprecated_show_load_progress )(const char *section, unsigned long section_sent, unsigned long section_size, unsigned long total_sent, unsigned long total_size)
void(* deprecated_pre_add_symbol_hook )(const char *)
void(* deprecated_post_add_symbol_hook )(void)
int readnow_symbol_files
char * debug_file_directory = NULL
static int validate_download = 0
static filename_languagefilename_language_table
static int fl_table_size
static int fl_table_next
static char * ext_args
enum overlay_debugging_state overlay_debugging = ovly_off
int overlay_cache_invalid = 0
static struct cmd_list_elementoverlaylist
static unsigned(* cache_ovly_table )[4] = 0
static unsigned cache_novlys = 0
static CORE_ADDR cache_ovly_table_base = 0

Define Documentation

#define DEBUG_SUBDIRECTORY   ".debug"

Definition at line 1380 of file symfile.c.

Referenced by find_separate_debug_file().


Typedef Documentation

typedef struct objfile* objfilep

Definition at line 2345 of file symfile.c.


Enumeration Type Documentation

enum ovly_index
Enumerator:
VMA 
SIZE 
LMA 
MAPPED 

Definition at line 3386 of file symfile.c.


Function Documentation

void _initialize_symfile ( void  )
static void add_filename_language ( char *  ext,
enum language  lang 
) [static]
static void add_section_size_callback ( bfd *  abfd,
asection *  asec,
void *  data 
) [static]

Definition at line 1871 of file symfile.c.

Referenced by generic_load().

static void add_symbol_file_command ( char *  args,
int  from_tty 
) [static]
void add_symtab_fns ( enum bfd_flavour  flavour,
const struct sym_fns sf 
)

Definition at line 1764 of file symfile.c.

References VEC_safe_push.

Referenced by _initialize_machoread(), _initialize_somread(), and _initialize_xcoffread().

void addr_info_make_relative ( struct section_addr_info addrs,
bfd *  abfd 
)
static const char* addr_section_name ( const char *  s) [static]

Definition at line 484 of file symfile.c.

Referenced by addr_info_make_relative(), and addrs_section_compar().

static int addrs_section_compar ( const void *  ap,
const void *  bp 
) [static]

Definition at line 498 of file symfile.c.

References addr_section_name().

Referenced by addrs_section_sort().

static struct other_sections** addrs_section_sort ( struct section_addr_info addrs) [static, read]
struct section_addr_info* alloc_section_addr_info ( size_t  num_sections) [read]
struct symtab* allocate_symtab ( const char *  filename,
struct objfile objfile 
) [read]
static struct section_addr_info* build_section_addr_info_from_bfd ( bfd *  abfd) [static, read]
static void clear_memory_write_data ( void *  arg) [static]

Definition at line 2012 of file symfile.c.

References memory_write_request::baton, memory_write_request::data, VEC, VEC_free, VEC_iterate, and xfree().

Referenced by generic_load().

void clear_symtab_users ( int  add_flags)
static void clear_symtab_users_cleanup ( void *  ignore) [static]

Definition at line 2870 of file symfile.c.

References clear_symtab_users().

Referenced by reread_symbols(), and syms_from_objfile_1().

static void decrement_reading_symtab ( void *  ) [static]
enum language deduce_language_from_filename ( const char *  filename)
void default_symfile_offsets ( struct objfile objfile,
const struct section_addr_info addrs 
)
bfd_byte* default_symfile_relocate ( struct objfile objfile,
asection *  sectp,
bfd_byte *  buf 
)

Definition at line 3584 of file symfile.c.

References symfile_dummy_outputs().

struct symfile_segment_data* default_symfile_segments ( bfd *  abfd) [read]
void find_lowest_section ( bfd *  abfd,
asection *  sect,
void *  obj 
)

Definition at line 191 of file symfile.c.

Referenced by addr_info_make_relative().

struct obj_section* find_pc_overlay ( CORE_ADDR  pc) [read]
static char* find_separate_debug_file ( const char *  dir,
const char *  canon_dir,
const char *  debuglink,
unsigned long  crc32,
struct objfile objfile 
) [static]
char* find_separate_debug_file_by_debuglink ( struct objfile objfile)
static struct sym_fns * find_sym_fns ( bfd *  abfd) [static, read]
void free_section_addr_info ( struct section_addr_info sap)
bfd* gdb_bfd_open_maybe_remote ( const char *  name)
void generic_load ( char *  args,
int  from_tty 
)
int get_section_index ( struct objfile objfile,
char *  section_name 
)

Definition at line 1747 of file symfile.c.

References objfile::obfd.

Referenced by parse_partial_symbols(), and record_minimal_symbol().

struct symfile_segment_data* get_symfile_segment_data ( bfd *  abfd) [read]
struct cleanup* increment_reading_symtab ( void  ) [read]
static void info_ext_lang_command ( char *  args,
int  from_tty 
) [static]

Definition at line 2704 of file symfile.c.

References _, fl_table_next, language_str(), and printf_filtered().

static void init_entry_point_info ( struct objfile objfile) [static]
static void init_filename_language_table ( void  ) [static]
static void init_objfile_sect_indices ( struct objfile objfile) [static]
static void list_overlays_command ( char *  args,
int  from_tty 
) [static]
static void load_command ( char *  arg,
int  from_tty 
) [static]
static void load_progress ( ULONGEST  bytes,
void *  untyped_arg 
) [static]
static void load_section_callback ( bfd *  abfd,
asection *  asec,
void *  data 
) [static]
static void map_overlay_command ( char *  args,
int  from_tty 
) [static]
void new_symfile_objfile ( struct objfile objfile,
int  add_flags 
)
static void overlay_auto_command ( char *  args,
int  from_tty 
) [static]
static void overlay_command ( char *  args,
int  from_tty 
) [static]

Definition at line 3342 of file symfile.c.

References gdb_stdout, help_list(), and printf_unfiltered().

static void overlay_invalidate_all ( void  ) [static]

Definition at line 2953 of file symfile.c.

References ALL_OBJSECTIONS, obj_section::ovly_mapped, and section_is_overlay().

Referenced by section_is_mapped().

static void overlay_load_command ( char *  args,
int  from_tty 
) [static]
static void overlay_manual_command ( char *  args,
int  from_tty 
) [static]
CORE_ADDR overlay_mapped_address ( CORE_ADDR  pc,
struct obj_section section 
)
static void overlay_off_command ( char *  args,
int  from_tty 
) [static]
CORE_ADDR overlay_unmapped_address ( CORE_ADDR  pc,
struct obj_section section 
)
CORE_ADDR pc_in_mapped_range ( CORE_ADDR  pc,
struct obj_section section 
)
CORE_ADDR pc_in_unmapped_range ( CORE_ADDR  pc,
struct obj_section section 
)
static void place_section ( bfd *  abfd,
asection *  sect,
void *  obj 
) [static]
void print_transfer_performance ( struct ui_file stream,
unsigned long  data_count,
unsigned long  write_count,
const struct timeval *  start_time,
const struct timeval *  end_time 
)
static void read_symbols ( struct objfile objfile,
int  add_flags 
) [static]
static void read_target_long_array ( CORE_ADDR  memaddr,
unsigned int myaddr,
int  len,
int  size,
enum bfd_endian  byte_order 
) [static]

Definition at line 3407 of file symfile.c.

References extract_unsigned_integer(), len, and read_memory().

Referenced by simple_overlay_update_1(), and simple_read_overlay_table().

void relative_addr_info_to_section_offsets ( struct section_offsets section_offsets,
int  num_sections,
const struct section_addr_info addrs 
)
void reread_symbols ( void  )

Definition at line 2352 of file symfile.c.

References _, all_cleanups(), build_objfile_section_table(), clear_complaints(), clear_symtab_users(), clear_symtab_users_cleanup(), discard_cleanups(), do_cleanups(), error(), exec_bfd, exec_file_attach(), find_sym_fns(), objfile::flags, free_objfile_separate_debug(), objfile::free_psymtabs, gdb_bfd_open_maybe_remote(), gdb_bfd_unref(), objfile::global_psymbols, init_entry_point_info(), psymbol_allocation_list::list, make_cleanup(), make_cleanup_bfd_unref(), make_cleanup_free_objfile(), memcpy(), memset(), objfile::minimal_symbol_count, objfile::msymbol_demangled_hash, objfile::msymbol_hash, objfile::msymbols, objfile::mtime, objfile::next, objfile::num_sections, objfile::obfd, object_files, OBJF_PSYMTABS_READ, objfile_has_symbols(), objfile_name(), objfile::objfile_obstack, objfile_set_sym_fns(), objfiles_changed(), observer_notify_executable_changed(), observer_notify_new_objfile(), section_offsets::offsets, objfile::original_name, preserve_values(), printf_unfiltered(), psymbol_bcache_free(), psymbol_bcache_init(), objfile::psymbol_cache, objfile::psymtabs, objfile::psymtabs_addrmap, read_symbols(), reinit_frame_cache(), objfile::section_offsets, objfile::sections, objfile::separate_debug_objfile_backlink, set_objfile_per_bfd(), objfile::sf, SIZEOF_N_SECTION_OFFSETS, objfile::static_psymbols, sym_fns::sym_finish, sym_fns::sym_init, sym_fns::sym_new_init, symfile_complaints, symfile_objfile, objfile::symtabs, objfile::template_symbols, terminate_minimal_symbol_table(), VEC, VEC_cleanup, VEC_iterate, VEC_safe_push, wrap_here(), and xfree().

Referenced by attach_command_post_wait(), load_command(), remote_open_1(), and run_command_1().

int section_is_mapped ( struct obj_section osect)
int section_is_overlay ( struct obj_section section)
static int sections_overlap ( struct obj_section a,
struct obj_section b 
) [static]

Definition at line 3048 of file symfile.c.

References obj_section_addr, and obj_section_endaddr.

Referenced by map_overlay_command().

static int separate_debug_file_exists ( const char *  name,
unsigned long  crc,
struct objfile parent_objfile 
) [static]
static void set_ext_lang_command ( char *  args,
int  from_tty,
struct cmd_list_element e 
) [static]
void set_initial_language ( void  )
static void show_debug_file_directory ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  value 
) [static]

Definition at line 1370 of file symfile.c.

References _, and fprintf_filtered().

static void show_ext_args ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  value 
) [static]

Definition at line 2636 of file symfile.c.

References _, and fprintf_filtered().

static void simple_free_overlay_table ( void  ) [static]

Definition at line 3394 of file symfile.c.

References cache_novlys, cache_ovly_table, cache_ovly_table_base, and xfree().

Referenced by simple_read_overlay_table().

void simple_overlay_update ( struct obj_section osect)
static int simple_overlay_update_1 ( struct obj_section osect) [static]
static int simple_read_overlay_table ( void  ) [static]
struct objfile* symbol_file_add ( const char *  name,
int  add_flags,
struct section_addr_info addrs,
int  flags 
) [read]
struct objfile* symbol_file_add_from_bfd ( bfd *  abfd,
const char *  name,
int  add_flags,
struct section_addr_info addrs,
int  flags,
struct objfile parent 
) [read]
void symbol_file_add_main ( const char *  args,
int  from_tty 
)
static void symbol_file_add_main_1 ( const char *  args,
int  from_tty,
int  flags 
) [static]
void symbol_file_add_separate ( bfd *  bfd,
const char *  name,
int  symfile_flags,
struct objfile objfile 
)
static struct objfile* symbol_file_add_with_addrs ( bfd *  abfd,
const char *  name,
int  add_flags,
struct section_addr_info addrs,
int  flags,
struct objfile parent 
) [static, read]
void symbol_file_clear ( int  from_tty)
void symbol_file_command ( char *  args,
int  from_tty 
)
CORE_ADDR symbol_overlayed_address ( CORE_ADDR  address,
struct obj_section section 
)
bfd* symfile_bfd_open ( const char *  cname)
static void symfile_dummy_outputs ( bfd *  abfd,
asection *  sectp,
void *  dummy 
) [static]

Definition at line 3575 of file symfile.c.

Referenced by default_symfile_relocate().

static void symfile_find_segment_sections ( struct objfile objfile) [static]
int symfile_map_offsets_to_segments ( bfd *  abfd,
const struct symfile_segment_data data,
struct section_offsets offsets,
int  num_segment_bases,
const CORE_ADDR segment_bases 
)
bfd_byte* symfile_relocate_debug_section ( struct objfile objfile,
asection *  sectp,
bfd_byte *  buf 
)
static void syms_from_objfile ( struct objfile objfile,
struct section_addr_info addrs,
int  add_flags 
) [static]

Definition at line 1025 of file symfile.c.

References init_entry_point_info(), and syms_from_objfile_1().

Referenced by symbol_file_add_with_addrs().

static void syms_from_objfile_1 ( struct objfile objfile,
struct section_addr_info addrs,
int  add_flags 
) [static]
static void terminate_after_last_dir_separator ( char *  path) [static]

Definition at line 1482 of file symfile.c.

Referenced by find_separate_debug_file_by_debuglink().

static void unmap_overlay_command ( char *  args,
int  from_tty 
) [static]
static VEC ( registered_sym_fns  ) [static]

Definition at line 144 of file symfile.c.

References auto_solib_add, currently_reading_symtab, and gdb_assert.


Variable Documentation

unsigned cache_novlys = 0 [static]
unsigned(* cache_ovly_table)[4] = 0 [static]
char* debug_file_directory = NULL

Definition at line 79 of file symfile.c.

Referenced by gdbtk_add_hooks(), and symbol_file_add_with_addrs().

Definition at line 78 of file symfile.c.

Referenced by gdbtk_add_hooks(), and symbol_file_add_with_addrs().

void(* deprecated_show_load_progress)(const char *section, unsigned long section_sent, unsigned long section_size, unsigned long total_sent, unsigned long total_size)

Definition at line 73 of file symfile.c.

Referenced by load_progress(), and mi_interpreter_resume().

int(* deprecated_ui_load_progress_hook)(const char *section, unsigned long num)

Definition at line 71 of file symfile.c.

Referenced by gdbtk_add_hooks(), load_progress(), and load_srec().

char* ext_args [static]

Definition at line 2634 of file symfile.c.

Referenced by set_ext_lang_command().

Definition at line 2615 of file symfile.c.

int fl_table_next [static]
int fl_table_size [static]

Definition at line 2616 of file symfile.c.

Referenced by add_filename_language(), and init_filename_language_table().

struct cmd_list_element* overlaylist [static]

Definition at line 3339 of file symfile.c.

Definition at line 84 of file symfile.c.

Referenced by captured_main(), and symbol_file_add_with_addrs().

int validate_download = 0 [static]

Definition at line 1866 of file symfile.c.

Referenced by load_progress().

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines