GDB (xrefs)

Classes | Functions
compile-c-symbols.c File Reference
`#include "defs.h"`
`#include "compile-internal.h"`
`#include "symtab.h"`
`#include "parser-defs.h"`
`#include "block.h"`
`#include "objfiles.h"`
`#include "compile.h"`
`#include "value.h"`
`#include "exceptions.h"`
`#include "gdbtypes.h"`
`#include "dwarf2loc.h"`

Go to the source code of this file.

## Classes
struct | symbol_error

## Functions
static hashval_t | hash_symbol_error (const void *a)
static int | eq_symbol_error (const void *a, const void *b)
static void | del_symbol_error (void *a)
static void | insert_symbol_error (htab_t hash, const struct symbol *sym, const char *text)
static void | error_symbol_once (struct compile_c_instance *context, const struct symbol *sym)
static gdb::unique_xmalloc_ptr< char > | symbol_substitution_name (struct symbol *sym)
static void | convert_one_symbol (struct compile_c_instance *context, struct block_symbol sym, int is_global, int is_local)
static void | convert_symbol_sym (struct compile_c_instance *context, const char *identifier, struct block_symbol sym, domain_enum domain)
static void | convert_symbol_bmsym (struct compile_c_instance *context, struct bound_minimal_symbol bmsym)
void | gcc_convert_symbol (void *datum, struct gcc_c_context *gcc_context, enum gcc_c_oracle_request request, const char *identifier)
gcc_address | gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context, const char *identifier)
static hashval_t | hash_symname (const void *a)
static int | eq_symname (const void *a, const void *b)
static int | symbol_seen (htab_t hashtab, struct symbol *sym)
static void | generate_vla_size (struct compile_c_instance *compiler, string_file &stream, struct gdbarch *gdbarch, unsigned char *registers_used, CORE_ADDR pc, struct type *type, struct symbol *sym)
static void | generate_c_for_for_one_variable (struct compile_c_instance *compiler, string_file &stream, struct gdbarch *gdbarch, unsigned char *registers_used, CORE_ADDR pc, struct symbol *sym)
unsigned char * | generate_c_for_variable_locations (struct compile_c_instance *compiler, string_file &stream, struct gdbarch *gdbarch, const struct block *block, CORE_ADDR pc)

## Function Documentation

## ◆ convert_one_symbol()

static void convert_one_symbol | ( | struct compile_c_instance * | context,
|  | struct block_symbol | sym,
|  | int | is_global,
|  | int | is_local
| ) |  |
| static

Definition at line 144 of file compile-c-symbols.c.

References _, frame_info::addr, compile_c_instance::base, block_symbol::block, BLOCK_START, C_CTX, COMPILE_I_RAW_SCOPE, convert_type(), error(), error_symbol_once(), symtab::filename, gdb_assert_not_reached, get_selected_frame(), gnu_ifunc_resolve_addr, internal_error(), LOC_ARG, LOC_BLOCK, LOC_COMMON_BLOCK, LOC_COMPUTED, LOC_CONST, LOC_CONST_BYTES, LOC_FINAL_VALUE, LOC_LABEL, LOC_LOCAL, LOC_OPTIMIZED_OUT, LOC_REF_ARG, LOC_REGISTER, LOC_REGPARM_ADDR, LOC_STATIC, LOC_TYPEDEF, LOC_UNDEF, LOC_UNRESOLVED, lval_memory, read_var_value(), compile_instance::scope, STRUCT_DOMAIN, symbol_error::sym, block_symbol::symbol, SYMBOL_BLOCK_VALUE, SYMBOL_CLASS, SYMBOL_DOMAIN, SYMBOL_LINE, SYMBOL_NATURAL_NAME, SYMBOL_PRINT_NAME, symbol_read_needs_frame(), symbol_substitution_name(), symbol_symtab(), SYMBOL_TYPE, SYMBOL_VALUE, SYMBOL_VALUE_ADDRESS, target_gdbarch(), TYPE_CODE, TYPE_CODE_ENUM, TYPE_GNU_IFUNC, value_address(), VALUE_LVAL, and warning().

Referenced by convert_symbol_sym().

## ◆ convert_symbol_bmsym()

static void convert_symbol_bmsym | ( | struct compile_c_instance * | context,
|  | struct bound_minimal_symbol | bmsym
| ) |  |
| static

