GDB (xrefs)

Macros | Functions | Variables
compile.c File Reference
`#include "defs.h"`
`#include "top.h"`
`#include "ui-out.h"`
`#include "command.h"`
`#include "cli/cli-script.h"`
`#include "cli/cli-utils.h"`
`#include "completer.h"`
`#include "gdbcmd.h"`
`#include "compile.h"`
`#include "compile-internal.h"`
`#include "compile-object-load.h"`
`#include "compile-object-run.h"`
`#include "language.h"`
`#include "frame.h"`
`#include "source.h"`
`#include "block.h"`
`#include "arch-utils.h"`
`#include "filestuff.h"`
`#include "target.h"`
`#include "osabi.h"`
`#include "gdb_wait.h"`
`#include "valprint.h"`
`#include "common/gdb_optional.h"`
`#include "common/gdb_unlinker.h"`

Go to the source code of this file.

## Macros
#define | TMP_PREFIX "/tmp/gdbobj-"
#define | TEMPLATE TMP_PREFIX "XXXXXX"

## Functions
static void | show_compile_debug (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static int | check_raw_argument (const char **arg)
static void | compile_file_command (const char *arg, int from_tty)
static void | compile_code_command (const char *arg, int from_tty)
void | compile_print_value (struct value *val, void *data_voidp)
static void | compile_print_command (const char *arg, int from_tty)
static void | do_rmdir (void *arg)
static const char * | get_compile_file_tempdir (void)
static compile_file_names | get_new_file_names ()
static const struct block * | get_expr_block_and_pc (CORE_ADDR *pc)
static void | build_argc_argv (const char *s, int *argcp, char ***argvp)
static void | set_compile_args (const char *args, int from_tty, struct cmd_list_element *c)
static void | show_compile_args (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static void | append_args (int *argcp, char ***argvp, int argc, char **argv)
static void | show_compile_gcc (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static const char * | get_selected_pc_producer_options (void)
static void | filter_args (int *argcp, char **argv)
static void | get_args (const struct compile_instance *compiler, struct gdbarch *gdbarch, int *argcp, char ***argvp)
static void | cleanup_compile_instance (void *arg)
static void | print_callback (void *ignore, const char *message)
static compile_file_names | compile_to_object (struct command_line *cmd, const char *cmd_string, enum compile_i_scope_types scope)
static void | compile_command (const char *args, int from_tty)
void | eval_compile_command (struct command_line *cmd, const char *cmd_string, enum compile_i_scope_types scope, void *scope_data)
std::string | compile_register_name_mangled (struct gdbarch *gdbarch, int regnum)
int | compile_register_name_demangle (struct gdbarch *gdbarch, const char *regname)
void | _initialize_compile (void)

## Variables
static struct cmd_list_element * | compile_command_list
int | compile_debug
static char * | compile_args
static int | compile_args_argc
static char ** | compile_args_argv
static char * | compile_gcc

## Macro Definition Documentation

## ◆ TEMPLATE

#define TEMPLATE TMP_PREFIX "XXXXXX"

Referenced by get_compile_file_tempdir().

## ◆ TMP_PREFIX

#define TMP_PREFIX "/tmp/gdbobj-"

Definition at line 49 of file compile.c.

Referenced by do_rmdir().

## Function Documentation

## ◆ _initialize_compile()

void _initialize_compile | ( | void |  | ) |

Definition at line 678 of file compile.c.

References _, add_cmd(), add_com_alias(), add_prefix_cmd(), add_setshow_boolean_cmd(), add_setshow_optional_filename_cmd(), add_setshow_string_cmd(), class_maintenance, class_obscure, class_support, cmdlist, compile_args, compile_code_command(), compile_command(), compile_command_list, compile_debug, compile_file_command(), compile_gcc, compile_print_command(), filename_completer(), set_cmd_completer(), set_compile_args(), setdebuglist, setlist, show_compile_args(), show_compile_debug(), show_compile_gcc(), showdebuglist, and showlist.

## ◆ append_args()

static void append_args | ( | int * | argcp,
|  | char *** | argvp,
|  | int | argc,
|  | char ** | argv
| ) |  |
| static

Definition at line 326 of file compile.c.

References gdb::argv, and XRESIZEVEC.

Referenced by get_args().

## ◆ build_argc_argv()

static void build_argc_argv | ( | const char * | s,
|  | int * | argcp,
|  | char *** | argvp
| ) |  |
| static

Definition at line 287 of file compile.c.

References gdb_argv::count(), and gdb_argv::release().

Referenced by get_args(), and set_compile_args().

## ◆ check_raw_argument()

static int check_raw_argument | ( | const char ** | arg | ) |
| static

Definition at line 74 of file compile.c.

References check_for_argument(), and skip_spaces().

Referenced by compile_code_command(), and compile_file_command().

## ◆ cleanup_compile_instance()

static void cleanup_compile_instance | ( | void * | arg | ) |
| static

Definition at line 434 of file compile.c.

References compile_instance::destroy.

Referenced by compile_to_object().

## ◆ compile_code_command()

static void compile_code_command | ( | const char * | arg,
|  | int | from_tty
| ) |  |
| static

Definition at line 127 of file compile.c.

References _, ui::async, check_for_argument(), check_raw_argument(), compile_control, COMPILE_I_RAW_SCOPE, COMPILE_I_SIMPLE_SCOPE, current_ui, error(), eval_compile_command(), execute_control_command_untraced(), get_command_line(), make_scoped_restore(), and skip_spaces().

Referenced by _initialize_compile(), and compile_command().

## ◆ compile_command()

static void compile_command | ( | const char * | args,
|  | int | from_tty
| ) |  |
| static

Definition at line 612 of file compile.c.

References compile_code_command().

Referenced by _initialize_compile().

## ◆ compile_file_command()

static void compile_file_command | ( | const char * | arg,
|  | int | from_tty
| ) |  |
| static

Definition at line 90 of file compile.c.

References _, ui::async, check_raw_argument(), COMPILE_I_RAW_SCOPE, COMPILE_I_SIMPLE_SCOPE, current_ui, error(), eval_compile_command(), gdb_abspath(), make_scoped_restore(), skip_spaces(), string, and string_printf().

Referenced by _initialize_compile().

## ◆ compile_print_command()

static void compile_print_command | ( | const char * | arg,
|  | int | from_tty
| ) |  |
| static

Definition at line 174 of file compile.c.

References ui::async, compile_control, COMPILE_I_PRINT_ADDRESS_SCOPE, current_ui, eval_compile_command(), execute_control_command_untraced(), get_command_line(), make_scoped_restore(), and print_command_parse_format().

Referenced by _initialize_compile().

## ◆ compile_print_value()

void compile_print_value | ( | struct value * | val,
|  | void * | data_voidp
| ) |  |

Definition at line 161 of file compile.c.

References print_value().

Referenced by do_module_cleanup().

## ◆ compile_register_name_demangle()

int compile_register_name_demangle | ( | struct gdbarch * | gdbarch,
|  | const char * | regname
| ) |  |

Definition at line 661 of file compile.c.

References _, error(), gdbarch_num_regs(), gdbarch_register_name(), and regnum.

Referenced by store_regs().

## ◆ compile_register_name_mangled()

std::string compile_register_name_mangled | ( | struct gdbarch * | gdbarch,
|  | int | regnum
| ) |  |

Definition at line 651 of file compile.c.

References gdbarch_register_name(), regnum, and string_printf().

Referenced by generate_register_struct(), pushf_register(), and pushf_register_address().

## ◆ compile_to_object()

static compile_file_names compile_to_object | ( | struct command_line * | cmd,
|  | const char * | cmd_string,
|  | enum compile_i_scope_types | scope
| ) |  |
| static

Definition at line 455 of file compile.c.

References _, gdb::argv, compile_instance::block, command_line::body_list, string_file::c_str(), cleanup_compile_instance(), code, compile_debug, compile_gcc, current_language, do_cleanups(), gdb::optional< T >::emplace(), error(), compile_instance::fe, fprintf_unfiltered(), gdb_fopen_cloexec(), gdb_stdlog, gdbarch_gnu_triplet_regexp(), gdbarch_osabi(), get_args(), get_current_arch(), get_expr_block_and_pc(), get_frame_address_in_block(), get_new_file_names(), get_selected_frame(), gdb::unlinker::keep(), language_defn::la_compute_program, language_defn::la_get_compile_instance, language_defn::la_name, command_line::line, make_cleanup(), command_line::next, compile_file_names::object_file(), osabi_triplet_regexp(), perror_with_name(), print_callback(), ui_file::puts(), compile_instance::scope, compile_file_names::source_file(), string, target_has_execution, and xfree().

Referenced by eval_compile_command().

## ◆ do_rmdir()

static void do_rmdir | ( | void * | arg | ) |
| static

Definition at line 200 of file compile.c.

References _, gdb_assert, startswith(), TMP_PREFIX, warning(), WEXITSTATUS, WIFEXITED, and XDELETEVEC.

Referenced by get_compile_file_tempdir().

## ◆ eval_compile_command()

void eval_compile_command | ( | struct command_line * | cmd,
|  | const char * | cmd_string,
|  | enum compile_i_scope_types | scope,
|  | void * | scope_data
| ) |  |

Definition at line 622 of file compile.c.

References COMPILE_I_PRINT_ADDRESS_SCOPE, COMPILE_I_PRINT_VALUE_SCOPE, compile_object_load(), compile_object_run(), compile_to_object(), eval_compile_command(), gdb_assert, compile_file_names::object_file(), compile_module::scope, compile_module::scope_data, and compile_file_names::source_file().

Referenced by compile_code_command(), compile_file_command(), compile_print_command(), eval_compile_command(), and execute_control_command_1().

## ◆ filter_args()

static void filter_args | ( | int * | argcp,
|  | char ** | argv
| ) |  |
| static

Definition at line 378 of file compile.c.

References gdb::argv, and xfree().

Referenced by get_args().

## ◆ get_args()

static void get_args | ( | const struct compile_instance * | compiler,
|  | struct gdbarch * | gdbarch,
|  | int * | argcp,
|  | char *** | argvp
| ) |  |
| static

Definition at line 401 of file compile.c.

References append_args(), build_argc_argv(), compile_args_argc, compile_args_argv, filter_args(), compile_instance::gcc_target_options, gdbarch_gcc_target_options(), and get_selected_pc_producer_options().

Referenced by compile_to_object().

## ◆ get_compile_file_tempdir()

static const char* get_compile_file_tempdir | ( | void |  | ) |
| static

Definition at line 218 of file compile.c.

References _, do_rmdir(), error(), make_final_cleanup(), perror_with_name(), and TEMPLATE.

Referenced by get_new_file_names().

## ◆ get_expr_block_and_pc()

static const struct block* get_expr_block_and_pc | ( | CORE_ADDR * | pc | ) |
| static

Definition at line 262 of file compile.c.

References BLOCK_START, BLOCKVECTOR_BLOCK, get_current_source_symtab_and_line(), get_selected_block(), symtab_and_line::pc, STATIC_BLOCK, symtab_and_line::symtab, and SYMTAB_BLOCKVECTOR.

Referenced by compile_to_object().

## ◆ get_new_file_names()

static compile_file_names get_new_file_names | ( |  | ) |
| static

Definition at line 246 of file compile.c.

References get_compile_file_tempdir(), SLASH_STRING, and string_printf().

Referenced by compile_to_object().

## ◆ get_selected_pc_producer_options()

static const char* get_selected_pc_producer_options | ( | void |  | ) |
| static

Definition at line 357 of file compile.c.

References find_pc_compunit_symtab(), get_frame_pc(), get_selected_frame(), symtab_and_line::pc, skip_spaces(), skip_to_space(), and startswith().

Referenced by get_args().

## ◆ print_callback()

static void print_callback | ( | void * | ignore,
|  | const char * | message
| ) |  |
| static

Definition at line 445 of file compile.c.

References fputs_filtered(), and gdb_stderr.

Referenced by compile_to_object().

## ◆ set_compile_args()

static void set_compile_args | ( | const char * | args,
|  | int | from_tty,
|  | struct cmd_list_element * | c
| ) |  |
| static

Definition at line 305 of file compile.c.

References build_argc_argv(), compile_args, compile_args_argc, and compile_args_argv.

Referenced by _initialize_compile().

## ◆ show_compile_args()

static void show_compile_args | ( | struct ui_file * | file,
|  | int | from_tty,
|  | struct cmd_list_element * | c,
|  | const char * | value
| ) |  |
| static

Definition at line 314 of file compile.c.

References _, and fprintf_filtered().

Referenced by _initialize_compile().

## ◆ show_compile_debug()

static void show_compile_debug | ( | struct ui_file * | file,
|  | int | from_tty,
|  | struct cmd_list_element * | c,
|  | const char * | value
| ) |  |
| static

Definition at line 62 of file compile.c.

References _, and fprintf_filtered().

Referenced by _initialize_compile().

## ◆ show_compile_gcc()

static void show_compile_gcc | ( | struct ui_file * | file,
|  | int | from_tty,
|  | struct cmd_list_element * | c,
|  | const char * | value
| ) |  |
| static

Definition at line 343 of file compile.c.

References _, and fprintf_filtered().

Referenced by _initialize_compile().

## Variable Documentation

## ◆ compile_args

char* compile_args
| static

Definition at line 296 of file compile.c.

Referenced by _initialize_compile(), and set_compile_args().

## ◆ compile_args_argc

int compile_args_argc
| static

Definition at line 299 of file compile.c.

Referenced by get_args(), and set_compile_args().

## ◆ compile_args_argv

char** compile_args_argv
| static

Definition at line 300 of file compile.c.

Referenced by get_args(), and set_compile_args().

## ◆ compile_command_list

struct cmd_list_element* compile_command_list
| static

Definition at line 53 of file compile.c.

Referenced by _initialize_compile().

## ◆ compile_debug

int compile_debug

Definition at line 57 of file compile.c.

Referenced by _initialize_compile(), compile_object_load(), compile_to_object(), convert_symbol_sym(), gcc_convert_symbol(), gcc_symbol_address(), and setup_sections().

## ◆ compile_gcc

char* compile_gcc
| static

Definition at line 338 of file compile.c.

Referenced by _initialize_compile(), and compile_to_object().