• R/O
  • HTTP
  • SSH
  • HTTPS

List of commits

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


All branches
RSS
修訂. 時間 作者
37ab865 2020-06-20 00:55:52 Tom de Vries

[gdb/testsuite] Limit default_target_compile override

The file lib/future.exp contains an override of dejagnu's
default_target_compile.

The override is activated if dejagnu's default_target_compile is missing
support for one or more languages.

However, if the override is activated, it's active for all languages.

This unnecessarily extends the scope of potential problems in the override to
languages that don't need the override.

Fix this by limiting the scope of the override.

Also add a note stating for which languages the override is active, as a
reminder that support for those languages needs to be ported to dejagnu. With
my system dejagnu 1.6.1, as well as with current dejagnu trunk, that gives us:
...
NOTE: Dejagnu's default_target_compile is missing support for Go, using \
local override
NOTE: Dejagnu's default_target_compile is missing support for Rust, using \
local override
...

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-06-19 Tom de Vries <tdevries@suse.de>

* lib/gdb.exp (gdb_note): New proc.
* lib/future.exp (gdb_default_target_compile_1): Factor out of ...
(gdb_default_target_compile): ... here. Only call
gdb_default_target_compile_1 if use_gdb_compile(<lang>) is set.
(use_gdb_compile): Change to array.
(toplevel): Update sets of use_gdb_compile to specify language.
Warn about default_target_compile override. Store dejagnu's version
of default_target_compile in dejagnu_default_target_compile.

13aa5ce 2020-06-19 18:25:43 Nick Clifton

Silence warnings about incompatible plugins.

I have been looking at a Fedora bug report[1] from a user who was
receiving warning messages from the BFD library about incompatible
plugins. It turns out that they had both 32-bit and 64-bit versions
of the same plugin installed, and the BFD library was attempting to
load all of them.

After thinking about it for a while, it seemed to me that the simplest
solution was to not warn about incompatible plugins whilst attempting
to create a list of viable plugins.

[1]: https://bugzilla.redhat.com/show_bug.cgi?id=1836618

* plugin.c (try_load_plugin): Suppress the error message about
being unable to open a plugin if creating a list of viable
plugins.

e443398 2020-06-19 12:29:30 Alan Modra

Re: ld testsuite fixes for alpha

I missed some.

* testsuite/ld-plugin/pr22983.1.d: Accept st_other notations.
* testsuite/ld-plugin/pr22983.2.d: Likewise.
* testsuite/ld-plugin/pr22983.4.d: Likewise.

2d0a923 2020-06-19 09:31:09 Alan Modra

ld testsuite fixes for alpha

Some tests failed just due to st_other info, eg. [NOPV], being
emitted by readelf or objdump. Fix that. Also since alpha doesn't
support ifunc, don't run the ifunc tests for alpha.

* testsuite/ld-elf/dynamic-1.rd: Accept st_other notations.
* testsuite/ld-elf/rdynamic-1.rd: Likewise.
* testsuite/ld-elf/pr9676.rd: Likewise.
* testsuite/ld-elf/pr9679.rd: Likewise.
* testsuite/ld-elfvers/vers30.dsym: Likewise.
* testsuite/ld-elfvers/vers31.dsym: Likewise.
* testsuite/ld-plugin/pr22983.3.d: Likewise.
* testsuite/ld-ifunc/ifunc.exp: Exclude alpha.

5fd104a 2020-06-19 09:20:20 Alan Modra

Emit a warning when -z relro is unsupported

ld silently accepts -z relro and -z norelro for targets that lack the
necessary GNU_RELRO support. This patch makes those targets emit a
warning instead, and adds testsuite infrastructure to detect when
relro is unsupported.