Definition at line 355 of file compile-c-symbols.c.

References C_CTX, convert_type(), gnu_ifunc_resolve_addr, bound_minimal_symbol::minsym, mst_bss, mst_data, mst_file_bss, mst_file_data, mst_file_text, mst_slot_got_plt, mst_solib_trampoline, mst_text, mst_text_gnu_ifunc, MSYMBOL_NATURAL_NAME, MSYMBOL_TYPE, MSYMBOL_VALUE_ADDRESS, objfile_type::nodebug_data_symbol, objfile_type::nodebug_got_plt_symbol, objfile_type::nodebug_text_gnu_ifunc_symbol, objfile_type::nodebug_text_symbol, objfile_type::nodebug_unknown_symbol, bound_minimal_symbol::objfile, objfile_type(), target_gdbarch(), and type.

Referenced by gcc_convert_symbol().

## ◆ convert_symbol_sym()

static void convert_symbol_sym | ( | struct compile_c_instance * | context,
|  | const char * | identifier,
|  | struct block_symbol | sym,
|  | domain_enum | domain
| ) |  |
| static

Definition at line 305 of file compile-c-symbols.c.

References block_symbol::block, block_static_block(), compile_debug, convert_one_symbol(), fprintf_unfiltered(), gdb_stdlog, and lookup_symbol().

Referenced by gcc_convert_symbol().

## ◆ del_symbol_error()

static void del_symbol_error | ( | void * | a | ) |
| static

Definition at line 73 of file compile-c-symbols.c.

References symbol_error::message, and xfree().

Referenced by generate_c_for_for_one_variable().

## ◆ eq_symbol_error()

static int eq_symbol_error | ( | const void * | a,
|  | const void * | b
| ) |  |
| static

Definition at line 62 of file compile-c-symbols.c.

References symbol_error::sym.

Referenced by generate_c_for_for_one_variable().

## ◆ eq_symname()

static int eq_symname | ( | const void * | a,
|  | const void * | b
| ) |  |
| static

Definition at line 554 of file compile-c-symbols.c.

References SYMBOL_NATURAL_NAME.

Referenced by generate_c_for_variable_locations().

## ◆ error_symbol_once()

static void error_symbol_once | ( | struct compile_c_instance * | context,
|  | const struct symbol * | sym
| ) |  |
| static

Definition at line 105 of file compile-c-symbols.c.

References _, err, error(), symbol_error::message, symbol_error::sym, and compile_c_instance::symbol_err_map.

Referenced by convert_one_symbol().

## ◆ gcc_convert_symbol()

void gcc_convert_symbol | ( | void * | datum,
|  | struct gcc_c_context * | gcc_context,
|  | enum gcc_c_oracle_request | request,
|  | const char * | identifier
| ) |  |

Definition at line 414 of file compile-c-symbols.c.

References compile_c_instance::base, compile_instance::block, C_CTX, CATCH, compile_debug, convert_symbol_bmsym(), convert_symbol_sym(), END_CATCH, fprintf_unfiltered(), gdb_assert_not_reached, gdb_stdlog, LABEL_DOMAIN, lookup_minimal_symbol(), lookup_symbol(), RETURN_MASK_ALL, STRUCT_DOMAIN, TRY, and VAR_DOMAIN.

## ◆ gcc_symbol_address()

gcc_address gcc_symbol_address | ( | void * | datum,
|  | struct gcc_c_context * | gcc_context,
|  | const char * | identifier
| ) |  |

Definition at line 479 of file compile-c-symbols.c.

References BLOCK_START, BMSYMBOL_VALUE_ADDRESS, C_CTX, CATCH, compile_debug, END_CATCH, fprintf_unfiltered(), gdb_stdlog, gnu_ifunc_resolve_addr, LOC_BLOCK, lookup_bound_minimal_symbol(), lookup_symbol(), mst_text_gnu_ifunc, MSYMBOL_TYPE, RETURN_MASK_ERROR, block_symbol::symbol, SYMBOL_BLOCK_VALUE, SYMBOL_CLASS, SYMBOL_TYPE, target_gdbarch(), TRY, TYPE_GNU_IFUNC, and VAR_DOMAIN.

## ◆ generate_c_for_for_one_variable()

