GDB (xrefs)
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
minsyms.c File Reference
#include "defs.h"
#include <ctype.h>
#include "symtab.h"
#include "bfd.h"
#include "filenames.h"
#include "symfile.h"
#include "objfiles.h"
#include "demangle.h"
#include "value.h"
#include "cp-abi.h"
#include "target.h"
#include "cp-support.h"
#include "language.h"
#include "cli/cli-utils.h"
#include "gdbsupport/symbol.h"
#include <algorithm>
#include "gdbsupport/gdb-safe-ctype.h"
#include "gdbsupport/parallel-for.h"
#include "inferior.h"

Go to the source code of this file.

Classes

struct  msym_bunch
 
struct  found_minimal_symbols
 
struct  computed_hash_values
 

Macros

#define BUNCH_SIZE   127
 
#define MST_TO_STR(x)   case x: return #x;
 

Functions

static bool msymbol_is_cold_clone (minimal_symbol *minsym)
 
bool msymbol_is_function (struct objfile *objfile, minimal_symbol *minsym, CORE_ADDR *func_address_p)
 
unsigned int msymbol_hash_iw (const char *string)
 
unsigned int msymbol_hash (const char *string)
 
static void add_minsym_to_hash_table (struct minimal_symbol *sym, struct minimal_symbol **table, unsigned int hash_value)
 
static void add_minsym_to_demangled_hash_table (struct minimal_symbol *sym, struct objfile *objfile, unsigned int hash_value)
 
static void lookup_minimal_symbol_mangled (const char *lookup_name, const char *sfile, struct objfile *objfile, struct minimal_symbol **table, unsigned int hash, int(*namecmp)(const char *, const char *), found_minimal_symbols &found)
 
static void lookup_minimal_symbol_demangled (const lookup_name_info &lookup_name, const char *sfile, struct objfile *objfile, struct minimal_symbol **table, unsigned int hash, symbol_name_matcher_ftype *matcher, found_minimal_symbols &found)
 
struct bound_minimal_symbol lookup_minimal_symbol (const char *name, const char *sfile, struct objfile *objf)
 
struct bound_minimal_symbol lookup_bound_minimal_symbol (const char *name)
 
int find_minimal_symbol_address (const char *name, CORE_ADDR *addr, struct objfile *objfile)
 
static const char * linkage_name_str (const lookup_name_info &lookup_name)
 
void iterate_over_minimal_symbols (struct objfile *objf, const lookup_name_info &lookup_name, gdb::function_view< bool(struct minimal_symbol *)> callback)
 
bound_minimal_symbol lookup_minimal_symbol_linkage (const char *name, struct objfile *objf)
 
struct bound_minimal_symbol lookup_minimal_symbol_linkage (const char *name, bool only_main)
 
struct bound_minimal_symbol lookup_minimal_symbol_text (const char *name, struct objfile *objf)
 
struct minimal_symbollookup_minimal_symbol_by_pc_name (CORE_ADDR pc, const char *name, struct objfile *objf)
 
static int frob_address (struct objfile *objfile, CORE_ADDR pc, unrelocated_addr *unrel_addr)
 
static minimal_symbol_type msym_prefer_to_msym_type (lookup_msym_prefer prefer)
 
bound_minimal_symbol lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *section, lookup_msym_prefer prefer, bound_minimal_symbol *previous)
 
struct bound_minimal_symbol lookup_minimal_symbol_by_pc (CORE_ADDR pc)
 
bool in_gnu_ifunc_stub (CORE_ADDR pc)
 
static CORE_ADDR stub_gnu_ifunc_resolve_addr (struct gdbarch *gdbarch, CORE_ADDR pc)
 
static bool stub_gnu_ifunc_resolve_name (const char *function_name, CORE_ADDR *function_address_p)
 
static void stub_gnu_ifunc_resolver_stop (code_breakpoint *b)
 
static void stub_gnu_ifunc_resolver_return_stop (code_breakpoint *b)
 
static int get_symbol_leading_char (bfd *abfd)
 
static const char * mst_str (minimal_symbol_type t)
 
static bool minimal_symbol_is_less_than (const minimal_symbol &fn1, const minimal_symbol &fn2)
 
static int compact_minimal_symbols (struct minimal_symbol *msymbol, int mcount, struct objfile *objfile)
 
static void clear_minimal_symbol_hash_tables (struct objfile *objfile)
 
static void build_minimal_symbol_hash_tables (struct objfile *objfile, const std::vector< computed_hash_values > &hash_values)
 
static struct minimal_symbollookup_solib_trampoline_symbol_by_pc (CORE_ADDR pc)
 
CORE_ADDR find_solib_trampoline_target (frame_info_ptr frame, CORE_ADDR pc)
 
