GDB (xrefs)

Classes | Functions | Variables
compile-object-load.c File Reference
`#include "defs.h"`
`#include "compile-object-load.h"`
`#include "compile-internal.h"`
`#include "command.h"`
`#include "objfiles.h"`
`#include "gdbcore.h"`
`#include "readline/tilde.h"`
`#include "bfdlink.h"`
`#include "gdbcmd.h"`
`#include "regcache.h"`
`#include "inferior.h"`
`#include "compile.h"`
`#include "block.h"`
`#include "arch-utils.h"`
`#include <algorithm>`

Go to the source code of this file.

## Classes
struct | munmap_list
struct | setup_sections_data
struct | link_hash_table_cleanup_data

## Functions
static void | munmap_list_add (struct munmap_list **headp, CORE_ADDR addr, CORE_ADDR size)
void | munmap_list_free (struct munmap_list *head)
static void | munmap_listp_free_cleanup (void *headp_voidp)
static void | setup_sections (bfd *abfd, asection *sect, void *data_voidp)
static void | link_callbacks_multiple_definition (struct bfd_link_info *link_info, struct bfd_link_hash_entry *h, bfd *nbfd, asection *nsec, bfd_vma nval)
static void | link_callbacks_warning (struct bfd_link_info *link_info, const char *xwarning, const char *symbol, bfd *abfd, asection *section, bfd_vma address)
static void | link_callbacks_undefined_symbol (struct bfd_link_info *link_info, const char *name, bfd *abfd, asection *section, bfd_vma address, bfd_boolean is_fatal)
static void | link_callbacks_reloc_overflow (struct bfd_link_info *link_info, struct bfd_link_hash_entry *entry, const char *name, const char *reloc_name, bfd_vma addend, bfd *abfd, asection *section, bfd_vma address)
static void | link_callbacks_reloc_dangerous (struct bfd_link_info *link_info, const char *message, bfd *abfd, asection *section, bfd_vma address)
static void | link_callbacks_unattached_reloc (struct bfd_link_info *link_info, const char *name, bfd *abfd, asection *section, bfd_vma address)
static void | link_callbacks_einfo (const char *fmt,...) ATTRIBUTE_PRINTF(1
static void | link_hash_table_free (void *d)
static void | copy_sections (bfd *abfd, asection *sect, void *data)
static struct type * | get_out_value_type (struct symbol *func_sym, struct objfile *objfile, enum compile_i_scope_types scope)
static struct type * | get_regs_type (struct symbol *func_sym, struct objfile *objfile)
static void | store_regs (struct type *regs_type, CORE_ADDR regs_base)
struct compile_module * | compile_object_load (const compile_file_names &file_names, enum compile_i_scope_types scope, void *scope_data)

## Variables
static const struct bfd_link_callbacks | link_callbacks

## Function Documentation

## ◆ compile_object_load()

struct compile_module* compile_object_load | ( | const compile_file_names & | file_names,
|  | enum compile_i_scope_types | scope,
|  | void * | scope_data
| ) |  |

Definition at line 610 of file compile-object-load.c.

References _, BMSYMBOL_VALUE_ADDRESS, builtin_type(), builtin_type::builtin_void, check_typedef(), compile_debug, COMPILE_I_PRINT_ADDRESS_SCOPE, COMPILE_I_PRINT_VALUE_SCOPE, COMPILE_I_RAW_SCOPE, COMPILE_I_SIMPLE_SCOPE, copy_sections(), do_cleanups(), error(), fprintf_unfiltered(), compile_module::func_sym, gdb_assert, gdb_bfd_errmsg(), gdb_bfd_open(), GDB_MMAP_PROT_READ, GDB_MMAP_PROT_WRITE, gdb_stdlog, gdbarch_infcall_mmap(), gdb::ref_ptr< T, Policy >::get(), get_out_value_type(), get_regs_type(), gnu_ifunc_resolve_addr, gnutarget, internal_error(), setup_sections_data::last_max_alignment, setup_sections_data::last_prot, setup_sections_data::last_section_first, setup_sections_data::last_size, lookup_global_symbol_from_objfile(), lookup_minimal_symbol(), make_cleanup(), bound_minimal_symbol::minsym, mst_text, mst_text_gnu_ifunc, mst_unknown, MSYMBOL_TYPE, munmap_list_add(), compile_module::munmap_list_head, setup_sections_data::munmap_list_headp, munmap_listp_free_cleanup(), compile_file_names::object_file(), compile_module::objfile, objfile::objfile(), objfile_name(), compile_module::out_value_addr, compile_module::out_value_type, paddress(), compile_module::regs_addr, compile_module::scope, compile_module::scope_data, setup_sections(), compile_module::source_file, compile_file_names::source_file(), store_regs(), block_symbol::symbol, symbol_file_add_from_bfd(), SYMBOL_TYPE, target_gdbarch(), TYPE_CODE, TYPE_CODE_FUNC, TYPE_LENGTH, TYPE_NFIELDS, TYPE_TARGET_TYPE, types_deeply_equal(), VAR_DOMAIN, warning(), and XNEW.

Referenced by eval_compile_command().

## ◆ copy_sections()

static void copy_sections | ( | bfd * | abfd,
|  | asection * | sect,
|  | void * | data
| ) |  |
| static

Definition at line 338 of file compile-object-load.c.

References _, link_hash_table_cleanup_data::abfd, do_cleanups(), error(), gdb_assert, link_callbacks, link_hash_table_free(), link_hash_table_cleanup_data::link_next, make_cleanup(), memset(), paddress(), target_gdbarch(), target_write_memory(), xfree(), and xmalloc().

Referenced by compile_object_load().

## ◆ get_out_value_type()

static struct type* get_out_value_type | ( | struct symbol * | func_sym,
|  | struct objfile * | objfile,
|  | enum compile_i_scope_types | scope
| ) |  |
| static

Definition at line 417 of file compile-object-load.c.

References _, BLOCK_FUNCTION, block_lookup_symbol(), BLOCK_SUPERBLOCK, BLOCKVECTOR_BLOCK, BLOCKVECTOR_NBLOCKS, check_typedef(), COMPILE_I_EXPR_PTR_TYPE, COMPILE_I_EXPR_VAL, COMPILE_I_PRINT_ADDRESS_SCOPE, error(), GLOBAL_BLOCK, blockvector::nblocks, objfile_name(), symbol::owner, SEARCH_NAME, STATIC_BLOCK, SYMBOL_LINKAGE_NAME, SYMBOL_TYPE, symbol::symtab, SYMTAB_BLOCKVECTOR, TYPE_CODE, TYPE_CODE_ARRAY, TYPE_CODE_FUNC, TYPE_CODE_PTR, TYPE_TARGET_TYPE, types_deeply_equal(), and VAR_DOMAIN.

Referenced by compile_object_load().

## ◆ get_regs_type()

static struct type* get_regs_type | ( | struct symbol * | func_sym,
|  | struct objfile * | objfile
| ) |  |
| static

Definition at line 525 of file compile-object-load.c.

References _, check_typedef(), error(), objfile_name(), SYMBOL_TYPE, TYPE_CODE, TYPE_CODE_PTR, TYPE_CODE_STRUCT, TYPE_FIELD_TYPE, TYPE_NFIELDS, and TYPE_TARGET_TYPE.

Referenced by compile_object_load().

## ◆ link_callbacks_einfo()

static void static void link_callbacks_einfo | ( | const char * | fmt,
|  |  | ...
| ) |  |
| static

Definition at line 282 of file compile-object-load.c.

References _, string, string_vprintf(), and warning().

## ◆ link_callbacks_multiple_definition()

static void link_callbacks_multiple_definition | ( | struct bfd_link_info * | link_info,
|  | struct bfd_link_hash_entry * | h,
|  | bfd * | nbfd,
|  | asection * | nsec,
|  | bfd_vma | nval
| ) |  |
| static

Definition at line 203 of file compile-object-load.c.

References _, and warning().

## ◆ link_callbacks_reloc_dangerous()

static void link_callbacks_reloc_dangerous | ( | struct bfd_link_info * | link_info,
|  | const char * | message,
|  | bfd * | abfd,
|  | asection * | section,
|  | bfd_vma | address
| ) |  |
| static

Definition at line 253 of file compile-object-load.c.

References _, and warning().

## ◆ link_callbacks_reloc_overflow()

static void link_callbacks_reloc_overflow | ( | struct bfd_link_info * | link_info,
|  | struct bfd_link_hash_entry * | entry,
|  | const char * | name,
|  | const char * | reloc_name,
|  | bfd_vma | addend,
|  | bfd * | abfd,
|  | asection * | section,
|  | bfd_vma | address
| ) |  |
| static

Definition at line 242 of file compile-object-load.c.

## ◆ link_callbacks_unattached_reloc()

static void link_callbacks_unattached_reloc | ( | struct bfd_link_info * | link_info,
|  | const char * | name,
|  | bfd * | abfd,
|  | asection * | section,
|  | bfd_vma | address
| ) |  |
| static

Definition at line 266 of file compile-object-load.c.

References _, name, and warning().

## ◆ link_callbacks_undefined_symbol()

static void link_callbacks_undefined_symbol | ( | struct bfd_link_info * | link_info,
|  | const char * | name,
|  | bfd * | abfd,
|  | asection * | section,
|  | bfd_vma | address,
|  | bfd_boolean | is_fatal
| ) |  |
| static

Definition at line 230 of file compile-object-load.c.

References _, name, and warning().

## ◆ link_callbacks_warning()

static void link_callbacks_warning | ( | struct bfd_link_info * | link_info,
|  | const char * | xwarning,
|  | const char * | symbol,
|  | bfd * | abfd,
|  | asection * | section,
|  | bfd_vma | address
| ) |  |
| static

Definition at line 218 of file compile-object-load.c.

References _, and warning().

## ◆ link_hash_table_free()

static void link_hash_table_free | ( | void * | d | ) |
| static

Definition at line 325 of file compile-object-load.c.

References link_hash_table_cleanup_data::abfd, and link_hash_table_cleanup_data::link_next.

Referenced by copy_sections().

## ◆ munmap_list_add()

static void munmap_list_add | ( | struct munmap_list ** | headp,
|  | CORE_ADDR | addr,
|  | CORE_ADDR | size
| ) |  |
| static

Definition at line 48 of file compile-object-load.c.

References munmap_list::addr, munmap_list::next, munmap_list::size, size, and XNEW.

Referenced by compile_object_load(), and setup_sections().

## ◆ munmap_list_free()

void munmap_list_free | ( | struct munmap_list * | head | ) |

Definition at line 64 of file compile-object-load.c.

References munmap_list::addr, gdbarch_infcall_munmap(), munmap_list::next, munmap_list::size, target_gdbarch(), and xfree().

Referenced by do_module_cleanup(), and munmap_listp_free_cleanup().

## ◆ munmap_listp_free_cleanup()

static void munmap_listp_free_cleanup | ( | void * | headp_voidp | ) |
| static

Definition at line 81 of file compile-object-load.c.

References munmap_list_free().

Referenced by compile_object_load().

## ◆ setup_sections()

static void setup_sections | ( | bfd * | abfd,
|  | asection * | sect,
|  | void * | data_voidp
| ) |  |
| static

Definition at line 113 of file compile-object-load.c.

References _, compile_debug, error(), fprintf_unfiltered(), GDB_MMAP_PROT_EXEC, GDB_MMAP_PROT_READ, GDB_MMAP_PROT_WRITE, gdb_stdlog, gdbarch_infcall_mmap(), setup_sections_data::last_max_alignment, setup_sections_data::last_prot, setup_sections_data::last_section_first, setup_sections_data::last_size, munmap_list_add(), setup_sections_data::munmap_list_headp, paddress(), and target_gdbarch().

Referenced by compile_object_load().

## ◆ store_regs()

static void store_regs | ( | struct type * | regs_type,
|  | CORE_ADDR | regs_base
| ) |  |
| static

Definition at line 555 of file compile-object-load.c.

References _, check_typedef(), COMPILE_I_SIMPLE_REGISTER_DUMMY, compile_register_name_demangle(), error(), get_current_frame(), get_thread_regcache(), inferior_ptid, paddress(), pulongest(), reg_offset, regnum, target_gdbarch(), target_write_memory(), TYPE_CODE, TYPE_CODE_INT, TYPE_CODE_PTR, TYPE_FIELD_BITPOS, TYPE_FIELD_BITSIZE, TYPE_FIELD_NAME, TYPE_FIELD_TYPE, TYPE_LENGTH, TYPE_NFIELDS, value_contents(), value_entirely_available(), value_from_register(), and value_optimized_out().

Referenced by compile_object_load().

## Variable Documentation

## ◆ link_callbacks

const struct bfd_link_callbacks link_callbacks
| static

Initial value:
=
{
NULL,
link_callbacks_multiple_definition,
NULL,
NULL,
NULL,
link_callbacks_warning,
link_callbacks_undefined_symbol,
link_callbacks_reloc_overflow,
link_callbacks_reloc_dangerous,
link_callbacks_unattached_reloc,
NULL,
link_callbacks_einfo,
NULL,
NULL,
NULL,
}
link_callbacks_unattached_reloc
static void link_callbacks_unattached_reloc(struct bfd_link_info *link_info, const char *name, bfd *abfd, asection *section, bfd_vma address)
Definition: compile-object-load.c:266
link_callbacks_multiple_definition
static void link_callbacks_multiple_definition(struct bfd_link_info *link_info, struct bfd_link_hash_entry *h, bfd *nbfd, asection *nsec, bfd_vma nval)
Definition: compile-object-load.c:203
link_callbacks_reloc_dangerous
static void link_callbacks_reloc_dangerous(struct bfd_link_info *link_info, const char *message, bfd *abfd, asection *section, bfd_vma address)
Definition: compile-object-load.c:253
link_callbacks_reloc_overflow
static void link_callbacks_reloc_overflow(struct bfd_link_info *link_info, struct bfd_link_hash_entry *entry, const char *name, const char *reloc_name, bfd_vma addend, bfd *abfd, asection *section, bfd_vma address)
Definition: compile-object-load.c:242
link_callbacks_einfo
static void link_callbacks_einfo(const char *fmt,...) ATTRIBUTE_PRINTF(1
Definition: compile-object-load.c:282
link_callbacks_undefined_symbol
static void link_callbacks_undefined_symbol(struct bfd_link_info *link_info, const char *name, bfd *abfd, asection *section, bfd_vma address, bfd_boolean is_fatal)
Definition: compile-object-load.c:230
link_callbacks_warning
static void link_callbacks_warning(struct bfd_link_info *link_info, const char *xwarning, const char *symbol, bfd *abfd, asection *section, bfd_vma address)
Definition: compile-object-load.c:218

Definition at line 297 of file compile-object-load.c.

Referenced by copy_sections().