static void generate_c_for_for_one_variable | ( | struct compile_c_instance * | compiler,
|  | string_file & | stream,
|  | struct gdbarch * | gdbarch,
|  | unsigned char * | registers_used,
|  | CORE_ADDR | pc,
|  | struct symbol * | sym
| ) |  |
| static

Definition at line 635 of file compile-c-symbols.c.

References _, string_file::c_str(), CATCH, del_symbol_error(), END_CATCH, eq_symbol_error(), error(), gdb_assert_not_reached, generate_vla_size(), hash_symbol_error(), insert_symbol_error(), is_dynamic_type(), LOC_ARG, LOC_COMPUTED, LOC_LOCAL, LOC_REF_ARG, LOC_REGISTER, LOC_REGPARM_ADDR, RETURN_MASK_ERROR, string_file::size(), SYMBOL_CLASS, SYMBOL_COMPUTED_OPS, compile_c_instance::symbol_err_map, symbol_substitution_name(), SYMBOL_TYPE, TRY, string_file::write(), xcalloc(), and xfree().

Referenced by generate_c_for_variable_locations().

## ◆ generate_c_for_variable_locations()

unsigned char* generate_c_for_variable_locations | ( | struct compile_c_instance * | compiler,
|  | string_file & | stream,
|  | struct gdbarch * | gdbarch,
|  | const struct block * | block,
|  | CORE_ADDR | pc
| ) |  |

Definition at line 712 of file compile-c-symbols.c.

References BLOCK_FUNCTION, block_iterator_first(), block_iterator_next(), block_static_block(), BLOCK_SUPERBLOCK, discard_cleanups(), eq_symname(), gdbarch_num_regs(), generate_c_for_for_one_variable(), hash_symname(), make_cleanup(), symbol_seen(), xcalloc(), XCNEWVEC, and xfree().

Referenced by c_compute_program().

## ◆ generate_vla_size()

static void generate_vla_size | ( | struct compile_c_instance * | compiler,
|  | string_file & | stream,
|  | struct gdbarch * | gdbarch,
|  | unsigned char * | registers_used,
|  | CORE_ADDR | pc,
|  | struct type * | type,
|  | struct symbol * | sym
| ) |  |
| static

Definition at line 581 of file compile-c-symbols.c.

References c_get_range_decl_name(), check_typedef(), dwarf2_compile_property_to_c(), field_is_static(), name, PROP_LOCEXPR, PROP_LOCLIST, string, TYPE_CODE, TYPE_CODE_ARRAY, TYPE_CODE_RANGE, TYPE_CODE_STRUCT, TYPE_CODE_UNION, TYPE_FIELD, TYPE_FIELD_TYPE, TYPE_HIGH_BOUND_KIND, TYPE_INDEX_TYPE, TYPE_IS_REFERENCE, TYPE_NFIELDS, TYPE_RANGE_DATA, and TYPE_TARGET_TYPE.

Referenced by generate_c_for_for_one_variable().

## ◆ hash_symbol_error()

static hashval_t hash_symbol_error | ( | const void * | a | ) |
| static

Definition at line 52 of file compile-c-symbols.c.

References symbol_error::sym.

Referenced by generate_c_for_for_one_variable().

## ◆ hash_symname()

static hashval_t hash_symname | ( | const void * | a | ) |
| static

Definition at line 543 of file compile-c-symbols.c.

References SYMBOL_NATURAL_NAME.

Referenced by generate_c_for_variable_locations().

## ◆ insert_symbol_error()

static void insert_symbol_error | ( | htab_t | hash,
|  | const struct symbol * | sym,
|  | const char * | text
| ) |  |
| static

Definition at line 84 of file compile-c-symbols.c.

References hash(), symbol_error::message, symbol_error::sym, and XNEW.

Referenced by generate_c_for_for_one_variable().

## ◆ symbol_seen()

static int symbol_seen | ( | htab_t | hashtab,
|  | struct symbol * | sym
| ) |  |
| static

Definition at line 566 of file compile-c-symbols.c.

Referenced by generate_c_for_variable_locations().

## ◆ symbol_substitution_name()

static gdb::unique_xmalloc_ptr<char> symbol_substitution_name | ( | struct symbol * | sym | ) |
| static

Definition at line 130 of file compile-c-symbols.c.

References symbol_error::sym, and SYMBOL_NATURAL_NAME.

Referenced by convert_one_symbol(), and generate_c_for_for_one_variable().