aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
AgeCommit message (Collapse)AuthorFilesLines
2019-08-07Make first and last lines of 'command help documentation' consistent.Philippe Waroquiers3-6/+11
With this patch, the help docs now respect 2 invariants: * The first line of a command help is terminated by a '.' character. * The last character of a command help is not a newline character. Note that the changes for the last invariant were done by Tom, as part of : [PATCH] Remove trailing newlines from help text https://sourceware.org/ml/gdb-patches/2019-06/msg00050.html but some occurrences have been re-introduced since then. Some help docs had to be rephrased/restructured to respect the above invariants. Before this patch, print_doc_line was printing the first line of a command help documentation, but stopping at the first '.' or ',' character. This was giving inconsistent results : * The first line of command helps was sometimes '.' terminated, sometimes not. * The first line of command helps was not always designed to be readable/understandable/unambiguous when stopping at the first '.' or ',' character. This e.g. created the following inconsistencies/problems: < catch exception -- Catch Ada exceptions < catch handlers -- Catch Ada exceptions < catch syscall -- Catch system calls by their names < down-silently -- Same as the `down' command while the new help is: > catch exception -- Catch Ada exceptions, when raised. > catch handlers -- Catch Ada exceptions, when handled. > catch syscall -- Catch system calls by their names, groups and/or numbers. > down-silently -- Same as the `down' command, but does not print anything. Also, the command help doc should not be terminated by a newline character, but this was not respected by all commands. The cli-option -OPT framework re-introduced some occurences. So, the -OPT build help framework was changed to not output newlines at the end of %OPTIONS% replacement. This patch changes the help documentations to ensure the 2 invariants given above. It implied to slightly rephrase or restructure some help docs. Based on the above invariants, print_doc_line (called by 'apropos' and 'help' commands to print the first line of a command help) now outputs the full first line of a command help. This all results in a lot of small changes in the produced help docs. There are less code changes than changes in the help docs, as a lot of docs are produced by some code (e.g. the remote packet usage settings). gdb/ChangeLog 2019-08-07 Philippe Waroquiers <philippe.waroquiers@skynet.be> * cli/cli-decode.h (print_doc_line): Add for_value_prefix argument. * cli/cli-decode.c (print_doc_line): Likewise. It now prints the full first line, except when FOR_VALUE_PREFIX. In this case, the trailing '.' is not output, and the first character is uppercased. (print_help_for_command): Update call to print_doc_line. (print_doc_of_command): Likewise. * cli/cli-setshow.c (deprecated_show_value_hack): Likewise. * cli/cli-option.c (append_indented_doc): Do not append newline. (build_help_option): Append newline after first appended_indented_doc only if a second call is done. (build_help): Append 2 new lines before each option, except the first one. * compile/compile.c (_initialize_compile): Add new lines after %OPTIONS%, when not at the end of the help. Change help doc or code producing the help doc to respect the invariants. * maint-test-options.c (_initialize_maint_test_options): Likewise. Also removed the new line after 'Options:', as all other commands do not put an empty line between 'Options:' and the first option. * printcmd.c (_initialize_printcmd): Likewise. * stack.c (_initialize_stack): Likewise. * interps.c (interpreter_exec_cmd): Fix "Usage:" line that was incorrectly telling COMMAND is optional. * ada-lang.c (_initialize_ada_language): Change help doc or code producing the help doc to respect the invariants. * ada-tasks.c (_initialize_ada_tasks): Likewise. * breakpoint.c (_initialize_breakpoint): Likewise. * cli/cli-cmds.c (_initialize_cli_cmds): Likewise. * cli/cli-logging.c (_initialize_cli_logging): Likewise. * cli/cli-setshow.c (_initialize_cli_setshow): Likewise. * cli/cli-style.c (cli_style_option::add_setshow_commands, _initialize_cli_style): Likewise. * corelow.c (core_target_info): Likewise. * dwarf-index-cache.c (_initialize_index_cache): Likewise. * dwarf2read.c (_initialize_dwarf2_read): Likewise. * filesystem.c (_initialize_filesystem): Likewise. * frame.c (_initialize_frame): Likewise. * gnu-nat.c (add_task_commands): Likewise. * infcall.c (_initialize_infcall): Likewise. * infcmd.c (_initialize_infcmd): Likewise. * interps.c (_initialize_interpreter): Likewise. * language.c (_initialize_language): Likewise. * linux-fork.c (_initialize_linux_fork): Likewise. * maint-test-settings.c (_initialize_maint_test_settings): Likewise. * maint.c (_initialize_maint_cmds): Likewise. * memattr.c (_initialize_mem): Likewise. * printcmd.c (_initialize_printcmd): Likewise. * python/lib/gdb/function/strfns.py (_MemEq, _StrLen, _StrEq, _RegEx): Likewise. * ravenscar-thread.c (_initialize_ravenscar): Likewise. * record-btrace.c (_initialize_record_btrace): Likewise. * record-full.c (_initialize_record_full): Likewise. * record.c (_initialize_record): Likewise. * regcache-dump.c (_initialize_regcache_dump): Likewise. * regcache.c (_initialize_regcache): Likewise. * remote.c (add_packet_config_cmd, init_remote_threadtests, _initialize_remote): Likewise. * ser-tcp.c (_initialize_ser_tcp): Likewise. * serial.c (_initialize_serial): Likewise. * skip.c (_initialize_step_skip): Likewise. * source.c (_initialize_source): Likewise. * stack.c (_initialize_stack): Likewise. * symfile.c (_initialize_symfile): Likewise. * symtab.c (_initialize_symtab): Likewise. * target-descriptions.c (_initialize_target_descriptions): Likewise. * top.c (init_main): Likewise. * tracefile-tfile.c (tfile_target_info): Likewise. * tracepoint.c (_initialize_tracepoint): Likewise. * tui/tui-win.c (_initialize_tui_win): Likewise. * utils.c (add_internal_problem_command): Likewise. * valprint.c (value_print_option_defs): Likewise. gdb/testsuite/ChangeLog 2019-08-07 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.base/style.exp: Update tests for help doc new invariants. * gdb.base/help.exp: Likewise.
2019-08-06Add more styling to "disassemble"Tom Tromey3-1/+16
This adds more styling to the disassemble command. In particular, addresses and function names in the disassembly are now styled. This required fixing a small latent bug in set_output_style. This function always passed NULL to emit_style_escape; but when writing to a file other than gdb_stdout, it should emit the style escape directly. (FWIW this is another argument for better integrating the pager with ui_file and getting rid of this entire layer.) gdb/ChangeLog 2019-08-06 Tom Tromey <tom@tromey.com> * utils.c (set_output_style): Sometimes pass stream to emit_style_escape. * ui-out.h (class ui_out) <can_emit_style_escape>: Declare. * record-btrace.c (btrace_insn_history): Update. * mi/mi-out.h (class mi_ui_out) <can_emit_style_escape>: New method. * disasm.h (gdb_pretty_print_disassembler): Add uiout parameter. Update initializers. <m_uiout>: New field. <m_di>: Move lower. * disasm.c (gdb_pretty_print_disassembler::pretty_print_insn): Remove "uiout" parameter. (dump_insns): Update. * cli-out.h (class cli_ui_out) <can_emit_style_escape>: Declare. * cli-out.c (cli_ui_out::can_emit_style_escape): New method. gdb/testsuite/ChangeLog 2019-08-06 Tom Tromey <tom@tromey.com> * gdb.base/style.exp: Add disassemble test. * gdb.base/style.c (some_called_function): New function. (main): Use it.
2019-08-05Add block['var'] accessorChristian Biesinger2-0/+9
Currently we support iteration on blocks; this patch extends that to make subscript access work as well. gdb/ChangeLog: 2019-08-05 Christian Biesinger <cbiesinger@google.com> * NEWS: Mention dictionary access on blocks. * python/py-block.c (blpy_getitem): New function. (block_object_as_mapping): New struct. (block_object_type): Use new struct for tp_as_mapping field. gdb/doc/ChangeLog: 2019-08-05 Christian Biesinger <cbiesinger@google.com> * python.texi (Blocks In Python): Document dictionary access on blocks. gdb/testsuite/ChangeLog: 2019-08-05 Christian Biesinger <cbiesinger@google.com> * gdb.python/py-block.exp: Test dictionary access on blocks.
2019-08-05Increase timeout in gdb.mi/list-thread-groups-available.expSimon Marchi2-4/+16
Running make check-read1 TESTS="gdb.mi/list-thread-groups-available.exp" on my machine results in timeout failures. Running it while having `tail -F testsuite/gdb.log` on the side shows that the test is never really blocked, it is just slow at consuming the large output generated by `-list-thread-groups --available` (which lists all the processes on the system). If I increase the timeout to a large value, the test passes in ~30 seconds (compared to under 1 second normally). Increase the timeout for the particular mi_gdb_test that is long to execute under read1. The new timeout value is a bit arbitrary. The default timeout is 10 seconds, so I set the new timeout to be "old-timeout * 10", so 100 seconds in the typical case. gdb/testsuite/ChangeLog: PR gdb/24863 * gdb.mi/list-thread-groups-available.exp: Increase timeout for -list-thread-groups --available test when running under check-read1.
2019-08-05[gdb/testsuite] Run read1 timeout tests with with_read1_timeout_factorTom de Vries5-33/+73
When running tests with check-read1, we run into some timeouts where the tests are not easy to rewrite using gdb_test_sequence: ... FAIL: gdb.base/help.exp: help data (timeout) FAIL: gdb.base/help.exp: help files (timeout) FAIL: gdb.base/help.exp: help internals (timeout) FAIL: gdb.base/help.exp: help user-defined (timeout) FAIL: gdb.base/help.exp: help breakpoint "b" abbreviation (timeout) FAIL: gdb.base/help.exp: help breakpoint "br" abbreviation (timeout) FAIL: gdb.base/help.exp: help breakpoint "bre" abbreviation (timeout) FAIL: gdb.base/info-macros.exp: info macros 2 (timeout) FAIL: gdb.base/info-macros.exp: next (timeout) FAIL: gdb.base/info-macros.exp: info macros 3 (timeout) FAIL: gdb.base/info-macros.exp: next (timeout) FAIL: gdb.base/info-macros.exp: next (timeout) FAIL: gdb.base/info-macros.exp: info macros (timeout) FAIL: gdb.base/info-macros.exp: next (timeout) FAIL: gdb.base/info-macros.exp: next (timeout) FAIL: gdb.base/info-macros.exp: info macros 7 (timeout) FAIL: gdb.cp/nested-types.exp: ptype S10 (limit = -1) // parse failed (timeout) FAIL: gdb.cp/nested-types.exp: set print type nested-type-limit 1 (timeout) ... Fix these by increasing the timeout by a factor 10. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-08-05 Tom de Vries <tdevries@suse.de> PR testsuite/24863 * lib/gdb.exp (with_read1_timeout_factor): New proc. * gdb.base/help.exp: Use with_read1_timeout_factor. * gdb.base/info-macros.exp: Same. * gdb.cp/nested-types.exp: Same.
2019-08-05[gdb/testsuite] Fail in gdb_compile if pie results in non-PIE executableTom de Vries2-14/+72
When running gdb.base/break-idempotent.exp with --target_board=unix/-fno-PIE/-no-pie, we get: ... nr of expected passes 140 ... The test-case is compiled once with nopie and once with pie, but in both cases we end up with a non-PIE executable. The "-fno-PIE -no-pie" options specified using the target_board are interpreted by dejagnu as multilib_flags, and end up overriding the pie flags. Fix this by checking in gdb_compile if the resulting exec is non-PIE despite of a pie setting, and if so return an error: ... Running gdb/testsuite/gdb.base/break-idempotent.exp ... gdb compile failed, pie failed to generate PIE executable === gdb Summary === nr of expected passes 70 nr of untested testcases 1 ... Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-08-05 Tom de Vries <tdevries@suse.de> * lib/gdb.exp (version_at_least): Factor out of ... (tcl_version_at_least): ... here. (gdb_compile): Fail if pie results in non-PIE executable. (readelf_version, readelf_prints_pie): New proc. (exec_is_pie): Return -1 if unknown.
2019-08-05[gdb/testsuite] Fix typo in tcl_version_at_leastTom de Vries2-1/+5
In tcl_version_at_least we compare a minor against a major version number: ... } elseif { $tcl_version_major == $major \ && $tcl_version_major >= $minor } { ... Fix this by using $tcl_version_minor in the comparison instead. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-08-05 Tom de Vries <tdevries@suse.de> * lib/gdb.exp (tcl_version_at_least): Fix typo.
2019-08-04Skip GDB test reconnect-ctrl-c.exp if nointerrupts is set.Sandra Loosemore2-0/+9
2019-08-04 Sandra Loosemore <sandra@codesourcery.com> gdb/testsuite/ * gdb.server/reconnect-ctrl-c.exp: Skip if nointerrupts.
2019-08-04Add check for readline support to more GDB tab-completion tests.Sandra Loosemore2-3/+16
2019-08-04 Sandra Loosemore <sandra@codesourcery.com> gdb/testsuite/ * lib/completion-support.exp (test_gdb_complete_none): Skip tab completion tests if no readline support. (test_gdb_complete_unique_re): Likewise. (test_gdb_complete_multiple): Likewise.
2019-08-03New test for 'info sources [-dirname | -basename] [--] [REGEXP]'.Philippe Waroquiers4-0/+147
This patch introduces a test for the 'info sources' command and its new arguments [-dirname | -basename] [--] [REGEXP]. gdb/testsuite/ChangeLog 2019-08-03 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.base/info_sources.exp: New file. * gdb.base/info_sources.c: New file. * gdb.base/info_sources_base.c: New file.
2019-08-01Remove directory names from gdb.base/batch-exit-status.expPedro Franco de Carvalho2-12/+26
Adjust gdb.base/batch-exit-status.exp so that test prefixes don't show directory names for the source scripts passed with -x, to make test results from different build directories comparable. gdb/testsuite/ChangeLog: 2019-08-01 Pedro Franco de Carvalho <pedromfc@linux.ibm.com> * gdb.base/batch-exit-status.exp: Call test_exit_status with prefix argument. (test_exit_status): Add prefix argument.
2019-08-01[gdb/testsuite] Fix gdb.threads/fork-plus-threads.exp timeout with check-run1Tom de Vries2-0/+14
With gdb.threads/fork-plus-threads.exp and check-run1 we get: ... FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: \ inferior 1 exited (timeout) ... Fix this by calling exp_continue for new thread and thread exited messages. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-08-01 Tom de Vries <tdevries@suse.de> PR testsuite/24863 * gdb.threads/fork-plus-threads.exp: Fix check-run1 timeout by calling exp_continue for new thread and thread exited messages.
2019-08-01[gdb/testsuite] Fix gdb.base/structs.exp timeout with check-read1Tom de Vries3-1/+44
With gdb.base/structs.exp and check-read1 we get: ... FAIL: gdb.base/structs.exp: p chartest (timeout) ... Fix this by using gdb_test_sequence. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-08-01 Tom de Vries <tdevries@suse.de> PR testsuite/24863 * gdb.base/structs.exp: Fix check-read1 timeout using gdb_test_sequence. * lib/gdb.exp (tcl_version_at_least, lrepeat): New proc.
2019-08-01[gdb/testsuite] Fix gdb.base/break-interp.exp timeout with check-read1Tom de Vries2-0/+14
With gdb.base/break-interp.exp and check-read1, we run get: ... FAIL: gdb.base/break-interp.exp: LDprelinkNOdebugNO: \ BINprelinkNOdebugNOpieNO: symbol-less: info files (timeout) FAIL: gdb.base/break-interp.exp: LDprelinkNOdebugNO: \ BINprelinkNOdebugNOpieYES: symbol-less: info files (timeout) FAIL: gdb.base/break-interp.exp: LDprelinkNOdebugIN: \ BINprelinkNOdebugNOpieNO: symbol-less: info files (timeout) FAIL: gdb.base/break-interp.exp: LDprelinkNOdebugIN: \ BINprelinkNOdebugNOpieYES: symbol-less: info files (timeout) ... Fix this by calling exp_continue after each "info files" line. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-08-01 Tom de Vries <tdevries@suse.de> PR testsuite/24863 * gdb.base/break-interp.exp: Use exp_continue after each "info files" line.
2019-08-01[gdb/testsuite] Fix gdb.base/signals.exp timeout with check-read1Tom de Vries2-2/+20
With gdb.base/signals.exp and check-read1 we get: ... FAIL: gdb.base/signals.exp: info signals (timeout) ... Fix this by using gdb_test_sequence. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-08-01 Tom de Vries <tdevries@suse.de> PR testsuite/24863 * gdb.base/signals.exp: Fix check-read1 timeout using gdb_test_sequence.
2019-07-30Allow nested function displaysTom Tromey5-0/+109
In Ada, it's possible to have nested functions. However, block.c:contained_in does not recognize this. Normally, this is no problem, but if gdb is stopped inside a nested function, then you can end up in the unexpected situation that "print" of an expression will work, whereas "display" of the same expression will not -- because contained_in returns 0. This patch simply removes the BLOCK_FUNCTION check from contained_in. The rationale here is that in languages without nested functions, this will not cause any issues. gdb/ChangeLog 2019-07-30 Tom Tromey <tromey@adacore.com> * block.c (contained_in): Remove BLOCK_FUNCTION check. gdb/testsuite/ChangeLog 2019-07-30 Tom Tromey <tromey@adacore.com> * gdb.ada/display_nested.exp: New file. * gdb.ada/display_nested/foo.adb: New file. * gdb.ada/display_nested/pack.adb: New file. * gdb.ada/display_nested/pack.ads: New file.
2019-07-30[PR/24474] Add gdb.lookup_static_symbol to the python APIChristian Biesinger3-0/+35
Similar to lookup_global_symbol, except that it checks the STATIC_SCOPE. gdb/ChangeLog: 2019-07-30 Christian Biesinger <cbiesinger@google.com> PR/24474: Add a function to lookup static variables. * NEWS: Mention this new function. * python/py-symbol.c (gdbpy_lookup_static_symbol): New function. * python/python-internal.h (gdbpy_lookup_static_symbol): New function. * python/python.c (python_GdbMethods): Add new function. gdb/doc/ChangeLog: 2019-07-30 Christian Biesinger <cbiesinger@google.com> * python.texi (Symbols In Python): Document new function gdb.lookup_static_symbol. gdb/testsuite/ChangeLog: 2019-07-30 Christian Biesinger <cbiesinger@google.com> * gdb.python/py-symbol.c: Add a static variable and one in an anonymous namespace. * gdb.python/py-symbol.exp: Test gdb.lookup_static_symbol.
2019-07-30Add missing changelog entryChristian Biesinger1-0/+4
I forgot to commit the change before pushing commit 25ec8924842a215e7f684d3a5076607409ac822f
2019-07-30[gdb/testsuite] Work around tcl bug in libsegfault.exp with check-read1Tom de Vries2-1/+10
When running libsegfault.exp with check-read1, I get: ... Running gdb/testsuite/gdb.base/libsegfault.exp ... ERROR: tcl error sourcing gdb/testsuite/gdb.base/libsegfault.exp. ERROR: no such variable (read trace on "env(LD_PRELOAD)") invoked from within "set env(LD_PRELOAD)" ("uplevel" body line 1) invoked from within "uplevel 1 [list set $var]" invoked from within "if [uplevel 1 [list array exists $var]] { set saved_arrays($var) [uplevel 1 [list array get $var]] } else { set saved_scalars($var) [uplevel ..." invoked from within "if [uplevel 1 [list info exists $var]] { if [uplevel 1 [list array exists $var]] { set saved_arrays($var) [uplevel 1 [list array get $var]] ..." (procedure "save_vars" line 11) invoked from within "save_vars { env(LD_PRELOAD) } { if { ![info exists env(LD_PRELOAD) ] || $env(LD_PRELOAD) == "" } { set env(LD_PRELOAD) "$lib" } else { ..." (procedure "gdb_spawn_with_ld_preload" line 4) invoked from within "gdb_spawn_with_ld_preload $libsegfault """ ... There are several things here interacting with environment variable LD_PRELOAD: - the expect "binary" build/gdb/testsuite/expect-read1 with does export LD_PRELOAD=build/gdb/testsuite/read1.so before calling native expect - read1.so which does unsetenv ("LD_PRELOAD") upon first call to read - the test-case, which wants to set or append libSegFault.so to LD_PRELOAD The error occurs when accessing $env(LD_PRELOAD), in a branch where "info exists env(LD_PRELOAD)" returns true. AFAIU, this is https://core.tcl-lang.org/tcl/tktview?name=67fd4f973a "incorrect results of 'info exists' when unset env var in one interp and check for existence from another interp". Work around the tcl bug by not unsetting the variable, but setting it to "" instead: ... - unsetenv ("LD_PRELOAD"); + setenv ("LD_PRELOAD", "", 1); ... Verified that reverting commit de28a3b72e "[gdb/testsuite, 2/2] Fix gdb.linespec/explicit.exp with check-read1" reintroduced the check-read1 failure in gdb.linespec/explicit.exp. This fixes a similar error in attach-slow-waitpid.exp, which also sets LD_PRELOAD. Tested on x86_64-linux with check-read1. gdb/testsuite/ChangeLog: 2019-07-30 Tom de Vries <tdevries@suse.de> * lib/read1.c (read): Don't use unsetenv (v), use setenv (v, "", 1) instead.
2019-07-30[gdb/testsuite] Fail in gdb_compile if nopie results in PIE executableTom de Vries2-0/+24
When running gdb.base/dump.exp with --target_board=unix/-fPIE/-pie, we get: ... Running gdb/testsuite/gdb.base/dump.exp ... FAIL: gdb.base/dump.exp: dump array as value, intel hex ... The FAIL happens because although the test specifies nopie, the exec is in fact compiled as PIE. The "-fPIE -pie" options specified using the target_board are interpreted by dejagnu as multilib_flags, and end up overriding the nopie flags. Fix this by checking in gdb_compile if the resulting exec is PIE despite of a nopie setting, and if so return an error: ... Running gdb/testsuite/gdb.base/dump.exp ... gdb compile failed, nopie failed to prevent PIE executable === gdb Summary === nr of untested testcases 1 ... Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-07-30 Tom de Vries <tdevries@suse.de> PR testsuite/24834 * lib/gdb.exp (gdb_compile): Fail if nopie results in PIE executable. (exec_is_pie): New proc.
2019-07-29Fix misspelling (nonexistant -> nonexistent)Christian Biesinger1-2/+2
gdb/testsuite/ChangeLog: 2019-07-29 Christian Biesinger <cbiesinger@google.com> * gdb.python/py-objfile.exp: Fix misspelling (nonexistant -> nonexistent)
2019-07-29Add Objfile.lookup_{global,static}_symbol functionsChristian Biesinger3-0/+23
This is essentially the inverse of Symbol.objfile. This allows handling different symbols with the same name (but from different objfiles) and can also be faster if the objfile is known. gdb/ChangeLog: 2019-07-29 Christian Biesinger <cbiesinger@google.com> * NEWS: Mention new functions Objfile.lookup_{global,static}_symbol. * python/py-objfile.c (objfpy_lookup_global_symbol): New function. (objfpy_lookup_static_symbol): New function. (objfile_object_methods): Add new functions. gdb/doc/ChangeLog: 2019-07-29 Christian Biesinger <cbiesinger@google.com> * python.texi (Objfiles In Python): Document new functions Objfile.lookup_{global,static}_symbol. gdb/testsuite/ChangeLog: 2019-07-29 Christian Biesinger <cbiesinger@google.com> * gdb.python/py-objfile.c: Add global and static vars. * gdb.python/py-objfile.exp: Test new functions Objfile. lookup_global_symbol and lookup_static_symbol.
2019-07-29Two fixes for test suite's terminalTom Tromey2-1/+31
Exactly which escape sequences are emitted by gdb in TUI mode are determined largely by the curses implementation. Testing my latest (as yet unsubmitted) series to refactor the TUI showed a couple of failures that I tracked to the test suite's terminal implementation. In particular, the CSI "@" sequence was not implemented; and the CSI "X" sequence was implemented incorrectly. This patch fixes both of these problems. Tested on x86-64 Fedora 28. gdb/testsuite/ChangeLog 2019-07-29 Tom Tromey <tom@tromey.com> * lib/tuiterm.exp (Term::_csi_@): New proc. (Term::_csi_X): Don't move cursor.
2019-07-29Test 'set print frame-info|frame-arguments presence'.Philippe Waroquiers5-5/+144
Updated tests to test the new options and new values. Test the default for print_what in python frame filtering. Updated the tests impacted by the default in python frame filtering which is now consistent with the backtrace command. gdb/testsuite/ChangeLog 2019-07-29 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.base/options.exp: Update backtrace - completion to new option -frame-info. * gdb.base/frame-args.exp: Test new 'frame-arguments presence'. Test new 'set print frame-info'. Test backtrace -frame-info overriding 'set print frame-info'. * gdb.python/py-framefilter.exp: Test new 'frame-arguments presence'. Test new 'set print frame-info'. Verify consistency of backtrace with and without filters, with and without -no-filters. * gdb.python/py-framefilter-invalidarg.exp: Update to new print_what default.
2019-07-29[gdb/testsuite, 2/2] Fix gdb.linespec/explicit.exp with check-read1Tom de Vries2-1/+6
When running gdb.linespec/explicit.exp with check-read1, we get: ... (gdb) PASS: gdb.linespec/explicit.exp: set max-completions unlimited break  -function ... top (gdb) PASS: gdb.linespec/explicit.exp: complete with no arguments break -function ... top (gdb) FAIL: gdb.linespec/explicit.exp: complete with no arguments (clearing input line) ... The problem is that the send_gdb "\t\t" triggers completion twice: ... set tst "complete with no arguments" send_gdb "break \t" gdb_test_multiple "" $tst { "break \\\x07" { send_gdb "\t\t" gdb_test_multiple "" $tst { ... } clear_input_line $tst ... but the following gdb_test_multiple only parses it once, so the second completion is left for clear_input_line, which fails. Fix this by triggering completion only once. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-07-29 Tom de Vries <tdevries@suse.de> * gdb.linespec/explicit.exp: Fix completion trigger for "complete with no arguments".
2019-07-29[gdb/testsuite, 1/2] Fix gdb.linespec/explicit.exp with check-read1Tom de Vries2-14/+6
When running gdb.linespec/explicit.exp with check-read1, we get: ... (gdb) PASS: gdb.linespec/explicit.exp: complete unique file name: break -source "3explicit.c" break -source exp^Glicit^G^M explicit.c explicit2.c ^M (gdb) FAIL: gdb.linespec/explicit.exp: complete non-unique file name ... The problem is that we have a gdb_test_multiple where we match two regexps: ... set tst "complete non-unique file name" send_gdb "break -source exp\t" gdb_test_multiple "" $tst { -re "break -source exp\\\x07licit" { ... } -re "break -source exp\\\x07l" { # This pattern may occur when glibc debuginfo is installed. ... } } ... but since second is a substring of the first, we'll usually match the first, but with check-read1 we'll match the second. Fix this by using a single regexp and merging the related code. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-07-29 Tom de Vries <tdevries@suse.de> * gdb.linespec/explicit.exp: Fix gdb_test_multiple regexps where second is a substring of the first for "complete non-unique file name".
2019-07-29[gdb/testsuite] Fix python.exp with check-read1Tom de Vries2-2/+7
when running python/python.exp with check-read1, we get: ... (gdb) PASS: gdb.python/python.exp: prompt substitution readline - end python gdb.prompt_hook = error_prompt^M Python Exception <type 'exceptions.RuntimeError'> Python exception calledPASS: gdb.python/python.exp: set hook : ^M (gdb) PASS: gdb.python/python.exp: set the hook to default python gdb.prompt_hook = None^M (gdb) PASS: gdb.python/python.exp: set print-stack full for prompt error test set python print-stack full^M (gdb) FAIL: gdb.python/python.exp: set the hook python gdb.prompt_hook = error_prompt^M Traceback (most recent call last):^M File "<string>", line 3, in error_prompt^M RuntimeError: Python exception called^M (gdb) FAIL: gdb.python/python.exp: set the hook to default ... The problem is that gdb_test_multiple here: ... gdb_test_multiple "python gdb.prompt_hook = error_prompt" "set the hook" { -re "Python Exception (exceptions.RuntimeError|<(type 'exceptions.|class ')RuntimeError'>) Python excepti on called.*" { pass "set hook" } } ... specifies a regexp that ends with ".*" but doesn't specify the expected $gdb_prompt. Consequently, due to check-read1, the ".*" is matched to "" and the remaining $gdb_prompt is read by the the following gdb_py_test_silent_cmd, which has its own $gdb_prompt read by the following gdb_py_test_silent_cmd, which has its own $gdb_prompt causing a mismatch for the following gdb_test_multiple: ... gdb_test_multiple "python gdb.prompt_hook = error_prompt" "set the hook" { -re "Traceback.*File.*line.*RuntimeError.*Python exception called.*" { pass "set hook" } } ... which causes both FAILs. The second gdb_test_multiple has the same problem as the first, but it happens not to cause a FAIL because it's followed by a gdb_py_test_silent_cmd and a clean_restart. Fix the regexps in both gdb_test_multiple calls. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-07-29 Tom de Vries <tdevries@suse.de> * gdb.python/python.exp: Don't terminate gdb_test_multiple regexp with ".*".
2019-07-29[gdb/testsuite] Fix mi-catch-cpp-exceptions.exp and mi-nonstop.exp with ↵Tom de Vries2-2/+7
check-read1 With check-read1 we get: ... FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: check for stap probe in libstdc++ FAIL: gdb.mi/mi-nonstop.exp: probe for target remote ... In both cases this is due to using gdb_test_multiple (which expects $gdb_prompt by default) in combination with gdb using $gdb_mi_prompt, similar to the problem fixed by commit d17725d72f "Don't expect gdb_prompt in mi_skip_python_test". Fix this by adding the $prompt_regexp argument to the gdb_test_multiple calls. gdb/testsuite/ChangeLog: 2019-07-29 Tom de Vries <tdevries@suse.de> * lib/gdb.exp (skip_libstdcxx_probe_tests_prompt, gdb_is_target_1): Pass prompt_regexp parameter to gdb_test_multiple calls.
2019-07-29[gdb/testsuite] Fix gdb.base/maint.exp with check-read1Tom de Vries2-3/+8
With gdb.base/maint.exp and check-read1, we get: ... FAIL: gdb.base/maint.exp: maint print registers ... Using this patch: ... diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp index a7675ea215..b81d7ec660 100644 --- a/gdb/testsuite/gdb.base/maint.exp +++ b/gdb/testsuite/gdb.base/maint.exp @@ -81,7 +81,9 @@ gdb_test_multiple $test $test { exp_continue } -re "$gdb_prompt $" { - gdb_assert { $saw_registers && $saw_headers } $test + gdb_assert { $saw_headers } "$test: saw headers" + gdb_assert { $saw_registers } "$test: saw registers" + pass "$test: got prompt" } } ... We get more information: ... PASS: gdb.base/maint.exp: maint print registers: saw headers FAIL: gdb.base/maint.exp: maint print registers: saw registers PASS: gdb.base/maint.exp: maint print registers: got prompt ... The problem is that when matching: ... (gdb) maint print registers^M Name Nr Rel Offset Size Type ^M rax 0 0 0 8 int64_t ^M ... the regexp for $saw_headers ends in "\[\r\n\]+", which allows it to match only the "\r". The remaining "\n" then start the next line to be matched, which doesn't match for the $saw_registers regexp since it starts with "^\[^\r\n\]+". Fix this by ending the regexps with "\r\n". Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-07-29 Tom de Vries <tdevries@suse.de> * gdb.base/maint.exp: Use "\r\n" instead of "\[\r\n\]+" in "maint print registers" regexps.
2019-07-29[gdb/testsuite] Fix gdb.base/define.exp with check-read1Tom de Vries2-1/+5
When running gdb.base/define.exp with check-read1, we get: ... show prompt^M Gdb's prompt is "(gdb) ".^M (gdb) PASS: gdb.base/define.exp: save gdb_prompt set prompt \(blah\) ^M (blah) PASS: gdb.base/define.exp: set gdb_prompt set prompt (gdb) PASS: gdb.base/define.exp: reset gdb_prompt ^M (gdb) FAIL: gdb.base/define.exp: define do-define ... The problem is that the "$gdb_prompt $" regexp here: ... gdb_test_multiple "set prompt $prior_prompt " "reset gdb_prompt" { -re "$gdb_prompt $" { pass "reset gdb_prompt" } } ... triggers for the echoing of the command "set prompt $prior_prompt " rather than for the prompt after the command has executed. Fix this by changing the regexp to "\r\n$gdb_prompt $". Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-07-29 Tom de Vries <tdevries@suse.de> * gdb.base/define.exp: Add "\r\n" to "reset gdb_prompt" regexp.
2019-07-29[gdb/testsuite] Don't expect gdb_prompt in mi_skip_python_testTom de Vries2-13/+26
When running gdb.python/py-mi-events.exp with make check-read1, we get: ... (gdb) ^M python print ('test')^M &"python print ('test')\n"^M ~"test\n"^M ^done^M (gdb) FAIL: gdb.python/py-mi-events.exp: verify python support ^M python print (sys.version_info[0])^M &"python print (sys.version_info[0])\n"^M ~"2\n"^M ^done^M (gdb) FAIL: gdb.python/py-mi-events.exp: check if python 3 ^M ... The FAILs happen as follows. On one hand, skip_python_tests_prompt uses the prompt_regexp parameter for the user_code argument of gdb_test_multiple: ... proc skip_python_tests_prompt { prompt_regexp } { global gdb_py_is_py3k gdb_test_multiple "python print ('test')" "verify python support" { -re "not supported.*$prompt_regexp" { unsupported "Python support is disabled." return 1 } -re "$prompt_regexp" {} } gdb_test_multiple "python print (sys.version_info\[0\])" "check if python 3" { -re "3.*$prompt_regexp" { set gdb_py_is_py3k 1 } -re ".*$prompt_regexp" { set gdb_py_is_py3k 0 } } ... On the other hand, gdb_test_multiple itself uses $gdb_prompt: ... -re "\r\n$gdb_prompt $" { if ![string match "" $message] then { fail "$message" } set result 1 } ... So when mi_skip_python_test calls skip_python_tests_prompt with prompt_regexp set to $mi_gdb_prompt: ... proc mi_skip_python_tests {} { global mi_gdb_prompt return [skip_python_tests_prompt "$mi_gdb_prompt$"] } ... and expect reads "(gdb) " and tries to match it (due to the READ1=1 setting), the user_code regexps using $prompt_regexp (set to $mi_gdb_prompt) don't match, but the $gdb_prompt regexp in gdb_test_multiple does match. Fix this by adding a prompt_regexp parameter to gdb_test_multiple, and using the parameter in skip_python_tests_prompt. Tested gdb.python/py-mi-events.exp with make check READ1=1 x86_64-linux. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-07-29 Tom de Vries <tdevries@suse.de> PR gdb/24855 * lib/gdb.exp (gdb_test_multiple): Add prompt_regexp parameter. (skip_python_tests_prompt): Add prompt_regexp argument to gdb_test_multiple calls.
2019-07-27Add test that "file" shows "main"Tom Tromey2-0/+38
This adds a new test that checks that the "file" command will show the program's "main". gdb/testsuite/ChangeLog 2019-07-27 Tom Tromey <tom@tromey.com> * gdb.tui/main.exp: New file.
2019-07-27Add test case for empty TUI windowsTom Tromey3-3/+117
My original intent here was to add a test case to test that empty TUI windows re-render their contents after a resize. However, this seems pretty broken at the moment, so a lot of the test is actually disabled. gdb/testsuite/ChangeLog 2019-07-27 Tom Tromey <tom@tromey.com> * lib/tuiterm.exp (Term::clean_restart): Make "executable" optional. * gdb.tui/empty.exp: New file.
2019-07-27Add TUI resizing testTom Tromey3-0/+93
This adds a test case that resizes the terminal and then checks that the TUI updates properly. gdb/testsuite/ChangeLog 2019-07-27 Tom Tromey <tom@tromey.com> * lib/tuiterm.exp (spawn): New proc. (Term::resize): New proc. * gdb.tui/resize.exp: New file.
2019-07-27Add TUI test for "list"Tom Tromey2-0/+41
This adds a test to check that the "list" command will update the TUI source window. gdb/testsuite/ChangeLog 2019-07-27 Tom Tromey <tom@tromey.com> * gdb.tui/list.exp: New file.
2019-07-27Add TUI register window testTom Tromey2-0/+52
This adds a very simple test of the TUI register window. gdb/testsuite/ChangeLog 2019-07-27 Tom Tromey <tom@tromey.com> * gdb.tui/regs.exp: New file.
2019-07-27Add "layout split" testTom Tromey2-0/+13
This adds a test of "layout split" to the TUI test suite. gdb/testsuite/ChangeLog 2019-07-27 Tom Tromey <tom@tromey.com> * gdb.tui/basic.exp: Add "layout split" test.
2019-07-27Add test for "layout asm"Tom Tromey2-0/+9
This adds a very simple test for "layout asm". gdb/testsuite/ChangeLog 2019-07-27 Tom Tromey <tom@tromey.com> * gdb.tui/basic.exp: Add "layout asm" test.
2019-07-27A virtual terminal for the test suiteTom Tromey3-0/+572
This patch implements a simple ANSI terminal emulator for the test suite. It is still quite basic, but it is good enough to allow some simple TUI testing to be done. gdb/testsuite/ChangeLog 2019-07-27 Tom Tromey <tom@tromey.com> * lib/tuiterm.exp: New file. * gdb.tui/basic.exp: New file.
2019-07-27Fix stepping bug associated with non-contiguous blocksKevin Buettner2-13/+30
I recently noticed the following behavior while debugging dw2-ranges-func-low-cold. This is one of the test programs associated with the test gdb.dwarf2/dw2-ranges-func.exp. (gdb) b 70 Breakpoint 1 at 0x401129: file dw2-ranges-func-lo-cold.c, line 70. (gdb) run Starting program: dw2-ranges-func-lo-cold Breakpoint 1, foo () at dw2-ranges-func-lo-cold.c:70 70 if (e) foo_cold (); /* foo foo_cold call */ (gdb) set var e=1 (gdb) step [Inferior 1 (process 12545) exited normally] This is incorrect. When stepping, we expect a step to occur. We do not expect the program to exit. Instead, we should see the following behavior: ... (gdb) set var e=1 (gdb) step foo () at dw2-ranges-func-lo-cold.c:54 54 baz (); /* foo_cold baz call */ (Note that I've shortened the paths in the above sessions to improve readability.) The bug is in fill_in_stop_func() in infrun.c. While working on non-contiguous address range improvements in 2018, I replaced the call to find_pc_partial_function() with a call to find_function_entry_range_from_pc(). Although this seemed like the right thing to do at the time, I now think that calling find_pc_partial_function (along with some other tweaks) is the right thing to do. For blocks with a single contiguous range, these functions do pretty much the same thing: when the function succeeds, the function name, start address, and end address are all filled in. Additionally, find_pc_partial_function contains an additional output parameter which is set to the block containing that PC. For blocks with non-contiguous ranges, find_pc_partial_function sets the start and end addresses to the start and end addresses of the range containing the pc. find_function_entry_range_from_pc does what it says; it sets the start and end addresses to those of the range containing the entry pc. The reason that I had thought that using the entry pc range was correct is due to the fact that fill_in_stop_func() contains some code for advancing past the function start and entry point. To do this, we'd need the range that contains the entry pc. However, when stepping, we actually want the range that contains the stop pc. If that range also contains the entry pc, we should then attempt to advance stop_func_start past the start offset and entry point. (I haven't thought very hard about the reason for advancing the stop_func_start in this manner. Since it's been there for quite a while, I'm assuming that it's still a good idea.) Back when I wrote the test case, I had included a test for doing the step shown in the example above. I had problems with it, however. At the time, I thought it was due to differing compiler versions, so I disabled that portion of the test. I have now reenabled those tests, but have left in place the logic which may be used to disable it. The changes to dw2-ranges-func.exp depend on my other recent changes to the file which have not been pushed yet. Finally, I'll note that the only caller of find_function_entry_range_from_pc() is/was fill_in_stop_func(). Once this commit goes in, it'll be dead code. I considered removing it, but I think that it ought to be used (instead of find_pc_partial_function) for determining the correct range to scan for prologue analysis, so I'm going to leave it in place for now. gdb/ChangeLog: * infrun.c (fill_in_stop_func): Use find_pc_partial_function instead of find_function_entry_range_from_pc. testsuite/ChangeLog: * gdb.dwarf2/dw2-ranges-func.exp (enable_foo_cold_stepping): Enable tests associated with this flag. Adjust regex referencing "foo_low" to now refer to "foo_cold" instead.
2019-07-27Improve test gdb.dwarf2/dw2-ranges-func.expKevin Buettner4-339/+495
The original dw2-ranges-func.exp test caused a function named foo to be created with two non-contiguous address ranges. In the C source file, a function named foo_low was incorporated into the function foo which was also defined in that file. The DWARF assembler is used to do this manipulation. The source file had been laid out so that foo_low would likely be placed (by the compiler and linker) at a lower address than foo(). The case where a range at a higher set of addresses (than foo) was not being tested. In a recent discussion on gdb-patches, it became clear that performing such tests are desirable because bugs were discovered which only became evident when the other range was located at high(er) addresses than the range containing the entry point for the function. This other (non entry pc) address range is typically used for "cold" code which executes less frequently. Thus, I renamed foo_low to foo_cold and renamed the C source file from dw-ranges-func.c to dw-ranges-func-lo.c. I then made a copy of this file, naming it dw-ranges-func-hi.c. (That was my intent anyway. According to git, I renamed dw-ranges-func.c to dw-ranges-func-hi.c and then modified it. dw-ranges-func-lo.c shows up as an entirely new file.) Within dw-ranges-func-hi.c, I changed the placement of foo_cold() along with some of the other functions so that foo_cold() would be at a higher address than foo() while also remaining non-contiguous. The two files, dw-ranges-func-lo.c and dw-ranges-func-hi.c, are essentially the same except for the placement of some of the functions therein. The tests in dw2-ranges-func.exp where then wrapped in a new proc named do_test which was then called in a loop from the outermost level. The loop causes each of the source files to have the same tests run upon them. I also added a few new tests which test functionality fixed by the other commits to this patch series. Due to the reorganization of the file, it's hard to identify these changes in the patch. So, here are the tests which were added: with_test_prefix "no-cold-names" { # Due to the calling sequence, this backtrace would normally # show function foo_cold for frame #1. However, we don't want # this to be the case due to placing it in the same block # (albeit at a different range) as foo. Thus it is correct to # see foo for frames #1 and #2. It is incorrect to see # foo_cold at frame #1. gdb_test_sequence "bt" "backtrace from baz" { "\[\r\n\]#0 .*? baz \\(\\) " "\[\r\n\]#1 .*? foo \\(\\) " "\[\r\n\]#2 .*? foo \\(\\) " "\[\r\n\]#3 .*? main \\(\\) " } # Doing x/2i foo_cold should show foo_cold as the first symbolic # address and an offset from foo for the second. We also check to # make sure that the offset is not too large - we don't GDB to # display really large offsets that would (try to) wrap around the # address space. set foo_cold_offset 0 set test "x/2i foo_cold" gdb_test_multiple $test $test { -re " (?:$hex) <foo_cold>.*?\n (?:$hex) <foo\[+-\](\[0-9\]+)>.*${gdb_prompt}" { set foo_cold_offset $expect_out(1,string) pass $test } } gdb_assert {$foo_cold_offset <= 10000} "offset to foo_cold is not too large" # Likewise, verify that second address shown by "info line" is at # and offset from foo instead of foo_cold. gdb_test "info line *foo_cold" "starts at address $hex <foo_cold> and ends at $hex <foo\[+-\].*?>.*" } When run against a GDB without the requisite bug fixes (from this patch series), these 6 failures should be seen: FAIL: gdb.dwarf2/dw2-ranges-func.exp: lo-cold: no-cold-names: backtrace from baz (pattern 4) FAIL: gdb.dwarf2/dw2-ranges-func.exp: lo-cold: no-cold-names: x/2i foo_cold FAIL: gdb.dwarf2/dw2-ranges-func.exp: lo-cold: no-cold-names: info line *foo_cold FAIL: gdb.dwarf2/dw2-ranges-func.exp: hi-cold: no-cold-names: backtrace from baz (pattern 3) FAIL: gdb.dwarf2/dw2-ranges-func.exp: hi-cold: no-cold-names: x/2i foo_cold FAIL: gdb.dwarf2/dw2-ranges-func.exp: hi-cold: no-cold-names: info line *foo_cold gdb/testsuite/ChangeLog: * gdb.dwarf2/dw2-ranges-func.c: Rename to... * gdb.dwarf2/dw2-ranges-func-lo-cold.c: ...this. * gdb.dwarf2/dw2-ranges-func-lo-cold.c (foo_low): Change name to foo_cold. Revise comments to match. * gdb.dwarf2/dw2-ranges-func-hi-cold.c: New file. * gdb.dwarf2/dw2-ranges-func.exp (do_test): New proc. Existing tests were wrapped into this proc; Call do_test in loop from outermost level. (foo_low): Rename all occurrences to "foo_cold". (backtrace from baz): New test. (x2/i foo_cold): New test. (info line *foo_cold): New test.
2019-07-26[gdb/testsuite] Fix unterminated string in i386-pkru.expTom de Vries2-1/+5
I ran into this error: ... ERROR: tcl error sourcing gdb/testsuite/gdb.arch/i386-pkru.exp. ERROR: missing " while executing "untested "" invoked from within "if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ [list debug additional_flags=${comp_flags}]] } { untested "failed to c..." (file "gdb/testsuite/gdb.arch/i386-pkru.exp" line 25) invoked from within ... caused by: ... untested "failed to compile x86 PKEYS test. ... Fix the unterminated string. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-07-26 Tom de Vries <tdevries@suse.de> * gdb.arch/i386-pkru.exp: Fix unterminated string.
2019-07-25[gdb/testsuite] Test skip_libstdcxx_probe_tests in mi-catch-cpp-exceptions.expTom de Vries4-44/+88
On a system without SDT probes in libstdc++, we run into: ... FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until \ breakpoint in main (unknown output after running) ... The test-case uses a regexp argument for the catch throw/rethrow/catch command, which is only supported on systems with SDT probes in libstdc++. Fix this by marking the portions of the test-case that use a regexp argument as unsupported on a system without SDT probes. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-07-25 Tom de Vries <tdevries@suse.de> PR testsuite/24830 * gdb.mi/mi-catch-cpp-exceptions.exp: Call mi_skip_libstdcxx_probe_tests, and skip unsupported tests. * lib/gdb.exp (skip_libstdcxx_probe_tests_prompt): Factor out of ... (skip_libstdcxx_probe_tests): ... here. * lib/mi-support.exp (mi_skip_libstdcxx_probe_tests): New proc.
2019-07-24[gdb/testsuite] Fix implicit declaration of printf in gdb.objc/*.mTom de Vries4-0/+10
When running gdb.objc/objcdecode.exp we get: ... objcdecode.m: In function '-[Decode multipleDef]': objcdecode.m:14:3: warning: incompatible implicit declaration of built-in \ function 'printf' printf("method multipleDef\n"); ^~~~~~ objcdecode.m:14:3: note: include '<stdio.h>' or provide a declaration of \ 'printf' ... Fix this in the three gdb.objc/*.m test-cases by including stdio.h. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-07-24 Tom de Vries <tdevries@suse.de> PR testsuite/24807 * gdb.objc/basicclass.m: Include stdio.h. * gdb.objc/nondebug.m: Same. * gdb.objc/objcdecode.m: Same.
2019-07-24[gdb/testsuite] Fix infoline-reloc-main-from-zero.exp compilationTom de Vries2-1/+7
When running gdb.base/infoline-reloc-main-from-zero.exp, I see: ... Running gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp ... gdb compile failed, ld: infoline-reloc-main-from-zero: \ not enough room for program headers, try linking with -N ld: final link failed: bad value collect2: error: ld returned 1 exit status UNTESTED: gdb.base/infoline-reloc-main-from-zero.exp: infoline-reloc-main-from-zero.exp UNTESTED: gdb.base/infoline-reloc-main-from-zero.exp: failed to compile ... Fix this by following the suggestion: ... -set opts {debug "additional_flags=-nostdlib -emain -Wl,-Ttext=0x00"} +set opts {debug "additional_flags=-nostdlib -emain -Wl,-Ttext=0x00 -Wl,-N"} ... Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-07-24 Tom de Vries <tdevries@suse.de> PR testsuite/24612 * gdb.base/infoline-reloc-main-from-zero.exp: Add -Wl,-N to additional_flags.
2019-07-24Update expected info threads error messages in gdb.multi/tids.expTom de Vries2-7/+19
We currently have these FAILs: ... FAIL: gdb.multi/tids.exp: two inferiors: info threads -1 FAIL: gdb.multi/tids.exp: two inferiors: info threads -$one ... because we're expecting: ... Invalid thread ID: -1 ... but instead we have: ... Unrecognized option at: -1 ... This error message for info threads has changed since commit 54d6600669 'Make "info threads" use the gdb::option framework'. Update the test accordingly. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-07-24 Tom de Vries <tdevries@suse.de> PR testsuite/24831 * gdb.multi/tids.exp: Update error messages for info threads.
2019-07-24[gdb/testsuite] Fix info-types.exp for debug info from more than one fileTom de Vries2-2/+11
On openSUSE Leap 15.0, I get: ... FAIL: gdb.base/info-types.exp: l=c: info types FAIL: gdb.base/info-types.exp: l=c++: info types ... because the info type command prints info for files info-types.c, stddef.h, elf-init.c and init.c, while the regexp in the test-case expect only info for info-types.c. Fix this by extending the regexp. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-07-24 Tom de Vries <tdevries@suse.de> * gdb.base/info-types.exp: Allow info types to print info for more than one file.
2019-07-23[gdb/testsuite] Add missing initial prompt read in multidictionary.expTom de Vries2-0/+12
When running multidictionary.exp in conjunction with: ... $ stress -c $(($(cat /proc/cpuinfo | grep -c "^processor") + 1)) ... we get: ... Running gdb/testsuite/gdb.dwarf2/multidictionary.exp ... ERROR: Couldn't load multidictionary into gdb. === gdb Summary === nr of unresolved testcases 1 ... The multidictionary test-case needs -readnow, and achieves this using: ... gdb_spawn_with_cmdline_opts "-readnow" gdb_load ... but the initial gdb prompt is not read. Usually, the following gdb_load command accidentally consumes that initial prompt (at the gdb_expect for the kill command in gdb_file_cmd). But under high load, that doesn't happen and we run into the error. Fix this by consuming the initial gdb prompt after spawning gdb. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-07-23 Tom de Vries <tdevries@suse.de> PR testsuite/24842 * gdb.dwarf2/multidictionary.exp: Consume initial prompt after gdb_spawn_with_cmdline_opts.
2019-07-23[gdb][Arm]: gdb cannot step across CMSE secure entry function code.Srinath Parvathaneni3-0/+105
GDB is not able to execute "step" command on function calls of Armv8-M cmse secure entry functions. Everytime GNU linker come across definition of any cmse secure entry function in object file(s), it creates two new instructions secure gateway (sg) and original branch destination (b.w), place those two instructions in ".gnu.sgstubs" section of executable. Any function calls to these cmse secure entry functions is re-directed through secure gateway (sg) present in ".gnu.sgstubs" section. Example: Following is a function call to cmse secure entry function "foo": ... bl xxxx <foo> --->(a) ... <foo> xxxx: push {r7, lr} GNU linker on finding out "foo" is a cmse secure entry function, created sg and b.w instructions and place them in ".gnu.sgstubs" section (marked by c). The "bl" instruction (marked by a) which is a call to cmse secure entry function is modified by GNU linker (as marked by b) and call flow is re-directly through secure gateway (sg) in ".gnu.sgstubs" section. ... bl yyyy <foo> ---> (b) ... section .gnu.sgstubs: ---> (c) yyyy <foo> yyyy: sg // secure gateway b.w xxxx <__acle_se_foo> // original_branch_dest ... 0000xxxx <__acle_se_foo> xxxx: push {r7, lr} ---> (d) On invoking GDB, when the control is at "b" and we pass "step" command, the pc returns "yyyy" (sg address) which is a trampoline and which does not exist in source code. So GDB jumps to next line without jumping to "__acle_se_foo" (marked by d). The above details are published on the Arm website [1], please refer to section 5.4 (Entry functions) and section 3.4.4 (C level development flow of secure code). [1] https://developer.arm.com/architectures/cpu-architecture/m-profile/docs/ecm0359818/latest/armv8-m-security-extensions-requirements-on-development-tools-engineering-specification This patch fixes above problem by returning target pc "xxxx" to GDB on executing "step" command at "b", so that the control jumps to "__acle_se_foo" (marked by d). gdb/ChangeLog: * arm-tdep.c (arm_skip_cmse_entry): New function. (arm_is_sgstubs_section): New function. (arm_skip_stub): Add call to arm_skip_cmse_entry function. gdb/testsuite/ChangeLog: * gdb.arch/arm-cmse-sgstubs.c: New test. * gdb.arch/arm-cmse-sgstubs.exp: New file.
2019-07-23[gdb/testsuite] Fix command result testing in mi-complete.expTom de Vries2-2/+10
When running gdb.mi/mi-complete.exp in conjunction with: ... $ stress -c $(($(cat /proc/cpuinfo | grep -c "^processor") + 1)) ... we get less than 50% full passes: ... $ for n in $(seq 1 100); do \ make V=1 -O check \ 'RUNTESTFLAGS=gdb.mi/mi-complete.exp --target_board=unix'; \ done 2>&1 \ | grep "expected passes" | sort | uniq -c 45 # of expected passes 7 9 # of expected passes 8 46 # of expected passes 9 ... A diff between a passing and failing gdb.log shows this difference: ... -&"set max-completions 1\n" 2-complete br +&"set max-completions 1\n" ... The problem is that the test-case issues the "set max-completion <n>" command, and without waiting for the output issues a next command, and tries to parse the results of both commands, expecting a specific interleaving of the various output streams. Fix the FAIL by waiting for the result of the "set max-completion <n>" command before issuing another command. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-07-23 Tom de Vries <tdevries@suse.de> PR testsuite/24711 * gdb.mi/mi-complete.exp: Wait for "set max-completions" result before issuing next command.