CORE_ADDR minimal_symbol_upper_bound (struct bound_minimal_symbol minsym)
 
typefind_minsym_type_and_address (minimal_symbol *msymbol, struct objfile *objfile, CORE_ADDR *address_p)
 

Variables

static const struct gnu_ifunc_fns stub_gnu_ifunc_fns
 
const struct gnu_ifunc_fnsgnu_ifunc_fns_p = &stub_gnu_ifunc_fns
 

Macro Definition Documentation

◆ BUNCH_SIZE

#define BUNCH_SIZE   127

◆ MST_TO_STR

#define MST_TO_STR ( x)    case x: return #x;

Function Documentation

◆ add_minsym_to_demangled_hash_table()

static void add_minsym_to_demangled_hash_table ( struct minimal_symbol * sym,
struct objfile * objfile,
unsigned int hash_value )
static

◆ add_minsym_to_hash_table()

static void add_minsym_to_hash_table ( struct minimal_symbol * sym,
struct minimal_symbol ** table,
unsigned int hash_value )
static

Definition at line 195 of file minsyms.c.

References minimal_symbol::hash_next, and MINIMAL_SYMBOL_HASH_SIZE.

Referenced by build_minimal_symbol_hash_tables().

◆ build_minimal_symbol_hash_tables()

static void build_minimal_symbol_hash_tables ( struct objfile * objfile,
const std::vector< computed_hash_values > & hash_values )
static

◆ clear_minimal_symbol_hash_tables()

static void clear_minimal_symbol_hash_tables ( struct objfile * objfile)
static

◆ compact_minimal_symbols()

static int compact_minimal_symbols ( struct minimal_symbol * msymbol,
int mcount,
struct objfile * objfile )
static

◆ find_minimal_symbol_address()

int find_minimal_symbol_address ( const char * name,
CORE_ADDR * addr,
struct objfile * objfile )

◆ find_minsym_type_and_address()

type * find_minsym_type_and_address ( minimal_symbol * msymbol,
struct objfile * objfile,
CORE_ADDR * address_p )

◆ find_solib_trampoline_target()

CORE_ADDR find_solib_trampoline_target ( frame_info_ptr frame,
CORE_ADDR pc )

◆ frob_address()

static int frob_address ( struct objfile * objfile,
CORE_ADDR pc,
unrelocated_addr * unrel_addr )
static

Definition at line 701 of file minsyms.c.

References objfile::sections(), and general_symbol_info::unrel_addr.

Referenced by lookup_minimal_symbol_by_pc_section().

◆ get_symbol_leading_char()

static int get_symbol_leading_char ( bfd * abfd)
static

◆ in_gnu_ifunc_stub()

bool in_gnu_ifunc_stub ( CORE_ADDR pc)

◆ iterate_over_minimal_symbols()

void iterate_over_minimal_symbols ( struct objfile * objf,
const lookup_name_info & lookup_name,
gdb::function_view< bool(struct minimal_symbol *)> callback )

◆ linkage_name_str()

static const char * linkage_name_str ( const lookup_name_info & lookup_name)
static

◆ lookup_bound_minimal_symbol()

struct bound_minimal_symbol lookup_bound_minimal_symbol ( const char * name)

◆ lookup_minimal_symbol()

struct bound_minimal_symbol lookup_minimal_symbol ( const char * name,
const char * sfile,
struct objfile * objf )

Definition at line 363 of file minsyms.c.

References case_sensitive_on, current_program_space, objfile_per_bfd_storage::demangled_hash_languages, found_minimal_symbols::external_symbol, found_minimal_symbols::file_symbol, FULL, language_defn::get_symbol_name_matcher(), language_def(), lookup_minimal_symbol_demangled(), lookup_minimal_symbol_mangled(), MINIMAL_SYMBOL_HASH_SIZE, bound_minimal_symbol::minsym, objfile_per_bfd_storage::msymbol_demangled_hash, msymbol_hash(), objfile_per_bfd_storage::msymbol_hash, name, nr_languages, objfile_debug_name(), program_space::objfiles(), objfile::per_bfd, lookup_name_info::search_name_hash(), objfile::separate_debug_objfile_backlink, symbol_lookup_debug, symbol_lookup_debug_printf, and found_minimal_symbols::trampoline_symbol.

