GDB (xrefs)

Classes | Typedefs | Enumerations | Functions | Variables
/tmp/gdb-8.1/gdb/main.c File Reference
`#include "defs.h"`
`#include "top.h"`
`#include "target.h"`
`#include "inferior.h"`
`#include "symfile.h"`
`#include "gdbcore.h"`
`#include "getopt.h"`
`#include <sys/types.h>`
`#include <sys/stat.h>`
`#include <ctype.h>`
`#include "event-loop.h"`
`#include "ui-out.h"`
`#include "interps.h"`
`#include "main.h"`
`#include "source.h"`
`#include "cli/cli-cmds.h"`
`#include "objfiles.h"`
`#include "auto-load.h"`
`#include "maint.h"`
`#include "filenames.h"`
`#include "filestuff.h"`
`#include <signal.h>`
`#include "event-top.h"`
`#include "infrun.h"`
`#include "signals-state-save-restore.h"`
`#include <vector>`

Go to the source code of this file.

## Classes
struct | cmdarg

## Typedefs
typedef void() | catch_command_errors_const_ftype(const char *, int)

## Enumerations
enum | cmdarg_kind { CMDARG_FILE, CMDARG_COMMAND, CMDARG_INIT_FILE, CMDARG_INIT_COMMAND }

## Functions
const char * | get_gdb_program_name (void)
static void | print_gdb_help (struct ui_file *)
void | set_gdb_data_directory (const char *new_datadir)
static char * | relocate_path (const char *progname, const char *initial, int flag)
char * | relocate_gdb_directory (const char *initial, int flag)
static void | get_init_files (const char **system_gdbinit, const char **home_gdbinit, const char **local_gdbinit)
static void | setup_alternate_signal_stack (void)
static void | captured_command_loop ()
static int | handle_command_errors (struct gdb_exception e)
static int | catch_command_errors (catch_command_errors_const_ftype command, const char *arg, int from_tty)
static void | symbol_file_add_main_adapter (const char *arg, int from_tty)
static void | validate_readnow_readnever ()
static void | captured_main_1 (struct captured_main_args *context)
static void | captured_main (void *data)
int | gdb_main (struct captured_main_args *args)

## Variables
char * | interpreter_p
int | dbx_commands = 0
char * | gdb_sysroot = 0
char * | gdb_datadir = 0
static int | gdb_datadir_provided = 0
char * | python_libdir = 0
struct ui_file * | gdb_stdtargin
struct ui_file * | gdb_stdtarg
struct ui_file * | gdb_stdtargerr
int | batch_flag = 0
int | batch_silent = 0
int | return_child_result = 0
int | return_child_result_value = -1
static char * | gdb_program_name

## Typedef Documentation

## ◆ catch_command_errors_const_ftype

typedef void() catch_command_errors_const_ftype(const char *, int)

Definition at line 366 of file main.c.

## Enumeration Type Documentation

## ◆ cmdarg_kind

enum cmdarg_kind

Enumerator
CMDARG_FILE |
CMDARG_COMMAND |
CMDARG_INIT_FILE |
CMDARG_INIT_COMMAND |

Definition at line 419 of file main.c.

## Function Documentation

## ◆ captured_command_loop()

static void captured_command_loop | ( |  | ) |
| static

Definition at line 313 of file main.c.

References all_cleanups(), ui::async, current_ui, do_cleanups(), ui::instream, interp_pre_command_loop(), PROMPT_BLOCKED, ui::prompt_state, quit_command(), start_event_loop(), ui::stdin_stream, and top_level_interpreter().

Referenced by captured_main().

## ◆ captured_main()

static void captured_main | ( | void * | data | ) |
| static

Definition at line 1142 of file main.c.

References captured_command_loop(), captured_main_1(), CATCH, END_CATCH, exception_print(), gdb_stderr, RETURN_MASK_ALL, and TRY.

Referenced by gdb_main().

## ◆ captured_main_1()

static void captured_main_1 | ( | struct captured_main_args * | context | ) |
| static

Definition at line 450 of file main.c.

