aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
AgeCommit message (Collapse)AuthorFilesLines
2023-01-13Use require gdb_skip_xml_testTom Tromey11-44/+11
This changes some tests to use "require gdb_skip_xml_test".
2023-01-13Use require !gdb_debug_enabledTom Tromey18-71/+18
This changes some tests to use "require !gdb_debug_enabled".
2023-01-13Use require is_c_compiler_gccTom Tromey21-77/+21
This changes some tests to use "require is_c_compiler_gcc".
2023-01-13Use require !skip_shlib_testsTom Tromey6-10/+12
This changes some tests to use "require !skip_shlib_tests". This patch cleans up a few spots that were missed in the earlier patch.
2023-01-13Use require !skip_gdbserver_testsTom Tromey34-108/+34
This changes some tests to use "require !skip_gdbserver_tests".
2023-01-13Use require isnativeTom Tromey16-40/+26
This changes some tests to use "require isnative".
2023-01-13Use require can_spawn_for_attachTom Tromey22-69/+22
This changes some tests to use "require can_spawn_for_attach".
2023-01-13Use require !use_gdb_stubTom Tromey45-146/+52
This changes some tests to use "require !use_gdb_stub".
2023-01-13Use require support_go_compileTom Tromey11-22/+11
This changes some tests to use "require support_go_compile".
2023-01-13Use require supports_get_siginfo_typeTom Tromey3-12/+3
This changes some tests to use "require supports_get_siginfo_type".
2023-01-13Use require can_single_step_to_signal_handlerTom Tromey1-4/+1
This changes some tests to use "require can_single_step_to_signal_handler".
2023-01-13Use require is_elf_targetTom Tromey2-6/+2
This changes some tests to use "require is_elf_target".
2023-01-13Use require is_amd64_regs_targetTom Tromey4-14/+4
This changes some tests to use "require is_amd64_regs_target".
2023-01-13Use require is_aarch32_targetTom Tromey7-28/+7
This changes some tests to use "require is_aarch32_target".
2023-01-13Use require is_aarch64_targetTom Tromey13-52/+13
This changes some tests to use "require is_aarch64_target".
2023-01-13Use require support_displaced_steppingTom Tromey12-50/+12
This changes some tests to use "require support_displaced_stepping".
2023-01-13Use require !skip_avx_*Tom Tromey3-12/+3
This changes some tests to use "require" with !skip_avx_*.
2023-01-13Use require !skip_btrace_testsTom Tromey27-108/+27
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_aarch64_sve_testsTom Tromey1-4/+1
This changes some tests to use "require !skip_aarch64_sve_tests".
2023-01-13Use require !skip_ifunc_testsTom Tromey2-8/+2
This changes some tests to use "require !skip_ifunc_tests".
2023-01-13Use require !skip_hw_watchpoint_testsTom Tromey19-56/+20
This changes some tests to use "require !skip_hw_watchpoint_tests".
2023-01-13Use require !skip_ctf_testsTom Tromey5-20/+5
This changes some tests to use "require !skip_ctf_tests".
2023-01-13Use require !skip_d_testsTom Tromey5-5/+5
This changes some tests to use "require !skip_d_tests".
2023-01-13Use require !skip_go_testsTom Tromey13-13/+13
This changes some tests to use "require !skip_go_tests".
2023-01-13Use require !skip_ada_testsTom Tromey202-204/+202
This changes some tests to use "require !skip_ada_tests".
2023-01-13Use require !skip_fortran_testsTom Tromey73-81/+73
This changes some tests to use "require !skip_fortran_tests".
2023-01-13Use require !skip_rust_testsTom Tromey15-43/+15
This changes some tests to use "require !skip_rust_tests".
2023-01-13Use require !skip_stl_testsTom Tromey5-5/+5
This changes some tests to use "require !skip_stl_tests".
2023-01-13Use require !skip_dlmopen_testsTom Tromey1-4/+1
This changes some tests to use "require !skip_dlmopen_tests".
2023-01-13Use require !skip_shlib_testsTom Tromey74-238/+75
This changes some tests to use "require !skip_shlib_tests".
2023-01-13Use require !skip_cplus_testsTom Tromey171-265/+171
This changes some tests to use "require !skip_cplus_tests".
2023-01-13Use require is_x86_like_targetTom Tromey18-77/+18
This changes some tests to use "require is_x86_like_target".
2023-01-13Use require dwarf2_supportTom Tromey215-661/+215
This changes some tests to use "require dwarf2_support".
2023-01-13Use require supports_process_recordTom Tromey10-66/+26
This changes some tests to use "require supports_process_record".
2023-01-13Use require supports_reverseTom Tromey30-101/+30
This changes some tests to use "require supports_reverse".
2023-01-13Use unsupported in 'require'Tom Tromey1-1/+1
This changes 'require' to use 'unsupported' rather than 'untested'. The latter doesn't really seem to be correct according to the DejaGNU documentation: Declares a test was not run. `untested' writes in the log file a message beginning with _UNTESTED_, appending the `message' argument. For example, you might use this in a dummy test whose only role is to record that a test does not yet exist for some feature. The example there, and some text elsewhere, is what makes me think this isn't a great fit. On the other hand, 'unsupported' says: Declares that a test case depends on some facility that does not exist in the testing environment.
2023-01-13Change 'require' to accept a list of predicatesTom Tromey11-41/+30
This changes 'require' to accept a list of simple predicates. For now, each predicate is just the name of a proc, optionally prefixed with "!" to indicate that the result should be inverted. It's possible to make this fancier, but so far I haven't done so. One idea I had is to allow a predicate to have associated text to display on failure. Another is to convert the predicates that need a running gdb (e.g., skip_python_tests) to start their own gdb, and then 'require' could enforce the rule that gdb not be running when it is called.
2023-01-13Don't use ensure_gdb_index with requireTom Tromey6-6/+24
This series changes 'require' to take a list of simple predicates. This patch backs out the one use of 'require' that doesn't conform to this -- calling ensure_gdb_index.
2023-01-12Disable ptype/o for dynamic typesTom Tromey2-0/+76
A user pointed out that "ptype/o" of a certain Ada type -- while in C mode -- caused gdb to crash. The bug here is that dynamic types can't really be printed this way. This patch avoids the bug by disabling the "/o" feature in this case. Note that using "ptype/o" in this way makes sense for the time being, because the Ada code doesn't support the "/o" feature (yet); and in any case gdb should not crash.
2023-01-11[gdb/testsuite] Fix regexp in gdb.threads/dlopen-libpthread.expSimon Marchi1-2/+2
Fix regexp in gdb.threads/dlopen-libpthread.exp: 'libpthread\\.so' -> '/libpthread\\.so'. Tested on x86_64-linux.
2023-01-11[gdb/testsuite] Fix gdb.threads/dlopen-libpthread.exp for upstream glibc, againTom de Vries2-6/+41
On an x86_64 laptop running ubuntu 22.04.1 with unity desktop: ... $ echo $XDG_CURRENT_DESKTOP Unity:Unity7:ubuntu ... I have: ... $ echo $LD_PRELOAD libgtk3-nocsd.so.0 ... due to package gtk3-nocsd, a package recommended by unity-session. Consequently, for each exec these dependencies are pulled in, including libpthread.so.0: ... $ lddtree /lib/x86_64-linux-gnu/libgtk3-nocsd.so.0 libgtk3-nocsd.so.0 => /lib/x86_64-linux-gnu/libgtk3-nocsd.so.0 (interpreter => none) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 ld-linux-x86-64.so.2 => /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ... So, while test-case gdb.threads/dlopen-libpthread.exp appears to run ok: ... # of expected passes 12 # of unsupported tests 1 ... with LD_PRELOAD="" we have instead: ... (gdb) PASS: gdb.threads/dlopen-libpthread.exp: continue to breakpoint: notify info sharedlibrary^M From To Syms Read Shared Object Library^M $hex $hex Yes /lib64/ld-linux-x86-64.so.2^M $hex $hex Yes /lib/x86_64-linux-gnu/libc.so.6^M $hex $hex Yes dlopen-libpthread.so^M (gdb) FAIL: gdb.threads/dlopen-libpthread.exp: libpthread.so found ... The problem is that libpthread is expected as dependency of dlopen-libpthread.so, but it's missing: ... $ lddtree dlopen-libpthread.so dlopen-libpthread.so => ./dlopen-libpthread.so (interpreter => none) libc.so.6 => $outputs/gdb.threads/dlopen-libpthread/dlopen-libpthread.so.d/libc.so.6 ld-linux-x86-64.so.2 => /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ... due to having glibc 2.35, which has libpthread integrated into libc. Fix this by: - adding a proc has_dependency - using [has_dependency $exec libpthread.so] as hint that libpthread may be preloaded - using ![has_dependency $shlib libpthread.so] to detect that the libpthread.so dependency is missing. Also add a missing return after untested "no matching probes". Tested on x86_64-linux, with and without LD_PRELOAD="".
2023-01-10gdb/dwarf2: Fix 'rw_pieced_value' for values casted to different type.Rohr, Stephan1-1/+51
The 'rw_pieced_value' function is executed when fetching a (lazy) variable described by 'DW_OP_piece' or 'DW_OP_bit_piece'. The function checks the 'type' and 'enclosing_type' fields of the value for identity. * The 'type' field describes the type of a value. * In most cases, the 'enclosing_type' field is identical to the 'type' field. * Scenarios where the 'type' and 'enclosing_type' of an object differ are described in 'gdb/value.c'. Possible cases are: * If a value represents a C++ object, then the 'type' field gives the object's compile-time type. If the object actually belongs to some class derived from `type', perhaps with other base classes and additional members, then `type' is just a subobject of the real thing, and the full object is probably larger than `type' would suggest. * If 'type' is a dynamic class (i.e. one with a vtable), then GDB can actually determine the object's run-time type by looking at the run-time type information in the vtable. GDB may then elect to read the entire object. * If the user casts a variable to a different type (e.g. 'print (<type> []) <variable>'), the value's type is updated before reading the value. If a lazy value is fetched, GDB allocates space based on the enclosing type's length and typically reads the 'full' object. This is not implemented for pieced values and causes an internal error if 'type' and 'enclosing_type' of a value are not identical. However, GDB can read the value based on its type. Thus, this patch fixes the previously mentioned cases by removing the check for identity. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28605 gdb/ChangeLog: 2022-04-13 Stephan Rohr <stephan.rohr@intel.com> * dwarf2/loc.c (rw_pieced_value): Fix check on 'type' and 'enlcosing_type' when reading pieced value 'v'. gdb/testsuite/ChangeLog: 2022-04-13 Stephan Rohr <stephan.rohr@intel.com> * gdb.dwarf2/shortpiece.exp: Added test cases.
2023-01-09gdb/linespec.c: Fix missing source file during breakpoint re-setAaron Merey1-0/+9
During breakpoint re-setting, the source_filename of an explicit_location_spec is used to lookup the symtabs associated with the breakpoint being re-set. This source_filename is compared with each known symtab filename in order to retrieve the breakpoint's symtabs. However the source_filename may have been originally copied from a symtab's fullname (the path where GDB found the source file) when the breakpoint was first created. If a breakpoint symtab's filename and fullname differ and there is no substitute-path rule that converts the fullname to the filename, this will cause a NOT_FOUND_ERROR to be thrown during re-setting. Fix this by using a symtab's filename to set the explicit_location_spec source_filename instead of the symtab's fullname.
2023-01-09Fix crash with C++ qualified namesTom Tromey1-0/+1
PR c++/29503 points out that something like "b->Base::member" will crash when 'b' does not have pointer type. This seems to be a simple oversight in eval_op_member. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29503 Reviewed-By: Bruno Larsen <blarsen@redhat.com>
2023-01-09testsuite: add -O0 to Intel compilers if no 'optimize' option is givenTankut Baris Aktemur1-0/+41
icpx/icx give the following warning if '-g' is used without '-O'. icpx: remark: Note that use of '-g' without any optimization-level option will turn off most compiler optimizations similar to use of '-O0'; use '-Rno-debug-disables-optimization' to disable this remark [-Rdebug-disables-optimization] The warning makes dejagnu think that compilation has failed. E.g.: $ make check TESTS="gdb.cp/local.exp" RUNTESTFLAGS="CXX_FOR_TARGET='icpx' CC_FOR_TARGET=icx" ... gdb compile failed, icpx: remark: Note that use of '-g' without any optimization-level option will turn off most compiler optimizations similar to use of '-O0'; use '-Rno-debug-disables-optimization' to disable this remark [-Rdebug-disables-optimization] === gdb Summary === # of untested testcases 1 Furthermore, if no -O flag is passed, icx/icc optimize the code by default. This breaks assumptions in many GDB tests that the code is unoptimized by default. E.g.: $ make check TESTS="gdb.cp/cmpd-minsyms.exp" RUNTESTFLAGS="CXX_FOR_TARGET='icpx' CC_FOR_TARGET=icx" ... FAIL: gdb.cp/cmpd-minsyms.exp: gdb_breakpoint: set breakpoint at 'GDB<int>::a() const' FAIL: gdb.cp/cmpd-minsyms.exp: gdb_breakpoint: set breakpoint at 'GDB<int>::b() volatile' FAIL: gdb.cp/cmpd-minsyms.exp: gdb_breakpoint: set breakpoint at 'GDB<int>::c() const volatile' FAIL: gdb.cp/cmpd-minsyms.exp: gdb_breakpoint: set breakpoint at GDB<int>::operator == FAIL: gdb.cp/cmpd-minsyms.exp: gdb_breakpoint: set breakpoint at GDB<int>::operator==(GDB<int> const&) FAIL: gdb.cp/cmpd-minsyms.exp: gdb_breakpoint: set breakpoint at GDB<char>::harder(char) FAIL: gdb.cp/cmpd-minsyms.exp: gdb_breakpoint: set breakpoint at GDB<int>::harder(int) FAIL: gdb.cp/cmpd-minsyms.exp: gdb_breakpoint: set breakpoint at "int GDB<char>::even_harder<int>(char)" FAIL: gdb.cp/cmpd-minsyms.exp: gdb_breakpoint: set breakpoint at GDB<int>::simple() === gdb Summary === # of expected passes 1 # of unexpected failures 9 To fix both problems, pass the -O0 flag explicitly, if no optimization option is given. With this patch we get, e.g.: $ make check TESTS="gdb.cp/cmpd-minsyms.exp gdb.cp/local.exp" RUNTESTFLAGS="CXX_FOR_TARGET='icpx' CC_FOR_TARGET=icx" ... === gdb Summary === # of expected passes 19 # of known failures 1 Approved-By: Tom Tromey <tom@tromey.com>
2023-01-09testsuite: handle icc and icpc deprecated remarksNils-Christian Kempke1-7/+30
Starting with icc/icpc version 2021.7.0 and higher both compilers emit a deprecation remark when used. E.g. >> icc --version icc: remark #10441: The Intel(R) C++ Compiler Classic (ICC) is deprecated and will be removed from product release in the second half of 2023. The Intel(R) oneAPI DPC++/C++ Compiler (ICX) is the recommended compiler moving forward. Please transition to use this compiler. Use '-diag-disable=10441' to disable this message. icc (ICC) 2021.7.0 20220713 Copyright (C) 1985-2022 Intel Corporation. All rights reserved. >> icpc --version icpc: remark #10441: The Intel(R) C++ Compiler Classic (ICC) is deprecated ... icpc (ICC) 2021.7.0 20220720 Copyright (C) 1985-2022 Intel Corporation. All rights reserved. As the testsuite compile fails when unexpected output by the compiler is seen this change in the compiler breaks all existing icc and icpc tests. This patch makes the gdb testsuite more forgiving by a) allowing the output of the remark when trying to figure out the compiler version and by b) adding '-diag-disable=10441' to the compile command whenever gdb_compile is called without the intention to detect the compiler. Approved-By: Tom Tromey <tom@tromey.com>
2023-01-06gdb/c++: Detect ambiguous variables in imported namespacesBruno Larsen1-2/+11
When running gdb.cp/nsusing.cc and stopping at line 17, we can ask GDB to print x and get a compiler-dependent answer. Using gcc 12.2.1, GDB will print M::x, and using clang 16.0.0 prints N::x. Not only is this behavior confusing to users, it is also not consistent with compiler behaviors, which would warn that using x is ambiguous at this point. This commit makes GDB behavior consistent with compilers. it achieves this by making it so instead of exiting early when finding any symbol with the correct name, GDB continues searching through all include directives, storing all matching symbols in a relational map betwen the mangled name and the found symbols. If the resulting map has more than one entry, GDB says that the reference is ambiguous and lists all possibilities. Otherwise it returns the block_symbol structure for the desired symbol, or an empty struct if nothing was found. The commit also changes gdb.cp/nsusing.exp to test the ambiguous detection.
2023-01-06gdb/mi: add no-history stop reasonBruno Larsen1-1/+1
When executing in reverse and runs out of recorded history, GDB prints a warning to the user, but does not add a reason in the stopped record, for example: *stopped,frame={addr="0x000000000040113e",func="main",args=[],file="/home/blarsen/Documents/fsf_build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.reverse/solib-reverse.c",fullname="/home/blarsen/Documents/binutils-gdb/gdb/testsuite/gdb.reverse/solib-reverse.c",line="27",arch="i386:x86-64"},thread-id="1",stopped-threads="all",core="1" This problem was reported as record/29260. This commit adds the reason no-history to the record, making it easier for interfaces using the mi interpreter to report the result. It also changes the test gdb.mi/mi-reverse.exp to test that the reason shows up correctly. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29260
2023-01-06gdb/testsuite: Fix FAILs in gdb.linespec/cpcompletion.exp when using clangBruno Larsen1-15/+18
When using clang 16.0.0 to test gdb.linespec/cpcompletion.exp, I get 99 unexpected failures. They all fail to produce a complete list of completion options for a function, either overload2_function, overload3_function or anon_ns_function. This happens because clang is optimizing them away, since they are never used. Fix this by adding __attribute__((used)) to all declarations to the aforementioned functions.