Referenced by ada_has_this_exception_support(), ada_main_name(), ada_tasks_inferior_data_sniffer(), arc_linux_skip_solib_resolver(), arm_skip_cmse_entry(), arm_skip_stub(), avr_scan_prologue(), bsd_uthread_lookup_address(), call_target_sbrk(), checkpoint_command(), classify_name(), coff_read_minsyms(), compile_object_load(), convert_code_addr_to_desc_addr(), create_exception_master_breakpoint_hook(), create_std_terminate_master_breakpoint(), d_main_name(), dbx_end_psymtab(), elf_gnu_ifunc_resolve_by_got(), elf_locate_base(), enable_break(), eval_op_objc_msgcall(), fbsd_read_integer_by_name(), find_imps(), find_minimal_symbol_address(), find_stab_function(), frv_frame_this_id(), ft32_analyze_prologue(), gcc_convert_symbol(), gen_var_ref(), ravenscar_thread_target::get_fpu_state(), get_running_thread_msymbol(), glibc_skip_solib_resolver(), gnuv3_get_typeid(), gnuv3_skip_trampoline(), go_main_name(), has_ravenscar_runtime(), hppa_symbol_address(), inferior_call_waitpid(), inferior_has_bug(), info_scope_command(), inside_main_func(), call_site_target::iterate_over_addresses(), jit_breakpoint_re_set_internal(), ld_so_xfer_auxv(), libpthread_objfile_p(), lm_base(), lm_base(), lookup_bound_minimal_symbol(), lookup_child_selector(), lookup_objc_class(), m32c_m16c_address_to_pointer(), m32c_m16c_pointer_to_address(), m32c_return_value(), m32r_frame_this_id(), m68hc11_get_register_info(), macho_resolve_oso_sym_with_minsym(), main_got(), mips_linux_skip_resolver(), nbsd_skip_solib_resolver(), obsd_skip_solib_resolver(), pascal_main_name(), pd_enable(), pdc_symbol_addrs(), ps_pglobal_lookup(), ps_pglobal_lookup(), remote_target::remote_check_symbols(), simple_overlay_update(), simple_read_overlay_table(), sol2_skip_solib_resolver(), tui_get_begin_asm_address(), value_nsstring(), value_static_field(), z80_breakpoint_kind_from_pc(), z80_frame_unwind_cache(), z80_read_overlay_region_table(), and z80_scan_prologue().

◆ lookup_minimal_symbol_by_pc()

struct bound_minimal_symbol lookup_minimal_symbol_by_pc ( CORE_ADDR pc)

Definition at line 996 of file minsyms.c.

References lookup_minimal_symbol_by_pc_section().

Referenced by amd64_skip_main_prologue(), amd64_windows_skip_trampoline_code(), arm_pc_is_thumb(), arm_pe_skip_trampoline_code(), arm_skip_stack_protector(), arm_wince_skip_main_prologue(), call_site_find_chain_1(), call_site_for_pc(), convert_code_addr_to_desc_addr(), csky_frame_unwind_cache(), dwarf_expr_reg_to_entry_parameter(), elf_gnu_ifunc_record_cache(), find_frame_funname(), find_pc_sect_line(), frv_skip_main_prologue(), ftrace_update_function(), func_verify_no_selftailcall(), get_function_name(), get_pc_function_start(), get_prev_frame_always_1(), gnuv2_value_rtti_type(), gnuv3_get_typename_from_type_info(), gnuv3_rtti_type(), gnuv3_skip_trampoline(), handle_jit_event(), i386_pe_skip_trampoline_code(), i386_skip_main_prologue(), ia64_convert_from_func_ptr_addr(), info_cb(), info_checkpoints_command(), info_frame_command_core(), call_site_target::iterate_over_addresses(), m32c_m16c_address_to_pointer(), m32c_m16c_pointer_to_address(), m68hc11_get_return_insn(), maintenance_translate_address(), mips_make_symbol_special(), mips_pc_is_micromips(), mips_pc_is_mips(), mips_pc_is_mips16(), mips_pc_isa(), mips_skip_pic_trampoline_code(), mips_stub_frame_sniffer(), msp430_skip_trampoline_code(), powerpc_linux_in_dynsym_resolve_code(), ppc_elfv2_skip_entrypoint(), print_unpacked_pointer(), py_print_frame(), read_atcb(), resolve_sal_pc(), rs6000_skip_main_prologue(), rs6000_skip_trampoline_code(), skip_prologue_function(), tailcall_dump(), until_next_command(), pascal_language::value_print_inner(), and x86_in_indirect_branch_thunk().

◆ lookup_minimal_symbol_by_pc_name()

struct minimal_symbol * lookup_minimal_symbol_by_pc_name ( CORE_ADDR pc,
const char * name,
struct objfile * objf )

◆ lookup_minimal_symbol_by_pc_section()

bound_minimal_symbol lookup_minimal_symbol_by_pc_section ( CORE_ADDR pc_in,
struct obj_section * section,
lookup_msym_prefer prefer,
bound_minimal_symbol * previous )