References _, add_substitute_path_rule(), ALL_OBJFILES, annotation_level, captured_main_args::argc, captured_main_args::argv, gdb::argv, attach_command(), auto_load_local_gdbinit, auto_load_local_gdbinit_loaded, auto_load_local_gdbinit_pathname, batch_flag, batch_silent, baud_rate, BINDIR, catch_command_errors(), cd_command(), CMDARG_COMMAND, CMDARG_FILE, CMDARG_INIT_COMMAND, CMDARG_INIT_FILE, core_file_command(), current_directory, current_interp_named_p(), current_ui, dbx_commands, debug_file_directory, DEBUGDIR, DEBUGDIR_RELOCATABLE, directory_switch(), error(), exec_file_attach(), execute_command(), file_is_auto_load_safe(), fprintf_unfiltered(), fputs_unfiltered(), GDB_DATADIR, gdb_datadir, gdb_datadir_provided, GDB_DATADIR_RELOCATABLE, gdb_flush(), gdb_init(), gdb_program_name, gdb_realpath(), gdb_stderr, gdb_stdin, gdb_stdout, gdb_stdtargerr, gdb_stdtargin, gdb_sysroot, get_init_files(), global_auto_load, inhibit_gdbinit, init_history(), INTERP_CONSOLE, INTERP_INSIGHT, INTERP_MI1, INTERP_TUI, captured_main_args::interpreter_p, interpreter_p, lim_at_start, load_auto_scripts_for_objfile(), main_ui, notice_open_fds(), objfile::objfile(), PACKAGE, perror_warning_with_name(), print_gdb_configuration(), print_gdb_help(), print_gdb_version(), printf_filtered(), python_libdir, PYTHON_PATH_RELOCATABLE, quit_force(), readnever_symbol_files, readnow_symbol_files, relocate_gdb_directory(), remote_timeout, return_child_result, save_original_signals_state(), saved_command_line, set_gdb_data_directory(), set_inferior_args_vector(), set_inferior_io_terminal(), set_per_command_space(), set_per_command_time(), set_top_level_interpreter(), setup_alternate_signal_stack(), SLASH_STRING, source_script(), cmdarg::string, symbol_file_add_main_adapter(), TARGET_SYSROOT_PREFIX, TARGET_SYSTEM_ROOT, TARGET_SYSTEM_ROOT_RELOCATABLE, cmdarg::type, validate_readnow_readnever(), warning(), warning_pre_print, windows_get_absolute_argv0(), WITH_PYTHON_PATH, wrap_here(), write_files, xfree(), and xstrprintf().

Referenced by captured_main().

## ◆ catch_command_errors()

static int catch_command_errors | ( | catch_command_errors_const_ftype | command,
|  | const char * | arg,
|  | int | from_tty
| ) |  |
| static

Definition at line 371 of file main.c.

References CATCH, current_ui, END_CATCH, handle_command_errors(), maybe_wait_sync_command_done(), PROMPT_BLOCKED, ui::prompt_state, RETURN_MASK_ALL, and TRY.

Referenced by captured_main_1().

## ◆ gdb_main()

int gdb_main | ( | struct captured_main_args * | args | ) |

Definition at line 1168 of file main.c.

References captured_main(), CATCH, END_CATCH, exception_print(), gdb_stderr, RETURN_MASK_ALL, and TRY.

Referenced by main().

## ◆ get_gdb_program_name()

const char* get_gdb_program_name | ( | void |  | ) |

Definition at line 96 of file main.c.

References gdb_program_name.

## ◆ get_init_files()

static void get_init_files | ( | const char ** | system_gdbinit,
|  | const char ** | home_gdbinit,
|  | const char ** | local_gdbinit
| ) |  |
| static

Definition at line 198 of file main.c.

References GDB_DATADIR, gdb_datadir, gdb_datadir_provided, gdb_program_name, gdbinit, memset(), relocate_path(), SLASH_STRING, SYSTEM_GDBINIT, SYSTEM_GDBINIT_RELOCATABLE, xfree(), and xstrprintf().

Referenced by captured_main_1(), and print_gdb_help().

## ◆ handle_command_errors()

static int handle_command_errors | ( | struct gdb_exception | e | ) |
| static

Definition at line 348 of file main.c.

References async_enable_stdin(), exception_print(), gdb_stderr, and gdb_exception::reason.

Referenced by catch_command_errors().

## ◆ print_gdb_help()

static void print_gdb_help | ( | struct ui_file * | stream | ) |
| static

Definition at line 1191 of file main.c.

References _, fprintf_unfiltered(), fputs_unfiltered(), gdb_stdout, get_init_files(), and REPORT_BUGS_TO.

Referenced by captured_main_1().

## ◆ relocate_gdb_directory()

char* relocate_gdb_directory | ( | const char * | initial,
|  | int | flag
| ) |  |

Definition at line 159 of file main.c.

References gdb_program_name, relocate_path(), and xfree().

Referenced by _initialize_jit(), and captured_main_1().

## ◆ relocate_path()

static char* relocate_path | ( | const char * | progname,
|  | const char * | initial,
|  | int | flag
| ) |  |
| static

Definition at line 145 of file main.c.

References BINDIR.

Referenced by get_init_files(), and relocate_gdb_directory().

## ◆ set_gdb_data_directory()

void set_gdb_data_directory | ( | const char * | new_datadir | ) |

Definition at line 108 of file main.c.

