Commit Graph

107147 Commits

Author SHA1 Message Date
GDB Administrator
707055a26d Automatic date update in version.in 2022-01-13 00:00:31 +00:00
Mike Frysinger
685c3b6b8f sim: add ChangeLog for SIGSTKSZ update 2022-01-12 06:58:31 -05:00
Mike Frysinger
17d6f2152b sim: filter out SIGSTKSZ [PR sim/28302]
We map target signals to host signals so we can propagate signals
between the host & simulated worlds.  That means we need to know
the symbolic names & values of all signals that might be sent.

The tools that generate that list use signal.h and include all
symbols that start with "SIG" so as to automatically include any
new symbols that the C library might add.  Unfortunately, this
also picks up "SIGSTKSZ" which is not actually a signal itself,
but a signal related setting -- it's the size of the stack when
a signal is handled.

By itself this doesn't super matter as we will never see a signal
with that same value (since the range of valid signals tend to be
way less than 1024, and the size of the default signal stack will
never be that small).  But with recent glibc changes that make this
into a dynamic value instead of a compile-time constant, some users
see build failures when building the sim.

As suggested by Adam Sampson, update our scripts to ignore this
symbol to simplify everything and avoid the build failure.

Bug: https://sourceware.org/PR28302
2022-01-12 06:02:08 -05:00
GDB Administrator
2e894896ae Automatic date update in version.in 2022-01-12 00:00:37 +00:00
GDB Administrator
7a52f4e7ba Automatic date update in version.in 2022-01-11 00:00:49 +00:00
Fangrui Song
fb0b83d80d bfd_section_from_shdr: Support SHT_RELR sections
If a.so contains an SHT_RELR section, objcopy a.so will fail with:

    a.so: unknown type [0x13] section `.relr.dyn'

This change allows objcopy to work.

bfd/
    * elf.c (bfd_section_from_shdr): Support SHT_RELR.

(cherry picked from commit a619b58721)
2022-01-10 05:05:22 -08:00
Fangrui Song
67609c9c70 readelf: Support SHT_RELR/DT_RELR for -r
The -r output for SHT_RELR looks like:

Relocation section '.relr.dyn' at offset 0x530 contains 4 entries:
  7 offsets
00000000000028c0
00000000000028c8
0000000000003ad0
0000000000003ad8
0000000000003ae0
0000000000003ae8
0000000000003af0

For --use-dynamic, the header looks like

    'RELR' relocation section at offset 0x530 contains 32 bytes:

include/
    * elf/common.h (DT_ENCODING): Bump to 38.
    * elf/external.h (Elf32_External_Relr): New.
    (Elf64_External_Relr): New.

(cherry picked from commit a7fd118627)
2022-01-10 05:05:22 -08:00
Fangrui Song
1b244ed9d3 readelf: Support RELR in -S and -d and output
readelf -r dumping support is not added in this patch.

include/
	* elf/common.h: Add SHT_RELR, DT_RELR{,SZ,ENT}
bfd/
	* elf.c (_bfd_elf_print_private_bfd_data): Add DT_RELR{,SZ,ENT}.

(cherry picked from commit dd207c1302)
2022-01-10 05:05:22 -08:00
GDB Administrator
6473a19828 Automatic date update in version.in 2022-01-10 00:00:40 +00:00
GDB Administrator
c3ed5e03da Automatic date update in version.in 2022-01-09 00:00:36 +00:00
GDB Administrator
a1620b8ad4 Automatic date update in version.in 2022-01-08 00:00:27 +00:00
GDB Administrator
3a9183ba79 Automatic date update in version.in 2022-01-07 00:00:33 +00:00
GDB Administrator
99e28ccf1c Automatic date update in version.in 2022-01-06 00:00:26 +00:00
GDB Administrator
e62a5735c6 Automatic date update in version.in 2022-01-05 00:00:39 +00:00
GDB Administrator
131890b09d Automatic date update in version.in 2022-01-04 00:00:33 +00:00
GDB Administrator
7932ed1d8a Automatic date update in version.in 2022-01-03 00:00:47 +00:00
GDB Administrator
0611afc4a5 Automatic date update in version.in 2022-01-02 00:00:36 +00:00
GDB Administrator
ca396c1289 Automatic date update in version.in 2022-01-01 00:00:33 +00:00
GDB Administrator
9a1012563c Automatic date update in version.in 2021-12-31 00:00:34 +00:00
GDB Administrator
ab31db4296 Automatic date update in version.in 2021-12-30 00:00:29 +00:00
GDB Administrator
4e3308b4ef Automatic date update in version.in 2021-12-29 00:00:36 +00:00
GDB Administrator
a661fc7968 Automatic date update in version.in 2021-12-28 00:00:23 +00:00
GDB Administrator
6567268b01 Automatic date update in version.in 2021-12-27 00:00:23 +00:00
GDB Administrator
a03fbc6504 Automatic date update in version.in 2021-12-26 00:00:27 +00:00
GDB Administrator
caa9934704 Automatic date update in version.in 2021-12-25 00:00:25 +00:00
GDB Administrator
345b218476 Automatic date update in version.in 2021-12-24 00:00:26 +00:00
Andrew Burgess
6eccc2c811 gdb/remote: handle attach when stop packet lacks thread-id
Bug PR gdb/28405 reports a regression when using attach with an
extended-remote target.  In this case the target is not including a
thread-id in the stop packet it sends back after the attach.

The regression was introduced with this commit:

  commit 8f66807b98
  Date:   Wed Jan 13 20:26:58 2021 -0500

      gdb: better handling of 'S' packets

The problem is that when GDB processes the stop packet, it sees that
there is no thread-id and so has to "guess" which thread the stop
should apply to.

In this case the target only has one thread, so really, there's no
guessing needed, but GDB still runs through the same process, this
shouldn't cause us any problems.

However, after the above commit, GDB now expects itself to be more
internally consistent, specifically, only a thread that GDB thinks is
resumed, can be a candidate for having stopped.

It turns out that, when GDB attaches to a process through an
extended-remote target, the threads of the process being attached too,
are not, initially, marked as resumed.

And so, when GDB tries to figure out which thread the stop might apply
too, it finds no threads in the processes marked resumed, and so an
assert triggers.

In extended_remote_target::attach we create a new thread with a call
to add_thread_silent, rather than remote_target::remote_add_thread,
the reason is that calling the latter will result in a call to
'add_thread' rather than 'add_thread_silent'.  However,
remote_target::remote_add_thread includes additional
actions (i.e. calling remote_thread_info::set_resumed and set_running)
which are missing from extended_remote_target::attach.  These missing
calls are what would serve to mark the new thread as resumed.

In this commit I propose that we add an extra parameter to
remote_target::remote_add_thread.  This new parameter will force the
new thread to be added with a call to add_thread_silent.  We can now
call remote_add_thread from the ::attach method, the extra
actions (listed above) will now be performed, and the thread will be
left in the correct state.

Additionally, in PR gdb/28405, a segfault is reported.  This segfault
triggers when 'set debug remote 1' is used before trying to reproduce
the original assertion failure.  The cause of this is in
remote_target::select_thread_for_ambiguous_stop_reply, where we do
this:

  remote_debug_printf ("first resumed thread is %s",
		       pid_to_str (first_resumed_thread->ptid).c_str ());
  remote_debug_printf ("is this guess ambiguous? = %d", ambiguous);

  gdb_assert (first_resumed_thread != nullptr);

Notice that when debug printing is on we dereference
first_resumed_thread before we assert that the pointer is not
nullptr.  This is the cause of the segfault, and is resolved by moving
the assert before the debug printing code.

I've extended an existing test, ext-attach.exp, so that the original
test is run multiple times; we run in the original mode, as normal,
but also, we now run with different packets disabled in gdbserver.  In
particular, disabling Tthread would trigger the assertion as it was
reported in the original bug.  I also run the test in all-stop and
non-stop modes now for extra coverage, we also run the tests with
target-async enabled, and disabled.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28405

This is a cherry pick of commit b622494ee3 with a minor edit
in gdb.server/ext-attach.exp to disable some tests that fail due to
unrelated bugs.  Those unrelated bugs have been fixed in the master
branch.

gdb/ChangeLog:

	PR gdb/28405
	* remote.c (remote_target::remote_add_thread): Add new silent_p
	argument, use as needed.
	(remote_target::remote_notice_new_inferior): Pass additional
	argument to remote_add_thread.
	(remote_target::remote_notice_new_inferior): Likewise.
	(extended_remote_target::attach): Call remote_add_thread instead
	of add_thred_silent directly.
	(remote_target::select_thread_for_ambiguous_stop_reply): Move
	assert earlier, before we use the thing we're asserting is not
	nullptr.

gdb/testsuite/ChangeLog:

	PR gdb/28405
	* gdb.server/ext-attach.exp (run_test): New proc containing all of
	the old code for running the core of the test.  This proc is then
	called multiple times from the global scope.
2021-12-23 12:31:17 +00:00
GDB Administrator
f76f728ffd Automatic date update in version.in 2021-12-23 00:00:37 +00:00
GDB Administrator
a370d72ecf Automatic date update in version.in 2021-12-22 00:00:26 +00:00
GDB Administrator
929b774352 Automatic date update in version.in 2021-12-21 00:00:35 +00:00
GDB Administrator
5605cc18dd Automatic date update in version.in 2021-12-20 00:00:24 +00:00
GDB Administrator
d98eeb47ea Automatic date update in version.in 2021-12-19 00:00:39 +00:00
GDB Administrator
810d072bd7 Automatic date update in version.in 2021-12-18 00:00:24 +00:00
GDB Administrator
e3d95ca82e Automatic date update in version.in 2021-12-17 00:00:34 +00:00
GDB Administrator
e6e466cedd Automatic date update in version.in 2021-12-16 00:00:24 +00:00
GDB Administrator
ea170f6ffe Automatic date update in version.in 2021-12-15 00:00:39 +00:00
GDB Administrator
45be8a2b16 Automatic date update in version.in 2021-12-14 00:00:23 +00:00
GDB Administrator
273fac204d Automatic date update in version.in 2021-12-13 00:00:23 +00:00
GDB Administrator
ab55bbac1f Automatic date update in version.in 2021-12-12 00:00:18 +00:00
Bruno Larsen
b6fc91c70a PR gdb/28480: Improve ambiguous member detection
Basic ambiguity detection assumes that when 2 fields with the same name
have the same byte offset, it must be an unambiguous request. This is not
always correct. Consider the following code:

class empty { };

class A {
public:
  [[no_unique_address]] empty e;
};

class B {
public:
  int e;
};

class C: public A, public B { };

if we tried to use c.e in code, the compiler would warn of an ambiguity,
however, since A::e does not demand an unique address, it gets the same
address (and thus byte offset) of the members, making A::e and B::e have the
same address. however, "print c.e" would fail to report the ambiguity,
and would instead print it as an empty class (first path found).

The new code solves this by checking for other found_fields that have
different m_struct_path.back() (final class that the member was found
in), despite having the same byte offset.

The testcase gdb.cp/ambiguous.exp was also changed to test for this
behavior.

gdb/ChangeLog:

        PR gdb/28480
        * valops.c (struct_field_searcher::update_result): Improve
        ambiguous member detection.

gdb/testsuite/ChangeLog:

        PR gdb/28480

        Pushed by Joel Brobecker  <brobecker@adacore.com>
        * gdb.cp/ambiguous.cc: Add code to permit ambiguous member testing.
        * gdb.cp/ambiguous.exp: Add ambiguous member test.

(cherry picked from commit a41ad3474c)
2021-12-11 11:47:53 +04:00
GDB Administrator
773d894825 Automatic date update in version.in 2021-12-11 00:00:18 +00:00
GDB Administrator
2d77b379a9 Automatic date update in version.in 2021-12-10 00:00:33 +00:00
GDB Administrator
2d5dce68ed Automatic date update in version.in 2021-12-09 00:00:34 +00:00
GDB Administrator
d317660e0f Automatic date update in version.in 2021-12-08 00:00:27 +00:00
GDB Administrator
f032db248f Automatic date update in version.in 2021-12-07 00:00:22 +00:00
GDB Administrator
50cf27bed5 Automatic date update in version.in 2021-12-06 00:00:25 +00:00
GDB Administrator
f6447d9f92 Automatic date update in version.in 2021-12-05 00:00:31 +00:00
GDB Administrator
fc73c76917 Automatic date update in version.in 2021-12-04 00:00:26 +00:00
GDB Administrator
59830e9697 Automatic date update in version.in 2021-12-03 00:00:25 +00:00
GDB Administrator
63d2050f29 Automatic date update in version.in 2021-12-02 00:00:27 +00:00