binutils/
* testsuite/config/default.exp (ld_elf_shared_opt): Don't set.
* testsuite/lib/binutils-common.exp (check_relro_support): New proc.
(run_dump_test): Use check_relro_support to decide whether to pass
extra ld option "-z norelro".
ld/
* emultempl/elf.em (gld${EMULATION_NAME}_handle_option): Omit
-z relro and -z norelro when target support for GNU_RELRO is lacking.
(gld${EMULATION_NAME}_before_parse): Ignore RELRO default too.
* emultempl/aarch64elf.em (gld${EMULATION_NAME}_before_parse): Ignore
RELRO default when target support for GNU_RELRO is lacking.
* emultempl/armelf.em (gld${EMULATION_NAME}_before_parse): Likewise.
* emultempl/linux.em (gld${EMULATION_NAME}_before_parse): Likewise.
* emultempl/scoreelf.em (gld${EMULATION_NAME}_before_parse): Likewise.
* testsuite/config/default.exp (ld_elf_shared_opt): Don't set.
* testsuite/ld-elf/pr16322.d: xfail when no relro support.
* testsuite/ld-elf/pr22393-1a.d: Likewise.
* testsuite/ld-elf/pr22393-1b.d: Likewise.
* testsuite/ld-elf/shared.exp (pr20995-2.so, pr20995-2): Likewise.
* testsuite/lib/ld-lib.exp (run_ld_link_tests): Use check_relro_support
to decide whether to pass extra ld option "-z norelro".

7979bcc 2020-06-19 09:00:56 GDB Administrator

Automatic date update in version.in

2b0fb5f 2020-06-19 09:00:33 GDB Administrator

Automatic date update in version.in

753d158 2020-06-19 09:00:18 GDB Administrator

Automatic date update in version.in

3922b30 2020-06-19 07:18:36 Pedro Alves

Decouple inferior_ptid/inferior_thread(); dup ptids in thread list (PR 25412)

In PR 25412, Simon noticed that after the multi-target series, the
tid-reuse.exp testcase manages to create a duplicate thread in the
thread list. Or rather, two threads with the same PTID.

add_thread_silent has code in place to detect the case of a new thread
reusing some older thread's ptid, but it doesn't work correctly
anymore when the old thread is NOT the current thread and it has a
refcount higher than 0. Either condition prevents a thread from being
deleted, but the refcount case wasn't being considered. I think the
reason that case wasn't considered is that that code predates
thread_info refcounting. Back when it was originally written,
delete_thread always deleted the thread.

That add_thread_silent code in question has some now-unnecessary
warts, BTW. For instance, this:

/* Make switch_to_thread not read from the thread. */
new_thr->state = THREAD_EXITED;

... used to be required because switch_to_thread would update
'stop_pc' otherwise. I.e., it would read registers from an exited
thread otherwise. switch_to_thread no longer reads the stop_pc, since:

commit f2ffa92bbce9dd5fbedc138ac2a3bc8a88327d09
Author: Pedro Alves <palves@redhat.com>
AuthorDate: Thu Jun 28 20:18:24 2018 +0100

gdb: Eliminate the 'stop_pc' global

Also, if the ptid of the now-gone current thread is reused, we
currently return from add_thread_silent with the current thread
pointing at the _new_ thread. Either pointing at the old thread, or
at no thread selected would be reasonable. But pointing at an
unrelated thread (the new thread that happens to reuse the ptid) is
just broken. Seems like I was the one who wrote it like that but I
have no clue why, FWIW.

Currently, an exited thread kept in the thread list still holds its
original ptid. The idea was that we need the ptid to be able to
temporarily switch to another thread and then switch back to the
original thread, because thread switching is really inferior_ptid
switching. Switching back to the original thread requires a ptid
lookup.

Now, in order to avoid exited threads with the same ptid as a live
thread in the same thread list, one thing I considered (and tried) was
to change an exited thread's ptid to minus_one_ptid. However, with
that, there's a case that we won't handle well, which is if we end up
with more than one exited thread in the list, since then all exited
threads will all have the same ptid. Since inferior_thread() relies
on inferior_ptid, may well return the wrong thread.

