Commit Graph

102150 Commits

Author SHA1 Message Date
Pedro Alves 6dbdab44e5 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.
2020-06-18 23:18:08 +01:00
Pedro Alves 2da4b788f7 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.
2020-06-18 23:17:31 +01:00
Pedro Alves 50838d1be7 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.
2020-06-18 23:17:01 +01:00
Pedro Alves 31ce04e9e0 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 9f9d052e60
  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.
2020-06-18 23:16:25 +01:00
Pedro Alves 1ee1a36345 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.
2020-06-18 23:15:48 +01:00
Pedro Alves 6d350754a3 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.
2020-06-18 23:15:16 +01:00
Pedro Alves 5d971d48b9 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.
2020-06-18 23:14:40 +01:00
Pedro Alves 86e57d1b23 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.
2020-06-18 23:14:15 +01:00
Pedro Alves f2e1c129f8 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.
2020-06-18 23:13:47 +01:00
Pedro Alves 60db1b8565 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.
2020-06-18 23:12:43 +01:00
Pedro Alves fe7d6a8db0 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.
2020-06-18 23:11:57 +01:00
Pedro Alves 975f8708de 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.
2020-06-18 23:11:23 +01:00
Pedro Alves 1a20473059 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.
2020-06-18 23:10:53 +01:00
Pedro Alves ebe84f23d2 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.
2020-06-18 23:10:09 +01:00
Pedro Alves 191f02e593 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.
2020-06-18 23:09:05 +01:00
Pedro Alves 0ac553107c 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.
2020-06-18 23:08:14 +01:00
Pedro Alves 5233f39b8b 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.
2020-06-18 23:07:35 +01:00
Pedro Alves 087e161b3c 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.
2020-06-18 23:06:57 +01:00
Pedro Alves 7fb43e53d5 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.
2020-06-18 23:06:03 +01:00
Pedro Alves 18493a005a 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.
2020-06-18 23:05:18 +01:00
Pedro Alves a0776b131d 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.
2020-06-18 23:04:50 +01:00
Pedro Alves 6155c136cc Don't write to inferior_ptid in inf-ptrace.c
gdb/ChangeLog:
2020-06-18  Pedro Alves  <palves@redhat.com>

	* inf-ptrace.c (inf_ptrace_target::create_inferior): Switch to the
	added thread.
	(inf_ptrace_target::attach): Don't write to inferior_ptid.  Switch
	to the added thread.
	(inf_ptrace_target::detach_success): Use switch_to_no_thread
	instead of writing to inferior_ptid.
2020-06-18 23:04:17 +01:00
Pedro Alves c5316fc6e6 Don't write to inferior_ptid in gdbarch-selftests.c, mock address_space too
Use switch_to_thread instead of writing to inferior_ptid.  This
requires a couple of improvements to the mocking environment.  One is
to mock a pspace too, and assigning it to the inferior.  In turn, this
requires heap-allocating the address space, so that the regular
program_space dtor destroys the address space correctly.

(Note that new the mock program_space is allocated on the stack, and
thus depends on the previous patch that eliminated
delete_program_space.)

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

	* gdbarch-selftests.c: Include "progspace-and-thread.h".
	(register_to_value_test): Mock a program_space too.  Heap-allocate
	the address space.  Don't write to inferior_ptid.  Use
	switch_to_thread instead.