References _, fprintf_unfiltered(), gdb_abspath(), gdb_datadir, gdb_realpath(), gdb_stderr, print_sys_errmsg(), warning(), and xfree().

Referenced by captured_main_1(), and set_gdb_datadir().

## ◆ setup_alternate_signal_stack()

static void setup_alternate_signal_stack | ( | void |  | ) |
| static

Definition at line 293 of file main.c.

References xmalloc().

Referenced by captured_main_1().

## ◆ symbol_file_add_main_adapter()

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

Definition at line 395 of file main.c.

References symbol_file_add_main(), and SYMFILE_VERBOSE.

Referenced by captured_main_1().

## ◆ validate_readnow_readnever()

static void validate_readnow_readnever | ( |  | ) |
| static

Definition at line 408 of file main.c.

References _, error(), gdb_program_name, readnever_symbol_files, and readnow_symbol_files.

Referenced by captured_main_1().

## Variable Documentation

## ◆ batch_flag

int batch_flag = 0

Definition at line 79 of file main.c.

Referenced by captured_main_1(), fputs_maybe_filtered(), init_page_info(), input_interactive_p(), set_batch_flag_and_restore_page_info::set_batch_flag_and_restore_page_info(), and set_batch_flag_and_restore_page_info::~set_batch_flag_and_restore_page_info().

## ◆ batch_silent

int batch_silent = 0

Definition at line 82 of file main.c.

Referenced by captured_main_1(), and gdb_setup_readline().

## ◆ dbx_commands

int dbx_commands = 0

Enable dbx commands if set.

Definition at line 56 of file main.c.

Referenced by _initialize_breakpoint(), _initialize_cli_cmds(), _initialize_exec(), _initialize_infrun(), _initialize_printcmd(), _initialize_source(), _initialize_stack(), _initialize_symtab(), and captured_main_1().

## ◆ gdb_datadir

char* gdb_datadir = 0

GDB datadir, used to store data files.

Definition at line 62 of file main.c.

Referenced by captured_main_1(), do_finish_initialization(), get_init_files(), init_syscalls_info(), set_gdb_data_directory(), show_gdb_datadir(), VEC(), and xml_init_syscalls_info().

## ◆ gdb_datadir_provided

int gdb_datadir_provided = 0
| static

Definition at line 67 of file main.c.

Referenced by captured_main_1(), and get_init_files().

## ◆ gdb_program_name

char* gdb_program_name
| static

Definition at line 92 of file main.c.

Referenced by captured_main_1(), get_gdb_program_name(), get_init_files(), relocate_gdb_directory(), and validate_readnow_readnever().

## ◆ gdb_stdtarg

struct ui_file* gdb_stdtarg

Definition at line 75 of file main.c.

Referenced by do_monitor_command(), execute_command_to_string(), gdb_disable_readline(), gdb_os_flush_stdout(), gdb_os_write_stdout(), gdb_setup_readline(), remote_console_output(), remote_fileio_func_write(), mi_interp::resume(), cli_interp_base::set_logging(), and tui_setup_io().

## ◆ gdb_stdtargerr

struct ui_file* gdb_stdtargerr

Definition at line 76 of file main.c.

Referenced by captured_main_1(), execute_command_to_string(), gdb_disable_readline(), gdb_os_flush_stderr(), gdb_os_write_stderr(), gdb_setup_readline(), remote_fileio_func_write(), mi_interp::resume(), cli_interp_base::set_logging(), and tui_setup_io().

## ◆ gdb_stdtargin

struct ui_file* gdb_stdtargin

Definition at line 74 of file main.c.

Referenced by captured_main_1(), and remote_fileio_func_read().

## ◆ gdb_sysroot

char* gdb_sysroot = 0

System root path, used to find libraries etc.

Definition at line 59 of file main.c.

Referenced by _initialize_solib(), captured_main_1(), exec_file_find(), find_separate_debug_file(), gdb_sysroot_changed(), gdbsim_open(), remote_filesystem_is_local(), and solib_find_1().

## ◆ interpreter_p

char* interpreter_p

The name of the interpreter if specified on the command line.

Definition at line 53 of file main.c.

Referenced by _initialize_tui_interp(), captured_main_1(), and interp_set().

## ◆ python_libdir

char* python_libdir = 0

If non-NULL, the possibly relocated path to python's "lib" directory specified with –with-python.

Definition at line 71 of file main.c.

Referenced by captured_main_1(), and do_start_initialization().

## ◆ return_child_result

int return_child_result = 0

Definition at line 87 of file main.c.

Referenced by captured_main_1(), and quit_force().

## ◆ return_child_result_value

int return_child_result_value = -1

Definition at line 88 of file main.c.

Referenced by handle_inferior_event_1(), and quit_force().