◆ lookup_minimal_symbol_demangled()

static void lookup_minimal_symbol_demangled ( const lookup_name_info & lookup_name,
const char * sfile,
struct objfile * objfile,
struct minimal_symbol ** table,
unsigned int hash,
symbol_name_matcher_ftype * matcher,
found_minimal_symbols & found )
static

◆ lookup_minimal_symbol_linkage() [1/2]

struct bound_minimal_symbol lookup_minimal_symbol_linkage ( const char * name,
bool only_main )

◆ lookup_minimal_symbol_linkage() [2/2]

bound_minimal_symbol lookup_minimal_symbol_linkage ( const char * name,
struct objfile * objf )

◆ lookup_minimal_symbol_mangled()

static void lookup_minimal_symbol_mangled ( const char * lookup_name,
const char * sfile,
struct objfile * objfile,
struct minimal_symbol ** table,
unsigned int hash,
int(*)(const char *, const char *) namecmp,
found_minimal_symbols & found )
static

Definition at line 298 of file minsyms.c.

References minimal_symbol::hash_next, and found_minimal_symbols::maybe_collect().

Referenced by lookup_minimal_symbol().

◆ lookup_minimal_symbol_text()

struct bound_minimal_symbol lookup_minimal_symbol_text ( const char * name,
struct objfile * objf )

◆ lookup_solib_trampoline_symbol_by_pc()

static struct minimal_symbol * lookup_solib_trampoline_symbol_by_pc ( CORE_ADDR pc)
static

◆ minimal_symbol_is_less_than()

static bool minimal_symbol_is_less_than ( const minimal_symbol & fn1,
const minimal_symbol & fn2 )
inlinestatic

◆ minimal_symbol_upper_bound()

CORE_ADDR minimal_symbol_upper_bound ( struct bound_minimal_symbol minsym)

◆ mst_str()

static const char * mst_str ( minimal_symbol_type t)
static

◆ msym_prefer_to_msym_type()

static minimal_symbol_type msym_prefer_to_msym_type ( lookup_msym_prefer prefer)
static

◆ msymbol_hash()

unsigned int msymbol_hash ( const char * string)

◆ msymbol_hash_iw()

unsigned int msymbol_hash_iw ( const char * string)

Definition at line 165 of file minsyms.c.

References SYMBOL_HASH_NEXT.

Referenced by language_defn::search_name_hash().

◆ msymbol_is_cold_clone()

static bool msymbol_is_cold_clone ( minimal_symbol * minsym)
static

Definition at line 72 of file minsyms.c.

References name, and general_symbol_info::natural_name().

Referenced by msymbol_is_function().

◆ msymbol_is_function()

bool msymbol_is_function ( struct objfile * objfile,
minimal_symbol * minsym,
CORE_ADDR * func_address_p )

◆ stub_gnu_ifunc_resolve_addr()

static CORE_ADDR stub_gnu_ifunc_resolve_addr ( struct gdbarch * gdbarch,
CORE_ADDR pc )
static

Definition at line 1015 of file minsyms.c.

References paddress().

◆ stub_gnu_ifunc_resolve_name()

static bool stub_gnu_ifunc_resolve_name ( const char * function_name,
CORE_ADDR * function_address_p )
static

Definition at line 1025 of file minsyms.c.

◆ stub_gnu_ifunc_resolver_return_stop()

static void stub_gnu_ifunc_resolver_return_stop ( code_breakpoint * b)
static

Definition at line 1044 of file minsyms.c.

◆ stub_gnu_ifunc_resolver_stop()

static void stub_gnu_ifunc_resolver_stop ( code_breakpoint * b)
static

Definition at line 1036 of file minsyms.c.

Variable Documentation

◆ gnu_ifunc_fns_p

const struct gnu_ifunc_fns* gnu_ifunc_fns_p = &stub_gnu_ifunc_fns

Definition at line 1061 of file minsyms.c.

◆ stub_gnu_ifunc_fns

const struct gnu_ifunc_fns stub_gnu_ifunc_fns
static
Initial value:
=
{
}
static bool stub_gnu_ifunc_resolve_name(const char *function_name, CORE_ADDR *function_address_p)
Definition minsyms.c:1025
static void stub_gnu_ifunc_resolver_return_stop(code_breakpoint *b)
Definition minsyms.c:1044
static CORE_ADDR stub_gnu_ifunc_resolve_addr(struct gdbarch *gdbarch, CORE_ADDR pc)
Definition minsyms.c:1015
static void stub_gnu_ifunc_resolver_stop(code_breakpoint *b)
Definition minsyms.c:1036

Definition at line 1051 of file minsyms.c.