2020-06-18 23:03:47 +01:00
Pedro Alves 8df017996f gcore, handle exited threads better
An early (and since discarded) version of this series tried to make
exited threads have distinct PTID between each other, and that change
exposed a problem in linux-tdep.c...  This was exposed by the
gdb.threads/gcore-stale-thread.exp testcase, which is exactly about
calling gcore with an exited thread selected:

 (gdb) [Thread 0x7ffff7fb6740 (LWP 31523) exited]
 PASS: gdb.threads/gcore-stale-thread.exp: continue to breakpoint: break-here
 gcore /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.threads/gcore-stale-thread/gcore-stale-thread.core
 /home/pedro/gdb/binutils-gdb/build/../src/gdb/inferior.c:66: internal-error: void set_current_inferior(inferior*): Assertion `inf != NULL' failed.
 A problem internal to GDB has been detected,

That was find_inferior_ptid being called on the "exited" ptid, which
on that previous (and discarded attempt) had pid==-1.  The problem is
that linux-tdep.c, where it looks for the signalled thread, isn't
considering exited threads.  Also, while at it, that code isn't
considering multi-target either, since it is using
iterate_over_threads which iterates over all threads of all targets.
Fixed by switching to range-for iteration instead.

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

	* linux-tdep.c (find_signalled_thread(thread_info *,void *)):
	Delete.
	(find_signalled_thread()): New, factored out from
	linux_make_corefile_notes and adjusted to handle exited threads.
	(linux_make_corefile_notes): Adjust to use the new
	find_signalled_thread.
2020-06-18 23:03:08 +01:00
Pedro Alves 41792d688a Don't write to inferior_ptid in linux_get_siginfo_data
gdb/ChangeLog:
2020-06-18  Pedro Alves  <palves@redhat.com>

	* linux-tdep.c (btrace_fetch): Save/restore current thread instead
	of saving/restoring inferior_ptid.
2020-06-18 21:28:17 +01:00
Tom de Vries a8a566853a [gdb/testsuite] Move code from gdb_init to default_gdb_init
If a baseboard file wants to override a proc foo, but also use the original
proc, it'll have to do something like:
...
rename foo save_foo
proc foo { } {
    ...
    set res [save_foo]
    ...
    return res
}
...
This adds a new proc named save_foo, which introduces the risk of clashing with
an existing proc.

There's a pattern in the gdb testsuite procs, that facilitates this override:
...
proc default_foo { } {
  ...
}

proc foo { } {
    return [default_foo]
}
...
such that in a baseboard file we don't need the rename:
...
proc foo { } {
    ...
    set res [default_foo]
    ...
    return res
}
...

The exception to the pattern though is gdb_init, which has a default_gdb_init
counterpart, but contains much more code than just the call to
default_gdb_init.

Fix this by moving all but the call to default_gdb_init to default_gdb_init.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

	* lib/gdb.exp (gdb_init): Move all but call to default_gdb_init to ...
	(default_gdb_init): ... here.
2020-06-18 15:06:04 +02:00
Jan Beulich d27c357a5b x86: also test alternative VMGEXIT encoding
gas/

	* testsuite/gas/i386/arch-13.s: Add alternative VMGEXIT case.
	* testsuite/gas/i386/arch-13.d: Extend -march=. Adjust
	expectations.

opcodes/

	* i386-dis.c (prefix_table): Revert the last vmgexit change.
2020-06-18 04:58:27 -07:00
Fangrui Song 9a17a13643 [PATCH] gold: Set DF_1_PIE for -pie
PR gold/26039
	* layout.cc (Layout::finish_dynamic_section): Set DF_1_PIE.

	elfcpp/
	* elfcpp.h (enum DF_1): New enum member DF_1_PIE.
2020-06-18 10:46:18 +01:00
Sandra Loosemore 581bea2c99 Fix TUI support checks in gdb.tui tests.
2020-06-17 Sandra Loosemore <sandra@codesourcery.com>

	gdb/testsuite/
	* gdb.tui/basic.exp: Skip test when TUI is unsupported, don't
	just say UNSUPPORTED.
	* gdb.tui/corefile-run.exp: Likewise.
	* gdb.tui/empty.exp: Likewise.
	* gdb.tui/list-before.exp: Likewise.
	* gdb.tui/list.exp: Likewise.
	* gdb.tui/main.exp: Likewise.
	* gdb.tui/regs.exp: Likewise.
	* gdb.tui/resize.exp: Likewise.
	* gdb.tui/tui-layout-asm-short-prog.exp: Likewise.
	* gdb.tui/tui-layout-asm.exp: Likewise.
	* gdb.tui/tui-missing-src.exp: Likewise.
	* gdb.tui/winheight.exp: Likewise.
	* gdb.tui/new-layout.exp: Likewise.  Also move check earlier.
2020-06-17 21:57:16 -07:00
Tom Tromey 612f258a49 Remove unnecessary TUI declarations
I found some unnecessary declarations (and one unused macro) in the
TUI.  This patch removes them.

gdb/ChangeLog
2020-06-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-win.h (tui_scroll_forward, tui_scroll_backward)
	(tui_scroll_left, tui_scroll_right, struct tui_win_info): Don't
	declare.
	* tui/tui-data.h (MIN_CMD_WIN_HEIGHT): Remove.
2020-06-17 20:07:04 -06:00
GDB Administrator 0574b47b73 Automatic date update in version.in 2020-06-18 00:00:15 +00:00
Keith Seitz 99cf27cf12 Fix typo in my gdb.debuginfod entry. 2020-06-17 15:07:45 -07:00
Sandra Loosemore 05e682e3be Fix TCL error in gdb.python/py-format-string.exp.
2020-06-17 Sandra Loosemore <sandra@codesourcery.com>

	gdb/testsuite/
	* gdb.python/py-format-string.exp: Move test for python support
	earlier, out of function body.
2020-06-17 13:43:32 -07:00
Simon Marchi efb763a5ea gdb: check for partial symtab presence in dwarf2_initialize_objfile
This patch fixes an internal error that is triggered when loading the
same binary twice with the index-cache on:

    $ ./gdb -q -nx --data-directory=data-directory
    (gdb) set index-cache on
    (gdb) shell mktemp -d
    /tmp/tmp.BLgouVoPq4
    (gdb) set index-cache directory /tmp/tmp.BLgouVoPq4
    (gdb) file a.out
    Reading symbols from a.out...
    (gdb) file a.out
    Load new symbol table from "a.out"? (y or n) y
    Reading symbols from a.out...
    /home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:2540: internal-error: void create_cus_from_index(dwarf2_per_bfd*, const gdb_byte*, offset_type, const gdb_byte*, offset_type): Assertion `per_bfd->all_comp_units.empty ()' failed.
    A problem internal to GDB has been detected,
    further debugging may prove unreliable.
    Quit this debugging session? (y or n)