My next attempt to address this, was to switch an exited thread's ptid
to a globally unique "exited" ptid, which is a ptid with pid == -1 and
tid == 'the thread's global GDB thread number'. Note that GDB assumes
that the GDB global thread number is monotonically increasing and
doesn't wrap around. (We should probably make GDB thread numbers
64-bit to prevent that happening in practice; they're currently signed
32-bit.) This attempt went a long way, but still ran into a number of
issues. It was a major hack too, obviously.

My next attempt is the one that I'm proposing, which is to bite the
bullet and break the connection between inferior_ptid and
inferior_thread(), aka the current thread. I.e., make the current
thread be a global thread_info pointer that is written to directly by
switch_to_thread, etc., and making inferior_thread() return that
pointer, instead of having inferior_thread() lookup up the
inferior_ptid thread, by ptid_t. You can look at this as a
continuation of the effort of using more thread_info pointers instead
of ptids when possible.

By making the current thread a global thread_info pointer, we can make
switch_to_thread simply write to the global thread pointer, which
makes scoped_restore_current_thread able to restore back to an exited
thread without relying on unrelyable ptid look ups. I.e., this makes
it not a real problem to have more than one thread with the same ptid
in the thread list. There will always be only one live thread with a
given ptid, so code that looks up a live thread by ptid will always be
able to find the right one.

This change required auditing the whole codebase for places where we
were writing to inferior_ptid directly to change the current thread,
and change them to use switch_to_thread instead or one of its
siblings, because otherwise inferior_thread() would return a thread
unrelated to the changed-to inferior_ptid. That was all (hopefully)
done in previous patches.

After this, inferior_ptid is mainly used by target backend code. It
is also relied on by a number of target methods. E.g., the
target_resume interface and the memory reading routines -- we still
need it there because we need to be able to access memory off of
processes for which we don't have a corresponding inferior/thread
object, like when handling forks. Maybe we could pass down a context
explicitly to target_read_memory, etc.

gdb/ChangeLog:
2020-06-18 Pedro Alves <palves@redhat.com>

PR gdb/25412
* gdbthread.h (delete_thread, delete_thread_silent)
(find_thread_ptid): Update comments.
* thread.c (current_thread_): New global.
(is_current_thread): Move higher, and reimplement.
(inferior_thread): Reimplement.
(set_thread_exited): Use bool. Add assertions.
(add_thread_silent): Simplify thread-reuse handling by always
calling delete_thread.
(delete_thread): Remove intro comment.
(find_thread_ptid): Skip exited threads.
(switch_to_thread_no_regs): Write to current_thread_.
(switch_to_no_thread): Check CURRENT_THREAD_ instead of
INFERIOR_PTID. Clear current_thread_.

6dbdab4 2020-06-19 07:18:08 Pedro Alves

Don't write to inferior_ptid in aix-thread.c

There are other writes in the file, but they seem more harmless. This
one is changing the current thread permanently.

gdb/ChangeLog:
2020-06-18 Pedro Alves <palves@redhat.com>

* aix-thread.c (pd_update): Use switch_to_thread.

2da4b78 2020-06-19 07:17:31 Pedro Alves

Don't write to inferior_ptid in ravenscar-thread.c

gdb/ChangeLog:
2020-06-18 Pedro Alves <palves@redhat.com>

* ravenscar-thread.c (ravenscar_thread_target): Update.
(ravenscar_thread_target::update_inferior_ptid): Rename to ...
(ravenscar_thread_target::add_active_thread): ... this. Don't
set m_base_ptid here. Update to avoid referencing inferior_ptid.
(ravenscar_thread_target::wait): Don't write to inferior_ptid.

50838d1 2020-06-19 07:17:01 Pedro Alves

Don't write to inferior_ptid in windows-nat.c, part II

