aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.btrace
AgeCommit message (Collapse)AuthorFilesLines
2024-09-24btrace: Add support for IRET events.Felix Willgerodt2-1/+5
This is similar to the previous events that we added. Approved-By: Markus Metzger <markus.t.metzger@intel.com>
2024-09-24btrace: Add support for interrupt events.Felix Willgerodt4-0/+181
Newer Intel CPUs support recording asynchronous events in the PT trace. Libipt also recently added support for decoding these. This patch adds support for interrupt events, based on the existing aux infrastructure. GDB can now display such events during the record instruction-history and function-call-history commands. Subsequent patches will add the rest of the events currently supported. Approved-By: Markus Metzger <markus.t.metzger@intel.com>
2024-08-28gdb/testsuite: fix gdb.btrace/non-stop.exp end of history checkGuinevere Larsen1-7/+9
The recent commit 089197010993b3a5dc50bf882470bab2de696d92 changed the warnings when GDB reaches the end of the recorded history, and updated tests to expect the new messages. The pattern used for gdb.btrace/non-stop.exp, however, was too broad and could cause the following test result: ... (gdb) PASS: gdb.btrace/non-stop.exp: no progress: all: thread apply all continue: prompt ^M Reached end of recorded history; stopping.^M Following forward execution will be added to history.^M test (arg=0x0) at /data/vries/gdb/src/gdb/testsuite/gdb.btrace/non-stop.c:30^M 30 return arg; /* bp.2 */^M ^M Reached end of recorded history; stopping.^M Following forward execution will be added to history.^M test (arg=0x0) at /data/vries/gdb/src/gdb/testsuite/gdb.btrace/non-stop.c:30^M 30 return arg; /* bp.2 */^M PASS: gdb.btrace/non-stop.exp: no progress: all: thread apply all continue: thread 0 FAIL: gdb.btrace/non-stop.exp: no progress: all: thread apply all continue: thread 1 (timeout) ... This happens because the pattern looks like one of these 2: "Reached end of recorded.*Backwards execution.*" "Reached end of recorded.*Following forward.*" What seems to have happened is that all the output came at once, and most of it was consumed by the first '.*' pattern when checking for thread 0, so there was no output left for checking thread 1. This commit fixes that by making the expected outputs more exact. I also fixed the whitespace errors in gdb_cont_to_no_history_backwards that pre-dated the commit above, since I was already touching that proc. Approved-By: Tom de Vries <tdevries@suse.de>
2024-08-26Change message when reaching end of reverse history.Guinevere Larsen4-22/+32
In a record session, when we move backward, GDB switches from normal execution to simulation. Moving forward again, the emulation continues until the end of the reverse history. When the end is reached, the execution stops, and a warning message is shown. This message has been modified to indicate that the forward emulation has reached the end, but the execution can continue as normal, and the recording will also continue. Before this patch, the warning message shown in that case was the same as in the reverse case. This meant that when the end of history was reached in either backward or forward emulation, the same message was displayed: "No more reverse-execution history." This message has changed for these two cases. Backward emulation: "Reached end of recorded history; stopping. Backward execution from here not possible." Forward emulation: "Reached end of recorded history; stopping. Following forward execution will be added to history." The reason for this change is that the initial message was deceiving, for the forward case, making the user believe that forward debugging could not continue. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31224 Reviewed-By: Markus T. Metzger <markus.t.metzger@intel.com> (btrace) Approved-By: Guinevere Larsen <blarsen@redhat.com>
2024-08-14btrace: Extend ptwrite event decoding.Felix Willgerodt4-0/+1334
Call the ptwrite filter function whenever a ptwrite event is decoded. The returned string is written to the aux_data string table and a corresponding auxiliary instruction is appended to the function segment. Approved-By: Markus Metzger <markus.t.metzger@intel.com> Reviewed-By: Eli Zaretskii <eliz@gnu.org>
2024-01-22gdb/testsuite: relax filename restriction in some gdb.btrace testsGuinevere Larsen2-27/+37
The test gdb.btrace/tailcall.exp has multiple tests that include the filename in the output. When testing with gcc, only a relative path is printed, but when using clang, the full file path is printed instead. This makes most of those tests fail, with the exception of "record goto 4" which allows for more characters before the file name. The test gdb.btrace/recod_goto.exp suffers with the same issue This commit allows for text before the filename. However, instead of how the aforementioned "record goto 4", it uses a regexp that doesn't allow for newlines, just in case some off output happens. Approved-By: Tom Tromey <tom@tromey.com>
2024-01-12Update copyright year range in header of all files managed by GDBAndrew Burgess57-57/+57
This commit is the result of the following actions: - Running gdb/copyright.py to update all of the copyright headers to include 2024, - Manually updating a few files the copyright.py script told me to update, these files had copyright headers embedded within the file, - Regenerating gdbsupport/Makefile.in to refresh it's copyright date, - Using grep to find other files that still mentioned 2023. If these files were updated last year from 2022 to 2023 then I've updated them this year to 2024. I'm sure I've probably missed some dates. Feel free to fix them up as you spot them.
2023-04-27gdb/testsuite: change newline patterns used in gdb_testAndrew Burgess4-12/+12
This commit makes two changes to how we match newline characters in the gdb_test proc. First, for the newline pattern between the command output and the prompt, I propose changing from '[\r\n]+' to an explicit '\r\n'. The old pattern would spot multiple newlines, and so there are a few places where, as part of this commit, I've needed to add an extra trailing '\r\n' to the pattern in the main test file, where GDB's output actually includes a blank line. But I think this is a good thing. If a command produces a blank line then we should be checking for it, the current gdb_test doesn't do that. But also, with the current gdb_test, if a blank line suddenly appears in the output, this is going to be silently ignored, and I think this is wrong, the test should fail in that case. Additionally, the existing pattern will happily match a partial newline. There are a strangely large number of tests that end with a random '.' character. Not matching a literal period, but matching any single character, this is then matching half of the trailing newline sequence, while the \[\r\n\]+ in gdb_test is matching the other half of the sequence. I can think of no reason why this would be intentional, I suspect that the expected output at one time included a period, which has since been remove, but I haven't bothered to check on this. In this commit I've removed all these unneeded trailing '.' characters. The basic rule of gdb_test after this is that the expected pattern needs to match everything up to, but not including the newline sequence immediately before the GDB prompt. This is generally how the proc is used anyway, so in almost all cases, this commit represents no significant change. Second, while I was cleaning up newline matching in gdb_test, I've also removed the '[\r\n]*' that was added to the start of the pattern passed to gdb_test_multiple. The addition of this pattern adds no value. If the user pattern matches at the start of a line then this would match against the newline sequence. But, due to the '*', if the user pattern doesn't match at the start of a line then this group doesn't care, it'll happily match nothing. As such, there's no value to it, it just adds more complexity for no gain, so I'm removing it. No tests will need updating as a consequence of this part of the patch. Reviewed-By: Tom Tromey <tom@tromey.com>
2023-03-28[gdb/testsuite] Fix gdb.btrace/multi-inferior.exp for remote hostTom de Vries1-2/+4
Fix test-case gdb.btrace/multi-inferior.exp for remote host using gdb_remote_download. Tested on x86_64-linux.
2023-03-28[gdb/testsuite] Fix gdb.btrace/gcore.exp for remote hostTom de Vries1-1/+1
Fix test-case gdb.btrace/gcore.exp for remote host using host_standard_output. Tested on x86_64-linux.
2023-03-28[gdb/testsuite] Fix gdb.btrace/reconnect.exp for remote targetTom de Vries1-1/+3
Fix test-case gdb.btrace/reconnect.exp for target board remote-gdbserver-on-localhost using gdb_remote_download. Tested on x86_64-linux.
2023-01-26Minor "require" fixupsTom Tromey1-4/+1
I found a couple of spots that could use "require", and one spot where hoisting the "require" closer to the top of the file made it more clear.
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.