aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.btrace
AgeCommit message (Collapse)AuthorFilesLines
2023-01-22Minor cleanup in gdb.btrace/enable.expTom Tromey1-1/+1
I noticed a weird-looking bit of code in gdb.btrace/enable.exp that is left over from an earlier change. This patch moves the "!" inside the braces, where it belongs.
2023-01-13Rename to allow_tsx_testsTom Tromey1-1/+1
This changes skip_tsx_tests to invert the sense, and renames it to allow_tsx_tests.
2023-01-13Rename to allow_shlib_testsTom Tromey1-1/+1
This changes skip_shlib_tests to invert the sense, and renames it to allow_shlib_tests.
2023-01-13Rename to allow_gdbserver_testsTom Tromey2-3/+3
This changes skip_gdbserver_tests to invert the sense, and renames it to allow_gdbserver_tests.
2023-01-13Rename to allow_btrace_testsTom Tromey26-26/+26
This changes skip_btrace_tests to invert the sense, and renames it to allow_btrace_tests.
2023-01-13Rename to allow_btrace_pt_testsTom Tromey1-1/+1
This changes skip_btrace_pt_tests to invert the sense, and renames it to allow_btrace_pt_tests.
2023-01-13Use require !skip_gdbserver_testsTom Tromey1-4/+1
This changes some tests to use "require !skip_gdbserver_tests".
2023-01-13Use require !use_gdb_stubTom Tromey1-4/+1
This changes some tests to use "require !use_gdb_stub".
2023-01-13Use require !skip_btrace_testsTom Tromey25-100/+25
This changes some tests to use "require !skip_btrace_tests".
2023-01-13Use require !skip_btrace_pt_testsTom Tromey1-9/+1
This changes some tests to use "require !skip_btrace_pt_tests" and "require !skip_tsx_tests".
2023-01-13Use require !skip_shlib_testsTom Tromey1-9/+1
This changes some tests to use "require !skip_shlib_tests".
2023-01-01Update copyright year range in header of all files managed by GDBJoel Brobecker57-57/+57
This commit is the result of running the gdb/copyright.py script, which automated the update of the copyright year range for all source files managed by the GDB project to be updated to include year 2023.
2022-11-11gdb, btrace: Fix rn-dl-bind.exp for new icx remark.Felix Willgerodt1-1/+1
When running the test with the latest Intel compiler: Running gdb/gdb/testsuite/gdb.btrace/rn-dl-bind.exp ... gdb compile failed, icpx: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated] The test doesn't seem to test something specifically for C++, so I removed the C++ compilation option. Alternatively we could rename rn-dl-bind.exp.c to rn-dl-bind.exp.cc. Signed-off-by: Felix Willgerodt <felix.willgerodt@intel.com>
2022-10-25[gdb/testsuite] Handle missing .note.GNU-stackTom de Vries2-0/+2
On openSUSE Tumbleweed I run into this for the dwarf assembly test-cases, and some hardcoded assembly test-cases: ... Running gdb.dwarf2/fission-absolute-dwo.exp ... gdb compile failed, ld: warning: fission-absolute-dwo.o: \ missing .note.GNU-stack section implies executable stack ld: NOTE: This behaviour is deprecated and will be removed in a future \ version of the linker === gdb Summary === # of untested testcases 1 ... Fix the dwarf assembly test-cases by adding the missing .note.GNU-stack in proc Dwarf::assemble. Fix the hard-coded test-cases using this command: ... $ for f in $(find gdb/testsuite/gdb.* -name *.S); do if ! grep -q note.GNU-stack $f; then echo -e "\t.section\t.note.GNU-stack,\"\",@progbits" >> $f; fi; done ... Likewise for .s files, and gdb/testsuite/lib/my-syscalls.S. The idiom for arm seems to be to use %progbits instead, see commit 9a5911c08be ("gdb/testsuite/gdb.dwarf2: Replace @ with % for ARM compatability"), so hand-edit gdb/testsuite/gdb.arch/arm-disp-step.S to use %progbits instead. Note that dwarf assembly testcases use %progbits as decided by proc _section. Tested on x86_64-linux. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29674
2022-01-01Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker57-57/+57
This commit brings all the changes made by running gdb/copyright.py as per GDB's Start of New Year Procedure. For the avoidance of doubt, all changes in this commits were performed by the script.
2021-09-30gdb/testsuite: make runto_main not pass no-message to runtoSimon Marchi26-33/+0
As follow-up to this discussion: https://sourceware.org/pipermail/gdb-patches/2020-August/171385.html ... make runto_main not pass no-message to runto. This means that if we fail to run to main, for some reason, we'll emit a FAIL. This is the behavior we want the majority of (if not all) the time. Without this, we rely on tests logging a failure if runto_main fails, otherwise. They do so in a very inconsisteny mannet, sometimes using "fail", "unsupported" or "untested". The messages also vary widly. This patch removes all these messages as well. Also, remove a few "fail" where we call runto (and not runto_main). by default (without an explicit no-message argument), runto prints a failure already. In two places, gdb.multi/multi-re-run.exp and gdb.python/py-pp-registration.exp, remove "message" passed to runto. This removes a few PASSes that we don't care about (but FAILs will still be printed if we fail to run to where we want to). This aligns their behavior with the rest of the testsuite. Change-Id: Ib763c98c5f4fb6898886b635210d7c34bd4b9023
2021-09-16[gdb/testsuite] Fix interrupted sleep in multi-threaded test-casesTom de Vries1-1/+3
When running test-case gdb.threads/continue-pending-status.exp with native, I have: ... (gdb) continue^M Continuing.^M PASS: gdb.threads/continue-pending-status.exp: attempt 0: continue for ctrl-c ^C^M Thread 1 "continue-pendin" received signal SIGINT, Interrupt.^M [Switching to Thread 0x7ffff7fc4740 (LWP 1276)]^M 0x00007ffff758e4c0 in __GI___nanosleep () at nanosleep.c:27^M 27 return SYSCALL_CANCEL (nanosleep, requested_time, remaining);^M (gdb) PASS: gdb.threads/continue-pending-status.exp: attempt 0: caught interrupt ... but with target board unix/-m32, I run into: ... (gdb) continue^M Continuing.^M PASS: gdb.threads/continue-pending-status.exp: attempt 0: continue for ctrl-c [Thread 0xf74aeb40 (LWP 31957) exited]^M [Thread 0xf7cafb40 (LWP 31956) exited]^M [Inferior 1 (process 31952) exited normally]^M (gdb) Quit^M ... The problem is that the sleep (300) call at the end of main is interrupted, which causes the inferior to exit before the ctrl-c can be send. This problem is described at "Interrupted System Calls" in the docs, and the suggested solution (using a sleep loop) indeed fixes the problem. Fix this instead using the more prevalent: ... alarm (300); ... while (1) sleep (1); ... which is roughly equivalent because the sleep is called at the end of main, but slightly better because it guards against hangs from the start rather than from the end of main. Likewise in gdb.base/watch_thread_num.exp. Likewise in gdb.btrace/enable-running.exp, but use the sleep loop there, because the sleep is not called at the end of main. Tested on x86_64-linux.
2021-07-12[gdb/testsuite] Fix gdb.btrace/tsx.exp on system with tsx disabled in microcodeTom de Vries1-0/+8
Recently I started to see this fail with trunk: ... (gdb) record instruction-history^M 1 0x00000000004004ab <main+4>: call 0x4004b7 <test>^M 2 0x00000000004004c6 <test+15>: mov $0x1,%eax^M 3 0x00000000004004cb <test+20>: ret ^M (gdb) FAIL: gdb.btrace/tsx.exp: speculation indication ... This is due to an intel microcode update (1) that disables Intel TSX by default. Fix this by updating the pattern. Tested on x86_64-linux, with both gcc 7.5.0 and clang 12.0.1. [1] https://www.intel.com/content/www/us/en/support/articles/000059422/processors.html gdb/testsuite/ChangeLog: 2021-07-12 Tom de Vries <tdevries@suse.de> PR testsuite/28057 * gdb.btrace/tsx.exp: Add pattern for system with tsx disabled in microcode.
2021-04-12gdb, testsuite, btrace: relax unneeded stepi expected outputMarkus Metzger1-1/+1
In gdb.btrace/reconnect.exp, we test that we can disconnect and reconnect again to a GDB session that is recording with the btrace recording format. It does not really matter what we are recording. The test assumed that stepping from _start will bring us into an area without debug information. This is not correct on all systems. Relax the expected output to also support systems where we do have debug information for that code.
2021-03-03gdb, testsuite: enforce lazy binding for gdb.btrace/rn-dl-bind.expMarkus Metzger1-1/+2
In gdb.btrace/rn-dl-bind.exp we test that we can reverse-step over recorded dynamic linking. The test covers specific behaviour to support _dl_runtime_resolve calling the resolved function by returning to it. This would normally mess up stepping as we'd end up with backtraces that contain the same functions but different frame ids. Since GDB needs to recognize a return from _dl_runtime_resolve, the test only passes when debug information for _dl_runtime_resolve is available. The test requires that symbols are bound lazily. Otherwise, we won't record dynamic linking and the test will be fairly pointless. Recent GCC pass -z now by default to bind symbols eagerly. Add -z lazy to the test's ldflags to enforce lazy binding.
2021-03-03testsuite, gdb.btrace: adjust expected source line in non-stop.expMarkus Metzger1-2/+2
In gdb.btrace/non-stop.exp, we hard-code expected source lines assuming we know how they would match to the recorded trace. Despite the fact that we should really have been using an assembly source, the assumptions work pretty well. With clang-6 -m32, we found a case where the assumptions do not hold. Adjust the expected source lines a little bit to cover that case, as well. Should we run into more cases like this, we will have to switch to an assembly source file.
2021-03-03testsuite, gdb.btrace: remove implicit debug option in stepi.expMarkus Metzger1-1/+1
We use pre-compiled assembly including debug information for stepi, yet we compiled with -g, which was implicitly set by prepare_for_testing. Add {} options to avoid the implicit {debug}.
2021-03-03testsuite, gdb.btrace: adjust expected output to pass with clangMarkus Metzger3-21/+31
Clang generates slightly different debug information. Adjust the expected output of gdb.btrace/function_call_history.exp to work with both gcc and clang. Also modify gdb.btrace/exception.cc to reliably trace into main and update the corresponding patterns in gdb.btrace/exception.exp.
2021-03-03testsuite, gdb.btrace: move -Wl,-x to ldflagsMarkus Metzger1-1/+1
In gdb.btrace/unknown_functions.exp we need the linker to discard local symbols so GDB wouldn't know about them from the symbol table. When building with clang, it complains about the option not being used at compile-time. Move the option to ldflags to only pass it at link-time.
2021-03-03testsuite, gdb.btrace: pass rn-dl-bind.exp with clangMarkus Metzger1-9/+19
Clang generates slightly different debug information causing gdb.btrace/rn-dl-bind.exp to fail on its way to the actual test. Modify the test to remove that dependency.
2021-03-03testsuite, gdb.btrace: remove assembly-check in delta.expMarkus Metzger1-8/+1
In gdb.btrace/delta.exp, we test that we do not extend the trace unintentionally. This can be tested by checking the number of instructions. If we wanted to check the instruction history, as well, we'd need to work on an assembly file to have deterministic behaviour. This isn't really necessary for this test, however, and covered elsewhere. Also remove the function call history check for the same reason.
2021-01-01Update copyright year range in all GDB filesJoel Brobecker57-57/+57
This commits the result of running gdb/copyright.py as per our Start of New Year procedure... gdb/ChangeLog Update copyright year range in copyright header of all GDB files.
2020-12-21testsuite, gdb.btrace: fix 32-bit PIE false positivesMarkus Metzger3-5/+13
For 32-bit position independent executables, GCC generates an extra call to __x86.get_pc_thunk.<reg> which appears in the function call history. It is correct to appear there but this confuses the tests, which check for an expected sequence of functions. Build with nopie to avoid this complication. gdb/testsuite/ChangeLog: 2020-12-04 Markus Metzger <markus.t.metzger@intel.com> * gdb.btrace/exception.exp: Build with nopie. * gdb.btrace/function_call_history.exp: Likewise. * gdb.btrace/unknown_functions.exp: Likewise.
2020-12-21testsuite, gdb.btrace: skip multi-inferior.exp on gdbserver targetsMarkus Metzger1-0/+5
The gdb.btrace/multi-inferior.exp test creates multiple inferiors to check that recording is per-inferior. When run with the native-gdbserver board, this test hangs when trying to add the second inferior over the remote connection. Skip the test. Note that the test runs fine with the native-extended-gdbserver board file and we want to keep testing that configuration. gdb/testsuite/ChangeLog: 2020-12-11 Markus Metzger <markus.t.metzger@intel.com> * gdb.btrace/multi-inferior.exp: Skip if use_gdb_stub.
2020-12-21testsuite, gdb.btrace: make test names uniqueMarkus Metzger10-140/+218
gdb/testsuite/ChangeLog: 2020-12-04 Markus Metzger <markus.t.metzger@intel.com> * gdb.btrace/data.exp: Make test names unique. * gdb.btrace/delta.exp: Likewise. * gdb.btrace/enable.exp: Likewise. * gdb.btrace/function_call_history.exp: Likewise. * gdb.btrace/nohist.exp: Likewise. * gdb.btrace/non-stop.exp: Likewise. * gdb.btrace/rn-dl-bind.exp: Likewise. * gdb.btrace/step.exp: Likewise. * gdb.btrace/stepi.exp: Likewise. * gdb.btrace/tailcall.exp: Likewise.
2020-12-21gdb, record: rephrase the 'not recording' error messageMarkus Metzger3-8/+8
When trying to use one of the record commands without having enabled recording first, GDB gives the error message: (gdb) record function-call-history No record target is currently active. Use one of the "target record-<TAB><TAB>" commands first. In the record help, however, we say: (gdb) help record record, rec Start recording. List of record subcommands: record btrace, record b -- Start branch trace recording. record delete, record del, record d -- Delete the rest of execution log and start recording it anew. record full -- Start full execution recording. record function-call-history -- Prints the execution history at function granularity. record goto -- Restore the program to its state at instruction number N. record instruction-history -- Print disassembled instructions stored in the execution log. record save -- Save the execution log to a file. record stop, record s -- Stop the record/replay target. Change the above error message to (gdb) record function-call-history No recording is currently active. Use the "record full" or "record btrace" command first. to align with the help text. gdb/ChangeLog: 2020-12-03 Markus Metzger <markus.t.metzger@intel.com> * record.c (require_record_target): Rephrase error message. (info_record_command): Likewise. gdb/testsuite/ChangeLog: 2020-12-03 Markus Metzger <markus.t.metzger@intel.com> * gdb.btrace/enable.exp: Update error message. * gdb.btrace/multi-inferior.exp: Likewise. * gdb.btrace/reconnect.exp: Likewise. * gdb.python/py-record-btrace.exp: Likewise. * gdb.python/py-record-full.exp: Likewise.
2020-12-14[gdb/testsuite] Don't pass -fPIC to gdb_compile_shlibTom de Vries1-2/+1
When running test-case gdb.base/info-shared.exp, I see in gdb.log: ... Executing on host: \ gcc ... -fPIC -fpic -c -o info-shared-solib1.c.o info-shared-solib1.c ... The -fPIC comes from the test-case: ... if { [gdb_compile_shlib $srcfile_lib1 $binfile_lib1 \ [list additional_flags=-fPIC]] != "" } { ... but the -fpic, which overrides the -fPIC comes from gdb_compile_shlib. The proc gdb_compile_shlib adds the -fpic or similar dependent on platform and compiler. However, in some cases it doesn't add anything, which is probably why all those test-case pass -fPIC. Fix this by removing -fPIC from all the calls to gdb_compile_shlib, and ensuring that gdb_compile_shlib takes care of adding it, if required. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-12-14 Tom de Vries <tdevries@suse.de> * lib/gdb.exp (gdb_compile_shlib): Make sure it's not necessary to pass -fPIC. * gdb.ada/catch_ex_std.exp: Don't pass -fPIC to gdb_compile_shlib. * gdb.base/break-probes.exp: Same. * gdb.base/ctxobj.exp: Same. * gdb.base/dso2dso.exp: Same. * gdb.base/global-var-nested-by-dso.exp: Same. * gdb.base/info-shared.exp: Same. * gdb.base/jit-reader-simple.exp: Same. * gdb.base/print-file-var.exp: Same. * gdb.base/skip-solib.exp: Same. * gdb.btrace/dlopen.exp: Same.
2020-04-25gdb/testsuite: Remove build paths from test namesAndrew Burgess1-2/+4
Having paths in test names makes it harder to compare results from different builds of GDB. gdb/testsuite/ChangeLog: * gdb.btrace/multi-inferior.exp: Avoid paths in test names.
2020-04-21gdb, btrace: make record-btrace per-inferiorMarkus Metzger2-0/+94
When there is more than one inferior, the "record btrace" command should only apply to the current inferior. gdb/ChangeLog: 2020-03-19 Markus Metzger <markus.t.metzger@intel.com> * record-btrace.c (record_btrace_enable_warn): Ignore thread if its inferior is not recorded by us. (record_btrace_target_open): Replace call to all_non_exited_threads () with call to current_inferior ()->non_exited_threads (). (record_btrace_target::stop_recording): Likewise. (record_btrace_target::close): Likewise. (record_btrace_target::wait): Likewise. (record_btrace_target::record_stop_replaying): Likewise. gdb/testsuite/ChangeLog: 2020-03-19 Markus Metzger <markus.t.metzger@intel.com> * gdb.btrace/multi-inferior.c: New test. * gdb.btrace/multi-inferior.exp: New file.
2020-04-21gdb, btrace: forward fetch_registers for unknown threadsMarkus Metzger2-0/+93
In the record-btrace target, while replaying, we can only provide the PC register. The btrace state is stored in the thread_info. So, when trying to determine whether we are currently replaying, GDB calls find_thread_ptid() to obtain the thread_info. It also asserts that we do have a thread_info. For new threads, libthread-db may fetch registers before the thread is known to GDB. In this case, find_thread_ptid() returns nullptr and the assertion fails. Forward the fetch_registers request to the target beneath in that case. gdb/ChangeLog: 2020-03-19 Markus Metzger <markus.t.metzger@intel.com> * record-btrace.c (record_btrace_target::fetch_registers): Forward request if we do not have a thread_info. gdb/testsuite/ChangeLog: 2020-03-19 Markus Metzger <markus.t.metzger@intel.com> * gdb.btrace/enable-new-thread.c: New test. * gdb.btrace/enable-new-thread.exp: New file.
2020-04-17Replace most calls to help_list and cmd_show_listTom Tromey1-2/+2
Currently there are many prefix commands that do nothing but call either help_list or cmd_show_list. I happened to notice that one such call, for "set print type", used the wrong command list parameter, causing incorrect output. Rather than fix this bug in isolation, I decided to eliminate this possibility by adding two new ways to add prefix commands, which simply route the call to help_list or cmd_show_list, as appropriate. This makes it impossible for a mismatch to occur. In some cases, a bit of output was removed; however, I don't think this output in general was very useful. It seemed redundant with what's already printed by help_list. A representative example is this hunk, removed from ada-lang.c: - printf_unfiltered (_(\ -"\"set ada\" must be followed by the name of a setting.\n")); This simplified the CLI style set/show commands quite a bit, and allowed the deletion of a macro. This also cleans up some unusual code in windows-tdep.c. Tested on x86-64 Fedora 30. Note that I have no way to build the go32-nat.c change. gdb/ChangeLog 2020-04-17 Tom Tromey <tromey@adacore.com> * auto-load.c (show_auto_load_cmd): Remove. (auto_load_show_cmdlist_get): Use add_show_prefix_cmd. * arc-tdep.c (_initialize_arc_tdep): Use add_show_prefix_cmd. (maintenance_print_arc_command): Remove. * tui/tui-win.c (tui_command): Remove. (tui_get_cmd_list): Use add_basic_prefix_cmd. * tui/tui-layout.c (tui_layout_command): Remove. (_initialize_tui_layout): Use add_basic_prefix_cmd. * python/python.c (user_set_python, user_show_python): Remove. (_initialize_python): Use add_basic_prefix_cmd, add_show_prefix_cmd. * guile/guile.c (set_guile_command, show_guile_command): Remove. (install_gdb_commands): Use add_basic_prefix_cmd, add_show_prefix_cmd. (info_guile_command): Remove. * dwarf2/read.c (set_dwarf_cmd, show_dwarf_cmd): Remove. (_initialize_dwarf2_read): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cli/cli-style.h (class cli_style_option) <add_setshow_commands>: Remove do_set and do_show parameters. * cli/cli-style.c (set_style, show_style): Remove. (_initialize_cli_style): Use add_basic_prefix_cmd, add_show_prefix_cmd. (cli_style_option::add_setshow_commands): Remove do_set and do_show parameters. (cli_style_option::add_setshow_commands): Use add_basic_prefix_cmd, add_show_prefix_cmd. (STYLE_ADD_SETSHOW_COMMANDS): Remove macro. (set_style_name): Remove. * cli/cli-dump.c (dump_command, append_command): Remove. (srec_dump_command, ihex_dump_command, verilog_dump_command) (tekhex_dump_command, binary_dump_command) (binary_append_command): Remove. (_initialize_cli_dump): Use add_basic_prefix_cmd. * windows-tdep.c (w32_prefix_command_valid): Remove global. (init_w32_command_list): Remove; move into ... (_initialize_windows_tdep): ... here. Use add_basic_prefix_cmd. * valprint.c (set_print, show_print, set_print_raw) (show_print_raw): Remove. (_initialize_valprint): Use add_basic_prefix_cmd, add_show_prefix_cmd. * typeprint.c (set_print_type, show_print_type): Remove. (_initialize_typeprint): Use add_basic_prefix_cmd, add_show_prefix_cmd. * record.c (set_record_command, show_record_command): Remove. (_initialize_record): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cli/cli-cmds.c (_initialize_cli_cmds): Use add_basic_prefix_cmd, add_show_prefix_cmd. (info_command, show_command, set_debug, show_debug): Remove. * top.h (set_history, show_history): Don't declare. * top.c (set_history, show_history): Remove. * target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd) (unset_tdesc_cmd): Remove. (_initialize_target_descriptions): Use add_basic_prefix_cmd, add_show_prefix_cmd. * symtab.c (info_module_command): Remove. (_initialize_symtab): Use add_basic_prefix_cmd. * symfile.c (overlay_command): Remove. (_initialize_symfile): Use add_basic_prefix_cmd. * sparc64-tdep.c (info_adi_command): Remove. (_initialize_sparc64_adi_tdep): Use add_basic_prefix_cmd. * sh-tdep.c (show_sh_command, set_sh_command): Remove. (_initialize_sh_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * serial.c (serial_set_cmd, serial_show_cmd): Remove. (_initialize_serial): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Remove. (_initialize_ser_tcp): Use add_basic_prefix_cmd, add_show_prefix_cmd. * rs6000-tdep.c (set_powerpc_command, show_powerpc_command) (_initialize_rs6000_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * riscv-tdep.c (show_riscv_command, set_riscv_command) (show_debug_riscv_command, set_debug_riscv_command): Remove. (_initialize_riscv_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * remote.c (remote_command, set_remote_cmd): Remove. (_initialize_remote): Use add_basic_prefix_cmd. * record-full.c (set_record_full_command) (show_record_full_command): Remove. (_initialize_record_full): Use add_basic_prefix_cmd, add_show_prefix_cmd. * record-btrace.c (cmd_set_record_btrace) (cmd_show_record_btrace, cmd_set_record_btrace_bts) (cmd_show_record_btrace_bts, cmd_set_record_btrace_pt) (cmd_show_record_btrace_pt): Remove. (_initialize_record_btrace): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ravenscar-thread.c (set_ravenscar_command) (show_ravenscar_command): Remove. (_initialize_ravenscar): Use add_basic_prefix_cmd, add_show_prefix_cmd. * mips-tdep.c (show_mips_command, set_mips_command) (_initialize_mips_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * maint.c (maintenance_command, maintenance_info_command) (maintenance_check_command, maintenance_print_command) (maintenance_set_cmd, maintenance_show_cmd): Remove. (_initialize_maint_cmds): Use add_basic_prefix_cmd, add_show_prefix_cmd. (show_per_command_cmd): Remove. * maint-test-settings.c (maintenance_set_test_settings_cmd): Remove. (maintenance_show_test_settings_cmd): Remove. (_initialize_maint_test_settings): Use add_basic_prefix_cmd, add_show_prefix_cmd. * maint-test-options.c (maintenance_test_options_command): Remove. (_initialize_maint_test_options): Use add_basic_prefix_cmd. * macrocmd.c (macro_command): Remove (_initialize_macrocmd): Use add_basic_prefix_cmd. * language.c (set_check, show_check): Remove. (_initialize_language): Use add_basic_prefix_cmd, add_show_prefix_cmd. * infcmd.c (unset_command): Remove. (_initialize_infcmd): Use add_basic_prefix_cmd. * i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Remove. (_initialize_i386_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * go32-nat.c (go32_info_dos_command): Remove. (_initialize_go32_nat): Use add_basic_prefix_cmd. * cli/cli-decode.c (do_prefix_cmd, add_basic_prefix_cmd) (do_show_prefix_cmd, add_show_prefix_cmd): New functions. * frame.c (set_backtrace_cmd, show_backtrace_cmd): Remove. (_initialize_frame): Use add_basic_prefix_cmd, add_show_prefix_cmd. * dcache.c (set_dcache_command, show_dcache_command): Remove. (_initialize_dcache): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cp-support.c (maint_cplus_command): Remove. (_initialize_cp_support): Use add_basic_prefix_cmd. * btrace.c (maint_btrace_cmd, maint_btrace_set_cmd) (maint_btrace_show_cmd, maint_btrace_pt_set_cmd) (maint_btrace_pt_show_cmd, _initialize_btrace): Use add_basic_prefix_cmd, add_show_prefix_cmd. * breakpoint.c (save_command): Remove. (_initialize_breakpoint): Use add_basic_prefix_cmd. * arm-tdep.c (set_arm_command, show_arm_command): Remove. (_initialize_arm_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ada-lang.c (maint_set_ada_cmd, maint_show_ada_cmd) (set_ada_command, show_ada_command): Remove. (_initialize_ada_language): Use add_basic_prefix_cmd, add_show_prefix_cmd. * command.h (add_basic_prefix_cmd, add_show_prefix_cmd): Declare. gdb/testsuite/ChangeLog 2020-04-17 Tom Tromey <tromey@adacore.com> * gdb.cp/maint.exp (test_help): Simplify multiple_help_body. Update tests. * gdb.btrace/cpu.exp: Update tests. * gdb.base/maint.exp: Update tests. * gdb.base/default.exp: Update tests. * gdb.base/completion.exp: Update tests.
2020-03-11[gdb/testsuite] Fix stepi pattern in gdb.btrace/reconnect.expTom de Vries1-1/+1
When running gdb.btrace/reconnect.exp, I run into the follow FAIL: ... (gdb) stepi 19^M 0x00007ffff7dd8b67 59 return (ElfW(Addr)) &_DYNAMIC - \ elf_machine_dynamic ();^M (gdb) FAIL: gdb.btrace/reconnect.exp: first: stepi 19 ... The corresponding test looks like: ... gdb_test "stepi 19" "0x.* in .* from .*" ... which matches the usual: ... (gdb) stepi 19^M 0x00007ffff7dd8b67 in _dl_start () from target:/lib64/ld-linux-x86-64.so.2^M (gdb) PASS: gdb.btrace/reconnect.exp: first: stepi 19 ... which I also get when removing configure flag --with-separate-debug-dir=/usr/lib/debug. Fix this by allowing the source line pattern in the test regexp. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-03-11 Tom de Vries <tdevries@suse.de> * gdb.btrace/reconnect.exp: Allow source line pattern after stepi.
2020-01-01Update copyright year range in all GDB files.Joel Brobecker53-53/+53
gdb/ChangeLog: Update copyright year range in all GDB files.
2019-10-31[gdb/testsuite] Remove superfluous 3rd argument from gdb_test call (2)Tom de Vries3-6/+4
There's a pattern: ... gdb_test <command> <pattern> <command> ... that can be written shorter as: ... gdb_test <command> <pattern> ... Detect this pattern in proc gdb_test: ... global gdb_prompt upvar timeout timeout if [llength $args]>2 then { set message [lindex $args 2] + if { $message == [lindex $args 0] && [llength $args] == 3 } { + error "HERE" + } } else { set message [lindex $args 0] } ... and fix all occurrences in some gdb testsuite subdirs. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-10-31 Tom de Vries <tdevries@suse.de> * gdb.arch/amd64-disp-step-avx.exp: Drop superfluous 3rd argument to gdb_test. * gdb.arch/amd64-disp-step.exp: Same. * gdb.asm/asm-source.exp: Same. * gdb.btrace/buffer-size.exp: Same. * gdb.btrace/cpu.exp: Same. * gdb.btrace/enable.exp: Same. * gdb.dwarf2/count.exp: Same. * gdb.dwarf2/dw2-ranges-func.exp: Same. * gdb.dwarf2/dw2-ranges-psym.exp: Same. * gdb.fortran/vla-datatypes.exp: Same. * gdb.fortran/vla-history.exp: Same. * gdb.fortran/vla-ptype.exp: Same. * gdb.fortran/vla-value.exp: Same. * gdb.fortran/whatis_type.exp: Same. * gdb.guile/guile.exp: Same. * gdb.multi/tids.exp: Same. * gdb.python/py-finish-breakpoint.exp: Same. * gdb.python/py-framefilter.exp: Same. * gdb.python/py-pp-registration.exp: Same. * gdb.python/py-xmethods.exp: Same. * gdb.python/python.exp: Same. * gdb.server/connect-with-no-symbol-file.exp: Same. * gdb.server/no-thread-db.exp: Same. * gdb.server/run-without-local-binary.exp: Same. * gdb.stabs/weird.exp: Same. * gdb.threads/attach-many-short-lived-threads.exp: Same. * gdb.threads/thread-find.exp: Same. * gdb.threads/tls-shared.exp: Same. * gdb.threads/tls.exp: Same. * gdb.threads/wp-replication.exp: Same. * gdb.trace/ax.exp: Same. * lib/gdb.exp (gdb_test_exact, help_test_raw): Same. Change-Id: I2fa544c68f8c0099a77e03ff04ddc010eb2b6c7c
2019-04-23[gdb/testsuite] Fix gdb.btrace/reconnect.exp with native-gdbserverTom de Vries1-1/+1
When running gdb.btrace/reconnect.exp with native-gdbserver, we run into: ... FAIL: gdb.btrace/reconnect.exp: first: stepi 19 ... due to the fact that we're trying to match: ... stepi 19^M 0x00007ffff7dd8b57 in _dl_start () from /lib64/ld-linux-x86-64.so.2^M ... using pattern: ... gdb_test "stepi 19" "0x.* in .* from target.*" ... Fix this by changing the pattern to: ... gdb_test "stepi 19" "0x.* in .* from .*" ... Tested on x86_64-linux with native and native-gdbserver. gdb/testsuite/ChangeLog: 2019-04-23 Tom de Vries <tdevries@suse.de> PR gdb/24433 * gdb.btrace/reconnect.exp: Fix stepi 19 pattern.
2019-01-01Update copyright year range in all GDB files.Joel Brobecker53-53/+53
This commit applies all changes made after running the gdb/copyright.py script. Note that one file was flagged by the script, due to an invalid copyright header (gdb/unittests/basic_string_view/element_access/char/empty.cc). As the file was copied from GCC's libstdc++-v3 testsuite, this commit leaves this file untouched for the time being; a patch to fix the header was sent to gcc-patches first. gdb/ChangeLog: Update copyright year range in all GDB files.
2018-04-13btrace: set/show record btrace cpuMarkus Metzger1-0/+76
Add new set/show commands to set the processor that is used for enabling errata workarounds when decoding branch trace. The general format is "<vendor>:<identifier>" but we also allow two special values "auto" and "none". The default is "auto", which is the current behaviour of having GDB determine the processor on which the trace was recorded. If that cpu is not known to the trace decoder, e.g. when using an old decoder on a new system, decode may fail with "unknown cpu". In most cases it should suffice to 'downgrade' decode to assume an older cpu. Unfortunately, we can't do this automatically. The other special value, "none", disables errata workarounds. gdb/ * NEWS (New options): announce set/show record btrace cpu. * btrace.c: Include record-btrace.h. (btrace_compute_ftrace_pt): Skip enabling errata workarounds if the vendor is unknown. (btrace_compute_ftrace_1): Add cpu parameter. Update callers. Maybe overwrite the btrace configuration's cpu. (btrace_compute_ftrace): Add cpu parameter. Update callers. (btrace_fetch): Add cpu parameter. Update callers. (btrace_maint_update_pt_packets): Call record_btrace_get_cpu. Maybe overwrite the btrace configuration's cpu. Skip enabling errata workarounds if the vendor is unknown. * python/py-record-btrace.c: Include record-btrace.h. (recpy_bt_begin, recpy_bt_end, recpy_bt_instruction_history) (recpy_bt_function_call_history): Call record_btrace_get_cpu. * record-btrace.c (record_btrace_cpu_state_kind): New. (record_btrace_cpu): New. (set_record_btrace_cpu_cmdlist): New. (record_btrace_get_cpu): New. (require_btrace_thread, record_btrace_info) (record_btrace_resume_thread): Call record_btrace_get_cpu. (cmd_set_record_btrace_cpu_none): New. (cmd_set_record_btrace_cpu_auto): New. (cmd_set_record_btrace_cpu): New. (cmd_show_record_btrace_cpu): New. (_initialize_record_btrace): Initialize set/show record btrace cpu commands. * record-btrace.h (record_btrace_get_cpu): New. testsuite/ * gdb.btrace/cpu.exp: New. doc/ * gdb.texinfo: Document set/show record btrace cpu.
2018-02-20btrace, testsuite: do not force BTSMarkus Metzger1-9/+6
In gdb.btrace/buffer-size.exp we explicitly ask for the BTS recording format. This may lead to spurious fails on systems where PT is being used by some other process at the same time. Set both PT and BTS buffer sizes to 1 and check that whatever recording format is used will use a 4KB buffer. testsuite/ * gdb.btrace/buffer-size.exp: Do not force BTS.
2018-01-02Update copyright year range in all GDB filesJoel Brobecker52-52/+52
gdb/ChangeLog: Update copyright year range in all GDB files
2017-03-08gdb: Fix a few unstable test namesPedro Alves1-1/+2
Avoid putting unstable path names in test messages, in order to avoid spurious testrun result diffs like: [....] -PASS: gdb.base/break-fun-addr.exp: /home/pedro/gdb/test-build1/gdb/testsuite/outputs/gdb.base/break-fun-addr/break-fun-addr1: break *main +PASS: gdb.base/break-fun-addr.exp: /home/pedro/gdb/test-build2/gdb/testsuite/outputs/gdb.base/break-fun-addr/break-fun-addr1: break *main [....] gdb/ChangeLog: 2017-03-08 Pedro Alves <palves@redhat.com> * gdb.base/break-fun-addr.exp: Use $testfile1/$testfile2 for test prefix instead of $binfile1/$binfile2. * gdb.btrace/gcore.exp: Use "core" instead of unstable path name in test message. * gdb.python/py-completion.exp: Use "load python file" as test messages instead of unstable path names.
2017-02-01btrace, testsuite: fix extended-remote failMarkus Metzger1-0/+3
Parts of gdb.btrace/enable.exp are only valid for native debug. The check for skip_gdbserver_tests is done while GDB is running, though, which causes it to fail with --target_board=native-extended-gdbserver. Exit GDB before that check. testsuite/ * gdb.btrace/enable.exp: Call gdb_exit before skip_gdbserver_tests.
2017-02-01btrace, testsuite: fix extended-remote non-stop testMarkus Metzger1-2/+4
With --target_board=native-extended-gdbserver non-stop tests are failing with UNTESTED: gdb.btrace/non-stop.exp: failed to run to main Fix that by adding '-ex "set non-stop on"' to GDBFLAGS before restarting. testsuite/ * gdb.btrace/non-stop.exp: Add '-ex "set non-stop on"' to GDBFLAGS.
2017-02-01btrace: add unsupported/untested messages when skipping testsMarkus Metzger25-79/+167
We may silently skip gdb.btrace tests if - the target does not support record-btrace - the target does not support TSX - the target does not support gdbserver - we fail to compile the test - we fail to run to main Add unsupported/untested messages for each of those. testsuite/ * gdb.btrace/buffer-size.exp: Add unsupported/untested message if the test is skipped. * gdb.btrace/data.exp: Likewise. * gdb.btrace/delta.exp: Likewise. * gdb.btrace/dlopen.exp: Likewise. * gdb.btrace/enable-running.exp: Likewise. * gdb.btrace/enable.exp: Likewise. * gdb.btrace/exception.exp: Likewise. * gdb.btrace/function_call_history.exp: Likewise. * gdb.btrace/gcore.exp: Likewise. * gdb.btrace/instruction_history.exp: Likewise. * gdb.btrace/multi-thread-step.exp: Likewise. * gdb.btrace/nohist.exp: Likewise. * gdb.btrace/non-stop.exp: Likewise. * gdb.btrace/reconnect.exp: Likewise. * gdb.btrace/record_goto-step.exp: Likewise. * gdb.btrace/record_goto.exp: Likewise. * gdb.btrace/rn-dl-bind.exp: Likewise. * gdb.btrace/segv.exp: Likewise. * gdb.btrace/step.exp: Likewise. * gdb.btrace/stepi.exp: Likewise. * gdb.btrace/tailcall-only.exp: Likewise. * gdb.btrace/tailcall.exp: Likewise. * gdb.btrace/tsx.exp: Likewise. * gdb.btrace/unknown_functions.exp: Likewise. * gdb.btrace/vdso.exp: Likewise.
2017-02-01btrace: allow recording to be started (and stopped) for running threadsMarkus Metzger2-0/+143
When recording is started for a running thread, GDB was able to start tracing but then failed to read registers to insert the initial entry for the current PC. We don't really need that initial entry if we don't know where exactly we started recording. Skip that step to allow recording to be started while threads are running. If we do run into errors, we need to undo the tracing enable to not leak this thread. The operation did not complete so our caller won't clean up this thread. For the BTRACE_FORMAT_PT btrace format, we don't need that initial entry since it will be recorded in the trace. We can omit the call to btrace_add_pc. gdb/ * btrace.c (btrace_enable): Do not call btrace_add_pc for BTRACE_FORMAT_PT or if can_access_registers_ptid returns false. (btrace_fetch): Assert can_access_registers_ptid. * record-btrace.c (require_btrace_thread, record_btrace_info): Call validate_registers_access. testsuite/ * gdb.btrace/enable-running.c: New. * gdb.btrace/enable-running.exp: New.
2017-01-01update copyright year range in GDB filesJoel Brobecker50-50/+50
This applies the second part of GDB's End of Year Procedure, which updates the copyright year range in all of GDB's files. gdb/ChangeLog: Update copyright year range in all GDB files.