Writing to inferior_ptid in
windows_nat_target::get_windows_debug_event is just incorrect and not
necessary. We'll report the event to GDB's core, which then takes
care of switching inferior_ptid / current thread.

Related (see windows_nat_target::get_windows_debug_event), there's
also a "current_windows_thread" global that is just begging to get out
of sync with core GDB's current thread. This patch removes it.
gdbserver already does not have an equivalent global in win32-low.cc.

gdb/ChangeLog:
2020-06-18 Pedro Alves <palves@redhat.com>

* nat/windows-nat.c (current_windows_thread): Remove.
* nat/windows-nat.h (current_windows_thread): Remove.
* windows-nat.c (windows_nat_target::stopped_by_sw_breakpoint):
Adjust.
(display_selectors): Adjust to fetch the current
windows_thread_info based on inferior_ptid.
(fake_create_process): No longer write to current_windows_thread.
(windows_nat_target::get_windows_debug_event):
Don't set inferior_ptid or current_windows_thread.
(windows_nat_target::wait): Adjust to not rely on
current_windows_thread.
(do_initial_windows_stuff): Now a method of windows_nat_target.
Switch to the last_ptid thread.
(windows_nat_target::attach): Adjust.
(windows_nat_target::detach): Use switch_to_no_thread instead of
writing to inferior_ptid directly.
(windows_nat_target::create_inferior): Adjust.

31ce04e 2020-06-19 07:16:25 Pedro Alves

Don't write to inferior_ptid in windows-nat.c, part I

The inferior_ptid hack in do_initial_win32_stuff, added back in 2008:

https://sourceware.org/ml/gdb-patches/2008-10/msg00012.html

with:

commit 9f9d052e600ed9436f9fd558d62a189c8cc3d43e
Author: Pierre Muller <muller@sourceware.org>
AuthorDate: Thu Oct 2 14:20:07 2008 +0000

* win32-nat.c (do_initial_win32_stuff): Set inferior_ptid.

is no longer needed. Back then, current_inferior looked like this:

struct inferior*
current_inferior (void)
{
struct inferior *inf = find_inferior_pid (ptid_get_pid (inferior_ptid));
gdb_assert (inf);
return inf;
}

Nowadays, current_inferior() just returns the global current_inferior_
pointer, which didn't exist back then.

gdb/ChangeLog:
2020-06-18 Pedro Alves <palves@redhat.com>

* windows-nat.c (do_initial_windows_stuff): No longer set inferior_ptid.

1ee1a36 2020-06-19 07:15:48 Pedro Alves

Don't write to inferior_ptid in go32-nat.c

gdb/ChangeLog:
2020-06-18 Pedro Alves <palves@redhat.com>

* go32-nat.c (go32_nat_target::create_inferior): Switch to thread
after creating it, instead of writing to inferior_ptid. Don't
write to inferior_ptid.

6d35075 2020-06-19 07:15:16 Pedro Alves

Don't write to inferior_ptid in fork-child.c

This is no longer necessary. All targets that call fork_inferior now
also call switch_to_thread as soon as they add the main thread.

gdb/ChangeLog:
2020-06-18 Pedro Alves <palves@redhat.com>

* fork-child.c (postfork_hook): Don't write to inferior_ptid.

5d971d4 2020-06-19 07:14:40 Pedro Alves

Don't write to inferior_ptid in bsd-kvm.c

gdb/ChangeLog:
2020-06-18 Pedro Alves <palves@redhat.com>

* bsd-kvm.c (bsd_kvm_target_open): Switch to thread after adding
it, instead of writing to inferior_ptid.

86e57d1 2020-06-19 07:14:15 Pedro Alves

Don't write to inferior_ptid in btrace_fetch

gdb/ChangeLog:
2020-06-18 Pedro Alves <palves@redhat.com>

* btrace.c (btrace_fetch): Use switch_to_thread instead of writing
to inferior_ptid.