This is what happens:

1. We load the binary the first time, partial symtabs are created,
   per_bfd->all_comp_units is filled from those.
2. Because index-cache is on, we also generate an index in the cache.
3. We load the binary a second time, in dwarf2_initialize_objfile we
   check: was an index already loaded for this BFD?  No, so we try to
   read the index and fill the per-bfd using it.  We do find an index,
   it's in the cache.
4. The function create_cus_from_index asserts (rightfully) that
   per_cu->all_comp_units is empty, and the assertion fails.

This assertion verifies that we are not reading an index for a BFD for
which we have already built partial symtabs or read another index.

The index-cache gives a situation that isn't currently accounted for: a
BFD for which we have built the partial symtabs the first time, but has
an index the second time.

This patch addresses it by checking for the presence of partial symtabs
in dwarf2_initialize_objfile.  If there are, we don't try reading the
index.

gdb/ChangeLog:

	* dwarf2/read.c (dwarf2_initialize_objfile): Check for presence
	of partial symtabs.

gdb/testsuite/ChangeLog:

	* gdb.base/index-cache-load-twice.c: New.
	* gdb.base/index-cache-load-twice.exp: New.

Change-Id: Ie05474c44823fcdff852b73170dd28dfd66cb6a2
2020-06-17 14:49:33 -04:00
Simon Marchi 2951f6c068 gdb/regformats: remove unused regformats/reg-*.dat
I believe that the .dat files starting with `reg-` are the manually
written ones, the other being generated from xml files from the features
directory.

This patch removes the manually-written files that are no longer needed.
They are unused since the recent series that removed a bunch of
gdbserver ports.

gdb/ChangeLog:

	* regformats/reg-arm.dat: Remove.
	* regformats/reg-bfin.dat: Remove.
	* regformats/reg-cris.dat: Remove.
	* regformats/reg-crisv32.dat: Remove.
	* regformats/reg-m32r.dat: Remove.
	* regformats/reg-tilegx.dat: Remove.
	* regformats/reg-tilegx32.dat: Remove.

Change-Id: I55ab6e45e3d0d316cda93f863c51fc9b867adfaa
2020-06-17 14:42:54 -04:00
Simon Marchi 7d458ea516 gdb, gdbserver: remove ARM regdat files
This patch removes the leftover regformats .dat files for the arm
architecture.  There are no longer relevant, since the arm architecture
has been converted to use feature-based target-descriptions.  These .dat
files are used by GDBserver ports that still use static target
descriptions.

These .dat files are generated from corresponding .xml files in the
features directory.  And since the corresponding .xml files for these
arm .dat files don't exist anymore, it is impossible to re-generated
them.  If you delete these .dat files and type "make" in the features
directory, you'll get:

  make: *** No rule to make target '../regformats/arm/arm-with-iwmmxt.dat', needed by 'all'.  Stop.

So it removes the entries in the `WHICH` variable of
gdb/features/Makefile.

Finally, it removes the rule in gdbserver/Makefile to generate .cc files
from `../gdb/regformats/arm/%.dat`.

