aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
AgeCommit message (Collapse)AuthorFilesLines
2023-01-19GDB: Allow arbitrary keywords in integer set commandsMaciej W. Rozycki6-38/+53
Rather than just `unlimited' allow the integer set commands (or command options) to define arbitrary keywords for the user to use, removing hardcoded arrangements for the `unlimited' keyword. Remove the confusingly named `var_zinteger', `var_zuinteger' and `var_zuinteger_unlimited' `set'/`show' command variable types redefining them in terms of `var_uinteger', `var_integer' and `var_pinteger', which have the range of [0;UINT_MAX], [INT_MIN;INT_MAX], and [0;INT_MAX] each. Following existing practice `var_pinteger' allows extra negative values to be used, however unlike `var_zuinteger_unlimited' any number of such values can be defined rather than just `-1'. The "p" in `var_pinteger' stands for "positive", for the lack of a more appropriate unambiguous letter, even though 0 obviously is not positive; "n" would be confusing as to whether it stands for "non-negative" or "negative". Add a new structure, `literal_def', the entries of which define extra keywords allowed for a command and numerical values they correspond to. Those values are not verified against the basic range supported by the underlying variable type, allowing extra values to be allowed outside that range, which may or may not be individually made visible to the user. An optional value translation is possible with the structure to follow the existing practice for some commands where user-entered 0 is internally translated to UINT_MAX or INT_MAX. Such translation can now be arbitrary. Literals defined by this structure are automatically used for completion as necessary. So for example: const literal_def integer_unlimited_literals[] = { { "unlimited", INT_MAX, 0 }, { nullptr } }; defines an extra `unlimited' keyword and a user-visible 0 value, both of which get translated to INT_MAX for the setting to be used with. Similarly: const literal_def zuinteger_unlimited_literals[] = { { "unlimited", -1, -1 }, { nullptr } }; defines the same keyword and a corresponding user-visible -1 value that is used for the requested setting. If the last member were omitted (or set to `{}') here, then only the keyword would be allowed for the user to enter and while -1 would still be used internally trying to enter it as a part of a command would result in an "integer -1 out of range" error. Use said error message in all cases (citing the invalid value requested) replacing "only -1 is allowed to set as unlimited" previously used for `var_zuinteger_unlimited' settings only rather than propagating it to `var_pinteger' type. It could only be used for the specific case where a single extra `unlimited' keyword was defined standing for -1 and the use of numeric equivalents is discouraged anyway as it is for historical reasons only that they expose GDB internals, confusingly different across variable types. Similarly update the "must be >= -1" Guile error message. Redefine Guile and Python parameter types in terms of the new variable types and interpret extra keywords as Scheme keywords and Python strings used to communicate corresponding parameter values. Do not add a new PARAM_INTEGER Guile parameter type, however do handle the `var_integer' variable type now, permitting existing parameters defined by GDB proper, such as `listsize', to be accessed from Scheme code. With these changes in place it should be trivial for a Scheme or Python programmer to expand the syntax of the `make-parameter' command and the `gdb.Parameter' class initializer to have arbitrary extra literals along with their internal representation supplied. Update the testsuite accordingly. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-01-19[gdb/testsuite] Fix gdb.python/py-value-cc.exp for big endianTom de Vries2-2/+3
On s390x-linux, I run into: ... (gdb) python print(u[u_fields[0]])^M 99^M (gdb) PASS: gdb.python/py-value-cc.exp: u's first field via field python print(u[u_fields[1]])^M 0 '\000'^M (gdb) FAIL: gdb.python/py-value-cc.exp: u's second field via field ... There's a var u of this type: ... union U { int a; char c; }; ... and after assigning 99 to u.a, the test-case expects u.c to contain 99 (which it does on x86_64), but instead it contains 0. Fix this by instead assigning 0x63636363, to ensure that u.c == 99 for both little and big endian. Tested on x86_64-linux and s390x-linux.
2023-01-18Revert "X86: reverse-finish fix"Carl Love9-200/+57
This reverts commit b22548ddb30bfb167708e82d3bb932461c1b703a. This patch is being reverted since the patch series is causing regressions.
2023-01-18Revert "PowerPC: fix for gdb.reverse/finish-precsave.exp and ↵Carl Love2-120/+15
gdb.reverse/finish-reverse.exp" This reverts commit 92e07580db6a5572573d5177ca23933064158f89. Reverting patch as the patch series is causing regressions.
2023-01-18gdb: care for dynamic objfiles in build_id_bfd_get ()Jan Vrany1-0/+4
Accessing gdb.Objfile.build_id caused GDB to crash when objfile is dynamic, that is created by JIT reader API. The issue was NULL-pointer dereferencing in build_id_bfd_get () because dynamic objfiles have no underlaying BFD structure. This commit fixes the problem by a NULL-check in build_id_bfd_get ().
2023-01-17Use require in paramless.expTom Tromey1-1/+1
The new paramless.exp test was not converted to the new "require" approach. This patch fixes the problem.
2023-01-17PowerPC: fix for gdb.reverse/finish-precsave.exp and ↵Carl Love2-15/+120
gdb.reverse/finish-reverse.exp PR record/29927 - reverse-finish requires two reverse next instructions to reach previous source line PowerPC uses two entry points called the local entry point (LEP) and the global entry point (GEP). Normally the LEP is used when calling a function. However, if the table of contents (TOC) value in register 2 is not valid the GEP is called to setup the TOC before execution continues at the LEP. When executing in reverse, the function finish_backward sets the break point at the alternate entry point (GEP). However if the forward execution enters via the normal entry point (LEP), the reverse execution never sees the break point at the GEP of the function. Reverse execution continues until the next break point is encountered or the end of the recorded log is reached causing gdb to stop at the wrong place. This patch adds a new address to struct execution_control_state to hold the address of the alternate function start address, known as the GEP on PowerPC. The finish_backwards function is updated. If the stopping point is between the two entry points (the LEP and GEP on PowerPC), the stepping range is set to execute back to the alternate entry point (GEP on PowerPC). Otherwise, a breakpoint is inserted at the normal entry point (LEP on PowerPC). Function process_event_stop_test checks uses a stepping range to stop execution in the caller at the first instruction of the source code line. Note, on systems that only support one entry point, the address of the two entry points are the same. Test finish-reverse-next.exp is updated to include tests for the reverse-finish command when the function is entered via the normal entry point (i.e. the LEP) and the alternate entry point (i.e. the GEP). The patch has been tested on X86 and PowerPC with no regressions.
2023-01-17X86: reverse-finish fixCarl Love9-57/+200
PR record/29927 - reverse-finish requires two reverse next instructions to reach previous source line Currently on X86, when executing the finish command in reverse, gdb does a single step from the first instruction in the callee to get back to the caller. GDB stops on the last instruction in the source code line where the call was made. When stopped at the last instruction of the source code line, a reverse next or step command will stop at the first instruction of the same source code line thus requiring two step/next commands to reach the previous source code line. It should only require one step/next command to reach the previous source code line. By contrast, a reverse next or step command from the first line in a function stops at the first instruction in the source code line where the call was made. This patch fixes the reverse finish command so it will stop at the first instruction of the source line where the function call was made. The behavior on X86 for the reverse-finish command now matches doing a reverse-next from the beginning of the function. The proceed_to_finish flag in struct thread_control_state is no longer used. This patch removes the declaration, initialization and setting of the flag. This patch requires a number of regression tests to be updated. Test gdb.mi/mi-reverse.exp no longer needs to execute two steps to get to the previous line. The gdb output for tests gdb.reverse/until-precsave.exp and gdb.reverse/until-reverse.exp changed slightly. The expected result in tests gdb.reverse/amd64-failcall-reverse.exp and gdb.reverse/singlejmp-reverse.exp are updated to the correct expected result. This patch adds a new test gdb.reverse/finish-reverse-next.exp to test the reverse-finish command when returning from the entry point and from the body of the function. The step_until proceedure in test gdb.reverse/step-indirect-call-thunk.exp was moved to lib/gdb.exp and renamed cmd_until. The patch has been tested on X86 and PowerPC to verify no additional regression failures occured. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29927
2023-01-17gdb/testsuite: expect SIGSEGV from top GDB spawn idSimon Marchi2-2/+2
When testing with the native-extended-gdbserver, I get: Thread 1 "xgdb" received signal SIGSEGV, Segmentation fault. 0x00007ffff6d828f2 in GC_find_limit_with_bound () from /usr/lib/x86_64-linux-gnu/libgc.so.1 (gdb) FAIL: gdb.gdb/selftest.exp: xgdb is at prompt This is because the -re that is supposed to match this SIGSEGV is after `-i $inferior_spawn_id`. On native, the top and bottom GDB are on the same spawn id, so it ends up working. But with a gdbserver board, that's not the case. Move the SIGSEGV -re before the `-i $inferior_spawn_id` line, such that it matches what the top GDB outputs. Do the same fix in gdb.gdb/python-helper.exp. Change-Id: I3291630e218a5a3a6a47805b999ddbc9b968c927 Approved-By: Tom Tromey <tom@tromey.com>
2023-01-17Fix parameter-less template regression in new DWARF readerTom Tromey2-0/+87
PR c++/29896 points out a regression in the new DWARF reader. It does not properly handle a case like "break fn", where "fn" is a template function. This happens because the new index uses strncasecmp to compare. However, to make this work correctly, we need a custom function that ignores template parameters. This patch adds a custom comparison function and fixes the bug. A new test case is included. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29896
2023-01-14Pass internal gdb flags to --configuration invocationsTom Tromey2-3/+3
The test suite uses the --configuration flag to feature-test gdb. However, when I added this, I neglected to pass the internal gdbflags to this, causing an error, which then caused failures in the test suite (which would not be seen if you'd ever run "make install"). This patch fixes the bug. Tested by removing my install tree first, to verify that I could reproduce the failure.
2023-01-13Rename to allow_tui_testsTom Tromey11-38/+18
This changes skip_tui_tests to invert the sense, and renames it to allow_tui_tests. It also rewrites this function to use the output of "gdb --configuration", and it adds a note about the state of the TUI to that output.
2023-01-13Rename to allow_guile_testsTom Tromey28-97/+56
This changes skip_guile_tests to invert the sense, and renames it to allow_guile_tests. It also rewrites this proc to check the output of "gdb --configuration", as was done for Python. Then it changes the code to use "require" where possible.
2023-01-13Rename to allow_hw_breakpoint_testsTom Tromey8-18/+12
This changes skip_hw_breakpoint_tests to invert the sense, and renames it to allow_hw_breakpoint_tests. This also converts some tests to use "require" -- I missed this particular check in the first series.
2023-01-13Rename to allow_tsx_testsTom Tromey2-11/+11
This changes skip_tsx_tests to invert the sense, and renames it to allow_tsx_tests.
2023-01-13Rename to allow_shlib_testsTom Tromey87-93/+93
This changes skip_shlib_tests to invert the sense, and renames it to allow_shlib_tests.
2023-01-13Rename to allow_rust_testsTom Tromey16-20/+20
This changes skip_rust_tests to invert the sense, and renames it to allow_rust_tests.
2023-01-13Rename to allow_python_testsTom Tromey116-122/+122
This changes skip_python_tests to invert the sense, and renames it to allow_python_tests.
2023-01-13Rename to allow_perf_testsTom Tromey22-26/+26
This changes skip_perf_tests to invert the sense, and renames it to allow_perf_tests.
2023-01-13Rename to allow_opencl_testsTom Tromey6-13/+13
This changes skip_opencl_tests to invert the sense, and renames it to allow_opencl_tests.
2023-01-13Rename to allow_ifunc_testsTom Tromey3-6/+6
This changes skip_ifunc_tests to invert the sense, and renames it to allow_ifunc_tests.
2023-01-13Rename to allow_hw_watchpoint_testsTom Tromey32-97/+97
This changes skip_hw_watchpoint_tests to invert the sense, and renames it to allow_hw_watchpoint_tests.
2023-01-13Rename to allow_hw_watchpoint_multi_testsTom Tromey7-11/+11
This changes skip_hw_watchpoint_multi_tests to invert the sense, and renames it to allow_hw_watchpoint_multi_tests.
2023-01-13Rename to allow_hw_watchpoint_access_testsTom Tromey8-12/+12
This changes skip_hw_watchpoint_access_tests to invert the sense, and renames it to allow_hw_watchpoint_access_tests.
2023-01-13Rename to allow_go_testsTom Tromey15-17/+17
This changes skip_go_tests to invert the sense, and renames it to allow_go_tests.
2023-01-13Rename to allow_gdbserver_testsTom Tromey39-46/+46
This changes skip_gdbserver_tests to invert the sense, and renames it to allow_gdbserver_tests.
2023-01-13Rename to allow_fortran_testsTom Tromey74-76/+76
This changes skip_fortran_tests to invert the sense, and renames it to allow_fortran_tests.
2023-01-13Rename to allow_d_testsTom Tromey8-10/+10
This changes skip_d_tests to invert the sense, and renames it to allow_d_tests.
2023-01-13Rename to allow_dlmopen_testsTom Tromey2-13/+13
This changes skip_dlmopen_tests to invert the sense, and renames it to allow_dlmopen_tests.
2023-01-13Rename to allow_debuginfod_testsTom Tromey2-8/+8
This changes skip_debuginfod_tests to invert the sense, and renames it to allow_debuginfod_tests.
2023-01-13Rename to allow_ctf_testsTom Tromey8-10/+10
This changes skip_ctf_tests to invert the sense, and renames it to allow_ctf_tests.
2023-01-13Rename to allow_cplus_tests and allow_stl_testsTom Tromey183-195/+193
This changes skip_cplus_tests to invert the sense, and renames it to allow_cplus_tests. This one also converts skip_stl_tests to allow_stl_tests, as that was convenient to do at the same time.
2023-01-13Rename to allow_btrace_testsTom Tromey29-43/+43
This changes skip_btrace_tests to invert the sense, and renames it to allow_btrace_tests.
2023-01-13Rename to allow_btrace_pt_testsTom Tromey2-16/+16
This changes skip_btrace_pt_tests to invert the sense, and renames it to allow_btrace_pt_tests.
2023-01-13Rename to allow_avx512fp16_testsTom Tromey3-14/+14
This changes skip_avx512fp16_tests to invert the sense, and renames it to allow_avx512fp16_tests.
2023-01-13Rename to allow_avx512bf16_testsTom Tromey2-13/+13
This changes skip_avx512bf16_tests to invert the sense, and renames it to allow_avx512bf16_tests.
2023-01-13Rename to allow_ada_testsTom Tromey204-207/+207
This changes skip_ada_tests to invert the sense, and renames it to allow_ada_tests.
2023-01-13Rename to allow_aarch64_sve_testsTom Tromey3-11/+11
This changes skip_aarch64_sve_tests to invert the sense, and renames it to allow_aarch64_sve_tests.
2023-01-13Rename to allow_xml_testTom Tromey20-25/+24
This changes gdb_skip_xml_test to invert the sense, and renames it to allow_xml_test.
2023-01-13Use "require" for Python testsTom Tromey100-374/+170
This changes various tests to use "require" for the Python feature.
2023-01-13Fix latent bug in default_prompt_gdb_startTom Tromey1-0/+11
default_prompt_gdb_start mimics default_gdb_start, but does not set the use_gdb_stub global. This caused one Python test to work only because it used the ordinary gdb_start before later using default_prompt_gdb_start. This patch updates default_prompt_gdb_start to set this global as well.
2023-01-13Remove mi_skip_python_testsTom Tromey4-9/+3
mi_skip_python_tests was necessary because skip_python_tests used the running gdb, and so needed to know what prompt to expect. Now that skip_python_tests has been rewritten, mi_skip_python_tests is no longer needed.
2023-01-13Rewrite skip_python_testsTom Tromey2-25/+4
This rewrites skip_python_tests to examine the output of "gdb --configuration". This is a bit nicer because it does not require an already-running gdb.
2023-01-13Use require gnat_runtime_has_debug_infoTom Tromey6-24/+6
This changes some tests to use "require gnat_runtime_has_debug_info".
2023-01-13Use require !skip_debuginfod_testsTom Tromey1-1/+1
This changes some tests to use "require !skip_debuginfod_tests".
2023-01-13Use require using_fissionTom Tromey2-8/+2
This changes some tests to use "require using_fission".
2023-01-13Use require target_can_use_run_cmdTom Tromey6-18/+6
This changes some tests to use "require target_can_use_run_cmd".
2023-01-13Use require !skip_opencl_testsTom Tromey5-20/+5
This changes some tests to use "require !skip_opencl_tests".
2023-01-13Use require !skip_perf_testsTom Tromey21-63/+21
This changes some tests to use "require !skip_perf_tests".
2023-01-13Use require gdb_trace_common_supports_archTom Tromey28-112/+28
This changes some tests to use "require gdb_trace_common_supports_arch".