f2e1c12 2020-06-19 07:13:47 Pedro Alves

Don't write to inferior_ptid in bsd-kvm.c

gdb/ChangeLog:
2020-06-18 Pedro Alves <palves@redhat.com>

* bsd-kvm.c (bsd_kvm_target::close): Use switch_to_no_thread
instead of writing to inferior_ptid directly.

60db1b8 2020-06-19 07:12:43 Pedro Alves

Don't write to inferior_ptid in corelow.c

gdb/ChangeLog:
2020-06-18 Pedro Alves <palves@redhat.com>

* corelow.c (core_target::close): Use switch_to_no_thread instead
of writing to inferior_ptid directly.
(add_to_thread_list, core_target_open): Use switch_to_thread
instead of writing to inferior_ptid directly.

fe7d6a8 2020-06-19 07:11:57 Pedro Alves

Don't write to inferior_ptid in darwin-nat.c

Untested.

gdb/ChangeLog:
2020-06-18 Pedro Alves <palves@redhat.com>

* darwin-nat.c (darwin_nat_target::decode_message): Don't write to
inferior_ptid.
(darwin_nat_target::stop_inferior, darwin_nat_target::kill): Avoid
inferior_ptid.
(darwin_attach_pid): Use switch_to_no_thread instead of writing to
inferior_ptid directly.
(darwin_nat_target::init_thread_list): Switch to thread, instead
of writing to inferior_ptid.
(darwin_nat_target::attach): Don't write to inferior_ptid.
(darwin_nat_target::get_ada_task_ptid): Avoid inferior_ptid.

975f870 2020-06-19 07:11:23 Pedro Alves

Don't write to inferior_ptid in gnu-nat.c

Untested.

gdb/ChangeLog:
2020-06-18 Pedro Alves <palves@redhat.com>

* gnu-nat.c (gnu_nat_target::create_inferior): Switch to the added
thread.
(gnu_nat_target::attach): Don't write to inferior_ptid directly.
Instead use switch_to_thread.
(gnu_nat_target::detach): Use switch_to_no_thread
instead of writing to inferior_ptid directly. Used passed-in
inferior instead of looking up the inferior by pid.

1a20473 2020-06-19 07:10:53 Pedro Alves

Don't write to inferior_ptid in go32-nat.c

generic_mourn_inferior already takes care of switching to no thread.

gdb/ChangeLog:
2020-06-18 Pedro Alves <palves@redhat.com>

* go32-nat.c (go32_nat_target::create_inferior): Don't write to
inferior_ptid.

ebe84f2 2020-06-19 07:10:09 Pedro Alves

Don't write to inferior_ptid in nto-procfs.c

A best effort patch, which fixes some bit rot and removes some
inferior_ptid references -- this port clearly hasn't been built in a
long while.

gdb/ChangeLog:
2020-06-18 Pedro Alves <palves@redhat.com>

* nto-procfs.c (nto_procfs_target::update_thread_list): Avoid
inferior_ptid.
(nto_procfs_target::attach): Avoid inferior_ptid. Switch to
thread.
(nto_procfs_target::detach): Avoid referencing
inferior_ptid. Use switch_to_no_thread instead of writing to
inferior_ptid directly.
(nto_procfs_target::mourn_inferior): Use switch_to_no_thread
instead of writing to inferior_ptid directly.
(nto_procfs_target::create_inferior): Avoid inferior_ptid. Switch
to thread.

191f02e 2020-06-19 07:09:05 Pedro Alves

Don't write to inferior_ptid in remote-sim.c

gdb/ChangeLog:
2020-06-18 Pedro Alves <palves@redhat.com>

* remote-sim.c (gdbsim_target::create_inferior): Switch to thread
after creating it, instead of writing to inferior_ptid.
(gdbsim_target_open): Use switch_to_no_thread instead of writing
to inferior_ptid directly.
(gdbsim_target::wait): Don't write to inferior_ptid.

