50031 Commits

Author SHA1 Message Date
f40c0f9cab Use require gdb_skip_xml_test
This changes some tests to use "require gdb_skip_xml_test".
2023-01-13 13:18:56 -07:00
e5bf39c507 Use require !gdb_debug_enabled
This changes some tests to use "require !gdb_debug_enabled".
2023-01-13 13:18:56 -07:00
402c744761 Use require is_c_compiler_gcc
This changes some tests to use "require is_c_compiler_gcc".
2023-01-13 13:18:56 -07:00
78a1c061b2 Use require !skip_shlib_tests
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-13 13:18:56 -07:00
ba16d4d85f Use require !skip_gdbserver_tests
This changes some tests to use "require !skip_gdbserver_tests".
2023-01-13 13:18:56 -07:00
604f757b6d Use require isnative
This changes some tests to use "require isnative".
2023-01-13 13:18:56 -07:00
06e93b057c Use require can_spawn_for_attach
This changes some tests to use "require can_spawn_for_attach".
2023-01-13 13:18:56 -07:00
8ce7423fda Use require !use_gdb_stub
This changes some tests to use "require !use_gdb_stub".
2023-01-13 13:18:56 -07:00
1b1f4ab760 Use require support_go_compile
This changes some tests to use "require support_go_compile".
2023-01-13 13:18:56 -07:00
5f3ef82813 Use require supports_get_siginfo_type
This changes some tests to use "require supports_get_siginfo_type".
2023-01-13 13:18:56 -07:00
b7e1107003 Use require can_single_step_to_signal_handler
This changes some tests to use "require can_single_step_to_signal_handler".
2023-01-13 13:18:56 -07:00
28343f921b Use require is_elf_target
This changes some tests to use "require is_elf_target".
2023-01-13 13:18:56 -07:00
9eeafef372 Use require is_amd64_regs_target
This changes some tests to use "require is_amd64_regs_target".
2023-01-13 13:18:56 -07:00
abdc86caeb Use require is_aarch32_target
This changes some tests to use "require is_aarch32_target".
2023-01-13 13:18:56 -07:00
d9050fb8fa Use require is_aarch64_target
This changes some tests to use "require is_aarch64_target".
2023-01-13 13:18:55 -07:00
0a7043e0c5 Use require support_displaced_stepping
This changes some tests to use "require support_displaced_stepping".
2023-01-13 13:18:55 -07:00
2a90424099 Use require !skip_avx_*
This changes some tests to use "require" with !skip_avx_*.
2023-01-13 13:18:55 -07:00
6848695de2 Use require !skip_btrace_tests
This changes some tests to use "require !skip_btrace_tests".
2023-01-13 13:18:55 -07:00
ede8c648c4 Use require !skip_btrace_pt_tests
This changes some tests to use "require !skip_btrace_pt_tests" and
"require !skip_tsx_tests".
2023-01-13 13:18:55 -07:00
37c3d17ab7 Use require !skip_aarch64_sve_tests
This changes some tests to use "require !skip_aarch64_sve_tests".
2023-01-13 13:18:55 -07:00
caab91aebb Use require !skip_ifunc_tests
This changes some tests to use "require !skip_ifunc_tests".
2023-01-13 13:18:55 -07:00
7c1a12b3e8 Use require !skip_hw_watchpoint_tests
This changes some tests to use "require !skip_hw_watchpoint_tests".
2023-01-13 13:18:55 -07:00
c76fbc7fc3 Use require !skip_ctf_tests
This changes some tests to use "require !skip_ctf_tests".
2023-01-13 13:18:55 -07:00
1952d8b042 Use require !skip_d_tests
This changes some tests to use "require !skip_d_tests".
2023-01-13 13:18:55 -07:00
0c2a02481a Use require !skip_go_tests
This changes some tests to use "require !skip_go_tests".
2023-01-13 13:18:55 -07:00
d3f81254e5 Use require !skip_ada_tests
This changes some tests to use "require !skip_ada_tests".
2023-01-13 13:18:55 -07:00
8d0278eb40 Use require !skip_fortran_tests
This changes some tests to use "require !skip_fortran_tests".
2023-01-13 13:18:55 -07:00
a9145b105e Use require !skip_rust_tests
This changes some tests to use "require !skip_rust_tests".
2023-01-13 13:18:55 -07:00
c89196229b Use require !skip_stl_tests
This changes some tests to use "require !skip_stl_tests".
2023-01-13 13:18:55 -07:00
b47c999618 Use require !skip_dlmopen_tests
This changes some tests to use "require !skip_dlmopen_tests".
2023-01-13 13:18:55 -07:00
980d95b48c Use require !skip_shlib_tests
This changes some tests to use "require !skip_shlib_tests".
2023-01-13 13:18:55 -07:00
7978d474f2 Use require !skip_cplus_tests
This changes some tests to use "require !skip_cplus_tests".
2023-01-13 13:18:55 -07:00
18d2b8767a Use require is_x86_like_target
This changes some tests to use "require is_x86_like_target".
2023-01-13 13:18:55 -07:00
ce8d533e88 Use require dwarf2_support
This changes some tests to use "require dwarf2_support".
2023-01-13 13:18:55 -07:00
ade3e4f5b1 Use require supports_process_record
This changes some tests to use "require supports_process_record".
2023-01-13 13:18:55 -07:00
5954db83d1 Use require supports_reverse
This changes some tests to use "require supports_reverse".
2023-01-13 13:18:55 -07:00
fc5ab4bc44 Use unsupported in 'require'
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-13 13:18:54 -07:00
793862d2f4 Change 'require' to accept a list of predicates
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-13 13:18:54 -07:00
15bdcf4ca1 Don't use ensure_gdb_index with require
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-13 13:18:54 -07:00
bb0797528b gdb/infrun: add debug print in print_signal_received_reason
It would have helped me to see an infrun debug line being printed from
print_signal_received_reason, so I'm adding one.
2023-01-13 16:36:17 +00:00
8dd08de7e4 gdb: int to bool conversion for normal_stop
Change the return type of normal_stop (infrun.c) from int to bool.
Update callers.

