GDB (xrefs)
Classes | Macros | Functions | Variables
/tmp/gdb-7.10/gdb/top.c File Reference
#include "defs.h"
#include "gdbcmd.h"
#include "cli/cli-cmds.h"
#include "cli/cli-script.h"
#include "cli/cli-setshow.h"
#include "cli/cli-decode.h"
#include "symtab.h"
#include "inferior.h"
#include "infrun.h"
#include <signal.h>
#include "target.h"
#include "target-dcache.h"
#include "breakpoint.h"
#include "gdbtypes.h"
#include "expression.h"
#include "value.h"
#include "language.h"
#include "terminal.h"
#include "annotate.h"
#include "completer.h"
#include "top.h"
#include "version.h"
#include "serial.h"
#include "doublest.h"
#include "main.h"
#include "event-loop.h"
#include "gdbthread.h"
#include "extension.h"
#include "interps.h"
#include "observer.h"
#include "maint.h"
#include "filenames.h"
#include "readline/readline.h"
#include "readline/history.h"
#include <sys/types.h>
#include "event-top.h"
#include <sys/stat.h>
#include <ctype.h>
#include "ui-out.h"
#include "cli-out.h"
#include "tracepoint.h"
#include "inf-loop.h"

Go to the source code of this file.

Classes

struct  gdb_readline_wrapper_cleanup
 
struct  qt_args
 

Macros

#define PROMPT(X)   the_prompts.prompt_stack[the_prompts.top + X].prompt
 
#define PREFIX(X)   the_prompts.prompt_stack[the_prompts.top + X].prefix
 
#define SUFFIX(X)   the_prompts.prompt_stack[the_prompts.top + X].suffix
 
#define DEFAULT_PROMPT   "(gdb) "
 
#define SERVER_COMMAND_LENGTH   7
 
#define Hist_print   10
 

Functions

void initialize_all_files (void)
 