gdb/ChangeLog:

	* features/Makefile (WHICH): Remove arm files.
	* regformats/arm/arm-with-iwmmxt.dat: Remove.
	* regformats/arm/arm-with-neon.dat: Remove.
	* regformats/arm/arm-with-vfpv2.dat: Remove.
	* regformats/arm/arm-with-vfpv3.dat: Remove.

gdbserver/ChangeLog:

	* Makefile.in (%-generated.cc: ../gdb/regformats/arm/%.dat):
	Remove.

Change-Id: I3b7d989c50e2cb92235c1f7c7071a26839d84c78
2020-06-17 14:42:53 -04:00
Simon Marchi 3af96c0d99 gdb/features: remove rx.xml from XMLTOC list
When trying to run `make` in the features directory, in a clean repo, we
get:

    Makefile:254: warning: overriding recipe for target 'rx.c'
    Makefile:250: warning: ignoring old recipe for target 'rx.c'
    make: Nothing to be done for 'all'.

The warnings come from the fact that `rx.xml` is present in two lists,
causing two `rx.c` targets to be defined.  It is ok for it to be in the
FEATURES_XMLFILES list, as this architecture uses the "feature-based"
target-descriptions.  It shouldn't be in the XMLTOC list, as this is for
architectures that define complete/static target descriptions as XML
files.

gdb/ChangeLog:

	* features/Makefile (XMLTOC): Remove rx.xml.

Change-Id: Iada4ab54b3d4542588fac543d16ee35a92537319
2020-06-17 14:42:51 -04:00
Keith Seitz 43327b208e Pass INTERNAL_GDBFLAGS when executing GDB
gdb.debuginfod/fetch_src_and_symbols.exp attempts to ascertain
whether GDB was built with debuginfod support by executing
"$GDB --configuration".

That seems harmless enough. However, if GDB is not already installed
on the host, the command will fail:

$ ./gdb --config
Exception caught while booting Guile.
Error in function "open-file":
No such file or directory: "/usr/share/gdb/guile/gdb/boot.scm"
./gdb: warning: Could not complete Guile gdb module initialization from:
/usr/share/gdb/guile/gdb/boot.scm.
Limited Guile support is available.
Suggest passing --data-directory=/path/to/gdb/data-directory.
Python Exception <class 'ModuleNotFoundError'> No module named 'gdb':
./gdb: warning:
Could not load the Python gdb module from `/usr/share/gdb/python'.
Limited Python support is available from the _gdb module.
Suggest passing --data-directory=/path/to/gdb/data-directory.
This GDB was configured as follows:
   configure --host=x86_64-redhat-linux-gnu --target=x86_64-redhat-linux-gnu
      [abbreviated output]

The problem here is, of course, that while running in the test suite,
we must pass INTERNAL_GDBFLAGS in order to pick up the --data-directory
option.

gdb/testsuite/ChangeLog
2020-06-17  Keith Seitz  <keiths@redhat.com>

	* gdb.deuginfod/fetch_src_and_symbols.exp: Pass INTERNAL_GDBFLAGS
	when executing "gdb --configuration".
2020-06-17 10:44:59 -07:00
H.J. Lu 00401e65be ld: Suppress warning for unsupported attribute from older GCC
Suppress warning for unsupported attribute from older GCC:

.../ld/testsuite/ld-elf/pr25754-1a.c:9: warning: 'noclone' attribute directive ignored
.../ld/testsuite/ld-elf/pr25754-1a.c:9: warning: 'noclone' attribute directive ignored
ERROR: .../ld/testsuite/ld-elf/pr25754-1a.c: compilation failed
UNRESOLVED: Build pr25754-1a ( )

	* testsuite/ld-elf/linux-x86.exp (check_pr25749a): Append "-w"
	to cflags.
2020-06-17 07:53:19 -07:00
H.J. Lu 22aa1d5119 ld: Require GCC 5 for Build pr25749-1b (-pie -fPIE)
Before GCC 5, Build pr25749-1b (-pie -fPIE) won't trigger the expected
linker error.

	* testsuite/ld-elf/linux-x86.exp: Require GCC 5 for Build
	pr25749-1b (-pie -fPIE).
2020-06-17 07:39:28 -07:00
Cui,Lili 6fde587ff7 x86: Delete incorrect vmgexit entry in prefix_table
* i386-dis.c (prefix_table): Delete the incorrect vmgexit.
2020-06-17 07:01:06 -07:00
Tom de Vries 081e778cb8 [gdb/testsuite] Remove dependence on tcl_unknown
In gdb_init we install a local version of ::unknown, which relies on
::tcl_unknown, which is defined by dejagnu.

This proc may be moved into a namespace, or disappear altogether, as
indicated by dejagnu maintainers, so we can't rely on it.

Fix this by recreating tcl's version of unknown, and using that instead.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

	* lib/gdb.exp (gdb_tcl_unknown): New proc.
	(gdb_init): Use gdb_tcl_unknown for ::unknown override.  Make override
	conditional on presence of gdb_tcl_unknown.
	(gdb_finish): Make override undo conditional on presence of
	gdb_tcl_unknown.
2020-06-17 15:40:41 +02:00
Pedro Alves b25e22fd16 Update thread_control_state::trap_expected comments
The comments describing trap_expected are out of date.  It
predates displaced stepping and non-stop mode ("keep other threads
stopped").  It predates stepping over watchpoints with breakpoints
inserted (keep_going_pass_signal).  Says the variable is cleared
in normal_stop, when it isn't.  This fixes it.

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

	* gdbthread.h (thread_control_state) <trap_expected> Update
	comments.
2020-06-17 11:56:43 +01:00
Andrew Burgess a78a19b152 gdb: Convert language la_lookup_symbol_nonlocal field to a method
This commit changes the language_data::la_lookup_symbol_nonlocal
function pointer member variable into a member function of
language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

	* ada-lang.c (ada_lookup_symbol_nonlocal): Rename to
	ada_language::lookup_symbol_nonlocal.
	(ada_language_data): Delete la_lookup_symbol_nonlocal initializer.
	(ada_language::lookup_symbol_nonlocal): New member function,
	implementation from ada_lookup_symbol_nonlocal.
	* c-lang.c (c_language_data): Delete la_lookup_symbol_nonlocal
	initializer.
	(cplus_language_data): Delete la_lookup_symbol_nonlocal
	initializer.
	(cplus_language::lookup_symbol_nonlocal): New member function.
	(asm_language_data): Delete la_lookup_symbol_nonlocal initializer.
	(minimal_language_data) Likewise.
	* cp-namespace.c (cp_lookup_nested_symbol): Update comment.
	* d-lang.c (d_language_data): Delete la_lookup_symbol_nonlocal
	initializer.
	(d_language::lookup_symbol_nonlocal): New member function.
	* f-lang.c (f_language_data): Delete la_lookup_symbol_nonlocal
	initializer.
	(f_language::lookup_symbol_nonlocal): New member function.
	* go-lang.c (go_language_data): Delete la_lookup_symbol_nonlocal
	initializer.
	* language.c (unknown_language_data): Likewise.
	(auto_language_data): Likewise.
	* language.h (language_data): Delete la_lookup_symbol_nonlocal
	field.
	(language_defn::lookup_symbol_nonlocal): New member function.
	* m2-lang.c (m2_language_data): Delete la_lookup_symbol_nonlocal
	initializer.
	* objc-lang.c (objc_language_data): Likewise.
	* opencl-lang.c (opencl_language_data): Likewise.
	* p-lang.c (pascal_language_data): Likewise.
	* rust-lang.c (rust_lookup_symbol_nonlocal): Rename to
	rust_language::lookup_symbol_nonlocal.
	(rust_language_data): Delete la_lookup_symbol_nonlocal
	initializer.
	(rust_language::lookup_symbol_nonlocal): New member function,
	implementation from rust_lookup_symbol_nonlocal.
	* symtab.c (lookup_symbol_aux): Update call to
	lookup_symbol_nonlocal.
	(basic_lookup_symbol_nonlocal): Rename to...
	(language_defn::lookup_symbol_nonlocal): ...this, and update
	header comment.  Remove language_defn parameter, and replace with
	uses of `this'.
	* symtab.h (basic_lookup_symbol_nonlocal): Delete declaration.