I've also converted the (void) to () in the function declaration and
definition, given I was changing those lines anyway.

There should be no user visible changes after this commit.
2023-01-13 16:34:10 +00:00
0c1aa2a095 Disable ptype/o for dynamic types
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-12 12:15:41 -07:00
7bd836d5d9 gdb/doc: fix install-html with Texinfo 7
Starting with Texinfo 7 (this commit [1]), the output directory for the
HTML doc format is gdb/doc/gdb_html, rather than gdb/doc/gdb previously.
This breaks the install-html target, which expects the HTML doc to be in
gdb/doc/gdb:

    $ make install-html MAKEINFO=makeinfo DESTDIR=/tmp/install
    make[1]: Entering directory '/home/simark/build/binutils-gdb/gdb'
    make[2]: Entering directory '/home/simark/build/binutils-gdb/gdb/doc'
    makeinfo  -DHAVE_MAKEINFO_CLICK --html  -I /home/simark/src/binutils-gdb/gdb/doc/../../readline/readline/doc -I /home/simark/src/binutils-gdb/gdb/doc/../mi -I /home/simark/src/binutils-gdb/gdb/doc /home/simark/src/binutils-gdb/gdb/doc/gdb.texinfo
    makeinfo  -DHAVE_MAKEINFO_CLICK --html  -I /home/simark/src/binutils-gdb/gdb/doc /home/simark/src/binutils-gdb/gdb/doc/stabs.texinfo
    makeinfo  -DHAVE_MAKEINFO_CLICK --html  -I /home/simark/src/binutils-gdb/gdb/doc /home/simark/src/binutils-gdb/gdb/doc/annotate.texinfo
    test -z "/usr/local/share/doc/gdb" || /bin/sh /home/simark/src/binutils-gdb/gdb/doc/../../mkinstalldirs "/tmp/install/usr/local/share/doc/gdb"
     /usr/bin/install -c -m 644 '/home/simark/src/binutils-gdb/gdb/doc/gdb' '/tmp/install/usr/local/share/doc/gdb/gdb'
    /usr/bin/install: cannot stat '/home/simark/src/binutils-gdb/gdb/doc/gdb': No such file or directory
     /usr/bin/install -c -m 644 '/home/simark/src/binutils-gdb/gdb/doc/stabs' '/tmp/install/usr/local/share/doc/gdb/stabs'
    /usr/bin/install: cannot stat '/home/simark/src/binutils-gdb/gdb/doc/stabs': No such file or directory
     /usr/bin/install -c -m 644 '/home/simark/src/binutils-gdb/gdb/doc/annotate' '/tmp/install/usr/local/share/doc/gdb/annotate'
    /usr/bin/install: cannot stat '/home/simark/src/binutils-gdb/gdb/doc/annotate': No such file or directory
    make[2]: *** [Makefile:278: install-html] Error 1
    make[2]: Leaving directory '/home/simark/build/binutils-gdb/gdb/doc'
    make[1]: *** [Makefile:2240: subdir_do] Error 1
    make[1]: Leaving directory '/home/simark/build/binutils-gdb/gdb'
    make: *** [Makefile:2006: install-html] Error 2

