2015-01-01 09:32:14 +00:00
# Copyright 1988-2015 Free Software Foundation, Inc.
1999-04-16 01:35:26 +00:00
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
2007-08-23 18:14:19 +00:00
# the Free Software Foundation; either version 3 of the License, or
1999-04-16 01:35:26 +00:00
# (at your option) any later version.
2007-08-23 18:14:19 +00:00
#
1999-04-16 01:35:26 +00:00
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
2007-08-23 18:14:19 +00:00
#
1999-04-16 01:35:26 +00:00
# You should have received a copy of the GNU General Public License
2007-08-23 18:14:19 +00:00
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1999-04-16 01:35:26 +00:00
# This file was written by Rob Savoye. (rob@cygnus.com)
2012-09-12 18:55:49 +00:00
# Test basic help functionality.
# This is not intended to test the help text of every command,
# or even more than a few commands - too much of a maintenance burden.
1999-04-16 01:35:26 +00:00
gdb_start
2012-09-12 18:55:49 +00:00
# disable pagination
gdb_test_no_output "set height 0" "disable pagination"
1999-04-16 01:35:26 +00:00
2012-09-12 18:55:49 +00:00
# Test all the help classes.
2006-11-09 19:22:11 +00:00
test_class_help "aliases" {"Aliases of other commands\.\[\r\n\]+"}
2012-09-12 18:55:49 +00:00
test_class_help "breakpoints" {
"Making program stop at certain points\.\[\r\n\]+"
}
test_class_help "data" {"Examining data\.\[\r\n\]+"}
test_class_help "files" {"Specifying and examining files\.\[\r\n\]+"}
test_class_help "internals" {
"Maintenance commands\.\[\r\n\]+"
"Some gdb commands are provided just for use by gdb maintainers\.\[\r\n\]+"
"These commands are subject to frequent change, and may not be as\[\r\n\]+"
"well documented as user commands\.\[\r\n\]+"
}
test_class_help "obscure" {"Obscure features\.\[\r\n\]+"}
test_class_help "running" {"Running the program\.\[\r\n\]+"}
test_class_help "stack" {
"Examining the stack\..*\[\r\n\]+"
"When the program being debugged stops, gdb selects the innermost frame\.\[\r\n\]+"
"The commands below can be used to select other frames by number or address\.\[\r\n\]+"
}
test_class_help "status" {
"Status inquiries\.\[\r\n\]+"
}
test_class_help "support" {"Support facilities\.\[\r\n\]+"}
test_class_help "tracepoints" {
"Tracing of program execution without stopping the program\.\[\r\n\]+"
}
test_class_help "user-defined" {
"User-defined commands\.\[\r\n\]+"
"The commands in this class are those defined by the user\.\[\r\n\]+"
"Use the \"define\" command to define a command\.\[\r\n\]+"
}
2006-11-09 19:22:11 +00:00
2012-09-12 18:55:49 +00:00
# Test help of an abbreviated command. "break" is picked at random.
set help_breakpoint_text "Set breakpoint at specified line or function\..*"
1999-04-16 01:35:26 +00:00
# test help breakpoint "b" abbreviation
2012-09-12 18:55:49 +00:00
gdb_test "help b" $help_breakpoint_text "help breakpoint \"b\" abbreviation"
1999-04-16 01:35:26 +00:00
# test help breakpoint "br" abbreviation
2012-09-12 18:55:49 +00:00
gdb_test "help br" $help_breakpoint_text "help breakpoint \"br\" abbreviation"
1999-04-16 01:35:26 +00:00
# test help breakpoint "bre" abbreviation
2012-09-12 18:55:49 +00:00
gdb_test "help bre" $help_breakpoint_text "help breakpoint \"bre\" abbreviation"
1999-04-16 01:35:26 +00:00
# test help breakpoint "brea" abbreviation
2012-09-12 18:55:49 +00:00
gdb_test "help brea" $help_breakpoint_text "help breakpoint \"brea\" abbreviation"
1999-04-16 01:35:26 +00:00
# test help breakpoint "break" abbreviation
2012-09-12 18:55:49 +00:00
gdb_test "help break" $help_breakpoint_text "help breakpoint \"break\" abbreviation"
# Test help of an aliased command. "bt" is picked at random.
set help_backtrace_text "Print backtrace of all stack frames, or innermost COUNT frames\..*"
1999-04-16 01:35:26 +00:00
# test help backtrace "bt" abbreviation
2012-09-12 18:55:49 +00:00
gdb_test "help bt" $help_backtrace_text "help backtrace \"bt\" abbreviation"
1999-04-16 01:35:26 +00:00
# test help backtrace
2012-09-12 18:55:49 +00:00
gdb_test "help backtrace" $help_backtrace_text "help backtrace"
1999-04-16 01:35:26 +00:00
# test help commands
2002-03-26 05:10:26 +00:00
gdb_test "help commands" "Set commands to be executed when a breakpoint is hit\.\[\r\n\]+Give breakpoint number as argument after \"commands\"\.\[\r\n\]+With no argument, the targeted breakpoint is the last one set\.\[\r\n\]+The commands themselves follow starting on the next line\.\[\r\n\]+Type a line containing \"end\" to indicate the end of them\.\[\r\n\]+Give \"silent\" as the first line to make the breakpoint silent;\[\r\n\]+then no output is printed when it is hit, except what the commands print\." "help commands"
2012-09-12 18:55:49 +00:00
# Test a prefix command. "delete" is picked at random.
1999-04-16 01:35:26 +00:00
# test help delete "d" abbreviation
2006-11-09 19:22:11 +00:00
set expected_help_delete {
"Delete some breakpoints or auto-display expressions\.\[\r\n\]+"
"Arguments are breakpoint numbers with spaces in between\.\[\r\n\]+"
"To delete all breakpoints, give no argument\.\[\r\n\]+"
"Also a prefix command for deletion of other GDB objects\.\[\r\n\]+"
"The \"unset\" command is also an alias for \"delete\"\.\[\r\n\]+"
}
test_prefix_command_help {"d" "delete"} $expected_help_delete "help delete \"d\" abbreviation"
1999-04-16 01:35:26 +00:00
# test help delete
2006-11-09 19:22:11 +00:00
test_prefix_command_help "delete" $expected_help_delete
2012-09-12 18:55:49 +00:00
# Make sure help for help itself is present.
1999-04-16 01:35:26 +00:00
# test help help "h" abbreviation
2002-03-26 05:10:26 +00:00
gdb_test "help h" "Print list of commands\." "help help \"h\" abbreviation"
1999-04-16 01:35:26 +00:00
# test help help
2002-03-26 05:10:26 +00:00
gdb_test "help help" "Print list of commands\." "help help"
2012-09-12 18:55:49 +00:00
# The startup banner refers to "show copying" and "show warranty",
# might as well test for them.
1999-04-16 01:35:26 +00:00
# test help info copying
2012-09-12 18:55:49 +00:00
gdb_test "help show copying" "Conditions for redistributing copies of GDB\." \
"help show copying"
1999-04-16 01:35:26 +00:00
# test help info warranty
2012-09-12 18:55:49 +00:00
gdb_test "help show warranty" "Various kinds of warranty you do not have\." \
"help show warranty"
2012-08-17 17:37:03 +00:00
2012-09-12 18:55:49 +00:00
# Test a few other random "help show" commands.
1999-04-16 01:35:26 +00:00
# test help show commands
2002-03-26 05:10:26 +00:00
gdb_test "help show commands" "Show the history of commands you typed\.\[\r\n\]+You can supply a command number to start with, or a `\[+\]' to start after\[\r\n\]+the previous command number shown\." "help show commands"
1999-04-16 01:35:26 +00:00
# test help show confirm
2002-03-26 05:10:26 +00:00
gdb_test "help show confirm" "Show whether to confirm potentially dangerous operations\." "help show confirm"
2002-04-24 03:07:33 +00:00
1999-04-16 01:35:26 +00:00
# test help info bogus-gdb-command
2002-03-26 05:10:26 +00:00
gdb_test "help info bogus-gdb-command" "Undefined info command: \"bogus-gdb-command\"\. Try \"help info\"\." "help info bogus-gdb-command"
1999-04-16 01:35:26 +00:00
# test help gotcha
2002-03-26 05:10:26 +00:00
gdb_test "help gotcha" "Undefined command: \"gotcha\"\. Try \"help\"\." "help gotcha"
2012-09-12 18:55:49 +00:00
2000-03-23 23:21:27 +00:00
# test apropos regex
2012-08-23 16:59:14 +00:00
gdb_test "apropos \\\(print\[\^ bsiedf\\\".-\]\\\)" "handle -- Specify how to handle signals"
2000-03-23 23:21:27 +00:00
# test apropos >1 word string
2012-08-23 16:59:14 +00:00
gdb_test "apropos handle signal" "handle -- Specify how to handle signals"
2000-03-23 23:21:27 +00:00
# test apropos apropos
Add Guile as an extension language.
* NEWS: Mention Guile scripting.
* Makefile.in (SUBDIR_GUILE_OBS): New variable.
(SUBDIR_GUILE_SRCS, SUBDIR_GUILE_DEPS): New variables
(SUBDIR_GUILE_LDFLAGS, SUBDIR_GUILE_CFLAGS): New variables.
(INTERNAL_CPPFLAGS): Add GUILE_CPPFLAGS.
(CLIBS): Add GUILE_LIBS.
(install-guile): New rule.
(guile.o): New rule.
(scm-arch.o, scm-auto-load.o, scm-block.o): New rules.
(scm-breakpoint.o, scm-disasm.o, scm-exception.o): New rules.
(scm-frame.o, scm-iterator.o, scm-lazy-string.o): New rules.
(scm-math.o, scm-objfile.o, scm-ports.o): New rules.
(scm-pretty-print.o, scm-safe-call.o, scm-gsmob.o): New rules.
(scm-string.o, scm-symbol.o, scm-symtab.o): New rules.
(scm-type.o, scm-utils.o, scm-value.o): New rules.
* configure.ac: New option --with-guile.
* configure: Regenerate.
* config.in: Regenerate.
* auto-load.c: Remove #include "python/python.h". Add #include
"gdb/section-scripts.h".
(source_section_scripts): Handle Guile scripts.
(_initialize_auto_load): Add name of Guile objfile script to
scripts-directory help text.
* breakpoint.c (condition_command): Tweak comment to include Scheme.
* breakpoint.h (gdbscm_breakpoint_object): Add forward decl.
(struct breakpoint): New member scm_bp_object.
* defs.h (enum command_control_type): New value guile_control.
* cli/cli-cmds.c: Remove #include "python/python.h". Add #include
"extension.h".
(show_user): Update comment.
(_initialize_cli_cmds): Update help text for "show user". Update help
text for max-user-call-depth.
* cli/cli-script.c: Remove #include "python/python.h". Add #include
"extension.h".
(multi_line_command_p): Add guile_control.
(print_command_lines): Handle guile_control.
(execute_control_command, recurse_read_control_structure): Ditto.
(process_next_line): Recognize "guile" commands.
* disasm.c (gdb_disassemble_info): Make non-static.
* disasm.h: #include "dis-asm.h".
(struct gdbarch): Add forward decl.
(gdb_disassemble_info): Declare.
* extension.c: #include "guile/guile.h".
(extension_languages): Add guile.
(get_ext_lang_defn): Handle EXT_LANG_GDB.
* extension.h (enum extension_language): New value EXT_LANG_GUILE.
* gdbtypes.c (get_unsigned_type_max): New function.
(get_signed_type_minmax): New function.
* gdbtypes.h (get_unsigned_type_max): Declare.
(get_signed_type_minmax): Declare.
* guile/README: New file.
* guile/guile-internal.h: New file.
* guile/guile.c: New file.
* guile/guile.h: New file.
* guile/scm-arch.c: New file.
* guile/scm-auto-load.c: New file.
* guile/scm-block.c: New file.
* guile/scm-breakpoint.c: New file.
* guile/scm-disasm.c: New file.
* guile/scm-exception.c: New file.
* guile/scm-frame.c: New file.
* guile/scm-gsmob.c: New file.
* guile/scm-iterator.c: New file.
* guile/scm-lazy-string.c: New file.
* guile/scm-math.c: New file.
* guile/scm-objfile.c: New file.
* guile/scm-ports.c: New file.
* guile/scm-pretty-print.c: New file.
* guile/scm-safe-call.c: New file.
* guile/scm-string.c: New file.
* guile/scm-symbol.c: New file.
* guile/scm-symtab.c: New file.
* guile/scm-type.c: New file.
* guile/scm-utils.c: New file.
* guile/scm-value.c: New file.
* guile/lib/gdb.scm: New file.
* guile/lib/gdb/boot.scm: New file.
* guile/lib/gdb/experimental.scm: New file.
* guile/lib/gdb/init.scm: New file.
* guile/lib/gdb/iterator.scm: New file.
* guile/lib/gdb/printing.scm: New file.
* guile/lib/gdb/types.scm: New file.
* data-directory/Makefile.in (GUILE_SRCDIR): New variable.
(VPATH): Add $(GUILE_SRCDIR).
(GUILE_DIR): New variable.
(GUILE_INSTALL_DIR, GUILE_FILES): New variables.
(all): Add stamp-guile dependency.
(stamp-guile): New rule.
(clean-guile, install-guile, uninstall-guile): New rules.
(install-only): Add install-guile dependency.
(uninstall): Add uninstall-guile dependency.
(clean): Add clean-guile dependency.
doc/
* Makefile.in (GDB_DOC_FILES): Add guile.texi.
* gdb.texinfo (Auto-loading): Add set/show auto-load guile-scripts.
(Extending GDB): New menu entries Guile, Multiple Extension Languages.
(Guile docs): Include guile.texi.
(objfile-gdbdotext file): Add objfile-gdb.scm.
(dotdebug_gdb_scripts section): Mention Guile scripts.
(Multiple Extension Languages): New node.
* guile.texi: New file.
testsuite/
* configure.ac (AC_OUTPUT): Add gdb.guile.
* configure: Regenerate.
* lib/gdb-guile.exp: New file.
* lib/gdb.exp (get_target_charset): New function.
* gdb.base/help.exp: Update expected output from "apropos apropos".
* gdb.guile/Makefile.in: New file.
* gdb.guile/guile.exp: New file.
* gdb.guile/scm-arch.c: New file.
* gdb.guile/scm-arch.exp: New file.
* gdb.guile/scm-block.c: New file.
* gdb.guile/scm-block.exp: New file.
* gdb.guile/scm-breakpoint.c: New file.
* gdb.guile/scm-breakpoint.exp: New file.
* gdb.guile/scm-disasm.c: New file.
* gdb.guile/scm-disasm.exp: New file.
* gdb.guile/scm-equal.c: New file.
* gdb.guile/scm-equal.exp: New file.
* gdb.guile/scm-error.exp: New file.
* gdb.guile/scm-error.scm: New file.
* gdb.guile/scm-frame-args.c: New file.
* gdb.guile/scm-frame-args.exp: New file.
* gdb.guile/scm-frame-args.scm: New file.
* gdb.guile/scm-frame-inline.c: New file.
* gdb.guile/scm-frame-inline.exp: New file.
* gdb.guile/scm-frame.c: New file.
* gdb.guile/scm-frame.exp: New file.
* gdb.guile/scm-generics.exp: New file.
* gdb.guile/scm-gsmob.exp: New file.
* gdb.guile/scm-iterator.c: New file.
* gdb.guile/scm-iterator.exp: New file.
* gdb.guile/scm-math.c: New file.
* gdb.guile/scm-math.exp: New file.
* gdb.guile/scm-objfile-script-gdb.in: New file.
* gdb.guile/scm-objfile-script.c: New file.
* gdb.guile/scm-objfile-script.exp: New file.
* gdb.guile/scm-objfile.c: New file.
* gdb.guile/scm-objfile.exp: New file.
* gdb.guile/scm-ports.exp: New file.
* gdb.guile/scm-pretty-print.c: New file.
* gdb.guile/scm-pretty-print.exp: New file.
* gdb.guile/scm-pretty-print.scm: New file.
* gdb.guile/scm-section-script.c: New file.
* gdb.guile/scm-section-script.exp: New file.
* gdb.guile/scm-section-script.scm: New file.
* gdb.guile/scm-symbol.c: New file.
* gdb.guile/scm-symbol.exp: New file.
* gdb.guile/scm-symtab-2.c: New file.
* gdb.guile/scm-symtab.c: New file.
* gdb.guile/scm-symtab.exp: New file.
* gdb.guile/scm-type.c: New file.
* gdb.guile/scm-type.exp: New file.
* gdb.guile/scm-value-cc.cc: New file.
* gdb.guile/scm-value-cc.exp: New file.
* gdb.guile/scm-value.c: New file.
* gdb.guile/scm-value.exp: New file.
* gdb.guile/source2.scm: New file.
* gdb.guile/types-module.cc: New file.
* gdb.guile/types-module.exp: New file.
2014-02-10 03:40:01 +00:00
gdb_test "apropos apropos" "apropos -- Search for commands matching a REGEXP.*"