2020-06-17 09:25:12 +01:00
Andrew Burgess ebe2334ee6 gdb: Convert language la_value_print_inner field to a method
This commit changes the language_data::la_value_print_inner function
pointer member variable into a member function of language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

	* ada-lang.c (ada_language_data): Delete la_value_print_inner
	initializer.
	(ada_language::value_print_inner): New member function.
	* c-lang.c (c_language_data): Delete la_value_print_inner
	initializer.
	(cplus_language_data): Likewise.
	(asm_language_data): Likewise.
	(minimal_language_data): Likewise.
	* d-lang.c (d_language_data): Likewise.
	(d_language::value_print_inner): New member function.
	* f-lang.c (f_language_data): Delete la_value_print_inner
	initializer.
	(f_language::value_print_inner): New member function.
	* f-lang.h (f_value_print_innner): Rename to...
	(f_value_print_inner): ...this (note spelling of 'inner').
	* f-valprint.c (f_value_print_innner): Rename to...
	(f_value_print_inner): ...this (note spelling of 'inner').
	* go-lang.c (go_language_data): Delete la_value_print_inner
	initializer.
	(go_language::value_print_inner): New member function.
	* language.c (language_defn::value_print_inner): Define new member
	function.
	(unk_lang_value_print_inner): Delete.
	(unknown_language_data): Delete la_value_print_inner initializer.
	(unknown_language::value_print_inner): New member function.
	(auto_language_data): Delete la_value_print_inner initializer.
	(auto_language::value_print_inner): New member function.
	* language.h (language_data): Delete la_value_print_inner field.
	(language_defn::value_print_inner): Delcare new member function.
	* m2-lang.c (m2_language_data): Delete la_value_print_inner
	initializer.
	(m2_language::value_print_inner): New member function.
	* objc-lang.c (objc_language_data): Delete la_value_print_inner
	initializer.
	* opencl-lang.c (opencl_language_data): Likewise.
	* p-lang.c (pascal_language_data): Likewise.
	(pascal_language::value_print_inner): New member function.
	* rust-lang.c (rust_language_data): Delete la_value_print_inner
	initializer.
	(rust_language::value_print_inner): New member function.
	* valprint.c (do_val_print): Update call to value_print_inner.
2020-06-17 09:25:11 +01:00
Andrew Burgess a1d1fa3e41 gdb: Convert language la_value_print field to a method
This commit changes the language_data::la_value_print function pointer
member variable into a member function of language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

	* ada-lang.c (ada_language_data): Delete la_value_print
	initializer.
	(ada_language::value_print): New member function.
	* c-lang.c (c_language_data): Delete la_value_print initializer.
	(cplus_language_data): Likewise.
	(asm_language_data): Likewise.
	(minimal_language_data): Likewise.
	* d-lang.c (d_language_data): Likewise.
	* f-lang.c (f_language_data): Likewise.
	* go-lang.c (go_language_data): Likewise.
	* language.c (unk_lang_value_print): Delete.
	(language_defn::value_print): Define new member function.
	(unknown_language_data): Delete la_value_print initializer.
	(unknown_language::value_print): New member function.
	(auto_language_data): Delete la_value_print initializer.
	(auto_language::value_print): New member function.
	* language.h (language_data): Delete la_value_print field.
	(language_defn::value_print): Declare new member function.
	(LA_VALUE_PRINT): Update call to value_print.
	* m2-lang.c (m2_language_data): Delete la_value_print initializer.
	* objc-lang.c (objc_language_data): Likewise.
	* opencl-lang.c (opencl_language_data): Likewise.
	* p-lang.c (pascal_language_data): Likewise.
	(pascal_language::value_print): New member function.
	* rust-lang.c (rust_language_data): Delete la_value_print
	initializer.
2020-06-17 09:25:11 +01:00
Andrew Burgess f16a9f57b5 gdb: Convert language la_watch_location_expression field to a method
This commit changes the language_data::la_watch_location_expression
function pointer member variable into a member function of
language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

	* ada-lang.c (ada_watch_location_expression): Rename to
	ada_language::watch_location_expression.
	(ada_language_data): Delete la_watch_location_expression
	initializer.
	(ada_language::watch_location_expression): New member function,
	implementation from ada_watch_location_expression.
	* breakpoint.c (watch_command_1): Update call to
	watch_location_expression.
	* c-lang.c (c_watch_location_expression): Rename to
	language_defn::watch_location_expression.
	(c_language_data): Delete la_watch_location_expression
	initializer.
	(cplus_language_data): Likewise.
	(asm_language_data): Likewise.
	(minimal_language_data): Likewise.
	* c-lang.h (c_watch_location_expression): Delete declaration.
	* d-lang.c (d_language_data): Delete la_watch_location_expression
	initializer.
	* f-lang.c (f_language_data): Likewise.
	* go-lang.c (go_language_data): Likewise.
	* language.c (language_defn::watch_location_expression): Member
	function implementation from c_watch_location_expression.
	(unknown_language_data): Delete la_watch_location_expression
	initializer.
	(auto_language_data): Likewise.
	* language.h (language_data): Delete la_watch_location_expression
	field.
	(language_defn::watch_location_expression): Declare new member
	function.
	* m2-lang.c (m2_language_data): Delete
	la_watch_location_expression initializer.
	* objc-lang.c (objc_language_data): Likewise.
	* opencl-lang.c (opencl_language_data): Likewise.
	* p-lang.c (pascal_language_data): Likewise.
	* rust-lang.c (rust_watch_location_expression): Rename to
	rust_language::watch_location_expression.
	(rust_language_data): Delete la_watch_location_expression
	initializer.
	(rust_language::watch_location_expression): New member function,
	implementation from rust_watch_location_expression.