static void show_confirm (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
 
void do_restore_instream_cleanup (void *stream)
 
void read_command_file (FILE *stream)
 
struct cleanupprepare_execute_command (void)
 
void check_frame_language_change (void)
 
void maybe_wait_sync_command_done (int was_sync)
 
void execute_command (char *p, int from_tty)
 
char * execute_command_to_string (char *p, int from_tty)
 
void command_loop (void)
 
void dont_repeat (void)
 
struct cleanupprevent_dont_repeat (void)
 
char * gdb_readline (const char *prompt_arg)
 
static void show_write_history_p (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
 
static void show_history_size (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
 
static void show_history_remove_duplicates (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
 
static void show_history_filename (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
 
static void gdb_readline_wrapper_line (char *line)
 
static void gdb_readline_wrapper_cleanup (void *arg)
 
char * gdb_readline_wrapper (const char *prompt)
 
static void gdb_rl_operate_and_get_next_completion (void)
 
static int gdb_rl_operate_and_get_next (int count, int key)
 
void gdb_add_history (const char *command)
 
static void gdb_safe_append_history (void)
 
char * command_line_input (const char *prompt_arg, int repeat, char *annotation_suffix)
 
void print_gdb_version (struct ui_file *stream)
 
void print_gdb_configuration (struct ui_file *stream)
 
char * get_prompt (void)
 
void set_prompt (const char *s)
 
static int kill_or_detach (struct inferior *inf, void *args)
 
static int print_inferior_quit_action (struct inferior *inf, void *arg)
 
int quit_confirm (void)
 
void quit_force (char *args, int from_tty)
 
int input_from_terminal_p (void)
 
static void dont_repeat_command (char *ignored, int from_tty)
 
void show_commands (char *args, int from_tty)
 
static void set_readline_history_size (int history_size)
 
static void set_history_size_command (char *args, int from_tty, struct cmd_list_element *c)
 
void set_history (char *args, int from_tty)
 
void show_history (char *args, int from_tty)
 
void set_verbose (char *args, int from_tty, struct cmd_list_element *c)
 
void init_history (void)
 
static void show_prompt (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
 
static void show_async_command_editing_p (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
 
static void show_annotation_level (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
 
static void show_exec_done_display_p (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
 
static void set_gdb_datadir (char *args, int from_tty, struct cmd_list_element *c)
 
static void show_gdb_datadir (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
 
static void set_history_filename (char *args, int from_tty, struct cmd_list_element *c)
 
static void init_main (void)
 
void gdb_init (char *argv0)
 

Variables

const char gdbinit [] = GDBINIT
 
int inhibit_gdbinit = 0
 
char lang_frame_mismatch_warn []
 
int confirm = 1
 
FILE * instream
 
int in_user_command
 
char * current_directory
 
char gdb_dirbuf [1024]
 
void(* window_hook )(FILE *, char *)
 
char * saved_command_line
 
int saved_command_line_size = 100
 
int server_command
 
int remote_timeout = 2
 
int remote_debug = 0
 
char * lim_at_start
 
int(* deprecated_ui_loop_hook )(int)
 
void(* deprecated_print_frame_info_listing_hook )(struct symtab *s, int line, int stopline, int noerror)
 
int(* deprecated_query_hook )(const char *, va_list)
 
void(* deprecated_warning_hook )(const char *, va_list)
 
void(* deprecated_readline_begin_hook )(char *,...)
 
char *(* deprecated_readline_hook )(const char *)
 
void(* deprecated_readline_end_hook )(void)
 
void(* deprecated_attach_hook )(void)
 
void(* deprecated_detach_hook )(void)
 
void(* deprecated_interactive_hook )(void)
 
void(* deprecated_register_changed_hook )(int regno)
 
ptid_t(* deprecated_target_wait_hook )(ptid_t ptid, struct target_waitstatus *status, int options)
 
void(* deprecated_call_command_hook )(struct cmd_list_element *c, char *cmd, int from_tty)
 
void(* deprecated_context_hook )(int id)
 
int source_line_number
 
const char * source_file_name
 
void(* pre_init_ui_hook )(void)
 
static int suppress_dont_repeat = 0
 
static int command_editing_p
 
int history_expansion_p
 
static int write_history_p
 
static int history_size_setshow_var = -2
 
static int history_remove_duplicates = 0
 
static char * history_filename
 
static int gdb_readline_wrapper_done
 
static char * gdb_readline_wrapper_result
 
static void(* saved_after_char_processing_hook )(void)
 
static int operate_saved_history = -1
 
static int command_count = 0
 
static char * top_prompt
 
int info_verbose = 0
 
static char * staged_gdb_datadir
 

Macro Definition Documentation

#define DEFAULT_PROMPT   "(gdb) "

Definition at line 79 of file top.c.

Referenced by init_main().

#define Hist_print   10

Definition at line 1601 of file top.c.

Referenced by show_commands().

#define PREFIX (   X)    the_prompts.prompt_stack[the_prompts.top + X].prefix

Definition at line 73 of file top.c.

#define PROMPT (   X)    the_prompts.prompt_stack[the_prompts.top + X].prompt

Definition at line 72 of file top.c.

#define SERVER_COMMAND_LENGTH   7

Referenced by command_line_input().

#define SUFFIX (   X)    the_prompts.prompt_stack[the_prompts.top + X].suffix

Definition at line 74 of file top.c.

Function Documentation

void check_frame_language_change ( void  )
char* command_line_input ( const char *  prompt_arg,
int  repeat,
char *  annotation_suffix 
)
void command_loop ( void  )
void do_restore_instream_cleanup ( void *  stream)

Definition at line 278 of file top.c.

References instream.

Referenced by execute_user_command(), and read_command_file().

void dont_repeat ( void  )
static void dont_repeat_command ( char *  ignored,
int  from_tty 
)
static

Definition at line 1591 of file top.c.

References saved_command_line.

Referenced by init_main().

void execute_command ( char *  p,
int  from_tty 
)
char* execute_command_to_string ( char *  p,
int  from_tty 
)
void gdb_add_history ( const char *  command)

Definition at line 912 of file top.c.

References command_count, and history_remove_duplicates.

Referenced by command_line_handler(), and command_line_input().

void gdb_init ( char *  argv0)
char* gdb_readline ( const char *  prompt_arg)

Definition at line 615 of file top.c.

References fputs_unfiltered(), gdb_flush(), gdb_stdout, instream, xfree(), xmalloc(), and xrealloc().

Referenced by command_line_input().

char* gdb_readline_wrapper ( const char *  prompt)
static void gdb_readline_wrapper_cleanup ( void *  arg)
static
static void gdb_readline_wrapper_line ( char *  line)
static
static int gdb_rl_operate_and_get_next ( int  count,
int  key 
)
static
static void gdb_rl_operate_and_get_next_completion ( void  )
static

Definition at line 865 of file top.c.

References after_char_processing_hook, and operate_saved_history.

Referenced by gdb_rl_operate_and_get_next().

static void gdb_safe_append_history ( void  )
static
char* get_prompt ( void  )

Definition at line 1386 of file top.c.

References top_prompt.

Referenced by command_loop(), and top_level_prompt().

void init_history ( void  )
static void init_main ( void  )
static
void initialize_all_files ( void  )

Definition at line 164 of file init.c.

References _initialize_ada_exp, _initialize_ada_language, _initialize_addrmap, _initialize_agent, _initialize_amd64_linux_nat, _initialize_amd64_linux_tdep, _initialize_amd64_tdep, _initialize_annotate, _initialize_auto_load, _initialize_auxv, _initialize_ax_gdb, _initialize_break_catch_sig, _initialize_break_catch_syscall, _initialize_break_catch_throw, _initialize_breakpoint, _initialize_btrace, _initialize_c_language, _initialize_charset, _initialize_cli_cmds, _initialize_cli_dump, _initialize_cli_interp, _initialize_cli_logging, _initialize_cli_script, _initialize_coff_pe_read, _initialize_coffread, _initialize_compile, _initialize_complaints, _initialize_completer, _initialize_copying, _initialize_core, _initialize_corelow, _initialize_cp_abi, _initialize_cp_namespace, _initialize_cp_support, _initialize_cp_valprint, _initialize_ctf, _initialize_d_language, _initialize_dbxread, _initialize_dcache, _initialize_demangler, _initialize_dtrace_probe, _initialize_dummy_frame, _initialize_dwarf2_frame, _initialize_dwarf2_read, _initialize_dwarf2expr, _initialize_dwarf2loc, _initialize_elfread, _initialize_exec, _initialize_extension, _initialize_f_language, _initialize_f_valprint, _initialize_filesystem, _initialize_fork_child, _initialize_frame, _initialize_frame_base, _initialize_frame_reg, _initialize_frame_unwind, _initialize_gcore, _initialize_gdb_bfd, _initialize_gdb_osabi, _initialize_gdbarch, _initialize_gdbarch_utils, _initialize_gdbtypes, _initialize_gnu_v2_abi, _initialize_gnu_v3_abi, _initialize_go_language, _initialize_guile, _initialize_i386_linux_tdep, _initialize_i386_tdep, _initialize_infcall, _initialize_infcmd, _initialize_inflow, _initialize_infrun, _initialize_interpreter, _initialize_java_language, _initialize_jit, _initialize_language, _initialize_linux_fork, _initialize_linux_nat, _initialize_linux_tdep, _initialize_m2_language, _initialize_macrocmd, _initialize_macroscope, _initialize_maint_cmds, _initialize_mdebugread, _initialize_mem, _initialize_mem_search, _initialize_mi_cmd_env, _initialize_mi_cmds, _initialize_mi_interp, _initialize_mi_main, _initialize_mipsread, _initialize_notif, _initialize_objc_lang, _initialize_objc_language, _initialize_objfiles, _initialize_observer, _initialize_opencl_language, _initialize_osdata, _initialize_parse, _initialize_pascal_language, _initialize_pascal_valprint, _initialize_printcmd, _initialize_probe, _initialize_proc_service, _initialize_psymtab, _initialize_python, _initialize_record, _initialize_record_btrace, _initialize_record_full, _initialize_regcache, _initialize_reggroup, _initialize_remote, _initialize_reverse, _initialize_ser_hardwire, _initialize_ser_pipe, _initialize_ser_tcp, _initialize_serial, _initialize_solib, _initialize_solib_target, _initialize_source, _initialize_stabsread, _initialize_stack, _initialize_stap_probe, _initialize_step_skip, _initialize_svr4_solib, _initialize_symfile, _initialize_symfile_debug, _initialize_symfile_mem, _initialize_symmisc, _initialize_symtab, _initialize_tailcall_frame, _initialize_target_dcache, _initialize_target_descriptions, _initialize_tasks, _initialize_thread, _initialize_thread_db, _initialize_tracefile, _initialize_tracefile_tfile, _initialize_tracepoint, _initialize_tui, _initialize_tui_hooks, _initialize_tui_interp, _initialize_tui_layout, _initialize_tui_out, _initialize_tui_regs, _initialize_tui_stack, _initialize_tui_win, _initialize_typeprint, _initialize_ui_out, _initialize_user_regs, _initialize_utils, _initialize_valarith, _initialize_valops, _initialize_valprint, _initialize_values, _initialize_varobj, and _initialize_xml_support.

Referenced by gdb_init().

int input_from_terminal_p ( void  )
static int kill_or_detach ( struct inferior inf,
void *  args 
)
static
void maybe_wait_sync_command_done ( int  was_sync)
struct cleanup* prepare_execute_command ( void  )
struct cleanup* prevent_dont_repeat ( void  )

Definition at line 598 of file top.c.

References make_cleanup_restore_integer(), and suppress_dont_repeat.

Referenced by bpstat_do_actions_1(), and execute_gdb_command().

void print_gdb_configuration ( struct ui_file stream)
void print_gdb_version ( struct ui_file stream)

Definition at line 1225 of file top.c.

References _, fprintf_filtered(), host_name, PKGVERSION, REPORT_BUGS_TO, target_name, and version.

Referenced by captured_main(), and show_version().

static int print_inferior_quit_action ( struct inferior inf,
void *  arg 
)
static
int quit_confirm ( void  )
void quit_force ( char *  args,
int  from_tty 
)
void read_command_file ( FILE *  stream)

Definition at line 286 of file top.c.

References command_loop(), do_cleanups(), do_restore_instream_cleanup(), instream, and make_cleanup().

Referenced by script_from_file().

static void set_gdb_datadir ( char *  args,
int  from_tty,
struct cmd_list_element c 
)
static

Definition at line 1831 of file top.c.

References observer_notify_gdb_datadir_changed(), set_gdb_data_directory(), and staged_gdb_datadir.

Referenced by init_main().

void set_history ( char *  args,
int  from_tty 
)

Definition at line 1686 of file top.c.

References _, all_commands, gdb_stdout, help_list(), printf_unfiltered(), and sethistlist.

Referenced by _initialize_cli_cmds().

static void set_history_filename ( char *  args,
int  from_tty,
struct cmd_list_element c 
)
static

Definition at line 1848 of file top.c.

References current_directory, and history_filename.

Referenced by init_main().

static void set_history_size_command ( char *  args,
int  from_tty,
struct cmd_list_element c 
)
static

Definition at line 1680 of file top.c.

References history_size_setshow_var, and set_readline_history_size().

Referenced by init_main().

void set_prompt ( const char *  s)

Definition at line 1394 of file top.c.

References top_prompt, and xfree().

Referenced by gdbpy_before_prompt_hook(), and init_main().

static void set_readline_history_size ( int  history_size)
static

Definition at line 1668 of file top.c.

References gdb_assert.

Referenced by init_history(), and set_history_size_command().

void set_verbose ( char *  args,
int  from_tty,
struct cmd_list_element c 
)
static void show_annotation_level ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  value 
)
static

Definition at line 1810 of file top.c.

References _, and fprintf_filtered().

Referenced by init_main().

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

Definition at line 1801 of file top.c.

References _, and fprintf_filtered().

Referenced by init_main().

void show_commands ( char *  args,
int  from_tty 
)

Definition at line 1603 of file top.c.

References Hist_print, line, offset, parse_and_eval_long(), and printf_filtered().

Referenced by _initialize_cli_cmds().

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

Definition at line 96 of file top.c.

References _, and fprintf_filtered().

Referenced by init_main().

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

Definition at line 1817 of file top.c.

References _, and fprintf_filtered().

Referenced by init_main().

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

Definition at line 1840 of file top.c.

References _, fprintf_filtered(), and gdb_datadir.

Referenced by init_main().

void show_history ( char *  args,
int  from_tty 
)

Definition at line 1694 of file top.c.

References cmd_show_list(), and showhistlist.

Referenced by _initialize_cli_cmds().

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

Definition at line 717 of file top.c.

References _, and fprintf_filtered().

Referenced by init_main().

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

Definition at line 706 of file top.c.

References _, and fprintf_filtered().

Referenced by init_main().

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

Definition at line 694 of file top.c.

References _, and fprintf_filtered().

Referenced by init_main().

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

Definition at line 1794 of file top.c.

References _, and fprintf_filtered().

Referenced by init_main().

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

Definition at line 682 of file top.c.

References _, and fprintf_filtered().

Referenced by init_main().

Variable Documentation

int command_count = 0
static

Definition at line 907 of file top.c.

Referenced by gdb_add_history(), and gdb_safe_append_history().

int command_editing_p
static

Definition at line 672 of file top.c.

Referenced by command_line_input(), and init_main().

int confirm = 1

Definition at line 93 of file top.c.

Referenced by ATTRIBUTE_PRINTF(), and init_main().

char* current_directory

String containing the current directory (what getwd would return).

Definition at line 117 of file top.c.

Referenced by add_path(), bsd_kvm_open(), captured_main(), cd_command(), core_open(), gdb_abspath(), gdb_init(), go32_wait(), init_history(), m32r_upload_command(), openp(), pwd_command(), set_history_filename(), shell_escape(), and tfile_open().

void(* deprecated_attach_hook) (void)

Definition at line 216 of file top.c.

Referenced by attach_command_post_wait().

void(* deprecated_call_command_hook) (struct cmd_list_element *c, char *cmd, int from_tty)

Definition at line 239 of file top.c.

Referenced by clear_interpreter_hooks(), and execute_command().

void(* deprecated_context_hook) (int id)

Definition at line 244 of file top.c.

Referenced by clear_interpreter_hooks(), and handle_signal_stop().

void(* deprecated_detach_hook) (void)

Definition at line 217 of file top.c.

Referenced by detach_command(), disconnect_command(), and generic_mourn_inferior().

void(* deprecated_interactive_hook) (void)

Definition at line 222 of file top.c.

Referenced by clear_interpreter_hooks(), and maybe_quit().

void(* deprecated_print_frame_info_listing_hook) (struct symtab *s, int line, int stopline, int noerror)
int(* deprecated_query_hook) (const char *, va_list)
void(* deprecated_readline_begin_hook) (char *,...)

Definition at line 209 of file top.c.

Referenced by clear_interpreter_hooks(), and read_command_lines().

void(* deprecated_readline_end_hook) (void)

Definition at line 211 of file top.c.

Referenced by clear_interpreter_hooks(), and read_command_lines().

char*(* deprecated_readline_hook) (const char *)

Definition at line 210 of file top.c.

Referenced by clear_interpreter_hooks(), command_line_input(), and read_next_line().

void(* deprecated_register_changed_hook) (int regno)

Definition at line 227 of file top.c.

Referenced by clear_interpreter_hooks(), tui_install_hooks(), tui_remove_hooks(), and value_assign().

ptid_t(* deprecated_target_wait_hook) (ptid_t ptid, struct target_waitstatus *status, int options)
int(* deprecated_ui_loop_hook) (int)
void(* deprecated_warning_hook) (const char *, va_list)

Definition at line 195 of file top.c.

Referenced by clear_interpreter_hooks(), and vwarning().

char gdb_dirbuf[1024]

Definition at line 120 of file top.c.

Referenced by captured_main(), cd_command(), mi_cmd_env_pwd(), and pwd_command().

int gdb_readline_wrapper_done
static
char* gdb_readline_wrapper_result
static
const char gdbinit[] = GDBINIT

Definition at line 84 of file top.c.

Referenced by file_is_auto_load_safe(), get_init_files(), and init_cli_cmds().

int history_expansion_p

Definition at line 678 of file top.c.

Referenced by _initialize_cli_cmds(), command_line_handler(), command_line_input(), and init_main().

char* history_filename
static
int history_remove_duplicates = 0
static

Definition at line 703 of file top.c.

Referenced by gdb_add_history(), and init_main().

int history_size_setshow_var = -2
static

Definition at line 691 of file top.c.

Referenced by init_history(), init_main(), and set_history_size_command().

int in_user_command

Definition at line 113 of file top.c.

Referenced by do_restore_user_call_depth(), execute_user_command(), and input_from_terminal_p().

int info_verbose = 0
int inhibit_gdbinit = 0

Definition at line 86 of file top.c.

Referenced by _initialize_check_for_gdb_ini(), and captured_main().

FILE* instream
char lang_frame_mismatch_warn[]

Definition at line 109 of file language.c.

Referenced by check_frame_language_change(), and show_language_command().

char* lim_at_start

Definition at line 170 of file top.c.

Referenced by captured_main(), make_command_stats_cleanup(), and report_command_stats().

int operate_saved_history = -1
static

Definition at line 860 of file top.c.

Referenced by gdb_rl_operate_and_get_next(), and gdb_rl_operate_and_get_next_completion().

void(* pre_init_ui_hook) (void)

Definition at line 296 of file top.c.

Referenced by gdb_init().

int remote_debug = 0
int remote_timeout = 2
void(* saved_after_char_processing_hook) (void)
static

Definition at line 754 of file top.c.

Referenced by gdb_readline_wrapper_cleanup(), and gdb_readline_wrapper_line().

char* saved_command_line
int saved_command_line_size = 100

Definition at line 132 of file top.c.

Referenced by captured_main(), command_line_handler(), and command_line_input().

int server_command
const char* source_file_name
int source_line_number
char* staged_gdb_datadir
static

Definition at line 1826 of file top.c.

Referenced by init_main(), and set_gdb_datadir().

int suppress_dont_repeat = 0
static

Definition at line 577 of file top.c.

Referenced by dont_repeat(), and prevent_dont_repeat().

char* top_prompt
static

Definition at line 1381 of file top.c.

Referenced by get_prompt(), init_main(), and set_prompt().

void(* window_hook) (FILE *, char *)

Definition at line 126 of file top.c.

Referenced by command_loop().

int write_history_p
static

Definition at line 680 of file top.c.

Referenced by init_main(), and quit_force().