Fix this by adding -o switches to the HTML targets, to force the output
directories.

[1] https://git.savannah.gnu.org/cgit/texinfo.git/commit/?id=a868421baf9c44227c43490687f8d6b8d6c95414

Change-Id: Ie147dc7b4a52eb2348005b8dc006a41b0784621f
2023-01-11 17:30:05 -05:00
6be354acf3 gdb: Update gdbarch.py with latest changes in gdbarch.c
Commit 2b16913cdca2 ("gdb: make gdbarch_alloc take ownership of the tdep")
changed gdbarch.c without updating gdbarch.py.  As a result, running
gdbarch.py reverts those changes and causes the build to fail.

So change gdbarch.py to generate the current version of gdbarch.c.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-01-11 19:41:50 +00:00
2124b2de4b Set _WIN32_WINNT in common.m4 configure check
GCC recently added support for the Windows thread model, enabling
libstdc++ to support Windows natively.  However, this supporrt
requires a version of Windows later than the minimum version that is
supported by GDB.

PR build/29966 points out that the GDB configure test for std::thread
does not work in this situation, because _WIN32_WINNT is not defined
in test program, and so <thread> seems to be fine.

This patch is an attempt to fix the problem, by using the same setting
for _WIN32_WINNT at configure time as is used at build time.

I don't have access to one of the older systems so I don't think I can
truly test this.  I did do a mingw cross build, though.  I'm going to
ask the bug reporter to test it.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29966
2023-01-11 11:00:42 -07:00
1b9af5b949 [gdb/testsuite] Fix regexp in gdb.threads/dlopen-libpthread.exp
Fix regexp in gdb.threads/dlopen-libpthread.exp:
'libpthread\\.so' -> '/libpthread\\.so'.

Tested on x86_64-linux.
2023-01-11 18:37:20 +01:00
f1e1932859 [gdb/testsuite] Fix gdb.threads/dlopen-libpthread.exp for upstream glibc, again
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-11 11:44:00 +01:00
066620dcfb Fix bug in 'say_where' transform
The patch to change say_where into a method introduced a bug.  This
patch fixes it.
2023-01-10 16:36:48 -07:00
38190b2f01 gdb/dwarf2: Fix 'rw_pieced_value' for values casted to different type.
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-10 14:26:32 -07:00
7987c4636a Convert say_where to method on code_breakpoint
'say_where' is only useful (and only called for) code breakpoints, so
convert it to be a protected method on code_breakpoint.
2023-01-10 14:09:32 -07:00