aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib
AgeCommit message (Collapse)AuthorFilesLines
2019-10-24[gdb/testsuite] Add -wrap pattern flag to gdb_test_multipleTom de Vries1-1/+24
Currently, in order to rewrite: ... gdb_test <command> <pattern> <message> ... using gdb_test_multiple, we get: ... gdb_test_multiple <command> <message> { -re "\[\r\n\]*(?:<pattern>)\[\r\n\]+$gdb_prompt $" { pass $gdb_test_name } } ... Add a '-wrap pattern flag to gdb_test_multiple, that wraps the regexp pattern as gdb_test wraps its message argument. This allows us to rewrite into the more compact: ... gdb_test_multiple <command> <message> { -re -wrap <pattern> { pass $gdb_test_name } } ... Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-10-24 Tom de Vries <tdevries@suse.de> * lib/gdb.exp (gdb_test_multiple): Add -wrap pattern flag. * gdb.reverse/step-precsave.exp: Rewrite gdb_test_multiple containing kfail using -wrap pattern flag and convenience variable gdb_test_name. Change-Id: Ie42c97d5ab7acf6db351299ccd23a83540fe6e1a
2019-10-13[gdb/testsuite] Add KFAIL for missing support of reverse-debugging xsaveTom de Vries1-0/+4
Normally the gdb.reverse/*.exp test-cases pass on my system (apart from the record/23188 KFAIL for gdb.reverse/step-precsave.exp). But when specifying GLIBC_TUNABLES=glibc.tune.hwcaps=-XSAVEC_Usable to force glibc to use _dl_runtime_resolve_xsave instead of _dl_runtime_resolve_xsavec, we run into 1054 FAILs like this: ... (gdb) PASS: gdb.reverse/sigall-reverse.exp: b gen_HUP continue^M Continuing.^M Process record does not support instruction 0xfae64 at address \ 0x7ffff7ded958.^M Process record: failed to record execution log.^M ^M Program stopped.^M 0x00007ffff7ded958 in _dl_runtime_resolve_xsave () from \ /lib64/ld-linux-x86-64.so.2^M (gdb) FAIL: gdb.reverse/sigall-reverse.exp: get signal ABRT ... The problem is that the xsave instruction is not supported in reverse-debugging (PR record/25038). Add KFAILs for this PR. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-10-13 Tom de Vries <tdevries@suse.de> PR record/25038 * gdb.reverse/sigall-precsave.exp: Add PR record/25038 KFAIL. * gdb.reverse/sigall-reverse.exp: Same. * gdb.reverse/solib-precsave.exp: Same. * gdb.reverse/solib-reverse.exp: Same. * gdb.reverse/step-precsave.exp: Same. * gdb.reverse/until-precsave.exp: Same. * gdb.reverse/until-reverse.exp: Same. * lib/gdb.exp (gdb_continue_to_breakpoint): Same.
2019-10-10[gdb/testsuite] Fix ada tests with -fPIE/-pieTom de Vries1-0/+25
When running the gdb testsuite with target board unix/-fPIE/-pie, the resulting ada executables are not PIE executables, because gnatmake doesn't recognize -pie, and consequently doesn't pass it to gnatlink. Fix this by replacing "-pie" with "-largs -pie -margs" in target_compile_ada_from_dir, and doing the same for -no-pie. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-10-10 Tom de Vries <tdevries@suse.de> PR testsuite/24888 * lib/ada.exp (target_compile_ada_from_dir): Route -pie/-no-pie to gnatlink.
2019-10-07gdb/testsuite: Add gdb_test_name variableAndrew Burgess1-2/+36
This commit adds a new feature to gdb_test_multiple, an automatically created variable gdb_test_name. The idea is to make it easier to write tests using gdb_test_multiple, and avoid places where the string passed to pass/fail within an action element is different to the message passed to the top level gdb_test_multiple. As an example, previously you might write this: gdb_test_multiple "print foo" "test foo" { -re "expected output 1" { pass "test foo" } -re "expected output 2" { fail "test foo" } } This is OK, but it's easy for the pass/fail strings to come out of sync, or contain a typo. A better version would look like this: set testname "test foo" gdb_test_multiple "print foo" $testname { -re "expected output 1" { pass $testname } -re "expected output 2" { fail $testname } } This is better, but its a bit of a drag having to create a new variable each time. After this patch you can now write this: gdb_test_multiple "print foo" "test foo" { -re "expected output 1" { pass $gdb_test_name } -re "expected output 2" { fail $gdb_test_name } } The $gdb_test_name is setup by gdb_test_multiple, and cleaned up once the test has completed. Nested calls to gdb_test_multiple are supported, though $gdb_test_name will only ever contain the inner most test message (which is probably what you want). My only regret is that '$gdb_test_name' is so long, but I wanted something that was unlikely to clash with any existing variable name, or anything that a user is likely to want to use. I've tested this on x86-64/GNU Linux and see no test regressions, and I've converted one test script over to make use of this new technique both as an example, and to ensure that the new facility doesn't get broken. I have no plans to convert all tests over to this technique, but I hope others will find this useful for writing tests in the future. gdb/testsuite/ChangeLog: * lib/gdb.exp (gdb_test_multiple): Add gdb_test_name mechanism. * gdb.base/annota1.exp: Update to use gdb_test_name.
2019-10-01Introduce metadata styleTom Tromey1-0/+1
This introduces a new "metadata" style and changes many places in gdb to use it. The idea here is to let the user distinguish gdb output from output that (conceptually at least) comes directly from the inferior. The newly-styled category includes text that gdb traditionally surrounds in "<...>", like "<unavailable>". I only added a single test for this. In many cases this output is difficult to test. Also, while developing this errors in the implementation of the new printf formats showed up as regressions. gdb/ChangeLog 2019-10-01 Tom Tromey <tom@tromey.com> * p-lang.c (pascal_printstr): Use metadata style. * value.c (show_convenience): Use metadata style. * valprint.c (valprint_check_validity, val_print_optimized_out) (val_print_not_saved, val_print_unavailable) (val_print_invalid_address, generic_val_print, val_print) (value_check_printable, val_print_array_elements): Use metadata style. * ui-out.h (class ui_out) <field_fmt>: New overload. <do_field_fmt>: Add style parameter. * ui-out.c (ui_out::field_fmt): New overload. * typeprint.c (type_print_unknown_return_type) (val_print_not_allocated, val_print_not_associated): Use metadata style. * tui/tui-out.h (class tui_ui_out) <do_field_fmt>: Add style parameter. * tui/tui-out.c (tui_ui_out::do_field_fmt): Update. * tracepoint.c (tvariables_info_1): Use metadata style. * stack.c (print_frame_arg, print_frame_info, print_frame) (info_frame_command_core): Use metadata style. * skip.c (info_skip_command): Use metadata style. * rust-lang.c (rust_print_enum): Use metadata style. * python/py-prettyprint.c (print_stack_unless_memory_error): Use metadata style. * python/py-framefilter.c (py_print_single_arg): Use metadata style. * printcmd.c (do_one_display, print_variable_and_value): Use metadata style. * p-valprint.c (pascal_val_print) (pascal_object_print_value_fields): Use metadata style. * p-typeprint.c (pascal_type_print_base): Use metadata style. * mi/mi-out.h (class mi_ui_out) <do_field_fmt>: Add style parameter. * mi/mi-out.c (mi_ui_out::do_field_fmt): Update. * m2-valprint.c (m2_print_long_set): Use metadata style. * m2-typeprint.c (m2_print_type): Use metadata style. * infcmd.c (print_return_value_1): Use metadata style. * gnu-v3-abi.c (print_one_vtable): Use metadata style. * f-valprint.c (info_common_command_for_block): Use metadata style. * f-typeprint.c (f_type_print_base): Use metadata style. * expprint.c (print_subexp_standard): Use metadata style. * cp-valprint.c (cp_print_value_fields): Use metadata style. * cli/cli-style.h (class cli_style_option): Add constructor. (metadata_style): Declare. * cli/cli-style.c (metadata_style): New global. (_initialize_cli_style): Register metadata style. * cli-out.h (class cli_ui_out) <do_field_fmt>: Add style parameter. * cli-out.c (cli_ui_out::do_field_fmt): Update. * c-typeprint.c (c_type_print_base_struct_union) (c_type_print_base_1): Use metadata style. * breakpoint.c (watchpoint_value_print) (print_one_breakpoint_location): Use metadata style. * break-catch-syscall.c (print_one_catch_syscall): Use metadata style. * break-catch-sig.c (signal_catchpoint_print_one): Use metadata style. * ada-valprint.c (val_print_packed_array_elements, printstr) (print_field_values, ada_val_print_ref, ada_val_print): Use metadata style. * ada-typeprint.c (print_array_type, ada_print_type): Use metadata style. * ada-tasks.c (print_ada_task_info, info_task): Use metadata style. * ada-lang.c (user_select_syms): Use metadata style. gdb/testsuite/ChangeLog 2019-10-01 Tom Tromey <tom@tromey.com> * lib/gdb-utils.exp (style): Handle "metadata" argument. * gdb.base/style.exp: Add metadata style test.
2019-09-20Remove Cell Broadband Engine debugging supportUlrich Weigand1-181/+0
This patch implements removal of Cell/B.E. support, including - Support for the spu-*-* target - Support for native stand-alone SPU debugging - Support for integrated debugging of combined PPU/SPU applications - Remote debugging (gdbserver) support for all the above. The patch also removes the TARGET_OBJECT_SPU target object type, as this is available only on Cell/B.E. targets, including - Native Linux support - Core file support (including core file generation) - Remote target support, including removal of the qXfer:spu:read and qXfer:spu:write remote protocal packets and associated support in gdbserver. gdb/ChangeLog 2019-09-20 Ulrich Weigand <uweigand@de.ibm.com> * NEWS: Mention that Cell/B.E. debugging support was removed. * MAINTAINERS: Remove spu target. * config/djgpp/fnchange.lst: Remove entries for removed files. * Makefile.in (ALL_TARGET_OBS): Remove solib-spu.o, spu-multiarch.o, and spu-tdep.o. (HFILES_NO_SRCDIR): Remove solib-spu.h and spu-tdep.h. (ALLDEPFILES): Remove solib-spu.c, spu-linux-nat.c, spu-multiarch.c, and spu-tdep.c. * spu-linux-nat.c: Remove file. * spu-multiarch.c: Remove file. * spu-tdep.c: Remove file. * spu-tdep.h: Remove file. * solib-spu.c: Remove file. * solib-spu.h: Remove file. * configure.host (powerpc64*-*-linux*): Remove Cell/B.E. support. * configure.nat (spu-linux): Remove. * configure.tgt (powerpc*-*-linux*): Remove solib-spu.o and solib-multiarch.o from gdb_target_obs. (spu*-*-*): Remove. * arch/ppc-linux-common.h (struct ppc_linux_features): Remove "cell" feature flag. (ppc_linux_no_features): Update. * arch/ppc-linux-common.c (ppc_linux_match_description): Remove Cell/B.E. support. * arch/ppc-linux-tdesc.h (tdesc_powerpc_cell32l): Remove declaration. (tdesc_powerpc_cell64l): Likewise. * nat/ppc-linux.h (PPC_FEATURE_CELL): Remove. * ppc-linux-nat.c (ppc_linux_nat_target::read_description): Remove Cell/B.E. support. * ppc-linux-tdep.h: Do not include "solib-spu.h" or "spu-tdep.h". Do not include "features/rs6000/powerpc-cell32l.c" or "features/rs6000/powerpc-cell64l.c". (ppc_linux_spu_section): Remove. (ppc_linux_core_read_description): Remove Cell/B.E. support. (spe_context_objfile, spe_context_lm_addr, spe_context_offset, spe_context_cache_ptid, spe_context_cache_ptid): Remove. (ppc_linux_spe_context_lookup): Remove. (ppc_linux_spe_context_inferior_created): Remove. (ppc_linux_spe_context_solib_loaded): Remove. (ppc_linux_spe_context_solib_unloaded): Remove. (ppc_linux_spe_context): Remove. (struct ppu2spu_cache): Remove. (ppu2spu_prev_arch, ppu2spu_this_id, ppu2spu_prev_register): Remove. (struct ppu2spu_data): Remove. (ppu2spu_unwind_register, ppu2spu_sniffer, ppu2spu_dealloc_cache, ppu2spu_unwind): Remove. (ppc_linux_init_abi): Remove Cell/B.E. support. * rs6000-tdep.h (rs6000_gdbarch_init): Remove Cell/B.E. support. * features/Makefile (rs6000/powerpc-cell32l-expedite): Remove. (rs6000/powerpc-cell64l-expedite): Likewise (WHICH): Remove rs6000/powerpc-cell32l and rs6000/powerpc-cell64l. (XMLTOC): Remove rs6000/powerpc-cell32l.xml and rs6000/powerpc-cell64l.xml. * features/rs6000/powerpc-cell32l.xml: Remove. * features/rs6000/powerpc-cell64l.xml: Likewise. * features/rs6000/powerpc-cell32l.c: Remove generated file. * features/rs6000/powerpc-cell64l.c: Likewise. * regformats/rs6000/powerpc-cell32l.dat: Remove generated file. * regformats/rs6000/powerpc-cell64l.dat: Likewise. * regformats/reg-spu.dat: Remove. * target.h (enum target_object): Remove TARGET_OBJECT_SPU. * corelow.c (struct spuid_list): Remove. (add_to_spuid_list): Remove. (core_target::xfer_partial): Remove support for TARGET_OBJECT_SPU. * remote.c (PACKET_qXfer_spu_read, PACKET_qXfer_spu_write): Remove. (remote_protocol_features): Remove associated entries. (_initialize_remote): No longer initialize them. (remote_target::xfer_partial): Remove support for TARGET_OBJECT_SPU. * linux-nat.c (SPUFS_MAGIC): Remove. (linux_proc_xfer_spu): Remove. (spu_enumerate_spu_ids): Remove. (linux_nat_target::xfer_partial): Remove support for TARGET_OBJECT_SPU. * linux-tdep.c (-linux_spu_make_corefile_notes): Remove. (linux_make_corefile_notes): No longer call it. * regcache.c (cooked_read_test): Remove bfd_arch_spu special case. (cooked_write_test): Likewise. gdb/doc/ChangeLog 2019-09-20 Ulrich Weigand <uweigand@de.ibm.com> * doc/gdb.texinfo (Remote Configuration): Remove documentation for qXfer:spu:read and qXfer:spu:write. (General Query Packets): Likewise. (Cell Broadband Engine SPU architecture): Remove subsection. gdb/gdbserver/ChangeLog 2019-09-20 Ulrich Weigand <uweigand@de.ibm.com> * configure.srv (ipa_ppc_linux_regobj): Remove powerpc-cell32l-ipa.o and powerpc-cell64l-ipa.o. (powerpc*-*-linux*): Remove powerpc-cell32l.o and powerpc-cell64l.o from srv_regobj. Remove rs6000/powerpc-cell32l.xml and rs6000/powerpc-cell64l.xml from srv_xmlfiles. (spu*-*-*): Remove. * spu-low.c: Remove file. * linux-ppc-low.c (INSTR_SC, NR_spu_run): Remove. (parse_spufs_run): Remove. (ppc_get_pc): Remove Cell/B.E. support. (ppc_set_pc): Likewise. (ppc_breakpoint_at): Likewise. (ppc_arch_setup): Likewise. (ppc_get_ipa_tdesc_idx): Do not handle tdesc_powerpc_cell64l or tdesc_powerpc_cell32l. (initialize_low_arch): Do not call init_registers_powerpc_cell64l or init_registers_powerpc_cell32l. * linux-ppc-ipa.c (get_ipa_tdesc): Do not handle PPC_TDESC_CELL. (initialize_low_tracepoint): Do not call init_registers_powerpc_cell64l or init_registers_powerpc_cell32l. * linux-ppc-tdesc-init.h (PPC_TDESC_CELL): Mark as unused. (init_registers_powerpc_cell32l): Remove prototype. (init_registers_powerpc_cell64l): Likewise. * target.h (struct target_ops): Remove qxfer_spu member. * server.c (handle_qxfer_spu): Remove. (qxfer_packets): Remove entry for "spu". (handle_query): No longer support qXfer:spu:read or qXfer:spu:write. * linux-low.c (SPUFS_MAGIC): Remove. (spu_enumerate_spu_ids): Remove. (linux_qxfer_spu): Remove. (linux_target_ops): Remove qxfer_spu member. * lynx-low.c (lynx_target_ops): Remove qxfer_spu member. * nto-low.c (nto_target_ops): Remove qxfer_spu member. * win32-low.c (win32_target_ops): Remove qxfer_spu member. gdb/testsuite/ChangeLog 2019-09-20 Ulrich Weigand <uweigand@de.ibm.com> * gdb.arch/spu-info.exp: Remove file. * gdb.arch/spu-info.c: Remove file. * gdb.arch/spu-ls.exp: Remove file. * gdb.arch/spu-ls.c: Remove file. * gdb.asm/asm-source.exp: Remove support for spu*-*-*. * gdb.asm/spu.inc: Remove file. * gdb.base/dump.exp: Remove support for spu*-*-*. * gdb.base/stack-checking.exp: Likewise. * gdb.base/overlays.exp: Likewise. * gdb.base/ovlymgr.c: Likewise. * gdb.base/spu.ld: Remove file. * gdb.cp/bs15503.exp: Remove support for spu*-*-*. * gdb.cp/cpexprs.exp: Likewise. * gdb.cp/exception.exp: Likewise. * gdb.cp/gdb2495.exp: Likewise. * gdb.cp/mb-templates.exp: Likewise. * gdb.cp/pr9167.exp: Likewise. * gdb.cp/userdef.exp: Likewise. * gdb.xml/tdesc-regs.exp: Remove support for spu*-*-*. * gdb.cell: Remove directory. * lib/cell.exp: Remove file.
2019-09-19[gdb/testsuite] Don't use FOOBAR pattern in gdb_testTom de Vries1-12/+16
If gdb_test is used with fewer than five arguments, then the question_string defaults to "^FOOBAR$": ... if [llength $args]==5 { set question_string [lindex $args 3] set response_string [lindex $args 4] } else { set question_string "^FOOBAR$" } ... This can however match "FOOBAR", so perhaps "\$FOOBAR^" would have been a better choice. Eliminate the FOOBAR pattern from gdb_test by instead of defining a default regexp, conditionally appending the regexp matching to a user_code variable. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-09-19 Tom de Vries <tdevries@suse.de> * lib/gdb.exp (gdb_test): Eliminate "^FOOBAR$" pattern.
2019-09-19[gdb/testsuite] Fix gdb_target_cmdTom de Vries1-2/+2
In commit 81dc3ab594 "[gdb/testsuite] Handle unreachable network in server-connect.exp" a regression was introduced in gdb_target_cmd, causing ERRORs like this: ... ERROR: tcl error sourcing src/gdb/testsuite/gdb.server/abspath.exp. ERROR: wrong # args: should be "gdb_target_cmd {$args}" while executing "gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport" ... Fix the argument passing in gdb_target_cmd. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-09-19 Tom de Vries <tdevries@suse.de> * lib/gdbserver-support.exp (gdb_target_cmd): Fix argument passing.
2019-09-19[gdb/testsuite] Handle unreachable network in server-connect.expTom de Vries1-3/+13
When running gdb.server/server-connect.exp I run into: ... FAIL: gdb.server/server-connect.exp: tcp6: connect to gdbserver using tcp6:::1 FAIL: gdb.server/server-connect.exp: tcp6-with-brackets: connect to gdbserver \ using tcp6:[::1] FAIL: gdb.server/server-connect.exp: udp6: connect to gdbserver using udp6:::1 FAIL: gdb.server/server-connect.exp: udp6-with-brackets: connect to gdbserver \ using udp6:[::1] ... The FAIL is caused by the fact that the ipv6 loopback address is not available: ... PASS: gdb.server/server-connect.exp: tcp6: start gdbserver target remote tcp6:::1:2347^M A program is being debugged already. Kill it? (y or n) y^M tcp6:::1:2347: Network is unreachable.^M (gdb) FAIL: gdb.server/server-connect.exp: tcp6: connect to gdbserver using tcp6:::1 ... This should be marked UNSUPPORTED rather than FAIL. Furthermore, the test-case takes about 4 minutes, because the 'Network is unreachable' response is not explicitly handled in gdb_target_cmd, so instead it runs into the timeout case. Fix this by handling the 'Network is unreachable' response as UNSUPPORTED. This reduces testing time from 4 minutes to about 2 seconds. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-09-19 Tom de Vries <tdevries@suse.de> * lib/gdbserver-support.exp (gdb_target_cmd_ext): Return 2 (meaning UNSUPPORTED) for 'Network is unreachable' message. Factor out of ... (gdb_target_cmd): ... here. * gdb.server/server-connect.exp: Use gdb_target_cmd_ext, handle return value 2.
2019-09-14[gdb/testsuite] Require gnatmake 8 for gdb.ada/rename_subscript_param.expTom de Vries1-0/+19
When running gdb.ada/rename_subscript_param.exp with gnatmake 7.4.1, we get: ... FAIL: gdb.ada/rename_subscript_param.exp: print rename_subscript_param_b \ before changing its value FAIL: gdb.ada/rename_subscript_param.exp: print rename_subscript_param_b \ after changing its value ... The commit last touching the test-case (afcfda091e) states: ... The test still fails with old compilers that do not properly generate debug info for this renaming: ... Fix this by requiring at least gnatmake 8 for the test-case. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-09-14 Tom de Vries <tdevries@suse.de> PR teststuite/24599 * gdb.ada/rename_subscript_param.exp: Require gnatmake 8. * lib/ada.exp (gnatmake_version_at_least): New proc.
2019-09-05[gdb/testsuite] Restore breakpoint command in ui-redirect.expTom de Vries1-0/+27
In gdb.base/ui-redirect.exp, the "save breakpoint" command is used to write the current breakpoints to a file, but the actual output is not verified. Consequently, the test has regressed in that the "print 1" command associated with a breakpoint on main is removed by a subsequent runto_main, which first deletes all breakpoints: ... (gdb) break main Breakpoint 1 at 0x4004d7: file start.c, line 34. (gdb) commands Type commands for breakpoint(s) 1, one per line. End with a line saying just "end". > PASS: gdb.base/ui-redirect.exp: commands print 1 > PASS: gdb.base/ui-redirect.exp: print 1 end (gdb) PASS: gdb.base/ui-redirect.exp: end delete breakpoints Delete all breakpoints? (y or n) y ... and consequently the "save breakpoint" output is missing the breakpoint command for main: ... break main - commands - print 1 - end break foo break bar ... Fix this by replacing "gdb_breakpoint main" with runto_main, and verifying the "save breakpoints" output. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-09-05 Tom de Vries <tdevries@suse.de> * lib/gdb.exp (cmp_file_string): New proc. * gdb.base/ui-redirect.exp: Replace "gdb_breakpoint main" with runto_main. Verify save breakpoints output.
2019-08-29[gdb/testsuite] Fix gdb.fortran/info-types.exp regexpTom de Vries1-0/+12
The gdb.fortran/info-types.exp test-case passes with gcc 7 (though not on openSUSE, due to the extra debug info) and fails with gcc 4.8 and gcc 8. Fix the gdb_test regexp to fix all those cases. gdb/testsuite/ChangeLog: 2019-08-29 Tom de Vries <tdevries@suse.de> * gdb.fortran/info-types.exp: Fix gdb_test regexp to allow more diverse debug info. * lib/fortran.exp (fortran_int8): New proc, based on fortran_int4.
2019-08-28gdb/fortran: Implement la_print_typedef for FortranAndrew Burgess1-0/+12
Implement an la_print_typedef method for Fortran, this allows 'info types' to work for Fortran. The implementation is just copied from ada_print_typedef (with the appropriate changes). To support the testing of this patch I added a new proc, fortran_character1, to lib/fortran.exp which returns a regexp to match a 1-byte character type. The regexp returned is correct for current versions of gFortran. All of the other regexp are guesses based on all of the other support procs in lib/fortran.exp, I haven't tested them myself. gdb/ChangeLog: * f-lang.c (f_language_defn): Use f_print_typedef. * f-lang.h (f_print_typedef): Declare. * f-typeprint.c (f_print_typedef): Define. gdb/testsuite/ChangeLog: * gdb.fortran/info-types.exp: New file. * gdb.fortran/info-types.f90: New file. * lib/fortran.exp (fortran_character1): New proc.
2019-08-26[gdb/testsuite] Make skip_libstdcxx_probe_tests return 1 if trueTom de Vries1-4/+5
The tcl proc skip_libstdcxx_probe_tests currently returns 0 if the probe tests need to be skipped, while tcl interprets 0 as false rather than true, which is confusing. Fix this by making skip_libstdcxx_probe_tests return 1 if the probe tests need to be skipped. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-08-26 Tom de Vries <tdevries@suse.de> * lib/gdb.exp (skip_libstdcxx_probe_tests_prompt): Return 1 if probe * tests need to be skipped. * gdb.cp/exceptprint.exp: Update call to skip_libstdcxx_probe_tests. * gdb.mi/mi-catch-cpp-exceptions.exp: Update call to mi_skip_libstdcxx_probe_tests.
2019-08-20[gdb/testsuite] Clean up stale exec in gdb_compile_pascalTom de Vries1-0/+2
When running a pascal test with the stabs target board: ... $ test=gdb.pascal/case-insensitive-symbols.exp $ cd build/gdb/testsuite $ make check RUNTESTFLAGS="$test --target_board=stabs" ... we get: ... nr of untested testcases 1 nr of unsupported tests 1 ... due to: ... Error: Illegal parameter: -gstabs+^M Error: /usr/bin/ppcx64 returned an error exitcode^M ... OTOH, when running the same pascal test without the stabs target board: ... $ make check RUNTESTFLAGS="$test" ... we get: ... nr of expected passes 20 ... But when subsequently again running with the stabs target board: ... $ make check RUNTESTFLAGS="$test --target_board=stabs" ... we now get: ... nr of expected passes 20 ... The problem is that gdb_compile_pascal determines success based on existence of the exec after compilation: ... if ![file exists $destfile] { unsupported "Pascal compilation failed: $result" return "Pascal compilation failed." } ... without removing the exec before compilation, which allows a stale exec to make it seem as if compilation has succeeded. Fix this by removing the stale exec before compilation. gdb/testsuite/ChangeLog: 2019-08-20 Tom de Vries <tdevries@suse.de> * lib/pascal.exp (gdb_compile_pascal): Remove $destfile before compilation.
2019-08-16Remove the TUI execution info windowTom Tromey1-0/+7
The TUI execution info window is unusual in that it is always linked to a source or disassembly window. Even updates of its content are handled by the source window, so it really has no life of its own. This patch removes this window entirely and puts its functionality directly into the source window. This simplifies the code somewhat. This is a user-visible change, because now the box around the source (or disassembly) window encloses the execution info as well. I consider this an improvement as well, though. Note that this patch caused ncurses to start emitting the "CSI Z" sequence, so I've added this to the test suite terminal implementation. gdb/ChangeLog 2019-08-16 Tom Tromey <tom@tromey.com> * tui/tui.h (enum tui_win_type) <EXEC_INFO_WIN>: Remove. * tui/tui-winsource.h (struct tui_exec_info_window): Remove. (struct tui_source_window_base) <make_visible, refresh_window, resize>: Remove methods. <execution_info>: Remove field. * tui/tui-winsource.c (tui_source_window_base::do_erase_source_content) (tui_show_source_line, tui_source_window_base) (~tui_source_window_base): Update. (tui_source_window_base::resize) (tui_source_window_base::make_visible) (tui_source_window_base::refresh_window): Remove. (tui_source_window_base::update_exec_info): Update. * tui/tui-source.c (tui_source_window::set_contents): Update. * tui/tui-disasm.c (tui_disasm_window::set_contents): Update. gdb/testsuite/ChangeLog 2019-08-16 Tom Tromey <tom@tromey.com> * lib/tuiterm.exp (_csi_Z): New proc. * gdb.tui/basic.exp: Update window positions. * gdb.tui/empty.exp: Update window positions.
2019-08-15[testsuite] Make the testsuite work on mingwChristian Biesinger1-0/+4
Dejagnu produces an objdir like /c/, but GDB expects something like c:/. So fix it up in lib/gdb.exp. gdb/testsuite/ChangeLog: 2019-08-14 Christian Biesinger <cbiesinger@google.com> * lib/gdb.exp: When running on a mingw target, replace /x/ with x:/.
2019-08-08[gdb/testsuite] Fix gdb.tui/basic.exp with check-read1Tom de Vries1-1/+1
With gdb.tui/basic.exp and check-read1, we run into (using -v for verbose log): ... ^[[0+++ _csi_0 <<<>>> ERROR: (DejaGnu) proc "_csi_0" does not exist. ... In contrast, without check-read1, we have: ... ^[[0;10m<SNIP>+++ _csi_m <<<0;10>>> ... The problem is that this regexp in _accept: ... -re "^\x1b\\\[(\[0-9;\]*)(\[0-9a-zA-Z@\])" { ... while matching the longer sequence '^[' '[' '0' ';' '1' '0' 'm', also matches the shorter sequence '^[' '[' '0'. The regexp attempts to match a CSI (Control Sequence Introducer) sequence, and the final byte of such a sequence cannot be a digit. Fix the regexp accordingly: ... - -re "^\x1b\\\[(\[0-9;\]*)(\[0-9a-zA-Z@\])" { + -re "^\x1b\\\[(\[0-9;\]*)(\[a-zA-Z@\])" { ... Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-08-08 Tom de Vries <tdevries@suse.de> PR testsuite/24862 * lib/tuiterm.exp (_accept): Fix CSI regexp.
2019-08-05[gdb/testsuite] Run read1 timeout tests with with_read1_timeout_factorTom de Vries1-0/+12
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 Vries1-14/+64
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 Vries1-1/+1
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-04Add check for readline support to more GDB tab-completion tests.Sandra Loosemore1-3/+9
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-01[gdb/testsuite] Fix gdb.base/structs.exp timeout with check-read1Tom de Vries1-0/+32
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-07-30[gdb/testsuite] Work around tcl bug in libsegfault.exp with check-read1Tom de Vries1-1/+5
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 Vries1-0/+18
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-29Two fixes for test suite's terminalTom Tromey1-1/+26
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-29[gdb/testsuite] Fix mi-catch-cpp-exceptions.exp and mi-nonstop.exp with ↵Tom de Vries1-2/+2
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] Don't expect gdb_prompt in mi_skip_python_testTom de Vries1-13/+19
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 case for empty TUI windowsTom Tromey1-3/+8
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 Tromey1-0/+45
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-27A virtual terminal for the test suiteTom Tromey1-0/+526
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-25[gdb/testsuite] Test skip_libstdcxx_probe_tests in mi-catch-cpp-exceptions.expTom de Vries2-6/+18
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-04Fix foreach_with_prefix regressionPedro Alves1-1/+3
Fix a silly bug in commit a26c8de0ee93 ("Fix early return in foreach_with_prefix"). That patch made foreach_with_prefix always return after the first iteration, making ~10k tests disappear from test runs... This fixes it, and as penance, adds a testcase that exercises all kinds of different returns possible (ok, error, return, break, continue). I've written it with regular "foreach", and then switched to foreach_with_prefix and made sure we get the same results. I put the testcase in a new gdb.testsuite/ subdir, since this is exercising the testsuite harness bits. We can move this elsewhere if people prefer a different place, but I'm going ahead in order to unbreak the testsuite ASAP. gdb/testsuite/ChangeLog: 2019-07-04 Pedro Alves <palves@redhat.com> * lib/gdb.exp (foreach_with_prefix): Don't return early if body returned ok(0), break(3) or continue(4). * gdb.testsuite/foreach_with_prefix.exp: New file.
2019-07-03Fix early return in foreach_with_prefixPedro Alves1-1/+8
I noticed that an early return in a foreach_with_prefix block does not cause the outer scope to return, like: foreach_with_prefix var {"foo" "bar"} { return } # Control continues here, but it should not. The problem is that we're missing the usual "return -code" treatment. This commit fixes it. gdb/testsuite/ChangeLog: 2019-07-03 Pedro Alves <palves@redhat.com> * lib/gdb.exp (foreach_with_prefix): Use "catch" and "return -code".
2019-07-03Fix latent bug in test_gdb_complete_cmd_multiplePedro Alves1-1/+2
A following patch will add the following to a testcase: test_gdb_completion_offers_commands "| " And that tripped on a latent testsuite bug: (gdb) | PASS: gdb.base/shell.exp: tab complete "| " ^CQuit (gdb) complete | | ! | + PASS: gdb.base/shell.exp: cmd complete "| " | *** List may be truncated, max-completions reached. *** (gdb) FAIL: gdb.base/shell.exp: set max-completions 200 set max-completions 200 The issue is that "|" ends up as part of a regexp, and "|" in regexps has a special meaning... Fix this with string_to_regexp. gdb/testsuite/ChangeLog: 2019-07-03 Pedro Alves <palves@redhat.com> * lib/completion-support.exp (test_gdb_complete_cmd_multiple): Use string_to_regexp.
2019-07-03Fix test_gdb_complete_tab_multiple racePedro Alves1-2/+6
Running 'make check-read1 TESTS="gdb.base/options.exp"' revealed a race in test_gdb_complete_tab_multiple. There's a gdb_test_multiple call that expects a prompt in the middle of the regexp. That's racy because gdb_test_multiple includes a built-in FAIL pattern for the prompt, which may match if gdb is slow enough to produce the rest of the output after the prompt. Fix this in the usual way of splitting the matching in two. gdb/testsuite/ChangeLog: 2019-07-03 Pedro Alves <palves@redhat.com> * lib/completion-support.exp (test_gdb_complete_tab_multiple): Split one gdb_test_multiple call in two to avoid a race.
2019-06-15gdb/mi: New commands to catch C++ exceptionsAndrew Burgess1-3/+8
Adds some MI commands to catch C++ exceptions. The new commands are -catch-throw, -catch-rethrow, and -catch-catch, these all correspond to the CLI commands 'catch throw', 'catch rethrow', and 'catch catch'. Each MI command takes two optional arguments, '-t' has the effect of calling 'tcatch' instead of 'catch', for example: (gdb) -catch-throw -t Is the same as: (gdb) tcatch throw There is also a '-r REGEXP' argument that can supply a regexp to match against the exception type, so: (gdb) -catch-catch -r PATTERN Is the same as: (gdb) catch catch PATTERN The change in print_mention_exception_catchpoint might seem a little strange; changing the output from using ui_out::field_int and ui_out::text to using ui_out::message. The print_mention_exception_catchpoint is used as the 'print_mention' method for the exception catchpoint breakpoint object. Most of the other 'print_mention' methods (see breakpoint.c) use either printf_filtered, of ui_out::message. Using field_int was causing an unexpected field to be added to the MI output. Here's the output without the change in print_mention_exception_catchpoint: (gdb) -catch-throw ^done,bkptno="1",bkpt={number="1",type="breakpoint",disp="keep", enabled="y",addr="0x00000000004006c0", what="exception throw",catch-type="throw", thread-groups=["i1"],times="0"} Notice the breakpoint number appears in both the 'bkptno' field, and the 'number' field within the 'bkpt' tuple. Here's the output with the change in print_mention_exception_catchpoint: (gdb) -catch-throw ^done,bkpt={number="1",type="breakpoint",disp="keep", enabled="y",addr="0x00000000004006c0", what="exception throw",catch-type="throw", thread-groups=["i1"],times="0"} gdb/ChangeLog: * NEWS: Mention new MI commands. * break-catch-throw.c (enum exception_event_kind): Move to breakpoint.h. (print_mention_exception_catchpoint): Output text as a single message. (catch_exception_command_1): Rename to... (catch_exception_event): ...this, make non-static, update header command, and change some parameter types. (catch_catch_command): Update for changes to catch_exception_command_1. (catch_throw_command): Likewise. (catch_rethrow_command): Likewise. * breakpoint.c (enum exception_event_kind): Delete. * breakpoint.h (enum exception_event_kind): Moved here from break-catch-throw.c. (catch_exception_event): Declare. * mi/mi-cmd-catch.c (mi_cmd_catch_exception_event): New function. (mi_cmd_catch_throw): New function. (mi_cmd_catch_rethrow): New function. (mi_cmd_catch_catch): New function. * mi/mi-cmds.c (mi_cmds): Add 'catch-throw', 'catch-rethrow', and 'catch-catch' entries. * mi/mi-cmds.h (mi_cmd_catch_throw): Declare. (mi_cmd_catch_rethrow): Declare. (mi_cmd_catch_catch): Declare. gdb/doc/ChangeLog: * gdb.texinfo (GDB/MI Catchpoint Commands): Add menu entry to new node. (C++ Exception GDB/MI Catchpoint Commands): New node to describe new MI commands. gdb/testsuite/ChangeLog: * gdb.mi/mi-catch-cpp-exceptions.cc: New file. * gdb.mi/mi-catch-cpp-exceptions.exp: New file. * lib/mi-support.exp (mi_expect_stop): Handle 'exception-caught' as a stop reason.
2019-06-13lib/completion-support.exp: Add test_gdb_completion_offers_commandsPedro Alves1-9/+57
This adds a procedure to the collection of completion-testing routines, that allows checking whether completion offers all commands as completion candidates. This will be used for testing completing "frame apply all [TAB]", "thread apply all [TAB]", etc. gdb/testsuite/ChangeLog: 2019-06-13 Pedro Alves <palves@redhat.com> * lib/completion-support.exp (test_gdb_complete_tab_multiple) (test_gdb_complete_cmd_multiple, test_gdb_complete_multiple): Add 'max_completions' parameter and handle it. (test_gdb_completion_offers_commands): New.
2019-06-03Update tests following changes to "help" and "apropos"Philippe Waroquiers2-19/+49
Factorizes the testing of the help output, by having a single place that defines the common help trailer and/or prefix messages.
2019-05-22Add "style" proc to the test suiteTom Tromey1-0/+18
This adds a "style" helper proc to the test suite, and updates existing style tests to use it. Thanks to Sergio for the idea. Tested on x86-64 Fedora 29. gdb/testsuite/ChangeLog 2019-05-22 Tom Tromey <tromey@adacore.com> * gdb.base/info-shared.exp (check_info_shared): Use "style". * gdb.base/style.exp: Use "style". * lib/gdb-utils.exp (style): New proc.
2019-05-21testsuite: Mark the kill in gdbserver_run as optionalAlan Hayward1-1/+1
This matches the kill in gdb_file_cmd, and ensures that the command is not sent to the gdb.in file. When gdb.in is used as a batch file, any kill commands run before the target is started will cause gdb to stop processing commands. gdb/testsuite/ChangeLog: * lib/gdbserver-support.exp (gdbserver_run): Mark kill as optional.
2019-05-17testsuite: Remove TRANSCRIPT supportAlan Hayward1-47/+0
TRANSCRIPT is superseeded by the .in, .cmd and .debug files, and can be removed. gdb/testsuite/ChangeLog * README (Running the Testsuite): Change example. (Testsuite Parameters): Remove TRANSCRIPT. * lib/gdb.exp: Remove TRANSCRIPT check.
2019-05-17testsuite: Add replay logging to GDBSERVER_DEBUGAlan Hayward1-10/+49
Add "replay" to the list of GDBSERVER_DEBUG options. This will cause a gdbserver.replay file to be written to the test output directory. At the same time switch this to a comma separated list in order to easily handle all possible options. The replay log is created by GDB, but has been added to GDBSERVER_DEBUG as it is only required for gdbserver tests. To enable it, the gdb_debug_init is overridden to allow the additional checking, before calling the original function. gdb/testsuite/ChangeLog: * README (Testsuite Parameters): Add replay logging to GDBSERVER_DEBUG. (gdbserver,debug): Refer to GDBSERVER_DEBUG. * lib/gdbserver-support.exp (gdbserver_start): Treat gdbserverdebug as a comma separated list. (gdb_debug_init): Override procedure.
2019-05-17testsuite: Create .cmd files for gdb and gdbserverAlan Hayward2-0/+21
When spawning gdb or gdbserver create a .cmd file in the test output directory containing the full command line, ensuring the current gdb instance is appended to the files so that they can be quickly matched to the corresponding gdb.in file. gdb/testsuite/ChangeLog: * lib/gdb.exp (default_gdb_spawn): Call gdb_write_cmd_file. (gdb_write_cmd_file): New procedure. * lib/gdbserver-support.exp (gdbserver_start): Call gdbserver_write_cmd_file. (gdbserver_write_cmd_file): New proedure.
2019-05-17testsuite: Record all gdb input to gdb.inAlan Hayward1-18/+88
When debugging testsuite failures, it can be awkward parsing gdb.log to obtain all the commands run in order to manually re-run the test. This patch adds the functionality to save all gdb commands to the file gdb.in when the testsuite is run. The file is saved in the directory for the test and if gdb is restarted then .1, .2, .3 etc is added to the filename. Once a test has been run, the .in file can be used to re-run the test in the following way: gdb -x outputs/gdb.store/gdb.in outputs/gdb.store/store The code works by intercepting send_gdb. I've added a TYPE to ensure that any commands that would destroy the playback are kept from the log (for example the Y from an answer to a y/n question). Adds library function standard_output_file_with_gdb_instance to open a file postfixed with count of the gdb instance. Ensure this count is reset when a new .exp script is run. I've re-run a random selection of .in files to check they do not error. Logs with commands such as "attach <pid>" will not directly work when re-run. gdb/testsuite/ChangeLog: * lib/gdb.exp (gdb_unload): Mark Y as an answer. (delete_breakpoints): Likewise. (gdb_run_cmd): Likewise. (gdb_start_cmd): Likewise. (gdb_starti_cmd): Likewise. (gdb_internal_error_resync): Likewise. (gdb_test_multiple): Likewise. (gdb_reinitialize_dir): Likewise. (default_gdb_exit): Likewise. (gdb_file_cmd): Mark kill as optional. (default_gdb_start): Call gdb_stdin_log_init. (send_gdb): Call gdb_stdin_log_write. (rerun_to_main): Mark Y as an answer. (gdb_stdin_log_init): New function. (gdb_stdin_log_write): Likewise.
2019-05-17testsuite: Add option to capture GDB debugAlan Hayward1-0/+54
Add both board option and environment variable which enables gdb debug via a comma separated list and sends it to the file gdb.debug, located in the output directory for the current test. Document this. Add support for the environment variable in the Makefile. The testsuite can be run with gdb debug enabled in the following way: make check GDB_DEBUG="infrun,target,remote" A Test with multiple invocations of GDB will all append debug to the same log file. gdb/testsuite/ChangeLog: * Makefile.in: Pass through GDB_DEBUG. * README (Testsuite Parameters): Add GDB_DEBUG. (gdb,debug): Add board setting. * lib/gdb.exp (default_gdb_start): Start debugging. (gdb_debug_enabled): New procedure. (gdb_debug_init): Likewise.
2019-05-07[gdb/testsuite] Fix handling of DW_FORM_ref_addr in dwarf assemblerTom de Vries1-4/+2
When running gdb.dwarf2/multidictionary.exp with target board cc-with-dwz and current dwz, we run into a dwz abort: ... gdb compile failed, gdb/contrib/cc-with-tweaks.sh: line 188: 11484 Aborted \ (core dumped) $DWZ "$output_file" > /dev/null 2>&1 UNTESTED: gdb.dwarf2/multidictionary.exp: multidictionary.exp ... The dwz abort (PR dwz/24169) is caused by an invalid DW_FORM_ref_addr in the multidictionary binary. The multidictionary binary is build from multidictionary.S which is generated using the dwarf assembler, and multidictionary.S contains dwarf for 3 compilation units. In multidictionary0.o (generated from multidictionary.S), we find a concrete formal parameter DIE: ... <2><dc>: Abbrev Number: 4 (DW_TAG_formal_parameter) <dd> DW_AT_abstract_origin: <0xa6> ... referring to an abstract formal parameter DIE at 0xa6: ... <2><a6>: Abbrev Number: 8 (DW_TAG_formal_parameter) <a7> DW_AT_name : msg <ab> DW_AT_type : <0x92> ... but in the multidictionary binary the concrete formal parameter DIE is still referring to 0xa6: ... <2><1a3>: Abbrev Number: 4 (DW_TAG_formal_parameter) <1a4> DW_AT_abstract_origin: <0xa6> ... while the abstract formal parameter DIE has moved to 0x16d: ... <2><16d>: Abbrev Number: 8 (DW_TAG_formal_parameter) <16e> DW_AT_name : msg <172> DW_AT_type : <0x159> ... The concrete formal parameter DIE is specified in multidictionary.S like this: ... .Llabel21: .uleb128 4 .4byte .Llabel17 - .Lcu1_begin ... The problem is that the .Lcu1_begin label is assumed to mark the start of the .debug_info section in the executable, but in fact it marks the start of the first compilation unit from multidictionary.S in the executable. Usually these two entities are the same, but they are not when linked in object files contain dwarf info and are placed in the .debug_info section before the compilation units generated from multidictionary.S. Fix this in the dwarf assembler by generating instead the label itself: ... .Llabel21: .uleb128 4 .4byte .Llabel17 ... resulting in a relocation in the object file: ... Offset Info Type Sym. Value Sym. Name + Addend 0000000000dd 00040000000a R_X86_64_32 0000000000000000 .debug_info + a6 ... and resulting in the correct offset in the executable: ... <2><1a3>: Abbrev Number: 4 (DW_TAG_formal_parameter) <1a4> DW_AT_abstract_origin: <0x16d> ... Tested on x86_64-linux with native and cc-with-dwz. gdb/testsuite/ChangeLog: 2019-05-07 Tom de Vries <tdevries@suse.de> PR testsuite/24159 * lib/dwarf.exp: Fix handling of DW_FORM_ref_addr.
2019-05-06[gdb/testsuite] Fix index-cache.exp with cc-with-{gdb-index,debug-names}Tom de Vries1-0/+12
In gdb.base/index-cache.exp, handle the case that binfile contains either a .gdb_index or .debug_names index section. Tested on x86_64-linux with native, cc-with-gdb-index and cc-with-debug-names. gdb/testsuite/ChangeLog: 2019-05-06 Tom de Vries <tdevries@suse.de> * lib/gdb.exp (exec_has_index_section): New proc. * gdb.base/index-cache.exp: Handle case that binfile contains an index section.
2019-04-30Support DW_FORM_strx1, _strx2, _strx3, _strx4 forms.Ali Tamur1-0/+4
Dwarf5 defines DW_FORM_strx1 and others, which are similar to DW_FORM_strx but uses 1-4 bytes unsigned integers. This is a small step towards supporting dwarf5 in gdb.
2019-04-30Fix "catch exception" with dynamic linkingTom Tromey2-5/+37
When an Ada program is dynamically linked against libgnat, and when one of the standard exceptions is used, the exception object may be referenced by the main executable using a copy relocation. In this situation, a "catch exception" for those exceptions will not manage to stop. This happens because, under the hood, "catch exception" creates an expression object that examines the object addresses -- but in this case, the address will be incorrect. This patch fixes the problem by arranging for these filter expressions to examine all the relevant minimal symbols. This way, the object from libgnat will be found as well. Tested on x86-64 Fedora 29. gdb/ChangeLog 2019-04-30 Tom Tromey <tromey@adacore.com> * ada-lang.c (ada_lookup_simple_minsyms): New function. (create_excep_cond_exprs): Iterate over program spaces. (ada_exception_catchpoint_cond_string): Examine all minimal symbols for exception types. gdb/testsuite/ChangeLog 2019-04-30 Tom Tromey <tromey@adacore.com> * lib/ada.exp (find_ada_tool): New proc. * lib/gdb.exp (gdb_compile_shlib): Allow .o files as inputs. * gdb.ada/catch_ex_std.exp: New file. * gdb.ada/catch_ex_std/foo.adb: New file. * gdb.ada/catch_ex_std/some_package.adb: New file. * gdb.ada/catch_ex_std/some_package.ads: New file.