2020-06-17 09:25:11 +01:00
Andrew Burgess 7e56227dff gdb: Convert language la_collect_symbol_completion_matches field to a method
This commit changes the
language_data::la_collect_symbol_completion_matches function pointer
member variable into a member function of language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

	* ada-lang.c (ada_collect_symbol_completion_matches): Rename to
	ada_language::collect_symbol_completion_matches.
	(ada_language_data): Delete la_collect_symbol_completion_matches
	initializer.
	(ada_language::collect_symbol_completion_matches): New member
	function, implementation from
	ada_collect_symbol_completion_matches.
	* c-lang.c (c_language_data): Delete
	la_collect_symbol_completion_matches initializer.
	(cplus_language_data): Likewise.
	(asm_language_data): Likewise.
	(minimal_language_data): Likewise.
	* d-lang.c (d_language_data): Likewise.
	* f-lang.c (f_collect_symbol_completion_matches): Rename to
	f_language::collect_symbol_completion_matches.
	(f_language_data): Delete la_collect_symbol_completion_matches
	initializer.
	(f_language::collect_symbol_completion_matches) New member
	function, implementation from f_collect_symbol_completion_matches.
	* go-lang.c (go_language_data): Delete
	la_collect_symbol_completion_matches initializer.
	* language.c (unknown_language_data): Likewise.
	(auto_language_data): Likewise.
	* language.h (language_data): Delete
	la_collect_symbol_completion_matches field.
	(language_defn::collect_symbol_completion_matches): New member
	function.
	* m2-lang.c (m2_language_data): Delete
	la_collect_symbol_completion_matches initializer.
	* objc-lang.c (objc_language_data): Likewise.
	* opencl-lang.c (opencl_language_data): Likewise.
	* p-lang.c (pascal_language_data): Likewise.
	* rust-lang.c (rust_language_data): Likewise.
	* symtab.c (default_collect_symbol_completion_matches): Delete.
	(collect_symbol_completion_matches): Update call to
	collect_symbol_completion_matches.
	(collect_symbol_completion_matches_type): Likewise.
	* symtab.h (default_collect_symbol_completion_matches): Delete
	declaration.
2020-06-17 09:25:10 +01:00
Andrew Burgess 53fc67f8b2 gdb: Convert language la_word_break_characters field to a method
This commit changes the language_data::la_word_break_characters
function pointer member variable into a member function of
language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

	* ada-lang.c (ada_get_gdb_completer_word_break_characters): Delete.
	(ada_language_data): Delete la_word_break_characters initializer.
	(ada_language::word_break_characters): New member function.
	* c-lang.c (c_language_data): Delete la_word_break_characters
	initializer.
	(cplus_language_data): Likewise.
	(asm_language_data): Likewise.
	(minimal_language_data): Likewise.
	* completer.c: Update global comment.
	(advance_to_expression_complete_word_point): Update call to
	word_break_characters.
	(complete_files_symbols): Likewise.
	(complete_line_internal_1): Likewise.
	(default_completer_handle_brkchars): Likewise.
	(skip_quoted_chars): Likewise.
	* d-lang.c (d_language_data): Delete la_word_break_characters
	initializer.
	* f-lang.c (f_word_break_characters): Delete.
	(f_language_data): Delete la_word_break_characters initializer.
	(f_language::word_break_characters): New member function.
	* go-lang.c (go_language_data): Delete la_word_break_characters
	initializer.
	* language.c (unknown_language_data): Likewise.
	(auto_language_data): Likewise.
	* language.h (default_word_break_characters): Move declaration to
	earlier in the file.
	(language_data): Delete la_word_break_characters field.
	(language_defn::word_break_characters): New member function.
	* m2-lang.c (m2_language_data): Delete la_word_break_characters
	initializer.
	* objc-lang.c (objc_language_data): Likewise.
	* opencl-lang.c (opencl_language_data): Likewise.
	* p-lang.c (pascal_language_data): Likewise.
	* rust-lang.c (rust_language_data): Likewise.
