69 "the name of a maintenance command.\n"));
77 if (
query (
_(
"Should GDB dump core? ")))
81 signal (SIGABRT, SIG_DFL);
82 kill (getpid (), SIGABRT);
84 signal (SIGQUIT, SIG_DFL);
85 kill (getpid (), SIGQUIT);
99 internal_error (__FILE__, __LINE__,
"%s", (args == NULL ?
"" : args));
135 if (args == NULL || *args ==
'\0')
144 if (args == NULL || *args ==
'\0')
158 "by the name of an info command.\n"));
171 "by the name of a check command.\n"));
181 int substr_len = strlen(substr);
184 while ((tok = strstr (
string, substr)) != NULL)
192 if (tok[substr_len] ==
' ' 193 || tok[substr_len] ==
'\t' 194 || tok[substr_len] ==
'\0')
209 if (
flags & SEC_ALLOC)
212 if (
flags & SEC_LOAD)
215 if (
flags & SEC_RELOC)
218 if (
flags & SEC_READONLY)
221 if (
flags & SEC_CODE)
224 if (
flags & SEC_DATA)
230 if (
flags & SEC_CONSTRUCTOR)
233 if (
flags & SEC_HAS_CONTENTS)
236 if (
flags & SEC_NEVER_LOAD)
239 if (
flags & SEC_COFF_SHARED_LIBRARY)
242 if (
flags & SEC_IS_COMMON)
252 if (
flags & SEC_ALLOC)
254 if (
flags & SEC_LOAD)
256 if (
flags & SEC_RELOC)
258 if (
flags & SEC_READONLY)
260 if (
flags & SEC_CODE)
262 if (
flags & SEC_DATA)
266 if (
flags & SEC_CONSTRUCTOR)
268 if (
flags & SEC_HAS_CONTENTS)
270 if (
flags & SEC_NEVER_LOAD)
272 if (
flags & SEC_COFF_SHARED_LIBRARY)
274 if (
flags & SEC_IS_COMMON)
281 unsigned long filepos,
int addr_size)
297 flagword
flags = bfd_get_section_flags (abfd, asect);
298 const char *
name = bfd_section_name (abfd, asect);
299 const char *arg = (
const char *) datum;
301 if (arg == NULL || *arg ==
'\0' 309 addr = bfd_section_vma (abfd, asect);
310 endaddr = addr + bfd_section_size (abfd, asect);
313 asect->filepos, addr_size);
325 if (
string == NULL || *
string ==
'\0' 358 if (strcmp (arg,
"ALLOBJ") == 0)
364 bfd_get_filename (ofile->
obfd));
403 if (!file.
open (args,
"w"))
417 "by the name of a print command.\n"));
436 if (arg == NULL || *arg == 0)
437 error (
_(
"requires argument (address or section + address)"));
444 while (*p && !isspace (*p))
447 error (
_(
"Need to specify <section-name> and <address>"));
449 int arg_len = p - arg;
459 error (
_(
"Unknown section %s."), arg);
472 const char *symbol_offset
478 const char *section_name;
479 const char *obj_name;
489 symbol_name, symbol_offset,
490 section_name, obj_name);
493 symbol_name, symbol_offset, section_name);
515 if (args == NULL || *args ==
'\0')
518 the command you want to deprecate, and optionally the replacement command\n\ 519 enclosed in quotes.\n"));
529 if (args == NULL || *args ==
'\0')
532 the command you want to undeprecate.\n"));
552 const char *start_ptr = NULL;
553 const char *end_ptr = NULL;
569 start_ptr = strchr (text,
'\"');
570 if (start_ptr != NULL)
573 end_ptr = strrchr (start_ptr,
'\"');
576 len = end_ptr - start_ptr;
582 if (!start_ptr || !end_ptr)
593 if (
alias->malloced_replacement)
598 alias->deprecated_warn_user = 1;
599 alias->cmd_deprecated = 1;
603 alias->deprecated_warn_user = 0;
604 alias->cmd_deprecated = 0;
607 alias->malloced_replacement = 1;
641 "by the name of a set command.\n"));
664 #define TEXTEND &_etext 665 #elif defined (HAVE_ETEXT) 667 #define TEXTEND &etext 670 #if defined (HAVE_MONSTARTUP) && defined (HAVE__MCLEANUP) && defined (TEXTEND) 697 static int profiling_initialized;
699 if (!profiling_initialized)
702 profiling_initialized = 1;
721 error (
_(
"Profiling support is not available on this system."));
770 int nr_compunit_symtabs = 0;
780 ++nr_compunit_symtabs;
787 *nr_symtabs_ptr = nr_symtabs;
788 *nr_compunit_symtabs_ptr = nr_compunit_symtabs;
789 *nr_blocks_ptr = nr_blocks;
817 steady_clock::duration wall_time
823 ?
_(
"Startup time: %.6f (cpu), %.6f (wall)\n")
824 :
_(
"Command execution time: %.6f (cpu), %.6f (wall)\n"),
825 duration<double> (cmd_time).count (),
826 duration<double> (wall_time).count ());
832 char *lim = (
char *) sbrk (0);
838 ?
_(
"Space used: %ld (%s%ld during startup)\n")
839 :
_(
"Space used: %ld (%s%ld for this command)\n"),
841 (space_diff >= 0 ?
"+" :
""),
848 int nr_symtabs, nr_compunit_symtabs, nr_blocks;
852 " #compunits: %d (+%d)," 853 " #blocks: %d (+%d)\n"),
870 char *lim = (
char *) sbrk (0);
891 int nr_symtabs, nr_compunit_symtabs, nr_blocks;
917 error (
_(
"Bad value for 'mt set per-command no'."));
946 Selftests are not available in a non-development build.\n"));
960 Selftests are not available in a non-development build.\n"));
971 Commands for use by GDB maintainers.\n\ 972 Includes commands to dump specific internal GDB structures in\n\ 973 a human readable form, to cause GDB to deliberately dump core, etc."),
980 Commands for showing internal info about the program being debugged."),
986 List the BFD sections of the exec and core files. \n\ 987 Arguments may be any combination of:\n\ 988 [one or more section names]\n\ 989 ALLOC LOAD RELOC READONLY CODE DATA ROM CONSTRUCTOR\n\ 990 HAS_CONTENTS NEVER_LOAD COFF_SHARED_LIBRARY IS_COMMON\n\ 991 Sections matching any argument will be listed (no argument\n\ 992 implies all sections). In addition, the special argument\n\ 994 lists all sections from all object files, including shared libraries."),
998 _(
"Maintenance command for printing GDB internal state."),
1003 Set GDB internal variables used by the GDB maintainer.\n\ 1004 Configure variables internal to GDB that aid in GDB's maintenance"),
1010 Show GDB internal variables used by the GDB maintainer.\n\ 1011 Configure variables internal to GDB that aid in GDB's maintenance"),
1018 Get fatal error; make debugger dump its core.\n\ 1019 GDB sets its handling of SIGQUIT back to SIG_DFL and then sends\n\ 1020 itself a SIGQUIT signal."),
1026 Give GDB an internal error.\n\ 1027 Cause GDB to behave as if an internal error was detected."),
1032 Give GDB an internal warning.\n\ 1033 Cause GDB to behave as if an internal warning was reported."),
1038 Give GDB a demangler warning.\n\ 1039 Cause GDB to behave as if a demangler warning was reported."),
1043 This command has been moved to \"demangle\"."),
1048 Per-command statistics settings."),
1053 Show per-command statistics settings."),
1059 Set whether to display per-command execution time."),
_(
"\ 1060 Show whether to display per-command execution time."),
1062 If enabled, the execution time for each command will be\n\ 1063 displayed following the command's output."),
1069 Set whether to display per-command space usage."),
_(
"\ 1070 Show whether to display per-command space usage."),
1072 If enabled, the space usage for each command will be\n\ 1073 displayed following the command's output."),
1079 Set whether to display per-command symtab statistics."),
_(
"\ 1080 Show whether to display per-command symtab statistics."),
1082 If enabled, the basic symtab statistics for each command will be\n\ 1083 displayed following the command's output."),
1090 Set the display of time usage.\n\ 1091 If nonzero, will cause the execution time for each command to be\n\ 1092 displayed, following the command's output."),
1098 Set the display of space usage.\n\ 1099 If nonzero, will cause the execution space for each command to be\n\ 1100 displayed, following the command's output."),
1104 Print a type chain for a given symbol.\n\ 1105 For each node in a type chain, print the raw data for each member of\n\ 1106 the type structure, and the interpretation of the data."),
1110 _(
"Print statistics about internal gdb state."),
1115 Print the internal architecture configuration.\n\ 1116 Takes an optional file parameter."),
1120 Commands for checking internal gdb state."),
1126 _(
"Translate a section name and address to a symbol."),
1130 Deprecate a command. Note that this is just in here so the \n\ 1131 testsuite can check the command deprecator. You probably shouldn't use this,\n\ 1132 rather you should use the C function deprecate_cmd(). If you decide you \n\ 1133 want to use it: maintenance deprecate 'commandname' \"replacement\". The \n\ 1137 Undeprecate a command. Note that this is just in here so the \n\ 1138 testsuite can check the command deprecator. You probably shouldn't use this,\n\ 1139 If you decide you want to use it: maintenance undeprecate 'commandname'"),
1143 Run gdb's unit tests.\n\ 1144 Usage: maintenance selftest [filter]\n\ 1145 This will run any unit tests that were built in to gdb.\n\ 1146 If a filter is given, only the tests with that value in their name will ran."),
1153 Set watchdog timer."),
_(
"\ 1154 Show watchdog timer."),
_(
"\ 1155 When non-zero, this timeout is used instead of waiting forever for a target\n\ 1156 to finish a low-level step or continue operation. If the specified amount\n\ 1157 of time passes without a response from the target, an error occurs."),
1164 Set internal profiling."),
_(
"\ 1165 Show internal profiling."),
_(
"\ 1166 When enabled GDB is profiled."),
unsigned int deprecated_warn_user
char * hex_string(LONGEST num)
static void maintenance_demangle(const char *args, int from_tty)
struct cmd_list_element * next
struct bound_minimal_symbol lookup_minimal_symbol_by_pc_section(CORE_ADDR pc, struct obj_section *section)
static int per_command_symtab
int parse_cli_boolean_value(const char *arg)
static void maintenance_translate_address(const char *arg, int from_tty)
unsigned int cmd_deprecated
int gdb_bfd_section_index(bfd *abfd, asection *section)
static int per_command_space
__extension__ enum cmd_types type
struct bfd_section * the_bfd_section
#define BMSYMBOL_VALUE_ADDRESS(symbol)
struct cmd_list_element * deprecate_cmd(struct cmd_list_element *cmd, const char *replacement)
int query(const char *ctlstr,...)
EXTERN_C void monstartup(unsigned long, unsigned long)
static struct cmd_list_element * per_command_setlist
struct cmd_list_element * maintenanceinfolist
void internal_error(const char *file, int line, const char *fmt,...)
#define obj_section_endaddr(s)
struct cmd_list_element * maintenancechecklist
run_time_clock::time_point m_start_cpu_time
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, const char *doc, struct cmd_list_element **list)
#define ALL_OBJSECTIONS(objfile, osect)
static void maintenance_info_sections(const char *arg, int from_tty)
static void show_per_command_cmd(const char *args, int from_tty)
#define ALL_OBJFILE_OSECTIONS(objfile, osect)
void set_per_command_time(int new_value)
static struct cmd_list_element * per_command_showlist
struct cmd_list_element * cmdlist
static void show_watchdog(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
char * skip_spaces(char *chp)
void demangler_warning(const char *file, int line, const char *string,...)
static void print_objfile_section_info(bfd *abfd, struct obj_section *asect, const char *string)
int lookup_cmd_composition(const char *text, struct cmd_list_element **alias, struct cmd_list_element **prefix_cmd, struct cmd_list_element **cmd)
static void maintenance_internal_error(const char *args, int from_tty)
static void show_maintenance_profile_p(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
void printf_filtered(const char *format,...)
struct cmd_list_element * add_prefix_cmd(const char *name, enum command_class theclass, cmd_const_cfunc_ftype *fun, const char *doc, struct cmd_list_element **prefixlist, const char *prefixname, int allow_unknown, struct cmd_list_element **list)
static void maintenance_info_selftests(const char *arg, int from_tty)
#define MSYMBOL_OBJ_SECTION(objfile, symbol)
mach_port_t kern_return_t mach_port_t msgports mach_port_t kern_return_t pid_t pid mach_port_t kern_return_t mach_port_t task mach_port_t kern_return_t int flags
EXTERN_C void _mcleanup(void)
#define MSYMBOL_PRINT_NAME(symbol)
static void maintenance_set_cmd(const char *args, int from_tty)
struct cmd_list_element * setlist
static void maintenance_set_profile_cmd(const char *args, int from_tty, struct cmd_list_element *c)
void _initialize_maint_cmds(void)
void reset_prompt_for_continue_wait_time(void)
static void maintenance_info_command(const char *arg, int from_tty)
objfile(bfd *, const char *, objfile_flags)
void fprintf_filtered(struct ui_file *stream, const char *format,...)
scoped_command_stats(bool msg_type)
static void mcleanup_wrapper(void)
void add_setshow_zinteger_cmd(const char *name, enum command_class theclass, int *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_const_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
struct cmd_list_element * showlist
struct cmd_list_element * add_com_alias(const char *name, const char *oldname, enum command_class theclass, int abbrev_flag)
static void maintenance_print_command(const char *arg, int from_tty)
static void maintenance_print_architecture(const char *args, int from_tty)
__extension__ enum var_types var_type
char * pulongest(ULONGEST u)
#define ALL_COMPUNITS(objfile, cu)
int m_start_nr_compunit_symtabs
static void print_bfd_section_info(bfd *abfd, asection *asect, void *datum)
static void maintenance_command(const char *args, int from_tty)
struct gdbarch * get_current_arch(void)
static void print_bfd_flags(flagword flags)
void for_each_selftest(for_each_selftest_ftype func)
struct cmd_list_element * maintenance_set_cmdlist
int gdbarch_addr_bit(struct gdbarch *gdbarch)
std::chrono::steady_clock::time_point m_start_wall_time
void printf_unfiltered(const char *format,...)
void maintenance_print_type(const char *, int)
static int match_substring(const char *string, const char *substr)
const char * objfile_name(const struct objfile *objfile)
struct cmd_list_element * maintenanceprintlist
void cmd_show_list(struct cmd_list_element *list, int from_tty, const char *prefix)
struct cmd_list_element * add_alias_cmd(const char *name, cmd_list_element *old, enum command_class theclass, int abbrev_flag, struct cmd_list_element **list)
std::chrono::microseconds duration
void wrap_here(const char *indent)
std::chrono::steady_clock::duration get_prompt_for_continue_wait_time()
static void maintenance_check_command(const char *arg, int from_tty)
#define COMPUNIT_BLOCKVECTOR(cust)
static int per_command_time
struct gdbarch * gdbarch_from_bfd(bfd *abfd)
static void maintenance_print_statistics(const char *args, int from_tty)
void help_list(struct cmd_list_element *list, const char *cmdtype, enum command_class theclass, struct ui_file *stream)
char * hex_string_custom(LONGEST num, int width)
void void void void void void void void void perror_with_name(const char *string) ATTRIBUTE_NORETURN
struct bound_minimal_symbol lookup_minimal_symbol_by_pc(CORE_ADDR pc)
static int maintenance_profile_p
struct cmd_list_element * maintenance_show_cmdlist
static void maintenance_undeprecate(const char *args, int from_tty)
CORE_ADDR parse_and_eval_address(const char *exp)
void run_tests(const char *filter)
static void maintenance_time_display(const char *args, int from_tty)
bool open(const char *name, const char *mode)
struct minimal_symbol * minsym
static void maintenance_space_display(const char *args, int from_tty)
void print_objfile_statistics(void)
#define obj_section_addr(s)
void add_setshow_boolean_cmd(const char *name, enum command_class theclass, int *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_const_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
#define BLOCKVECTOR_NBLOCKS(blocklist)
static void set_per_command_cmd(const char *args, int from_tty)
struct program_space * current_program_space
static void maintenance_show_cmd(const char *args, int from_tty)
char * savestring(const char *ptr, size_t len)
static void maintenance_selftest(const char *args, int from_tty)
void do_set_command(const char *arg, int from_tty, struct cmd_list_element *c)
void set_per_command_space(int new_value)
struct cmd_list_element * maintenancelist
static void maintenance_do_deprecate(const char *, int)
static int profiling_state
void gdbarch_dump(struct gdbarch *gdbarch, struct ui_file *file)
#define ALL_COMPUNIT_FILETABS(cu, s)
static void maint_print_section_info(const char *name, flagword flags, CORE_ADDR addr, CORE_ADDR endaddr, unsigned long filepos, int addr_size)
static void maintenance_demangler_warning(const char *args, int from_tty)
static void count_symtabs_and_blocks(int *nr_symtabs_ptr, int *nr_compunit_symtabs_ptr, int *nr_blocks_ptr)
#define ALL_OBJFILES(obj)
unsigned int malloced_replacement
static void maintenance_dump_me(const char *args, int from_tty)
static time_point now() noexcept
static void maintenance_deprecate(const char *args, int from_tty)
#define MULTI_OBJFILE_P()
void internal_warning(const char *file, int line, const char *fmt,...)
static int match_bfd_flags(const char *string, flagword flags)
void error(const char *fmt,...)
static void maintenance_internal_warning(const char *args, int from_tty)
void print_symbol_bcache_statistics(void)