0ac5531 2020-06-19 07:08:14 Pedro Alves

Don't write to inferior_ptid in remote.c

gdb/ChangeLog:
2020-06-18 Pedro Alves <palves@redhat.com>

* remote.c (remote_target::remote_notice_new_inferior): Use
switch_to_thread instead of writing to inferior_ptid directly.
(remote_target::add_current_inferior_and_thread): Use
switch_to_no_thread instead of writing to inferior_ptid directly.
(extended_remote_target::attach): Use switch_to_inferior_no_thread
and switch_to_thread instead of using set_current_inferior or
writing to inferior_ptid directly.

5233f39 2020-06-19 07:07:35 Pedro Alves

Don't write to inferior_ptid in tracectf.c

gdb/ChangeLog:
2020-06-18 Pedro Alves <palves@redhat.com>

* tracectf.c (ctf_target_open): Switch to added thread instead of
writing to inferior_ptid directly.
(ctf_target::close): Use switch_to_no_thread instead of writing to
inferior_ptid directly.

087e161 2020-06-19 07:06:57 Pedro Alves

Don't write to inferior_ptid in tracefile-tfile.c

gdb/ChangeLog:
2020-06-18 Pedro Alves <palves@redhat.com>

* tracefile-tfile.c (tfile_target_open): Don't write to
inferior_ptid directly, instead switch to added thread.
(tfile_target::close): Use switch_to_no_thread instead of writing
to inferior_ptid directly.

7fb43e5 2020-06-19 07:06:03 Pedro Alves

Don't write to inferior_ptid in procfs.c

The inferior_ptid write in procfs_do_thread_registers should be
unnecessary because the target_fetch_registers method should (and
does) extract the ptid from the regcache.

Not tested.

gdb/ChangeLog:
2020-06-18 Pedro Alves <palves@redhat.com>

* procfs.c (procfs_target::attach): Don't write to inferior_ptid.
(procfs_target::detach): Use switch_to_no_thread
instead of writing to inferior_ptid directly.
(do_attach): Change return type to void. Switch to the added
thread.
(procfs_target::create_inferior): Switch to the added thread.
(procfs_do_thread_registers): Don't write to inferior_ptid.

18493a0 2020-06-19 07:05:18 Pedro Alves

Don't write to inferior_ptid in infrun.c

gdb/ChangeLog:
2020-06-18 Pedro Alves <palves@redhat.com>

* infrun.c (generic_mourn_inferior): Use switch_to_thread instead
of writing to inferior_ptid.
(scoped_restore_exited_inferior): Delete.
(handle_vfork_child_exec_or_exit): Simplify using
scoped_restore_current_pspace_and_thread. Use switch_to_thread
instead of writing to inferior_ptid.
(THREAD_STOPPED_BY): Delete.
(thread_stopped_by_watchpoint, thread_stopped_by_sw_breakpoint)
(thread_stopped_by_hw_breakpoint): Delete.
(save_waitstatus): Use
scoped_restore_current_thread+switch_to_thread, and call
target_stopped_by_watchpoint instead of
thread_stopped_by_watchpoint, target_stopped_by_sw_breakpoint
instead of thread_stopped_by_sw_breakpoint, and
target_stopped_by_hw_breakpoint instead of
thread_stopped_by_hw_breakpoint.
(handle_inferior_event)
<TARGET_WAITKIND_EXITED/TARGET_WAITKIND_SIGNALLED>: Don't write to
inferior_ptid directly, nor
set_current_inferior/set_current_program_space. Use
switch_to_thread / switch_to_inferior_no_thread instead.

a0776b1 2020-06-19 07:04:50 Pedro Alves

Don't write to inferior_ptid in target.c

gdb/ChangeLog:
2020-06-18 Pedro Alves <palves@redhat.com>

* target.c (generic_mourn_inferior): Use switch_to_no_thread
instead of writing to inferior_ptid.