2020-06-17 09:25:10 +01:00
Andrew Burgess c9debfb97e gdb: Convert language la_get_symbol_name_matcher field to a method
This commit changes the language_data::la_get_symbol_name_matcher
function pointer member variable into a member function of
language_defn.

There should be no user visible changes after this commit.

Before this commit access to the la_get_symbol_name_matcher function
pointer was through the get_symbol_name_matcher function, which looked
something like this (is pseudo-code):

  <return-type>
  get_symbol_name_matcher (language_defn *lang, <other args>)
  {
    if (current_language == ada)
      current_language->la_get_symbol_name_matcher (<other args>);
    else
      lang->la_get_symbol_name_matcher (<other args>);
  }

In this commit I moved the get_symbol_name_matcher as a non-virtual
function in the language_defn base class, I then add a new virtual
method that is only used from within get_symbol_name_matcher, this can
then be overridden by specific languages as needed.  So we now have:

  class language_defn
  {
    <return-type> get_symbol_name_matcher (<args>)
    {
      if (current_language == ada)
        return current_language->get_symbol_name_matcher_inner (<args>);
      else
        return this->get_symbol_name_matcher_inner (<args>);
    }

    virtual <return-type> get_symbol_name_matcher_inner (<args>)
    {
        ....
    }
  }

gdb/ChangeLog:

	* ada-lang.c (ada_get_symbol_name_matcher): Update header comment.
	(ada_language_data): Delete la_get_symbol_name_matcher
	initializer.
	(language_defn::get_symbol_name_matcher_inner): New member
	function.
	* c-lang.c (c_language_data): Delete la_get_symbol_name_matcher
	initializer.
	(cplus_language_data): Likewise.
	(cplus_language::get_symbol_name_matcher_inner): New member
	function.
	(asm_language_data): Delete la_get_symbol_name_matcher initializer.
	(minimal_language_data): Likewise.
	* cp-support.h (cp_get_symbol_name_matcher): Update header comment.
	* d-lang.c (d_language_data): Delete la_get_symbol_name_matcher
	initializer.
	* dictionary.c (iter_match_first_hashed): Update call to
	get_symbol_name_matcher.
	(iter_match_next_hashed): Likewise.
	(iter_match_next_linear): Likewise.
	* dwarf2/read.c (dw2_expand_symtabs_matching_symbol): Likewise.
	* f-lang.c (f_language_data): Delete la_get_symbol_name_matcher
	initializer.
	(f_language::get_symbol_name_matcher_inner): New member function.
	* go-lang.c (go_language_data): Delete la_get_symbol_name_matcher
	initializer.
	* language.c (default_symbol_name_matcher): Update header comment,
	make static.
	(language_defn::get_symbol_name_matcher): New definition.
	(language_defn::get_symbol_name_matcher_inner): Likewise.
	(get_symbol_name_matcher): Delete.
	(unknown_language_data): Delete la_get_symbol_name_matcher
	initializer.
	(auto_language_data): Likewise.
	* language.h (language_data): Delete la_get_symbol_name_matcher
	field.
	(language_defn::get_symbol_name_matcher): New member function.
	(language_defn::get_symbol_name_matcher_inner): Likewise.
	(default_symbol_name_matcher): Delete declaration.
	* linespec.c (find_methods): Update call to
	get_symbol_name_matcher.
	* m2-lang.c (m2_language_data): Delete la_get_symbol_name_matcher
	initializer.
	* minsyms.c (lookup_minimal_symbol): Update call to
	get_symbol_name_matcher.
	(iterate_over_minimal_symbols): Likewise.
	* objc-lang.c (objc_language_data): Delete
	la_get_symbol_name_matcher initializer.
	* opencl-lang.c (opencl_language_data): Likewise.
	* p-lang.c (pascal_language_data): Likewise.
	* psymtab.c (psymbol_name_matches): Update call to
	get_symbol_name_matcher.
	* rust-lang.c (rust_language_data): Delete
	la_get_symbol_name_matcher initializer.
	* symtab.c (symbol_matches_search_name): Update call to
	get_symbol_name_matcher.
	(compare_symbol_name): Likewise.
2020-06-17 09:25:09 +01:00