Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Fix up complaints.h for namespace use
If 'complaint' is used in a namespace context, it will fail because
'stop_whining' is only declared at the top level. This patch fixes
this problem in a simple way, by moving the declaration of
'stop_whining' out of the macro and to the top-level.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* complaints.h (stop_whining): Declare at top-level.
(complaint): Don't declare stop_whining.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Normalize handle_output_debug_string API
This changes gdbserver's implementation of handle_output_debug_string
to have the same calling convention as that of gdb. This allows for
sharing some more code in a subsequent patch.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (windows_nat::handle_output_debug_string):
Rename. No longer static.
* nat/windows-nat.h (handle_output_debug_string): Declare.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.c (handle_output_debug_string): Add parameter. Change
return type.
(win32_kill, get_child_debug_event): Update.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Share some Windows-related globals
This moves some Windows-related globals into nat/windows-nat.c,
sharing them between gdb and gdbserver.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (current_process_handle, current_process_id)
(main_thread_id, last_sig, current_event, last_wait_event)
(current_windows_thread, desired_stop_thread_id, pending_stops)
(struct pending_stop, siginfo_er): Move to nat/windows-nat.c.
(display_selectors, fake_create_process)
(get_windows_debug_event): Update.
* nat/windows-nat.h (current_process_handle, current_process_id)
(main_thread_id, last_sig, current_event, last_wait_event)
(current_windows_thread, desired_stop_thread_id, pending_stops)
(struct pending_stop, siginfo_er): Move from windows-nat.c.
* nat/windows-nat.c (current_process_handle, current_process_id)
(main_thread_id, last_sig, current_event, last_wait_event)
(current_windows_thread, desired_stop_thread_id, pending_stops)
(siginfo_er): New globals. Move from windows-nat.c.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.c (current_process_handle, current_process_id)
(main_thread_id, last_sig, current_event, siginfo_er): Move to
nat/windows-nat.c.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Share get_image_name between gdb and gdbserver
This moves get_image_name to nat/windows-nat.c so that it can be
shared between gdb and gdbserver.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (get_image_name): Move to nat/windows-nat.c.
(handle_load_dll): Update.
* nat/windows-nat.c (get_image_name): Move from windows-nat.c.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.c (get_image_name): Remove.
(handle_load_dll): Update.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Share thread_rec between gdb and gdbserver
This changes gdb and gdbserver to use the same calling convention for
the "thread_rec" helper function. Fully merging these is difficult
due to differences in how threads are managed by the enclosing
applications; but sharing a declaration makes it possible for future
shared code to call this method.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (enum thread_disposition_type): Move to
nat/windows-nat.h.
(windows_nat::thread_rec): Rename from thread_rec. No longer
static.
(windows_add_thread, windows_nat_target::fetch_registers)
(windows_nat_target::store_registers, handle_exception)
(windows_nat_target::resume, get_windows_debug_event)
(windows_nat_target::get_tib_address)
(windows_nat_target::thread_name)
(windows_nat_target::thread_alive): Update.
* nat/windows-nat.h (enum thread_disposition_type): Move from
windows-nat.c.
(thread_rec): Declare.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.c (windows_nat::thread_rec): Rename from thread_rec.
No longer static. Change parameters.
(child_add_thread, child_fetch_inferior_registers)
(child_store_inferior_registers, win32_resume)
(win32_get_tib_address): Update.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Wrap shared windows-nat code in windows_nat namespace
This wraps the shared windows-nat code in a windows_nat namespace.
This helps avoid name clashes.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c: Add "using namespace".
* nat/windows-nat.h: Wrap contents in windows_nat namespace.
* nat/windows-nat.c: Wrap contents in windows_nat namespace.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.h (struct win32_target_ops): Use qualified names where
needed.
* win32-i386-low.c: Add "using namespace".
* win32-low.c: Add "using namespace".
* win32-arm-low.c: Add "using namespace".
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Call CloseHandle from ~windows_thread_info
Add a destructor to windows_thread_info that calls CloseHandle.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* nat/windows-nat.h (struct windows_thread_info): Declare
destructor.
* nat/windows-nat.c (~windows_thread_info): New.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.c (delete_thread_info): Don't call CloseHandle.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Handle pending stops from the Windows kernel
PR gdb/22992 concerns an assertion failure in gdb when debugging a
certain inferior:
int finish_step_over(execution_control_state*): Assertion `ecs->event_thread->control.trap_expected' failed.
Initially the investigation centered on the discovery that gdb was not
suspending other threads when attempting to single-step. This
oversight is corrected in this patch: now, when stepping a thread, gdb
will call SuspendThread on all other threads.
However, the bug persisted even after this change. In particular,
WaitForDebugEvent could see a stop for a thread that was ostensibly
suspended. Our theory of what is happening here is that there are
actually simultaneous breakpoint hits, and the Windows kernel queues
the events, causing the second stop to be reported on a suspended
thread.
In Windows 10 or later gdb could use the DBG_REPLY_LATER flag to
ContinueDebugEvent to request that such events be re-reported later.
However, relying on that did not seem advisable, so this patch instead
arranges to queue such "pending" stops, and then to report them later,
once the step has completed.
In the PR, Pedro pointed out that it's best in this scenario to
implement the stopped_by_sw_breakpoint method, so this patch does this
as well.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
PR gdb/22992
* windows-nat.c (current_event): Update comment.
(last_wait_event, desired_stop_thread_id): New globals.
(struct pending_stop): New.
(pending_stops): New global.
(windows_nat_target) <stopped_by_sw_breakpoint>
<supports_stopped_by_sw_breakpoint>: New methods.
(windows_fetch_one_register): Add assertions. Adjust PC.
(windows_continue): Handle pending stops. Suspend other threads
when stepping. Use last_wait_event
(wait_for_debug_event): New function.
(get_windows_debug_event): Use wait_for_debug_event. Handle
pending stops. Queue spurious stops.
(windows_nat_target::wait): Set stopped_at_software_breakpoint.
(windows_nat_target::kill): Use wait_for_debug_event.
* nat/windows-nat.h (struct windows_thread_info)
<stopped_at_software_breakpoint>: New field.
* nat/windows-nat.c (windows_thread_info::resume): Clear
stopped_at_software_breakpoint.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Change type of argument to windows-nat.c:thread_rec
windows-nat.c:thread_rec accepts an integer parameter whose
interpretation depends on whether it is less than, equal to, or
greater than zero. I found this confusing at times, so this patch
replaces it with an enum instead.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (enum thread_disposition_type): New.
(thread_rec): Replace "get_context" parameter with "disposition";
change type.
(windows_add_thread, windows_nat_target::fetch_registers)
(windows_nat_target::store_registers, handle_exception)
(windows_nat_target::resume, get_windows_debug_event)
(windows_nat_target::get_tib_address)
(windows_nat_target::thread_name)
(windows_nat_target::thread_alive): Update.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Share Windows thread-suspend and -resume code
This adds "suspend" and "resume" methods to windows_thread_info, and
changes gdb and gdbserver to share this code.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (thread_rec): Use windows_thread_info::suspend.
(windows_continue): Use windows_continue::resume.
* nat/windows-nat.h (struct windows_thread_info) <suspend,
resume>: Declare new methods.
* nat/windows-nat.c: New file.
* configure.nat (NATDEPFILES): Add nat/windows-nat.o when needed.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.c (win32_require_context, suspend_one_thread): Use
windows_thread_info::suspend.
(continue_one_thread): Use windows_thread_info::resume.
* configure.srv (srv_tgtobj): Add windows-nat.o when needed.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Use lwp, not tid, for Windows thread id
This changes windows-nat.c to put the Windows thread id into the "lwp"
field of ptid_t, not the "tid" field. This is done for two reasons.
First, ptid.h has this to say:
process_stratum targets that handle threading themselves should
prefer using the ptid.lwp field, leaving the ptid.tid field for any
thread_stratum target that might want to sit on top.
Second, this change brings gdb and gdbserver into sync here, which
makes sharing code simpler.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (windows_add_thread, windows_delete_thread)
(windows_nat_target::fetch_registers)
(windows_nat_target::store_registers, fake_create_process)
(windows_nat_target::resume, windows_nat_target::resume)
(get_windows_debug_event, windows_nat_target::wait)
(windows_nat_target::pid_to_str)
(windows_nat_target::get_tib_address)
(windows_nat_target::get_ada_task_ptid)
(windows_nat_target::thread_name)
(windows_nat_target::thread_alive): Use lwp, not tid.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Make windows_thread_info::name a unique_xmalloc_ptr
This changes windows_thread_info::name to be a unique_xmalloc_ptr,
removing some manual memory management.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (handle_exception)
(windows_nat_target::thread_name): Update.
* nat/windows-nat.h (windows_thread_info): Remove destructor.
<name>: Now unique_xmalloc_ptr.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Change two windows_thread_info members to "bool"
This changes a couple of fields of windows_thread_info to have type
"bool". It also updates the comment of another field, to clarify the
possible values it can hold.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (thread_rec)
(windows_nat_target::fetch_registers): Update.
* nat/windows-nat.h (struct windows_thread_info) <suspended>:
Update comment.
<debug_registers_changed, reload_context>: Now bool.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-i386-low.c (update_debug_registers)
(i386_prepare_to_resume, i386_thread_added): Update.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Use new and delete for windows_thread_info
This adds a constructor, destructor, and member initializers to
windows_thread_info, and changes gdb and gdbserver to use new and
delete.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (windows_add_thread): Use new.
(windows_init_thread_list, windows_delete_thread): Use delete.
(get_windows_debug_event): Update.
* nat/windows-nat.h (struct windows_thread_info): Add constructor,
destructor, and initializers.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.c (child_add_thread): Use new.
(delete_thread_info): Use delete.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Share windows_thread_info between gdb and gdbserver
This introduces a new file, nat/windows-nat.h, which holds the
definition of windows_thread_info. This is now shared between gdb and
gdbserver.
Note that the two implementations different slightly. gdb had a
couple of fields ("name" and "reload_context") that gdbserver did not;
while gdbserver had one field ("base_context") that gdb did not, plus
better comments. The new file preserves all the fields, and the
comments.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (struct windows_thread_info): Remove.
* nat/windows-nat.h: New file.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.h (struct windows_thread_info): Remove.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Rename windows_thread_info::id to "tid"
This changes the name of a field in windows_thread_info, bringing gdb
and gdbserver closer into sync.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (struct windows_thread_info) <tid>: Rename from "id".
(thread_rec, windows_add_thread, windows_delete_thread)
(windows_continue): Update.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Rename win32_thread_info to windows_thread_info
This renames win32_thread_info to windows_thread_info in gdbserver.
This renaming helps make it possible to share some code between gdb
and gdbserver.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.h (struct windows_thread_info): Rename from
win32_thread_info. Remove typedef.
(struct win32_target_ops, win32_require_context): Update.
* win32-low.c (win32_get_thread_context)
(win32_set_thread_context, win32_prepare_to_resume)
(win32_require_context, thread_rec, child_add_thread)
(delete_thread_info, continue_one_thread)
(child_fetch_inferior_registers, child_store_inferior_registers)
(win32_resume, suspend_one_thread, win32_get_tib_address):
Update.
* win32-i386-low.c (update_debug_registers)
(win32_get_current_dr, i386_get_thread_context)
(i386_prepare_to_resume, i386_thread_added, i386_single_step)
(i386_fetch_inferior_register, i386_store_inferior_register):
Update.
* win32-arm-low.c (arm_get_thread_context)
(arm_fetch_inferior_register, arm_store_inferior_register):
Update.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Remove the "next" field from windows_thread_info
This changes windows_thread_info to remove the "next" field, replacing
the linked list of threads with a vector. This is a prerequisite to
sharing this structure with gdbserver, which manages threads
differently.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (struct windows_thread_info): Remove typedef.
(thread_head): Remove.
(thread_list): New global.
(thread_rec, windows_add_thread, windows_init_thread_list)
(windows_delete_thread, windows_continue): Update.
Simon Marchi [Wed, 8 Apr 2020 18:05:54 +0000 (14:05 -0400)]
gdb: stop using host-dependent signal numbers in windows-tdep.c
The signal enumeration in windows-tdep.c is defined differently whether
it is compiled on Cygwin or not. This is problematic, since the code in
tdep files is not supposed to be influenced by the host platform (the
platform GDB itself runs on).
This makes a difference in windows_gdb_signal_to_target. An obvious
example of clash is SIGABRT. Let's pretend we are cross-debugging a
Cygwin process from a MinGW (non-Cygwin Windows) GDB. If GDB needs to
translate the gdb signal number GDB_SIGNAL_ABRT into a target
equivalent, it would obtain the MinGW number (22), despite the target
being a Cygwin process. Conversely, if debugging a MinGW process from a
Cygwin-hosted GDB, GDB_SIGNAL_ABRT would be converted to a Cygwin signal
number (6) despite the target being a MinGW process. This is wrong,
since we want the result to depend on the target's platform, not GDB's
platform.
This known flaw was accepted because at the time we had a single OS ABI
(called Cygwin) for all Windows binaries (Cygwin ones and non-Cygwin
ones). This limitation is now lifted, as we now have separate Windows
and Cygwin OS ABIs. This means we are able to detect at runtime whether
the binary we are debugging is a Cygwin one or non-Cygwin one.
This patch splits the signal enum in two, one for the MinGW flavors and
one for Cygwin, removing all the ifdefs that made it depend on the host
platform. It then makes two separate gdb_signal_to_target gdbarch
methods, that are used according to the OS ABI selected at runtime.
There is a bit of re-shuffling needed in how the gdbarch'es are
initialized, but nothing major.
gdb/ChangeLog:
* windows-tdep.h (windows_init_abi): Add comment.
(cygwin_init_abi): New declaration.
* windows-tdep.c: Split signal enumeration in two, one for
Windows and one for Cygwin.
(windows_gdb_signal_to_target): Only deal with signal of the
Windows OS ABI.
(cygwin_gdb_signal_to_target): New function.
(windows_init_abi): Rename to windows_init_abi_common, don't set
gdb_signal_to_target gdbarch method. Add new new function with
this name.
(cygwin_init_abi): New function.
* amd64-windows-tdep.c (amd64_windows_init_abi_common): Add
comment. Don't call windows_init_abi.
(amd64_windows_init_abi): Add comment, call windows_init_abi.
(amd64_cygwin_init_abi): Add comment, call cygwin_init_abi.
* i386-windows-tdep.c (i386_windows_init_abi): Rename to
i386_windows_init_abi_common, don't call windows_init_abi. Add
a new function of this name.
(i386_cygwin_init_abi): New function.
(_initialize_i386_windows_tdep): Bind i386_cygwin_init_abi to
OS ABI Cygwin.
Simon Marchi [Wed, 8 Apr 2020 12:07:33 +0000 (08:07 -0400)]
Remove objfile parameter from read_gdb_index_from_buffer
I noticed this was unused, so remove it.
gdb/ChangeLog:
* dwarf2/read.c (read_gdb_index_from_buffer): Remove objfile
parameter.c.
(dwarf2_read_gdb_index): Update.
Gunther Nikl [Wed, 8 Apr 2020 11:33:16 +0000 (12:33 +0100)]
[PATCH 1/4]: microblaze: remove duplicate prototypes
The microblaze target header duplicates prototypes already provided by tc.h.
* config/tc-microblaze.h (md_begin, md_assemble, md_undefined_symbol,
md_show_usage, md_convert_frag, md_operand, md_number_to_chars,
md_estimate_size_before_relax, md_section_align, tc_gen_reloc,
md_apply_fix3): Delete prototypes.
Gunther Nikl [Wed, 8 Apr 2020 11:28:10 +0000 (12:28 +0100)]
[PATCH 4/4]: Add generic prototype for md_pcrel_from_section
This patch removes the need for target headers to provide a custom prototype
for md_pcrel_from_section.
* tc.h (md_pcrel_from_section): Add prototype.
* config/tc-aarch64.h (md_pcrel_from_section): Remove prototype.
* config/tc-arc.h (md_pcrel_from_section): Likewise.
* config/tc-arm.h (md_pcrel_from_section): Likewise.
* config/tc-avr.h (md_pcrel_from_section): Likewise.
* config/tc-bfin.h (md_pcrel_from_section): Likewise.
* config/tc-bpf.h (md_pcrel_from_section): Likewise.
* config/tc-csky.h (md_pcrel_from_section): Likewise.
* config/tc-d10v.h (md_pcrel_from_section): Likewise.
* config/tc-d30v.h (md_pcrel_from_section): Likewise.
* config/tc-epiphany.h (md_pcrel_from_section): Likewise.
* config/tc-fr30.h (md_pcrel_from_section): Likewise.
* config/tc-frv.h (md_pcrel_from_section): Likewise.
* config/tc-iq2000.h (md_pcrel_from_section): Likewise.
* config/tc-lm32.h (md_pcrel_from_section): Likewise.
* config/tc-m32c.h (md_pcrel_from_section): Likewise.
* config/tc-m32r.h (md_pcrel_from_section): Likewise.
* config/tc-mcore.h (md_pcrel_from_section): Likewise.
* config/tc-mep.h (md_pcrel_from_section): Likewise.
* config/tc-metag.h (md_pcrel_from_section): Likewise.
* config/tc-microblaze.h (md_pcrel_from_section): Likewise.
* config/tc-mmix.h (md_pcrel_from_section): Likewise.
* config/tc-moxie.h (md_pcrel_from_section): Likewise.
* config/tc-msp430.h (md_pcrel_from_section): Likewise.
* config/tc-mt.h (md_pcrel_from_section): Likewise.
* config/tc-or1k.h (md_pcrel_from_section): Likewise.
* config/tc-ppc.h (md_pcrel_from_section): Likewise.
* config/tc-rl78.h (md_pcrel_from_section): Likewise.
* config/tc-rx.h (md_pcrel_from_section): Likewise.
* config/tc-s390.h (md_pcrel_from_section): Likewise.
* config/tc-sh.h (md_pcrel_from_section): Likewise.
* config/tc-xc16x.h (md_pcrel_from_section): Likewise.
* config/tc-xstormy16.h (md_pcrel_from_section): Likewise.
Gunther Nikl [Wed, 8 Apr 2020 10:15:28 +0000 (11:15 +0100)]
[PATCH 3/4]: m32c: remove duplicate define and prototype
The m32c target header has a duplicate entry for MD_PCREL_FROM_SECTION.
The duplication was present since the initial commit of the port.
* config/tc-m32c.h (MD_PCREL_FROM_SECTION): Delete duplicate define.
(md_pcrel_from_section): Remove duplicate prototype.
Gunther Nikl [Wed, 8 Apr 2020 10:11:43 +0000 (11:11 +0100)]
[PATCH 2/4]: moxie: use generic pcrel support
The moxie target header uses md_pcrel_from, thus the local prototype and
the macro definition for MD_PCREL_FROM_SECTION are not needed.
* config/tc-moxie.h (MD_PCREL_FROM_SECTION): Delete define.
(md_pcrel_from): Remove prototytpe.
Tom de Vries [Wed, 8 Apr 2020 10:05:34 +0000 (12:05 +0200)]
[gdb/testsuite] Fix imported-unit.exp FAIL without psymtabs
The test-case gdb.dwarf2/imported-unit.exp contains a test testing partial
symbols, so when we run the test-case using either target board readnow,
cc-with-gdb-index or cc-with-debug-names, we run into:
...
FAIL: gdb.dwarf2/imported-unit.exp: no static partial symbols in importing unit
...
Fix this by marking the test unsupported if there are no partial symbols.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-04-08 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (psymtabs_p): New proc.
* gdb.dwarf2/imported-unit.exp: Mark "no static partial symbols in
importing unit" unsupported if there are no partial symbols.
Tom de Vries [Wed, 8 Apr 2020 04:57:56 +0000 (06:57 +0200)]
[gdb/testsuite] Add gcc/94469 xfails to gdb.ada/call_pn.exp
When running test-case gdb.ada/call_pn.exp with target board
unix/-flto/-O0/-flto-partition=none/-ffat-lto-objects, we run into:
...
(gdb) print last_node_id^M
Multiple matches for last_node_id^M
[0] cancel^M
[1] pck.last_node_id at gdb/testsuite/gdb.ada/call_pn/pck.adb:17^M
[2] pck.last_node_id at gdb/testsuite/gdb.ada/call_pn/foo.adb:17^M
> FAIL: gdb.ada/call_pn.exp: print last_node_id after calling pn (timeout)
...
This failure is due to a gcc bug that declares two instead of one symbols,
filed as PR gcc/94469.
Add an xfail at this test. Also add a similar xfail at an earlier test, that
only triggers with -readnow. Stabilize test results by making sure the
earlier xfail is always triggered, using "maint expand-symtabs".
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-04-08 Tom de Vries <tdevries@suse.de>
PR testsuite/25760
* gdb.ada/call_pn.exp: Call "maint expand-symtabs". Add xfails.
GDB Administrator [Wed, 8 Apr 2020 00:00:10 +0000 (00:00 +0000)]
Automatic date update in version.in
Kamil Rytarowski [Mon, 6 Apr 2020 18:08:46 +0000 (20:08 +0200)]
Define NetBSD specific skip_solib_resolver
gdb/ChangeLog:
* nbsd-tdep.c: Include "objfiles.h".
(nbsd_skip_solib_resolver): New.
(nbsd_init_abi): Call set_gdbarch_skip_solib_resolver().
nitachra [Tue, 7 Apr 2020 13:06:00 +0000 (18:36 +0530)]
DWARFv5: Info address command error in gdb with DWARFfv5.
GDB throws the error 'Unrecognized DWARF opcode 0x02 at 2' when running
Info address command with the executable file compiled with -gdwarf-5 flag.
This patch fixes this error.
Tested by running the testsuite before and after the patch and there is
no increase in the number of test cases that fails. Tested with both
-gdwarf-4 and -gdwarf-5 flags. Also tested -gslit-dwarf along with
-gdwarf-4 as well as -gdwarf-5 flags. Used clang version 10.0.0.
This is the test case used-
void bar(int arr[], int l, int m, int r) {
int i, j, k, n1= m - l + 1, n2= r - m, L[n1], R[n2];
for (i = 0; i < n1; i++)
L[i] = arr[l + i];
for (j = 0; j < n2; j++)
R[j] = arr[m + 1+ j];
}
int main()
{
int arr[] = {12, 11};
bar(arr,0,1,2);
return 0;
}
clang -gdwarf-5 test.c -o test.out
gdb test.out
gdb> start
gdb> step
gdb> step
gdb> step
gdb> step
gdb> info address L
Symbol "L" is multi-location:
Range 0x7c04007902bc5084-0x67fb876440700: a complex DWARF expression:
0: DW_OP_breg16 1 [$rip]
Unrecognized DWARF opcode 0x02 at 2
gdb/ChangeLog:
2020-04-07 Nitika Achra <Nitika.Achra@amd.com>
* dwarf2/loc.c (loclist_describe_location): Call the function decode_debug_loclists_
addresses if DWARF version is 5 or more because DW_LLE_start* or DW_LLE_offset_pair
with DW_LLE_base_addressx are being emitted in DWARFv5.
Add the newly added kind DW_LOC_OFFSET_PAIR also.
The length of location description is an unsigned ULEB integer in DWARFv5 instead of
unsigned integer.
nitachra [Tue, 7 Apr 2020 13:05:59 +0000 (18:35 +0530)]
DWARFv5: Handle location list for split dwarf.
GDB throws the error '<error reading variable: dwarf2_find_location_
expression: Corrupted DWARF expression.>' while printing the variable
value with executable file compiled with -gdwarf-5 and -gdwarf-split
flags. This is because DW_LLE_start* or DW_LLE_offset_pair with
DW_LLE_base_addressx are being emitted in DWARFv5 location list instead of
DW_LLE_GNU*. This patch fixes this error.
Tested by running the testsuite before and after the patch and there is no
increase in the number of test cases that fails. Tested with both -gdwarf-4
and -gdwarf-5 flags. Also tested -gslit-dwarf along with -gdwarf-4 as well as
-gdwarf-5 flags. Used clang version 10.0.0. This is the test case used-
void bar(int arr[], int l, int m, int r) {
int i, j, k, n1= m - l + 1, n2= r - m, L[n1], R[n2];
for (i = 0; i < n1; i++)
L[i] = arr[l + i];
for (j = 0; j < n2; j++)
R[j] = arr[m + 1+ j];
}
int main()
{
int arr[] = {12, 11};
bar(arr,0,1,2);
return 0;
}
clang -gdwarf-5 -gsplit-dwarf test.c -o test.out
gdb test.out
gdb> start
gdb> step
gdb> step
gdb> step
gdb> step
gdb> p L[0]
dwarf2_find_location_expression: Corrupted DWARF expression.
gdb/ChangeLog:
2020-04-07 Nitika Achra <Nitika.Achra@amd.com>
* dwarf2/loc.c (enum debug_loc_kind): Add a new kind DEBUG_LOC_OFFSET_PAIR.
(dwarf2_find_location_expression): Call the function decode_debug_loclists_
addresses if DWARF version is 5 or more. DW_LLE_start* or DW_LLE_offset_pair
with DW_LLE_base_addressx are being emitted in DWARFv5 instead of DW_LLE_GNU*.
Add applicable base address if the entry is DW_LLE_offset_pair from DWO.
(decode_debug_loclists_addresses): Return DEBUG_LOC_OFFSET_PAIR instead of
DEBUG_LOC_START_END in case of DW_LLE_offset_pair.
nitachra [Tue, 7 Apr 2020 13:05:58 +0000 (18:35 +0530)]
Support for DW_AT_loclists_base and DW_FORM_loclistx.
Hi Tom,
This is the updated series with ChangeLogs edits.
Regards,
Nitika
Simon Marchi [Tue, 7 Apr 2020 15:48:46 +0000 (11:48 -0400)]
gdb: small cleanups in dwarf2_psymtab constructors
I noticed that only one of the two dwarf2_psymtab constructors are
actually used. The one that is used accepts an `addr` parameter (the
base text offset), but its sole caller passes a constant, 0. We want to
keep calling the three-arguments standard_psymtab constructor form,
however, since it differs from the two-arguments form in subtle ways.
Also, I believe the dwarf2_per_cu_data associated to the created
dwarf2_psymtab should be passed as a constructor argument. That will
help me in a future patchset, to convince myself that the `per_cu_data`
field can't be NULL.
So this patch:
- Removes the two-parameters constructor of dwarf2_psymtab, as it is
unused.
- Removes the `addr` parameter of the remaining constructor, passing 0
directly to the base class' constructor.
- Adds a `per_cu` parameter, to assign the `per_cu_data` field at
construction.
gdb/ChangeLog:
* dwarf2/read.h (struct dwarf2_psymtab): Remove two-parameters
constructor. Remove `addr` parameter from other constructor and
add `per_cu` parameter.
* dwarf2/read.c (create_partial_symtab): Update.
Tom de Vries [Tue, 7 Apr 2020 15:33:05 +0000 (17:33 +0200)]
[gdb/symtab] Add symbol with inherited DW_AT_const_value to psymtabs
Consider the test-case added in this patch, with resulting dwarf (related to
variable aaa):
...
<0><d2>: Abbrev Number: 2 (DW_TAG_partial_unit)
<1><eb>: Abbrev Number: 4 (DW_TAG_variable)
<ec> DW_AT_name : aaa
<f0> DW_AT_type : <0xe4>
<f4> DW_AT_const_value : 1
<0><10c>: Abbrev Number: 2 (DW_TAG_compile_unit)
<10e> DW_AT_name : <artificial>
<1><11b>: Abbrev Number: 3 (DW_TAG_variable)
<11c> DW_AT_abstract_origin: <0xeb>
...
When running the test-case, we see:
...
(gdb) p aaa^M
No symbol "aaa" in current context.^M
(gdb) FAIL: gdb.dwarf2/imported-unit-abstract-const-value.exp: p aaa
...
while with target board readnow.exp, we have:
...
(gdb) p aaa^M
$1 = 1^M
...
This is due to the fact that there's no aaa symbol in the partial symtabs:
...
Partial symtab for source file <artificial>@0x101 (object 0x351cf40)^M
...
Global partial symbols:^M
`main', function, 0x4004a7^M
^M
...
which is due to the fact that when attempting to add the symbol corresponding
to DIE 0x11b in add_partial_symbol:
...
(gdb) p /x pdi->sect_off
$4 = 0x11b
(gdb) p pdi.has_const_value
$5 = 0
...
it seems the DW_AT_const_value was not inherited from DIE 0xeb, and
consequently we leave without adding a partial symbol.
Fix this by making sure that partial_die_info::has_const_value is inherited
in partial_die_info::fixup.
Build and reg-tested on x86_64-linux.
Tested test-case with target boards readnow, cc-with-gdb-index and
cc-with-debug-names. The "print aaa" test fails for cc-with-gdb-index, that's
PR25791, the test passes when applying the corresponding proposed patch.
gdb/ChangeLog:
2020-04-07 Tom de Vries <tdevries@suse.de>
PR symtab/25796
* dwarf2/read.c (can_have_DW_AT_const_value_p): New function.
(partial_die_info::fixup): Inherit has_const_value.
gdb/testsuite/ChangeLog:
2020-04-07 Tom de Vries <tdevries@suse.de>
PR symtab/25796
* gdb.dwarf2/imported-unit-abstract-const-value.exp: New file.
Rainer Orth [Tue, 7 Apr 2020 15:03:09 +0000 (17:03 +0200)]
ChangeLog entry for last change.
Rainer Orth [Tue, 7 Apr 2020 14:52:03 +0000 (16:52 +0200)]
ld: Fix several 32-bit SPARC plugin tests
Several ld plugin tests currently FAIL on 32-bit Solaris/SPARC:
FAIL: load plugin with source
FAIL: plugin claimfile lost symbol with source
FAIL: plugin claimfile replace symbol with source
FAIL: plugin claimfile resolve symbol with source
FAIL: plugin claimfile replace file with source
FAIL: plugin set symbol visibility with source
FAIL: plugin ignore lib with source
FAIL: plugin claimfile replace lib with source
FAIL: plugin 2 with source lib
FAIL: load plugin 2 with source
FAIL: load plugin 2 with source and -r
FAIL: plugin 3 with source lib
FAIL: load plugin 3 with source
FAIL: load plugin 3 with source and -r
FAIL: PR ld/20070
all of them in the same way:
./ld-new: BFD (GNU Binutils) 2.34.50.
20200328 internal error, aborting at /vol/src/gnu/binutils/hg/master/git/bfd/elf32-sparc.c:154 in sparc_final_write_processing
This happens when bfd_get_mach returns 0 when abfd refers to a source
file:
$11 = {
filename = 0x28c358 "/vol/src/gnu/binutils/hg/master/local/ld/testsuite/ld-plugin/func.c (symbol from plugin)", xvec = 0x24ed6c <sparc_elf32_sol2_vec>,
[...]
While I could find no specification what abfd's are allowed/expected in
*_final_write_processing, I could find no other target that behaved the
same. And indeed ignoring the 0 case fixes the failures. The code now
errors for other values. 64-bit SPARC is not affected because it doesn't
have a specific implementation of elf_backend_final_write_processing.
Tested on sparc-sun-solaris2.11.
2020-04-07 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Nick Clifton <nickc@redhat.com>
* elf32-sparc.c (sparc_final_write_processing): Fix whitespace.
<0>: Ignore.
<default>: Error rather than abort.
H.J. Lu [Tue, 7 Apr 2020 11:43:49 +0000 (04:43 -0700)]
gas: Mention support for Intel SERIALIZE and TSXLDTRK
* NEWS: Mention support for Intel SERIALIZE and TSXLDTRK
instructions.
H.J. Lu [Tue, 7 Apr 2020 11:17:01 +0000 (04:17 -0700)]
gas/doc/c-z80.texi: Fix @xref warnings
Fix
gas/doc/c-z80.texi:244: warning: `.' or `,' must follow @xref, not )
gas/doc/c-z80.texi:278: warning: `.' or `,' must follow @xref, not )
gas/doc/c-z80.texi:284: warning: `.' or `,' must follow @xref, not )
gas/doc/c-z80.texi:291: warning: `.' or `,' must follow @xref, not )
gas/doc/c-z80.texi:295: warning: `.' or `,' must follow @xref, not )
* doc/c-z80.texi: Fix @xref warnings.
Tom de Vries [Tue, 7 Apr 2020 08:57:20 +0000 (10:57 +0200)]
[gdb/symtab] Fix check-psymtab failure for inline function
Consider test-case inline.c, containing an inline function foo:
...
static inline int foo (void) { return 0; }
int main (void) { return foo (); }
...
And the test-case compiled with -O2 and debug info:
...
$ gcc -g inline.c -O2
...
This results in a DWARF entry for foo without pc info:
...
<1><114>: Abbrev Number: 4 (DW_TAG_subprogram)
<115> DW_AT_name : foo
<119> DW_AT_decl_file : 1
<11a> DW_AT_decl_line : 2
<11b> DW_AT_prototyped : 1
<11b> DW_AT_type : <0x10d>
<11f> DW_AT_inline : 3 (declared as inline and inlined)
...
When loading the executable in gdb, we create a partial symbol for foo, but
after expansion into a full symbol table no actual symbol is created,
resulting in a maint check-psymtab failure:
...
(gdb) maint check-psymtab
Static symbol `foo' only found in inline.c psymtab
...
Fix this by skipping this type of partial symbol during the check.
Note that we're not fixing this by not creating the partial symbol, because
this breaks setting a breakpoint on an inlined inline function in a CU for
which the partial symtab has not been expanded (test-case
gdb.dwarf2/break-inline-psymtab.exp).
Tested on x86_64-linux.
gdb/ChangeLog:
2020-04-07 Tom de Vries <tdevries@suse.de>
* psymtab.c (maintenance_check_psymtabs): Skip static LOC_BLOCK
symbols without address.
gdb/testsuite/ChangeLog:
2020-04-07 Tom de Vries <tdevries@suse.de>
* gdb.base/check-psymtab.c: New test.
* gdb.base/check-psymtab.exp: New file.
Cui,Lili [Tue, 7 Apr 2020 05:59:50 +0000 (13:59 +0800)]
Add support for intel TSXLDTRK instructions$
gas/
* config/tc-i386.c (cpu_arch): Add .TSXLDTRK.
(cpu_noarch): Likewise.
* doc/c-i386.texi: Document TSXLDTRK.
* testsuite/gas/i386/i386.exp: Run TSXLDTRK tests.
* testsuite/gas/i386/tsxldtrk.d: Likewise.
* testsuite/gas/i386/tsxldtrk.s: Likewise.
* testsuite/gas/i386/x86-64-tsxldtrk.d: Likewise.
opcodes/
* i386-dis.c (enum): Add PREFIX_0F01_REG_5_MOD_3_RM_1,
(prefix_table): New instructions (see prefixes above).
(rm_table): Likewise.
* i386-gen.c (cpu_flag_init): Add CPU_TSXLDTRK_FLAGS,
CPU_ANY_TSXLDTRK_FLAGS.
(cpu_flags): Add CpuTSXLDTRK.
* i386-opc.h (enum): Add CpuTSXLDTRK.
(i386_cpu_flags): Add cputsxldtrk.
* i386-opc.tbl: Add XSUSPLDTRK insns.
* i386-init.h: Regenerate.
* i386-tbl.h: Likewise.
GDB Administrator [Tue, 7 Apr 2020 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in
Kamil Rytarowski [Wed, 25 Mar 2020 19:29:44 +0000 (20:29 +0100)]
Implement basic threading support in the NetBSD target
Use sysctl(3) as the portable interface to prompt NetBSD threads on
all supported NetBSD versions. In future newer versions could switch
to PT_LWPSTATUS ptrace(2) API that will be supported on NetBSD 10.0
and newer.
Implement as part of nbsd_nat_target:
- thread_name() - read descriptive thread name
- thread_alive() - check whether a thread is alive
- post_attach() - updates the list of threads after attach
- update_thread_list() - updates the list of threads
- pid_to_str() - translates ptid to a descriptive string
There are two local static functions:
- nbsd_thread_lister() - generic LWP lister for a specified pid
- nbsd_add_threads() - utility to update the list of threads
Now, GDB on NetBSD can attach to a multithreaded process, spawn
a multithreaded process, list threads, print their LWP+PID numbers
and descriptive thread names.
gdb/ChangeLog:
* nbsd-nat.h (struct thread_info): Add forward declaration.
(nbsd_nat_target::thread_alive): Add.
(nbsd_nat_target::thread_name): Likewise.
(nbsd_nat_target::update_thread_list): Likewise.
(update_thread_list::post_attach): Likewise.
(post_attach::pid_to_str): Likewise.
* nbsd-nat.c: Include "gdbthread.h" and "inferior.h".
(nbsd_thread_lister): Add.
(nbsd_nat_target::thread_alive): Likewise.
(nbsd_nat_target::thread_name): Likewise.
(nbsd_add_threads): Likewise.
(update_thread_list::post_attach): Likewise.
(nbsd_nat_target::update_thread_list): Likewise.
(post_attach::pid_to_str): Likewise.
Tom Tromey [Mon, 6 Apr 2020 18:59:57 +0000 (12:59 -0600)]
Select variant field when printing variant
When I updated the Ada variant-printing code to be value-based, I
neglected a couple of issues. First, print_variant_part must first
extract the variant field before finding the active component; second,
print_field_values should pass in the field value as the outer value
when recursing.
This patch fixes both of these issues.
gdb/ChangeLog
2020-04-06 Tom Tromey <tromey@adacore.com>
* ada-valprint.c (print_variant_part): Extract the variant field.
(print_field_values): Use the field as the outer value when
recursing.
gdb/testsuite/ChangeLog
2020-04-06 Tom Tromey <tromey@adacore.com>
* gdb.ada/variant-record/proc.adb: New file.
* gdb.ada/variant-record/value.adb: New file.
* gdb.ada/variant-record/value.s: New file.
* gdb.ada/variant-record.exp: New file.
Tom Tromey [Mon, 6 Apr 2020 18:42:40 +0000 (12:42 -0600)]
Fix build breakage in NetBSD tdep files
A recent patch caused some build failures in NetBSD tdep files. I saw
this failure in my --enable-target=all build.
This patch fixes the problems. Tested by rebuilding.
I am going to check this in.
gdb/ChangeLog
2020-04-06 Tom Tromey <tromey@adacore.com>
* sh-nbsd-tdep.c: Include nbsd-tdep.h.
* ppc-nbsd-tdep.c: Include nbsd-tdep.h.
* mips-nbsd-tdep.c (mipsnbsd_init_abi): Add missing ";".
* arm-nbsd-tdep.c: Include nbsd-tdep.h.
* hppa-nbsd-tdep.c: Include nbsd-tdep.h.
Tom Tromey [Mon, 6 Apr 2020 18:13:24 +0000 (12:13 -0600)]
Handle complex error type in read_base_type
It turns out there was one more bug in the earlier complex series:
read_base_type could cause an assertion failure on some platforms. I
found this running the AdaCore internal test suite, but you can also
see it by running gdb's "gdb.cp" tests for x86 (not x86-64).
In particular, the DW_ATE_complex_float case calls
dwarf2_init_complex_target_type, which calls dwarf2_init_float_type,
which can return a type using TYPE_CODE_ERROR.
This patch changes the DWARF reader to handle this case, the same way
that the f-lang.c patch did. Perhaps init_complex_type really should
be changed to allow TYPE_CODE_ERROR? I was not sure.
Tested on x86-64 Fedora 30, using an x86 build. I'm checking this in.
gdb/ChangeLog
2020-04-06 Tom Tromey <tromey@adacore.com>
* dwarf2/read.c (read_base_type) <DW_ATE_complex_float>: Handle
TYPE_CODE_ERROR.
Kamil Rytarowski [Mon, 16 Mar 2020 18:02:22 +0000 (19:02 +0100)]
Add signal number conversions for NetBSD
gdb/ChangeLog:
* nbsd-tdep.c: Include "gdbarch.h".
Define enum with NetBSD signal numbers.
(nbsd_gdb_signal_from_target, nbsd_gdb_signal_to_target): New.
* alpha-nbsd-tdep.c (alphanbsd_init_abi): Call nbsd_init_abi().
* amd64-nbsd-tdep.c (amd64nbsd_init_abi): Likewise.
* arm-nbsd-tdep.c (arm_netbsd_elf_init_abi): Likewise.
* hppa-nbsd-tdep.c (hppanbsd_init_abi): Likewise.
* i386-nbsd-tdep.c (i386nbsd_init_abi): Likewise.
* mips-nbsd-tdep.c (nbsd_init_abi): Likewise.
* ppc-nbsd-tdep.c (ppcnbsd_init_abi): Likewise.
* sh-nbsd-tdep.c (shnbsd_init_abi): Likewise.
* sparc-nbsd-tdep.c (sparc32nbsd_init_abi): Likewise.
* sparc64-nbsd-tdep.c (sparc64nbsd_init_abi): Likewise.
* vax-nbsd-tdep.c (vaxnbsd_elf_init_abi): Likewise.
GDB Administrator [Mon, 6 Apr 2020 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 5 Apr 2020 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Sat, 4 Apr 2020 02:06:29 +0000 (19:06 -0700)]
elf: Remove zero-sized relocation section from section group
Remove zero-sized relocation section from a section group since it has
been removed from the output.
PR ld/25767
* elf.c (_bfd_elf_fixup_group_sections): Remove zero-sized
relocation section from section group.
GDB Administrator [Sat, 4 Apr 2020 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in
Hannes Domani [Fri, 3 Apr 2020 19:38:31 +0000 (21:38 +0200)]
Fix attributes of typed enums of typedefs
For this enum:
typedef unsigned char byte;
enum byte_enum : byte
{
byte_val = 128
};
The unsigned attribute is not set:
(gdb) p byte_val
$1 = -128
That's because it uses the attributes of the 'byte' typedef for the enum.
So this changes it to use the attributes of the underlying 'unsigned char'
instead.
gdb/ChangeLog:
2020-04-03 Hannes Domani <ssbssa@yahoo.de>
PR gdb/25325
* dwarf2/read.c (read_enumeration_type): Fix typed enum attributes.
gdb/testsuite/ChangeLog:
2020-04-03 Hannes Domani <ssbssa@yahoo.de>
PR gdb/25325
* gdb.cp/typed-enum.cc: New test.
* gdb.cp/typed-enum.exp: New file.
Tom Tromey [Fri, 3 Apr 2020 15:11:55 +0000 (09:11 -0600)]
Fix DWARF disassembly of DW_OP_const_type
While debugging another issue, I noticed that disassembling a DWARF
expression using DW_OP_const_type did not work.
disassemble_dwarf_expression was not properly decoding this operation.
This patch fixes the problem. Tested by re-debugging gdb.
I didn't write a test case because that seemed like overkill for
what's essentially a maintainer's helper.
The expression evaluator does decode this properly, so no other change
was needed.
gdb/ChangeLog
2020-04-03 Tom Tromey <tromey@adacore.com>
* dwarf2/loc.c (disassemble_dwarf_expression) <DW_OP_const_type>:
Read constant block.
GDB Administrator [Fri, 3 Apr 2020 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Thu, 2 Apr 2020 19:49:06 +0000 (15:49 -0400)]
gdb: use bfd_get_section_contents to read section contents in is_linked_with_cygwin_dll
The function is_linked_with_cygwin_dll currently uses
gdb_bfd_map_section to get some section contents. This is not ideal
because that memory, which is only used in this function, can't be
released. Instead, it was suggested to use
bfd_get_full_section_contents.
However, bfd_get_full_section_contents returns a newly allocated buffer,
which is not very practical to use with C++ automatic memory management
constructs. I decided to make gdb_bfd_get_full_section_contents, a
small alternative to bfd_get_full_section_contents. It is a small
wrapper around bfd_get_section_contents which returns the full contents
of the section in a gdb::byte_vector.
gdb_bfd_get_full_section_contents could be used at many places that
already allocate a vector of the size of the section and then call
bfd_get_section_contents. I think these call sites can be updated over
time.
gdb/ChangeLog:
* gdb_bfd.h: Include gdbsupport/byte-vector.h.
(gdb_bfd_get_full_section_contents): New declaration.
* gdb_bfd.c (gdb_bfd_get_full_section_contents): New function.
* windows-tdep.c (is_linked_with_cygwin_dll): Use
gdb_bfd_get_full_section_contents.
Simon Marchi [Thu, 2 Apr 2020 19:43:41 +0000 (15:43 -0400)]
gdb: replace some calls to internal_error with gdb_assert
There are a few spots using the pattern:
if (condition)
internal_error (__FILE__, __LINE__,
_("failed internal consistency check"));
The message brings no value, since it's pretty the description of a
failed assertion. Replace a few of these that are obvious with
gdb_assert.
gdb/ChangeLog:
* exec.c (build_section_table): Replace internal_error with
gdb_assert.
(section_table_xfer_memory_partial): Likewise.
* mdebugread.c (parse_partial_symbols): Likewise.
* psymtab.c (lookup_partial_symbol): Likewise.
* utils.c (wrap_here): Likewise.
Tom Tromey [Thu, 2 Apr 2020 19:13:02 +0000 (13:13 -0600)]
Avoid assertion failure due to complex type change
Tankut Baris Aktemur pointed out that the recent series to change how
complex types are handled introduced a regression.
This assert in init_complex_type was firing:
gdb_assert (TYPE_CODE (target_type) == TYPE_CODE_INT
|| TYPE_CODE (target_type) == TYPE_CODE_FLT);
The problem was that f-lang.c could call init_complex_type with a type
whose code was TYPE_CODE_ERROR.
It seemed best to me to fix this in f-lang.c, rather than to change
init_complex_type to accept error types.
Tested on x86-64 Fedora 30. I'm checking this in.
gdb/ChangeLog
2020-04-02 Tom Tromey <tromey@adacore.com>
* f-lang.c (build_fortran_types): Use arch_type to initialize
builtin_complex_s32 in the TYPE_CODE_ERROR case.
Tom Tromey [Thu, 2 Apr 2020 18:49:35 +0000 (12:49 -0600)]
Micro-optimize partial_die_info::read
While profiling the DWARF reader, I noticed that
partial_die_info::read creates a vector to store attributes. However,
the vector is not needed, as this code only processes a single
attribute at a time.
This patch removes the vector. On my machine, this improves the time
of "./gdb ./gdb" from 2.22 seconds to 1.92 seconds (mean times over 10
runs).
Note that the attribute is initialized by read_attribute, so it does
not need any special initialization. Avoiding this also improves
performance a bit.
Tested on x86-64 Fedora 30. I'm checking this in.
gdb/ChangeLog
2020-04-02 Tom Tromey <tromey@adacore.com>
* dwarf2/read.c (partial_die_info::read): Do not create a vector
of attributes.
Andrew Burgess [Mon, 23 Mar 2020 12:40:24 +0000 (12:40 +0000)]
gdb: Don't remove duplicate entries from the line table
In this commit:
commit
8c95582da858ac981f689a6f599acacb8c5c490f
Date: Mon Dec 30 21:04:51 2019 +0000
gdb: Add support for tracking the DWARF line table is-stmt field
A change was made in buildsym_compunit::record_line to remove
duplicate line table entries in some cases. This was an invalid
change, as these duplicate line table entries are used in _some_ cases
as part of prologue detection (see skip_prologue_using_sal).
It might be possible to identify those line table entries that are
required by skip_prologue_using_sal and only keep those duplicates
around, however, I have not done this here. The original duplicate
removal was done because (a) it was easy to implement, and (b) it
seemed obviously harmless.
As (b) is now known to be false, and implementation would be more
complex, and so (a) is also false. As such, it seems better to keep
all duplicates until an actual reason presents itself for why we
should remove any.
The original regression was spotted on RISC-V, which makes use of
skip_prologue_using_sal as part of riscv_skip_prologue. Originally I
created the test gdb.dwarf2/dw2-inline-small-func.exp, however, this
test will not compile on RISC-V as this target doesn't support
.uleb128 or .sleb128 assembler directives containing complex
expressions. As a result I added the gdb.opt/inline-small-func.exp
test, which exposes the bug on RISC-V, but obviously depends on the
compiler to produce specific DWARF information in order to expose the
bug. Still this test does ensure we always get the desired result,
even if the DWARF changes.
Originally the gdb.dwarf2/dw2-inline-small-func.exp test passed on
x86-64 even with the duplicate line table entries incorrectly
removed. The reason for this is that when a compilation unit doesn't
have a 'producer' string then skip_prologue_using_sal is not used,
instead the prologue is always skipped using analysis of the assembler
code.
However, for Clang on x86-64 skip_prologue_using_sal is used, so I
modified the gdb.dwarf2/dw2-inline-small-func.exp test to include a
'producer' string that names the Clang compiler. With this done the
test would fail on x86-64.
One thing to note is that the gdb.opt/inline-small-func.exp test might
fail on some targets. For example, if we compare sparc to risc-v by
looking at sparc32_skip_prologue we see that this function doesn't use
skip_prologue_using_sal, but instead uses find_pc_partial_function
directly. I don't know the full history behind why the code is like
it is, but it feels like sparc32_skip_prologue is an attempt to
duplicate some of the functionality of skip_prologue_using_sal, but
without all of the special cases. If this is true then the new test
could easily fail on this target, this would suggest that sparc should
consider switching to use skip_prologue_using_sal like risc-v does.
gdb/ChangeLog:
* buildsym.c (buildsym_compunit::record_line): Remove
deduplication code.
gdb/testsuite/ChangeLog:
* gdb.dwarf2/dw2-inline-small-func-lbls.c: New file.
* gdb.dwarf2/dw2-inline-small-func.c: New file.
* gdb.dwarf2/dw2-inline-small-func.exp: New file.
* gdb.dwarf2/dw2-inline-small-func.h: New file.
* gdb.opt/inline-small-func.c: New file.
* gdb.opt/inline-small-func.exp: New file.
* gdb.opt/inline-small-func.h: New file.
Andrew Burgess [Mon, 23 Mar 2020 15:11:48 +0000 (15:11 +0000)]
gdb/testsuite: Add support for DW_LNS_set_file to DWARF compiler
Extend the Dejagnu DWARF compiler to support DW_LNS_set_file opcode.
This will be used in a later commit. There should be no change in the
testsuite after this commit.
gdb/testsuite/ChangeLog:
* lib/dwarf.exp (Dwarf::lines::program::DW_LNS_set_file): New
function.
Andrew Burgess [Mon, 23 Mar 2020 15:11:25 +0000 (15:11 +0000)]
gdb/testsuite: Add compiler options parameter to function_range helper
When using the Dejagnu DWARF compiler tests will often use the
function_range helper function to extract the extents of a function.
If the plan is to compiler the file with non-default compiler flags
then we must pass those same compiler flags through to the
function_range helper function.
This will be used in a later commit, there should be no change in the
testsuite behaviour after this commit.
gdb/testsuite/ChangeLog:
* lib/dwarf.exp (function_range): Allow compiler options to be
specified.
Tom de Vries [Thu, 2 Apr 2020 15:12:49 +0000 (17:12 +0200)]
[gdb/testsuite] Don't use O2 for inlining in break-inline-psymtab.exp
In test-case gdb.dwarf2/break-inline-psymtab.exp we use O2 to enable inlining
of bar into foo in break-inline-psymtab-2.c.
Instead, enforce inlining using __attribute__((always_inline)), to avoid any
optimization-related test issues.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-04-02 Tom de Vries <tdevries@suse.de>
* gdb.dwarf2/break-inline-psymtab-2.c (bar): Add
__attribute__((always_inline)).
* gdb.dwarf2/break-inline-psymtab.exp: Don't use -O2.
H.J. Lu [Thu, 2 Apr 2020 14:39:55 +0000 (07:39 -0700)]
NOCF_PROTECTION_CFLAGS: Replace nopie with available
* testsuite/config/default.exp (NOCF_PROTECTION_CFLAGS): Replace
nopie with available.
H.J. Lu [Thu, 2 Apr 2020 14:03:08 +0000 (07:03 -0700)]
ld: Add NOCF_PROTECTION_CFLAGS to turn off -fcf-protection
GCC in Ubuntu 20.04 enables -fcf-protection by default, which leads to
FAIL: S-records
FAIL: S-records with constructors
FAIL: Build plt-main with -z bndplt
FAIL: Build plt-main with PIE and -z bndplt
FAIL: Build plt-main with -z bndplt -z now
FAIL: Build plt-main with PIE and -z bndplt -z now
on x86-64. Add NOCF_PROTECTION_CFLAGS to pass -fcf-protection=none on
these tests.
* testsuite/config/default.exp (NOCF_PROTECTION_CFLAGS): New.
Set to "-fcf-protection=none" if target compiler supports it.
* testsuite/ld-srec/srec.exp: Add $NOCF_PROTECTION_CFLAGS to
CC and CXX.
* testsuite/ld-x86-64/x86-64.exp: Add $NOCF_PROTECTION_CFLAGS
to PLT BND tests.
Jan W. Jagersma [Thu, 2 Apr 2020 13:31:43 +0000 (14:31 +0100)]
coff-go32-exe: support variable-length stubs
The stub size in GO32 executables has historically been fixed at 2048
bytes, due to hardcoded limitations in bfd. Recent patches to djgpp by
Stas Sergeev (CC'd) have pushed the stub right up to this limit, so if
any further expansion is desired, this must first be patched in bfd.
This series includes three patches: The first changes the meaning of
the bfd->origin field slightly, so that target code can use this to
specify an offset into the file where the actual bfd is located.
The second patch then uses this to enable support for variable-sized
stubs in the coff-go32-exe format.
The final patch is only a cleanup, it normalizes function and variable
names in coff-stgo32.c so that they all begin with the same prefix.
bfd * bfdio.c (bfd_bread, bfd_tell, bfd_seek, bfd_mmap): Always add
bfd->origin to file offset.
* bfdwin.c (bfd_get_file_window): Likewise.
* bfd.c: Clarify the use of the bfd->origin field.
* bfd-in2.h: Regenerate.
* coff-i386.c: Don't include go32exe.h. Allow overriding
coff_write_object_contents via COFF_WRITE_CONTENTS.
* coff-stgo32.c (go32exe_cleanup, go32exe_mkobject)
(go32exe_write_object_contents): New functions.
(go32exe_temp_stub, go32exe_temp_stub_size): New static globals.
(COFF_WRITE_CONTENTS, GO32EXE_DEFAULT_STUB_SIZE): Define.
(create_go32_stub): Remove check for 2k size limit. Read stub
from go32exe_temp_stub if present.
(go32_stubbed_coff_bfd_copy_private_bfd_data): Allocate and
copy variable-length stub.
(go32_check_format): Read stub to go32exe_temp_stub, set
origin, return go32exe_cleanup.
(adjust_filehdr_in_post, adjust_filehdr_out_pre)
(adjust_filehdr_out_post, adjust_scnhdr_in_post)
(adjust_scnhdr_out_pre, adjust_scnhdr_out_post)
(adjust_aux_in_post, adjust_aux_out_pre, adjust_aux_out_post):
Remove functions and their associated #defines.
* coffcode.h (coff_mkobject_hook): Remove stub copying code.
* libcoff-in.h: (struct coff_tdata): New field stub_size.
Rename field go32stub to stub.
* libcoff.h: Regenerate.
* coff-stgo32.c (go32_check_format): Rename to...
(go32exe_check_format): ...this.
(go32_stubbed_coff_bfd_copy_private_bfd_data): Rename to...
(go32exe_copy_private_bfd_data): ...this.
(stub_bytes): Rename to...
(go32exe_default_stub): ...this.
(create_go32_stub): Rename to...
(go32exe_create_stub): ...this.
* coff-stgo32.c (go32exe_copy_private_bfd_data): Avoid realloc
when possible.
include * coff/go32exe.h: Remove file.
* coff/internal.h (struct internal_filehdr): Remove field
go32stub. Remove flag F_GO32STUB.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:32 +0000 (15:11 +0200)]
gdbserver/linux-low: delete 'linux_target_ops' and 'the_low_target'
All the linux target ops have been moved into linux_process_target
as methods. The 'linux_target_ops' struct and its instantiations
are now obsolete. Delete them.
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* linux-low.h (struct linux_target_ops): Remove.
(the_low_target): Remove.
* linux-x86-low.cc (the_low_target): Remove.
* linux-aarch64-low.cc (the_low_target): Ditto.
* linux-arm-low.cc (the_low_target): Ditto.
* linux-bfin-low.cc (the_low_target): Ditto.
* linux-cris-low.cc (the_low_target): Ditto.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-ia64-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-mips-low.cc (the_low_target): Ditto.
* linux-nios2-low.cc (the_low_target): Ditto.
* linux-ppc-low.cc (the_low_target): Ditto.
* linux-riscv-low.cc (the_low_target): Ditto.
* linux-s390-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-sparc-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:32 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'get_ipa_tdesc_idx' into a method
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Remove the 'get_ipa_tdesc_idx' linux target op and let a concrete
linux target define the op by overriding the declaration in
process_stratum_target.
* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <get_ipa_tdesc_idx>: Remove.
* linux-low.cc (linux_process_target::get_ipa_tdesc_idx): Remove.
* linux-x86-low.cc (class x86_target) <get_ipa_tdesc_idx>: Declare.
(x86_get_ipa_tdesc_idx): Turn into...
(x86_target::get_ipa_tdesc_idx): ...this.
(the_low_target): Remove the op field.
* linux-ppc-low.cc (class ppc_target) <get_ipa_tdesc_idx>: Declare.
(ppc_get_ipa_tdesc_idx): Turn into...
(ppc_target::get_ipa_tdesc_idx): ...this.
(the_low_target): Remove the op field.
* linux-s390-low.cc (class s390_target) <get_ipa_tdesc_idx>: Declare.
(s390_get_ipa_tdesc_idx): Turn into...
(s390_target::get_ipa_tdesc_idx): ...this.
(the_low_target): Remove the op field.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:31 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'get_syscall_trapinfo' into a method
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Turn the 'get_syscall_trapinfo' linux target op into a method
of process_stratum_target.
* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <get_syscall_trapinfo>
<gdb_catch_this_syscall>
<low_supports_catch_syscall>
<low_get_syscall_trapinfo>: Declare.
* linux-low.cc (get_syscall_trapinfo): Turn into...
(linux_process_target::get_syscall_trapinfo): ...this.
(linux_process_target::low_get_syscall_trapinfo): Define.
(gdb_catch_this_syscall_p): Turn into...
(linux_process_target::gdb_catch_this_syscall): ...this.
(linux_process_target::low_supports_catch_syscall): Define.
Update the callers below.
(linux_process_target::wait_1)
(linux_process_target::supports_catch_syscall)
* linux-x86-low.cc (class x86_target) <low_supports_catch_syscall>
<low_get_syscall_trapinfo>: Declare.
(x86_target::low_supports_catch_syscall): Define.
(x86_get_syscall_trapinfo): Turn into...
(x86_target::low_get_syscall_trapinfo): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target)
<low_supports_catch_syscall>
<low_get_syscall_trapinfo>: Declare.
(aarch64_target::low_supports_catch_syscall): Define.
(aarch64_get_syscall_trapinfo): Turn into...
(aarch64_target::low_get_syscall_trapinfo): ...this.
(the_low_target): Remove the op field.
* linux-arm-low.cc (class arm_target) <low_supports_catch_syscall>
<low_get_syscall_trapinfo>: Declare.
(arm_target::low_supports_catch_syscall): Define.
(arm_get_syscall_trapinfo): Turn into...
(arm_target::low_get_syscall_trapinfo): ...this.
(the_low_target): Remove the op field.
* linux-ppc-low.cc (the_low_target): Remove the op field.
* linux-s390-low.cc (the_low_target): Remove the op field.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:31 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'supports_hardware_single_step' into a method
All the linux low targets except arm define the
'supports_hardware_single_step' op to return true. Hence, we override
the method to return true in linux_process_target, and remove the
definitions in all the linux low targets but arm.
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Remove the 'supports_hardware_single_step' linux target op and
override the process_stratum_target's op definition in
linux_process_target to return true.
* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <finish_step_over>
<maybe_hw_step>: Declare.
* linux-low.cc (can_hardware_single_step): Remove.
(maybe_hw_step): Turn into...
(linux_process_target::maybe_hw_step): ...this.
(finish_step_over): Turn into...
(linux_process_target::finish_step_over): ...this.
(linux_process_target::supports_hardware_single_step): Update
to return true.
Update the callers below.
(linux_process_target::single_step)
(linux_process_target::resume_one_lwp_throw)
* linux-arm-low.cc (class arm_target)
<supports_hardware_single_step>: Declare.
(arm_supports_hardware_single_step): Turn into...
(arm_target::supports_hardware_single_step): ...this.
(the_low_target): Remove the op field.
* linux-x86-low.cc (x86_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (aarch64_supports_hardware_single_step):
Remove.
(the_low_target): Remove the op field.
* linux-bfin-low.cc (bfin_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-crisv32-low.cc (cris_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-m32r-low.cc (m32r_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-m68k-low.cc (m68k_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-ppc-low.cc (ppc_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-s390-low.cc (s390_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-sh-low.cc (sh_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-tic6x-low.cc (tic6x_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-tile-low.cc (tile_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-xtensa-low.cc (xtensa_supports_hardware_single_step):
Remove.
(the_low_target): Remove the op field.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:31 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'supports_range_stepping' into a method
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Turn the 'supports_range_stepping' linux target op into a method
of linux_process_target.
* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <low_supports_range_stepping>: Declare.
* linux-low.cc (linux_process_target::low_supports_range_stepping):
Define.
(linux_process_target::supports_range_stepping): Update the call
site.
* linux-x86-low.cc (class x86_target)
<low_supports_range_stepping>: Declare.
(x86_supports_range_stepping): Turn into...
(x86_target::low_supports_range_stepping): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target)
<low_supports_range_stepping>: Declare.
(aarch64_supports_range_stepping): Turn into...
(aarch64_target::low_supports_range_stepping): ...this.
(the_low_target): Remove the op field.
* linux-arm-low.cc (the_low_target): Remove the op field.
* linux-bfin-low.cc (the_low_target): Ditto.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-ppc-low.cc (the_low_target): Ditto.
* linux-s390-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:30 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'emit_ops' into a method
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Remove the 'emit_ops' linux target ops and let the concrete
linux target define the op by overriding the declaration of
process_stratum_target.
* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <emit_ops>: Remove.
* linux-low.cc (linux_process_target::emit_ops): Remove.
* linux-x86-low.cc (class x86_target) <emit_ops>: Declare.
(x86_emit_ops): Turn into...
(x86_target::emit_ops): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target) <emit_ops>: Declare.
(aarch64_emit_ops): Turn into...
(aarch64_target::emit_ops): ...this.
(the_low_target): Remove the op field.
* linux-ppc-low.cc (class ppc_target) <emit_ops>: Declare.
(ppc_emit_ops): Turn into...
(ppc_target::emit_ops): ...this.
(the_low_target): Remove the op field.
* linux-s390-low.cc (class s390_target) <emit_ops>: Declare.
(s390_emit_ops): Turn into...
(s390_target::emit_ops): ...this.
(the_low_target): Remove the op field.
* linux-arm-low.cc (the_low_target): Remove the op field.
* linux-bfin-low.cc (the_low_target): Ditto.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:30 +0000 (15:11 +0200)]
gdbserver/linux-low: turn fast tracepoint ops into methods
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Remove the 'install_fast_tracepoint_jump_pad' and
'get_min_fast_tracepoint_insn_len' linux target ops to let the
concrete linux target define the ops by overriding the declarations
of process_stratum_target.
* linux-low.h (struct linux_target_ops): Remove the ops.
(class linux_process_target) <supports_fast_tracepoints>
<install_fast_tracepoint_jump_pad>
<get_min_fast_tracepoint_insn_len>: Remove.
* linux-low.cc (linux_process_target::supports_fast_tracepoints)
(linux_process_target::install_fast_tracepoint_jump_pad)
(linux_process_target::get_min_fast_tracepoint_insn_len): Remove.
* linux-x86-low.cc (class x86_target) <supports_fast_tracepoints>
<install_fast_tracepoint_jump_pad>
<get_min_fast_tracepoint_insn_len>: Declare.
(x86_target::supports_fast_tracepoints): Define.
(x86_install_fast_tracepoint_jump_pad): Turn into...
(x86_target::install_fast_tracepoint_jump_pad): ...this.
(x86_get_min_fast_tracepoint_insn_len): Turn into...
(x86_target::get_min_fast_tracepoint_insn_len): ...this.
(the_low_target): Remove the op fields.
* linux-aarch64-low.cc (class aarch64_target)
<supports_fast_tracepoints>
<install_fast_tracepoint_jump_pad>
<get_min_fast_tracepoint_insn_len>: Declare.
(aarch64_target::supports_fast_tracepoints): Define.
(aarch64_install_fast_tracepoint_jump_pad): Turn into...
(aarch64_target::install_fast_tracepoint_jump_pad): ...this.
(aarch64_get_min_fast_tracepoint_insn_len): Turn into...
(aarch64_target::get_min_fast_tracepoint_insn_len): ...this.
(the_low_target): Remove the op fields.
* linux-ppc-low.cc (class ppc_target) <supports_fast_tracepoints>
<install_fast_tracepoint_jump_pad>
<get_min_fast_tracepoint_insn_len>: Declare.
(ppc_target::supports_fast_tracepoints): Define.
(ppc_install_fast_tracepoint_jump_pad): Turn into...
(ppc_target::install_fast_tracepoint_jump_pad): ...this.
(ppc_get_min_fast_tracepoint_insn_len): Turn into...
(ppc_target::get_min_fast_tracepoint_insn_len): ...this.
(the_low_target): Remove the op fields.
* linux-s390-low.cc (class s390_target) <supports_fast_tracepoints>
<install_fast_tracepoint_jump_pad>
<get_min_fast_tracepoint_insn_len>: Declare.
(s390_target::supports_fast_tracepoints): Define.
(s390_install_fast_tracepoint_jump_pad): Turn into...
(s390_target::install_fast_tracepoint_jump_pad): ...this.
(s390_get_min_fast_tracepoint_insn_len): Turn into...
(s390_target::get_min_fast_tracepoint_insn_len): ...this.
(the_low_target): Remove the op fields.
* linux-arm-low.cc (the_low_target): Remove the op fields.
* linux-bfin-low.cc (the_low_target): Ditto.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:30 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'get_thread_area' into a method
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Turn the 'get_thread_area' linux target op into a method of
process_stratum_target.
* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <stuck_in_jump_pad>
<linux_fast_tracepoint_collecting>
<low_get_thread_area>: Declare.
* linux-low.cc (supports_fast_tracepoints): Remove.
(linux_fast_tracepoint_collecting): Turn into...
(linux_process_target::linux_fast_tracepoint_collecting): ...this.
(linux_process_target::low_get_thread_area): Define.
(stuck_in_jump_pad_callback): Turn into...
(linux_process_target::stuck_in_jump_pad): ...this.
Update the caller below.
(linux_process_target::stabilize_threads)
* linux-x86-low.cc (class x86_target) <low_get_thread_area>:
Declare.
(x86_get_thread_area): Turn into...
(x86_target::low_get_thread_area): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target) <low_get_thread_area>:
Declare.
(aarch64_get_thread_area): Turn into...
(aarch64_target::low_get_thread_area): ...this.
(the_low_target): Remove the op field.
* linux-ppc-low.cc (class ppc_target) <low_get_thread_area>:
Declare.
(ppc_get_thread_area): Turn into...
(ppc_target::low_get_thread_area): ...this.
(the_low_target): Remove the op field.
* linux-s390-low.cc (class s390_target) <low_get_thread_area>:
Declare.
(s390_get_thread_area): Turn into...
(s390_target::low_get_thread_area): ...this.
(the_low_target): Remove the op field.
* linux-arm-low.cc (the_low_target): Remove the op field.
* linux-bfin-low.cc (the_low_target): Ditto.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:29 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'supports_tracepoints' into a method
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Remote the 'supports_tracepoints' linux target op and let the
concrete linux target define it by overriding the op declared in
process_stratum_target.
* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <supports_tracepoints>: Remove.
* linux-low.cc (linux_process_target::supports_tracepoints): Remove.
* linux-x86-low.cc (class x86_target) <supports_tracepoints>:
Declare.
(x86_supports_tracepoints): Turn into...
(x86_target::supports_tracepoints): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target)
<supports_tracepoints>: Declare.
(aarch64_supports_tracepoints): Turn into...
(aarch64_target::supports_tracepoints): ...this.
(the_low_target): Remove the op field.
* linux-ppc-low.cc (class ppc_target) <supports_tracepoints>:
Declare.
(ppc_supports_tracepoints): Turn into...
(ppc_target::supports_tracepoints): ...this.
(the_low_target): Remove the op field.
* linux-s390-low.cc (class s390_target) <supports_tracepoints>:
Declare.
(s390_supports_tracepoints): Turn into...
(s390_target::supports_tracepoints): ...this.
(the_low_target): Remove the op field.
* linux-arm-low.cc (the_low_target): Remove the op field.
* linux-bfin-low.cc (the_low_target): Ditto.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:29 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'process_qsupported' into a method
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Remove the 'process_qsupported' linux target op and let a concrete
linux target define the op by overriding the op declaration in
process_stratum_target.
* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <process_qsupported>: Remove.
* linux-low.cc (linux_process_target::process_qsupported): Remove.
* linux-x86-low.cc (class x86_target) <process_qsupported>: Declare.
(x86_linux_process_qsupported): Turn into...
(x86_target::process_qsupported): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (the_low_target): Remove the op
field.
* linux-arm-low.cc (the_low_target): Ditto.
* linux-bfin-low.cc (the_low_target): Ditto.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-ppc-low.cc (the_low_target): Ditto.
* linux-s390-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:29 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'prepare_to_resume' into a method
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Turn the 'prepare_to_resume' linux target op into a method of
linux_process_target.
* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <low_prepare_to_resume>: Declare.
* linux-low.cc (linux_process_target::low_prepare_to_resume):
Define.
Update the callers below:
(linux_process_target::resume_one_lwp_throw)
(linux_process_target::low_prepare_to_resume)
* linux-x86-low.cc (class x86_target) <low_prepare_to_resume>:
Declare.
(x86_target::low_prepare_to_resume): Define.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target)
<low_prepare_to_resume>: Declare.
(aarch64_target::low_prepare_to_resume): Define.
(the_low_target): Remove the op field.
* linux-arm-low.cc (class arm_target) <low_prepare_to_resume>:
Declare.
(arm_prepare_to_resume): Turn into...
(arm_target::low_prepare_to_resume): ...this.
(the_low_target): Remove the op field.
* linux-mips-low.cc (class mips_target) <low_prepare_to_resume>:
Declare.
(mips_linux_prepare_to_resume): Turn into...
(mips_target::low_prepare_to_resume): ...this.
(the_low_target): Remove the op field.
* linux-bfin-low.cc (the_low_target): Remove the op field.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-ppc-low.cc (the_low_target): Ditto.
* linux-s390-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:28 +0000 (15:11 +0200)]
gdbserver/linux-low: turn process/thread addition/deletion ops into methods
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Turn the 'new_process', 'delete_process', 'new_thread',
'delete_thread', and 'new_fork' linux target ops into methods
of linux_process_target.
* linux-low.h (struct linux_target_ops): Remove the ops.
(class linux_process_target) <add_linux_process>
<add_lwp>
<delete_lwp>
<attach_lwp>
<detach_one_lwp>
<check_zombie_leaders>
<filter_exit_event>
<low_new_process>
<low_delete_process>
<low_new_thread>
<low_delete_thread>
<low_new_fork>: Declare.
* linux-low.cc (delete_lwp): Turn into...
(linux_process_target::delete_lwp): ...this.
(linux_process_target::low_delete_thread): Define.
(linux_add_process): Turn into...
(linux_process_target::add_linux_process): ...this.
(linux_process_target::low_new_process): Define.
(linux_process_target::low_delete_process): Define.
(linux_process_target::low_new_fork): Define.
(add_lwp): Turn into...
(linux_process_target::add_lwp): ...this.
(linux_process_target::low_new_thread): Define.
(linux_attach_lwp): Turn into...
(linux_process_target::attach_lwp): ...this.
(linux_detach_one_lwp): Turn into...
(linux_process_target::detach_one_lwp): ...this.
(linux_detach_lwp_callback): Remove and inline...
(linux_process_target::detach): ...here.
(check_zombie_leaders): Turn into...
(linux_process_target::check_zombie_leaders): ...this.
(filter_exit_event): Turn into...
(linux_process_target::filter_exit_event): ...this.
Update the callers below.
(linux_process_target::handle_extended_wait)
(linux_process_target::create_inferior)
(attach_proc_task_lwp_callback)
(linux_process_target::attach)
(linux_process_target::detach)
(linux_process_target::mourn)
* thread-db.cc (attach_thread)
* linux-x86-low.cc (class x86_target) <low_new_process>
<low_delete_process>
<low_new_thread>
<low_delete_thread>
<low_new_fork>: Declare.
(x86_linux_new_process): Turn into...
(x86_target::low_new_process): ...this.
(x86_linux_delete_process): Turn into...
(x86_target::low_delete_process): ...this.
(x86_target::low_new_thread): Define.
(x86_target::low_delete_thread): Define.
(x86_linux_new_fork): Turn into...
(x86_target::low_new_fork): ...this.
(the_low_target): Remove the op fields.
* linux-aarch64-low.cc (class aarch64_target) <low_new_process>
<low_delete_process>
<low_new_thread>
<low_delete_thread>
<low_new_fork>: Declare.
(aarch64_linux_new_process): Turn into...
(aarch64_target::low_new_process): ...this.
(aarch64_linux_delete_process): Turn into...
(aarch64_target::low_delete_process): ...this.
(aarch64_target::low_new_thread): Define.
(aarch64_target::low_delete_thread): Define.
(aarch64_linux_new_fork): Turn into...
(aarch64_target::low_new_fork): ...this.
(the_low_target): Remove the op fields.
* linux-arm-low.cc (class arm_target) <low_new_process>
<low_delete_process>
<low_new_thread>
<low_delete_thread>
<low_new_fork>: Declare.
(arm_new_process): Turn into...
(arm_target::low_new_process): ...this.
(arm_delete_process): Turn into...
(arm_target::low_delete_process): ...this.
(arm_new_thread): Turn into...
(arm_target::low_new_thread): ...this.
(arm_delete_thread): Turn into...
(arm_target::low_delete_thread): ...this.
(arm_new_fork): Turn into...
(arm_target::low_new_fork): ...this.
(the_low_target): Remove the op fields.
* linux-mips-low.cc (class mips_target) <low_new_process>
<low_delete_process>
<low_new_thread>
<low_delete_thread>
<low_new_fork>: Declare.
(mips_linux_new_process): Turn into...
(mips_target::low_new_process): ...this.
(mips_linux_delete_process): Turn into...
(mips_target::low_delete_process): ...this.
(mips_linux_new_thread): Turn into...
(mips_target::low_new_thread): ...this.
(mips_linux_delete_thread): Turn into...
(mips_target::low_delete_thread): ...this.
(mips_linux_new_fork): Turn into...
(mips_target::low_new_fork): ...this.
(the_low_target): Remove the op fields.
* linux-bfin-low.cc (the_low_target): Remove the op fields.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-ppc-low.cc (the_low_target): Ditto.
* linux-s390-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:28 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'siginfo_fixup' into a method
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Turn the 'siginfo_fixup' linux target op into a method of
linux_process_target.
* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <siginfo_fixup>
<low_siginfo_fixup>: Declare.
* linux-low.cc (siginfo_fixup): Turn into...
(linux_process_target::siginfo_fixup): ...this.
(linux_process_target::low_siginfo_fixup): Define.
* linux-x86-low.cc (class x86_target) <low_siginfo_fixup>: Declare.
(x86_siginfo_fixup): Turn into...
(x86_target::low_siginfo_fixup): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target):
<low_siginfo_fixup>: Declare.
(aarch64_linux_siginfo_fixup): Turn into...
(aarch64_target::low_siginfo_fixup): ...this.
(the_low_target): Remove the op field.
* linux-arm-low.cc (the_low_target): Remove the op field.
* linux-bfin-low.cc (the_low_target): Ditto.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-mips-low.cc (the_low_target): Ditto.
* linux-ppc-low.cc (the_low_target): Ditto.
* linux-s390-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:28 +0000 (15:11 +0200)]
gdbserver/linux-low: turn '{collect, supply}_ptrace_register' into methods
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Turn the 'collect_ptrace_register' and 'supply_ptrace_register'
linux target ops into methods of linux_process_target.
* linux-low.h (struct linux_target_ops): Remove the ops.
(class linux_process_target) <low_collect_ptrace_register>
<low_store_ptrace_register>: Declare.
* linux-low.cc (linux_process_target::low_collect_ptrace_register)
(linux_process_target::low_supply_ptrace_register): Define.
Update the callers below.
(linux_process_target::fetch_register)
(linux_process_target::store_register)
* linux-x86-low.cc (the_low_target): Remove the op fields.
* linux-aarch64-low.cc (the_low_target): Ditto.
* linux-arm-low.cc (the_low_target): Ditto.
* linux-bfin-low.cc (the_low_target): Ditto.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-sparc-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.
* linux-mips-low.cc (class mips_target)
<low_collect_ptrace_register>
<low_supply_ptrace_register>: Declare.
(mips_collect_ptrace_register): Turn into ...
(mips_target::low_collect_ptrace_register): ...this.
(mips_supply_ptrace_register): Turn into...
(mips_target::low_supply_ptrace_register): ...this.
(the_low_target): Remove the op fields.
* linux-ppc-low.cc (class ppc_target)
<low_collect_ptrace_register>
<low_supply_ptrace_register>: Declare.
(ppc_collect_ptrace_register): Turn into ...
(ppc_target::low_collect_ptrace_register): ...this.
(ppc_supply_ptrace_register): Turn into ...
(ppc_target::low_supply_ptrace_register): ...this.
(ppc_fill_gregset): Update for the calls to
low_collect_ptrace_register.
(the_low_target): Remove the op fields.
* linux-s390-low.cc (class s390_target)
<low_collect_ptrace_register>
<low_supply_ptrace_register>: Declare.
(s390_collect_ptrace_register): Turn into ...
(s390_target::low_collect_ptrace_register): ...this.
(s390_supply_ptrace_register): Turn into ...
(s390_target::low_supply_ptrace_register): ...this.
(s390_fill_gregset): Update for the calls to
low_collect_ptrace_register.
(the_low_target): Remove the op fields.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:27 +0000 (15:11 +0200)]
gdbserver/linux-low: turn watchpoint ops into methods
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Turn the 'stopped_by_watchpoint' and 'stopped_data_address' linux
target ops into methods of linux_process_target.
* linux-low.h (struct linux_target_ops): Remove the ops.
(class linux_process_target) <check_stopped_by_watchpoint>
<low_stopped_by_watchpoint>
<low_stopped_data_address>: Declare.
* linux-low.cc (check_stopped_by_watchpoint): Turn into...
(linux_process_target::check_stopped_by_watchpoint): ...this.
(linux_process_target::low_stopped_by_watchpoint): Define.
(linux_process_target::low_stopped_data_address): Define.
* linux-x86-low.cc (class x86_target) <low_stopped_by_watchpoint>
<low_stopped_data_address>: Declare.
(x86_stopped_by_watchpoint): Turn into...
(x86_target::low_stopped_by_watchpoint): ...this.
(x86_stopped_data_address): Turn into...
(x86_target::low_stopped_data_address): ...this.
(the_low_target): Remove the op fields.
* linux-aarch64-low.cc (class aarch64_target)
<low_stopped_by_watchpoint>
<low_stopped_data_address>: Declare.
(aarch64_stopped_by_watchpoint): Turn into...
(aarch64_target::low_stopped_by_watchpoint): ...this.
(aarch64_stopped_data_address): Turn into...
(aarch64_target::low_stopped_data_address): ...this.
(the_low_target): Remove the op fields.
* linux-arm-low.cc (class arm_target) <low_stopped_by_watchpoint>
<low_stopped_data_address>: Declare.
(arm_stopped_by_watchpoint): Turn into...
(arm_target::low_stopped_by_watchpoint): ...this.
(arm_stopped_data_address): Turn into...
(arm_target::low_stopped_data_address): ...this.
(the_low_target): Remove the op fields.
* linux-crisv32-low.cc (class crisv32_target)
<low_stopped_by_watchpoint>
<low_stopped_data_address>: Declare.
(cris_stopped_by_watchpoint): Turn into...
(crisv32_target::low_stopped_by_watchpoint): ...this.
(cris_stopped_data_address): Turn into...
(crisv32_target::low_stopped_data_address): ...this.
(the_low_target): Remove the op fields.
* linux-mips-low.cc (class mips_target) <low_stopped_by_watchpoint>
<low_stopped_data_address>: Declare.
(mips_stopped_by_watchpoint): Turn into...
(mips_target::low_stopped_by_watchpoint): ...this.
(mips_stopped_data_address): Turn into...
(mips_target::low_stopped_data_address): ...this.
(the_low_target): Remove the op fields.
* linux-bfin-low.cc (the_low_target): Remove the op fields.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-ppc-low.cc (the_low_target): Ditto.
* linux-s390-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-sparc-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:27 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'insert_point' and 'remove_point' into methods
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Turn the 'insert_point' and 'remove_point' linux target ops into
methods of linux_process_target.
* linux-low.h (struct linux_target_ops): Remove the ops.
(class linux_process_target) <low_insert_point>
<low_remove_point>: Declare.
* linux-low.cc (linux_process_target::low_insert_point)
(linux_process_target::low_remove_point): Define.
(linux_process_target::insert_point)
(linux_process_target::remove_point): Update for calls to
low_insert_point and low_remove_point.
* linux-x86-low.cc (class x86_target) <low_insert_point>
<low_remove_point>: Declare.
(x86_insert_point): Turn into...
(x86_target::low_insert_point): ...this.
(x86_remove_point): Turn into...
(x86_target::low_remove_point): ...this.
(the_low_target): Remove the op fields.
* linux-aarch64-low.cc (class aarch64_target) <low_insert_point>
<low_remove_point>: Declare.
(aarch64_insert_point): Turn into...
(aarch64_target::low_insert_point): ...this.
(aarch64_remove_point): Turn into...
(aarch64_target::low_remove_point): ...this.
(the_low_target): Remove the op fields.
* linux-arm-low.cc (class arm_target) <low_insert_point>
<low_remove_point>: Declare.
(arm_insert_point): Turn into...
(arm_target::low_insert_point): ...this.
(arm_remove_point): Turn into...
(arm_target::low_remove_point): ...this.
(the_low_target): Remove the op fields.
* linux-crisv32-low.cc (class crisv32_target) <low_insert_point>
<low_remove_point>: Declare.
(crisv32_insert_point): Turn into...
(crisv32_target::low_insert_point): ...this.
(crisv32_remove_point): Turn into...
(crisv32_target::low_remove_point): ...this.
(the_low_target): Remove the op fields.
* linux-mips-low.cc (class mips_target) <low_insert_point>
<low_remove_point>: Declare.
(mips_insert_point): Turn into...
(mips_target::low_insert_point): ...this.
(mips_remove_point): Turn into...
(mips_target::low_remove_point): ...this.
(the_low_target): Remove the op fields.
* linux-ppc-low.cc (class ppc_target) <low_insert_point>
<low_remove_point>: Declare.
(ppc_insert_point): Turn into...
(ppc_target::low_insert_point): ...this.
(ppc_remove_point): Turn into...
(ppc_target::low_remove_point): ...this.
(the_low_target): Remove the op fields.
* linux-bfin-low.cc (the_low_target): Remove the op fields.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-s390-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-sparc-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:27 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'supports_z_point_type' into a method
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Remove the 'supports_z_point_type' linux target op and let the
concrete linux target define it by overriding the op declared in
process_stratum_target.
* linux-low.cc (linux_process_target::supports_z_point_type):
Remove.
* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <supports_z_point_type>: Remove.
* linux-x86-low.cc (class x86_target) <supports_z_point_type>:
Declare.
(x86_supports_z_point_type): Turn into...
(x86_target::supports_z_point_type): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target)
<supports_z_point_type>: Declare.
(aarch64_supports_z_point_type): Turn into...
(aarch64_target::supports_z_point_type): ...this.
(the_low_target): Remove the op field.
* linux-arm-low.cc (class arm_target) <supports_z_point_type>:
Declare.
(arm_supports_z_point_type): Turn into...
(arm_target::supports_z_point_type): ...this.
(the_low_target): Remove the op field.
* linux-crisv32-low.cc (class crisv32_target)
<supports_z_point_type>: Declare.
(cris_supports_z_point_type): Turn into...
(crisv32_target::supports_z_point_type): ...this.
(the_low_target): Remove the op field.
* linux-mips-low.cc (class mips_target) <supports_z_point_type>:
Declare.
(mips_supports_z_point_type): Turn into...
(mips_target::supports_z_point_type): ...this.
(the_low_target): Remove the op field.
* linux-ppc-low.cc (class ppc_target) <supports_z_point_type>:
Declare.
(ppc_supports_z_point_type): Turn into...
(ppc_target::supports_z_point_type): ...this.
(the_low_target): Remove the op field.
* linux-s390-low.cc (class s390_target) <supports_z_point_type>:
Declare.
(s390_supports_z_point_type): Turn into...
(s390_target::supports_z_point_type): ...this.
(the_low_target): Remove the op field.
* linux-bfin-low.cc (the_low_target): Remove the op field.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-sparc-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:26 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'breakpoint_at' into a method
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Turn the 'breakpoint_at' linux target op into a method of
linux_process_target.
* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <low_breakpoint_at>: Declare.
Update the callers below:
* linux-low.cc (linux_process_target::save_stop_reason)
(linux_process_target::thread_still_has_status_pending)
(linux_process_target::wait_1)
* linux-x86-low.cc (class x86_target)
<low_breakpoint_at>: Declare.
(x86_breakpoint_at): Turn into...
(x86_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target)
<low_breakpoint_at>: Declare.
(aarch64_breakpoint_at): Turn into...
(aarch64_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-arm-low.cc (class arm_target)
<low_breakpoint_at>: Declare.
(arm_target::low_breakpoint_at): Define.
(the_low_target): Remove the op field.
* linux-bfin-low.cc (class bfin_target)
<low_breakpoint_at>: Declare.
(bfin_breakpoint_at): Turn into...
(bfin_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-cris-low.cc (class cris_target)
<low_breakpoint_at>: Declare.
(cris_breakpoint_at): Turn into...
(cris_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-crisv32-low.cc (class crisv32_target)
<low_breakpoint_at>: Declare.
(crisv32_breakpoint_at): Turn into...
(crisv32_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-ia64-low.cc (class ia64_target)
<low_breakpoint_at>: Declare.
(ia64_target::low_breakpoint_at): Define.
* linux-m32r-low.cc (class m32r_target)
<low_breakpoint_at>: Declare.
(m32r_breakpoint_at): Turn into...
(m32r_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-m68k-low.cc (class m68k_target)
<low_breakpoint_at>: Declare.
(m68k_breakpoint_at): Turn into...
(m68k_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-mips-low.cc (class mips_target)
<low_breakpoint_at>: Declare.
(mips_breakpoint_at): Turn into...
(mips_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-nios2-low.cc (class nios2_target)
<low_breakpoint_at>: Declare.
(nios2_breakpoint_at): Turn into...
(nios2_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-ppc-low.cc (class ppc_target)
<low_breakpoint_at>: Declare.
(ppc_breakpoint_at): Turn into...
(ppc_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-riscv-low.cc (class riscv_target)
<low_breakpoint_at>: Declare.
(riscv_breakpoint_at): Turn into...
(riscv_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-s390-low.cc (class s390_target)
<low_breakpoint_at>: Declare.
(s390_breakpoint_at): Turn into...
(s390_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-sh-low.cc (class sh_target)
<low_breakpoint_at>: Declare.
(sh_breakpoint_at): Turn into...
(sh_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-sparc-low.cc (class sparc_target)
<low_breakpoint_at>: Declare.
(sparc_breakpoint_at): Turn into...
(sparc_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-tic6x-low.cc (class tic6x_target)
<low_breakpoint_at>: Declare.
(tic6x_breakpoint_at): Turn into...
(tic6x_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-tile-low.cc (class tile_target)
<low_breakpoint_at>: Declare.
(tile_breakpoint_at): Turn into...
(tile_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-xtensa-low.cc (class xtensa_target)
<low_breakpoint_at>: Declare.
(xtensa_breakpoint_at): Turn into...
(xtensa_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:26 +0000 (15:11 +0200)]
gdbserver/linux-low: turn the 'decr_pc_after_break' field into a method
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Turn the 'decr_pc_after_break' linux_target_ops field into
a method of linux_process_target.
* linux-low.h (struct linux_target_ops)
<decr_pc_after_break>: Remove.
(class linux_process_target) <low_decr_pc_after_break>: New method
declaration.
* linux-low.cc (linux_process_target::low_decr_pc_after_break):
New method implementation.
Update the users below.
(linux_process_target::save_stop_reason)
(linux_process_target::wait_1)
* linux-x86-low.cc (class x86_target) <low_decr_pc_after_break>:
New declaration.
(x86_target::low_decr_pc_after_break): New method implementation.
(the_low_target): Remove the field.
* linux-bfin-low.cc (class bfin_target) <low_decr_pc_after_break>:
New declaration.
(bfin_target::low_decr_pc_after_break): New method implementation.
(the_low_target): Remove the field.
* linux-m68k-low.cc (class m68k_target) <low_decr_pc_after_break>:
New declaration.
(m68k_target::low_decr_pc_after_break): New method implementation.
(the_low_target): Remove the field.
* linux-s390-low.cc (class s390_target) <low_decr_pc_after_break>:
New declaration.
(s390_target::low_decr_pc_after_break): New method implementation.
(the_low_target): Remove the field.
* linux-aarch64-low.cc (the_low_target): Remove the field.
* linux-arm-low.cc (the_low_target): Remove the field.
* linux-cris-low.cc (the_low_target): Remove the field.
* linux-crisv32-low.cc (the_low_target): Remove the field.
* linux-m32r-low.cc (the_low_target): Remove the field.
* linux-mips-low.cc (the_low_target): Remove the field.
* linux-nios2-low.cc (the_low_target): Remove the field.
* linux-ppc-low.cc (the_low_target): Remove the field.
* linux-riscv-low.cc (the_low_target): Remove the field.
* linux-sh-low.cc (the_low_target): Remove the field.
* linux-sparc-low.cc (the_low_target): Remove the field.
* linux-tic6x-low.cc (the_low_target): Remove the field.
* linux-tile-low.cc (the_low_target): Remove the field.
* linux-xtensa-low.cc (the_low_target): Remove the field.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:26 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'supports_software_single_step' and 'get_next_pcs' into methods
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Remove the 'supports_software_single_step' linux target op and let
the concrete linux target define it by overriding the op in
process_stratum_target.
Turn the 'get_next_pcs' linux target op into a method of
linux_process_target.
* linux-low.h (struct linux_target_ops): Remove the ops.
(class linux_process_target) <supports_software_single_step>:
Remove.
<low_get_next_pcs>: Declare.
* linux-low.cc (can_software_single_step): Remove.
(linux_process_target::low_get_next_pcs): Define.
(linux_process_target::supports_software_single_step): Remove.
Update the callers below.
(linux_process_target::handle_extended_wait)
(linux_process_target::wait_1)
(linux_process_target::install_software_single_step_breakpoints)
(linux_process_target::single_step)
(linux_process_target::thread_needs_step_over)
(linux_process_target::proceed_one_lwp)
(linux_process_target::supports_range_stepping)
* linux-x86-low.cc (the_low_target): Remove the op field.
* linux-aarch64-low.cc (the_low_target): Ditto.
* linux-bfin-low.cc (the_low_target): Ditto.
* linux-cris-low.cc (the_low_target): Ditto.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-mips-low.cc (the_low_target): Ditto.
* linux-nios2-low.cc (the_low_target): Ditto.
* linux-ppc-low.cc (the_low_target): Ditto.
* linux-riscv-low.cc (the_low_target): Ditto.
* linux-s390-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-sparc-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.
* linux-arm-low.cc (class arm_target) <low_get_next_pcs>
<supports_software_single_step>: Declare.
(arm_target::supports_software_single_step): Define.
(arm_gdbserver_get_next_pcs): Turn into...
(arm_target::low_get_next_pcs): ...this.
(the_low_target): Remove the op field.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:25 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'sw_breakpoint_from_kind' into a method
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Remove the 'sw_breakpoint_from_kind' linux target op, and let
the concrete linux target define it by overriding the op
in process_stratum_target.
* linux-low.cc (linux_process_target::sw_breakpoint_from_kind):
Remove.
* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <sw_breakpoint_from_kind>: Remove.
* linux-x86-low.cc (class x86_target) <sw_breakpoint_from_kind>:
Declare.
(x86_sw_breakpoint_from_kind): Turn into...
(x86_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target)
<sw_breakpoint_from_kind>: Declare.
(aarch64_sw_breakpoint_from_kind): Turn into...
(aarch64_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-arm-low.cc (class arm_target) <sw_breakpoint_from_kind>:
Declare.
(arm_target::sw_breakpoint_from_kind): Define.
(the_low_target): Remove the op field.
* linux-bfin-low.cc (class bfin_target) <sw_breakpoint_from_kind>:
Declare.
(bfin_sw_breakpoint_from_kind): Turn into...
(bfin_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-cris-low.cc (class cris_target) <sw_breakpoint_from_kind>:
Declare.
(cris_sw_breakpoint_from_kind): Turn into...
(cris_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-crisv32-low.cc (class crisv32_target)
<sw_breakpoint_from_kind>: Declare.
(cris_sw_breakpoint_from_kind): Turn into...
(crisv32_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-ia64-low.cc (class ia64_target) <sw_breakpoint_from_kind>:
Declare.
(ia64_target::sw_breakpoint_from_kind): Define.
* linux-m32r-low.cc (class m32r_target) <sw_breakpoint_from_kind>:
Declare.
(m32r_sw_breakpoint_from_kind): Turn into...
(m32r_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-m68k-low.cc (class m68k_target) <sw_breakpoint_from_kind>:
Declare.
(m68k_sw_breakpoint_from_kind): Turn into...
(m68k_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-mips-low.cc (class mips_target) <sw_breakpoint_from_kind>:
Declare.
(mips_sw_breakpoint_from_kind): Turn into...
(mips_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-nios2-low.cc (class nios2_target) <sw_breakpoint_from_kind>:
Declare.
(nios2_sw_breakpoint_from_kind): Turn into...
(nios2_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-ppc-low.cc (class ppc_target) <sw_breakpoint_from_kind>:
Declare.
(ppc_sw_breakpoint_from_kind): Turn into...
(ppc_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-riscv-low.cc (class riscv_target) <sw_breakpoint_from_kind>:
Declare.
(riscv_sw_breakpoint_from_kind): Turn into...
(riscv_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-s390-low.cc (class s390_target) <sw_breakpoint_from_kind>:
Declare.
(s390_sw_breakpoint_from_kind): Turn into...
(s390_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-sh-low.cc (class sh_target) <sw_breakpoint_from_kind>:
Declare.
(sh_sw_breakpoint_from_kind): Turn into...
(sh_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-sparc-low.cc (class sparc_target) <sw_breakpoint_from_kind>:
Declare.
(sparc_sw_breakpoint_from_kind): Turn into...
(sparc_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-tic6x-low.cc (class tic6x_target) <sw_breakpoint_from_kind>:
Declare.
(tic6x_sw_breakpoint_from_kind): Turn into...
(tic6x_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-tile-low.cc (class tile_target) <sw_breakpoint_from_kind>:
Declare.
(tile_sw_breakpoint_from_kind): Turn into...
(tile_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-xtensa-low.cc (class xtensa_target)
<sw_breakpoint_from_kind>: Declare.
(xtensa_sw_breakpoint_from_kind): Turn into...
(xtensa_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:25 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'breakpoint_kind_from_{pc, current_state}' into methods
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Remove the 'breakpoint_kind_from_pc' and
'breakpoint_kind_from_current_state' linux target ops, and let the
concrete linux target define them by overriding the ops of
process_stratum_target.
* linux-low.cc (linux_process_target::breakpoint_kind_from_pc):
Remove.
(linux_process_target::breakpoint_kind_from_current_state): Remove.
* linux-low.h (struct linux_target_ops): Remove ops.
(class linux_process_target) <breakpoint_kind_from_pc>: Remove.
<breakpoint_kind_from_current_state>: Remove.
* linux-x86-low.cc (the_low_target): Remove the op fields.
* linux-bfin-low.cc (the_low_target): Ditto.
* linux-cris-low.cc (the_low_target): Ditto.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-mips-low.cc (the_low_target): Ditto.
* linux-nios2-low.cc (the_low_target): Ditto.
* linux-ppc-low.cc (the_low_target): Ditto.
* linux-s390-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-sparc-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.
* linux-aarch64-low.cc (class aarch64_target)
<breakpoint_kind_from_pc>
<breakpoint_kind_from_current_state>: Declare.
(aarch64_breakpoint_kind_from_pc): Turn into...
(aarch64_target::breakpoint_kind_from_pc): ...this.
(aarch64_breakpoint_kind_from_current_state): Turn into...
(aarch64_target::breakpoint_kind_from_current_state): ...this.
(the_low_target): Remove the op fields.
* linux-arm-low.cc (class arm_target):
<breakpoint_kind_from_pc>
<breakpoint_kind_from_current_state>: Declare.
(arm_target::breakpoint_kind_from_pc): Define.
(arm_target::breakpoint_kind_from_current_state): Define.
(the_low_target): Remove the op fields.
* linux-riscv-low.cc (class riscv_target):
<breakpoint_kind_from_pc>: Declare.
(riscv_breakpoint_kind_from_pc): Turn into...
(riscv_target::breakpoint_kind_from_pc): ...this.
(the_low_target): Remove the op fields.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:24 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'get_pc' and 'set_pc' into methods
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Turn the 'get_pc' and 'set_pc' linux target ops into methods
of linux_process_target.
* linux-low.h (struct linux_target_ops): Remove the ops.
(class linux_process_target) <low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
* linux-low.cc (supports_breakpoints): Turn into...
(linux_process_target::low_supports_breakpoints): ...this.
(linux_process_target::low_get_pc): Define.
(linux_process_target::low_set_pc): Define.
Update the callers below.
(linux_process_target::get_pc)
(linux_process_target::save_stop_reason)
(linux_process_target::maybe_move_out_of_jump_pad)
(linux_process_target::wait_1)
(linux_process_target::resume_one_lwp_throw)
(linux_process_target::resume)
(linux_process_target::proceed_all_lwps)
(linux_process_target::read_pc)
(linux_process_target::write_pc)
* linux-x86-low.cc (class linux_process_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(x86_target::low_supports_breakpoints): Define.
(x86_get_pc): Turn into...
(x86_target::low_get_pc): ...this.
(x86_set_pc): Turn into...
(x86_target::low_set_pc): ...this.
(the_low_target): Remove the op fields.
* linux-arm-low.cc (class arm_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(arm_target::low_supports_breakpoints)
(arm_target::low_get_pc)
(arm_target::low_set_pc): Define.
(the_low_target): Remove the op fields.
* linux-bfin-low.cc (class bfin_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(bfin_target::low_supports_breakpoints)
(bfin_target::low_get_pc)
(bfin_target::low_set_pc): Define.
(the_low_target): Remove the op fields.
* linux-cris-low.cc (class cris_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(cris_target::low_supports_breakpoints)
(cris_target::low_get_pc)
(cris_target::low_set_pc): Define.
(the_low_target): Remove the op fields.
* linux-crisv32-low.cc (class crisv32_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(crisv32_target::low_supports_breakpoints)
(crisv32_target::low_get_pc)
(crisv32_target::low_set_pc): Define.
(the_low_target): Remove the op fields.
* linux-m32r-low.cc (class m32r_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(m32r_target::low_supports_breakpoints)
(m32r_target::low_get_pc)
(m32r_target::low_set_pc): Define.
(the_low_target): Remove the op fields.
* linux-m68k-low.cc (class m68k_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(m68k_target::low_supports_breakpoints)
(m68k_target::low_get_pc)
(m68k_target::low_set_pc): Define.
(the_low_target): Remove the op fields.
* linux-nios2-low.cc (class nios2_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(nios2_target::low_supports_breakpoints)
(nios2_target::low_get_pc)
(nios2_target::low_set_pc): Define.
(the_low_target): Remove the op fields.
* linux-sh-low.cc (class sh_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(sh_target::low_supports_breakpoints)
(sh_target::low_get_pc)
(sh_target::low_set_pc): Define.
(the_low_target): Remove the op fields.
* linux-xtensa-low.cc (class xtensa_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(xtensa_target::low_supports_breakpoints)
(xtensa_target::low_get_pc)
(xtensa_target::low_set_pc): Define.
(the_low_target): Remove the op fields.
* linux-sparc-low.cc (class sparc_target)
<low_supports_breakpoints>
<low_get_pc>: Declare.
(sparc_target::low_supports_breakpoints)
(sparc_target::low_get_pc): Define.
(the_low_target): Remove the op fields.
* linux-tile-low.cc (class tile_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(tile_target::low_supports_breakpoints)
(tile_target::low_get_pc)
(tile_target::low_set_pc): Define.
(the_low_target): Remove the op fields.
* linux-aarch64-low.cc (class aarch64_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(aarch64_target::low_supports_breakpoints): Define.
(aarch64_get_pc): Turn into...
(aarch64_target::low_get_pc): ...this.
(aarch64_set_pc): Turn into...
(aarch64_target::low_set_pc): ...this.
(the_low_target): Remove the op fields.
* linux-mips-low.cc (class mips_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(mips_target::low_supports_breakpoints): Define.
(mips_get_pc): Turn into...
(mips_target::low_get_pc): ...this.
(mips_set_pc): Turn into...
(mips_target::low_set_pc): ...this.
(the_low_target): Remove the op fields.
* linux-ppc-low.cc (class ppc_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(ppc_target::low_supports_breakpoints): Define.
(ppc_get_pc): Turn into...
(ppc_target::low_get_pc): ...this.
(ppc_set_pc): Turn into...
(ppc_target::low_set_pc): ...this.
(the_low_target): Remove the op fields.
* linux-riscv-low.cc (class riscv_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(riscv_target::low_supports_breakpoints): Define.
(riscv_get_pc): Turn into...
(riscv_target::low_get_pc): ...this.
(riscv_set_pc): Turn into...
(riscv_target::low_set_pc): ...this.
(the_low_target): Remove the op fields.
* linux-s390-low.cc (class s390_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(s390_target::low_supports_breakpoints): Define.
(s390_get_pc): Turn into...
(s390_target::low_get_pc): ...this.
(s390_set_pc): Turn into...
(s390_target::low_set_pc): ...this.
(the_low_target): Remove the op fields.
* linux-tic6x-low.cc (class tic6x_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(tic6x_target::low_supports_breakpoints): Define.
(tic6x_get_pc): Turn into...
(tic6x_target::low_get_pc): ...this.
(tic6x_set_pc): Turn into...
(tic6x_target::low_set_pc): ...this.
(the_low_target): Remove the op fields.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:24 +0000 (15:11 +0200)]
gdbserver/linux-low: turn some more static functions into private methods
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Turn some more static methods in linux-low into private methods
of linux_process_target.
* linux-low.cc (get_pc): Turn into...
(linux_process_target::get_pc): ...this.
(save_stop_reason): Turn into...
(linux_process_target::save_stop_reason): ...this.
(thread_still_has_status_pending_p): Turn into...
(linux_process_target::thread_still_has_status_pending): ...this.
(status_pending_p_callback): Turn into...
(linux_process_target::status_pending_p_callback): ...this.
(resume_stopped_resumed_lwps): Turn into...
(linux_process_target::resume_stopped_resumed_lwps): ...this.
(install_software_single_step_breakpoints): Turn into...
(linux_process_target::install_software_single_step_breakpoints):
...this.
(single_step): Turn into...
(linux_process_target::single_step): ...this.
(linux_resume_one_lwp_throw): Turn into...
(linux_process_target::resume_one_lwp_throw): ...this.
(linux_resume_one_lwp): Turn into...
(linux_process_target::resume_one_lwp): ...this.
(resume_status_pending_p): Turn into...
(linux_process_target::resume_status_pending): ...this.
(need_step_over_p): Turn into...
(linux_process_target::thread_needs_step_over): ...this.
(linux_resume_one_thread): Turn into...
(linux_process_target::resume_one_thread): ...this.
(proceed_one_lwp): Turn into...
(linux_process_target::proceed_one_lwp): ...this.
(unsuspend_and_proceed_one_lwp): Turn into...
(linux_process_target::unsuspend_and_proceed_one_lwp): ...this.
Update the calls/references to the above functions below.
(linux_process_target::handle_extended_wait)
(linux_process_target::filter_event)
(linux_process_target::wait_for_event_filtered)
(linux_process_target::wait_1)
(linux_process_target::move_out_of_jump_pad)
(linux_process_target::start_step_over)
(linux_process_target::resume)
(linux_process_target::proceed_all_lwps)
(regsets_store_inferior_registers)
(linux_process_target::store_register)
* linux-low.h (class linux_process_target)
<get_pc>
<save_stop_reason>
<thread_still_has_status_pending>
<status_pending_p_callback>
<resume_stopped_resumed_lwps>
<install_software_single_step_breakpoints>
<single_step>
<resume_one_lwp_throw>
<resume_one_lwp>
<resume_status_pending>
<thread_needs_step_over>
<resume_one_thread>
<proceed_one_lwp>
<unsuspend_and_proceed_one_lwp>: Declare.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:24 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'fetch_register' into a method
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Turn the 'fetch_register' linux target op into a method of
linux_process_target.
* linux-low.h (struct linux_target_ops) <fetch_register>: Remove.
(class linux_process_target) <low_fetch_register>: Declare.
* linux-x86-low.cc (the_low_target)
* linux-aarch64-low.cc (the_low_target)
* linux-arm-low.cc (the_low_target)
* linux-bfin-low.cc (the_low_target)
* linux-cris-low.cc (the_low_target)
* linux-crisv32-low.cc (the_low_target)
* linux-m32r-low.cc (the_low_target)
* linux-m68k-low.cc (the_low_target)
* linux-nios2-low.cc (the_low_target)
* linux-ppc-low.cc (the_low_target)
* linux-s390-low.cc (the_low_target)
* linux-sh-low.cc (the_low_target)
* linux-sparc-low.cc (the_low_target)
* linux-tic6x-low.cc (the_low_target)
* linux-tile-low.cc (the_low_target)
* linux-xtensa-low.cc (the_low_target): Remove the op field.
* linux-ia64-low.cc (class ia64_target) <low_fetch_register>:
Declare.
(ia64_fetch_register): Turn into...
(ia64_target::low_fetch_register): ...this.
(the_low_target): Remove the op field.
* linux-mips-low.cc (class mips_target) <low_fetch_register>:
Declare.
(mips_fetch_register): Turn into...
(mips_target::low_fetch_register): ...this.
(the_low_target): Remove the op field.
* linux-riscv-low.cc (class riscv_target) <low_fetch_register>:
Declare.
(riscv_fetch_register): Turn into...
(riscv_target::low_fetch_register): ...this.
(the_low_target): Remove the op field.
Update the callers below.
* linux-low.cc (linux_process_target::fetch_registers)
(linux_process_target::low_fetch_register)
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:24 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'cannot_{fetch/store}_register' into methods
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Turn the 'cannot_fetch_register' and 'cannot_store_register'
linux target ops into methods of linux_process_target.
* linux-low.h (struct linux_target_ops): Remove the low target ops.
(class linux_process_target) <fetch_register>
<store_register>
<usr_fetch_inferior_registers>
<usr_store_inferior_registers>
<low_cannot_fetch_register>
<low_cannot_fetch_register> Declare.
* linux-low.cc (fetch_register): Turn into...
(linux_process_target::fetch_register): ...this.
(store_register): Turn into ...
(linux_process_target::store_register): ...this.
(usr_fetch_inferior_registers): Turn into...
(linux_process_target::usr_fetch_inferior_registers): ...this.
(usr_store_inferior_registers): Turn into...
(linux_process_target::usr_store_inferior_registers): ...this.
* linux-x86-low.cc (class x86_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(x86_cannot_store_register): Turn into...
(x86_target::low_cannot_store_register): ...this.
(x86_cannot_fetch_register): Turn into...
(x86_target::low_cannot_fetch_register): ...this.
(the_low_target): Remove the target op fields.
* linux-aarch64-low.cc (class aarch64_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(aarch64_target::low_cannot_fetch_register)
(aarch64_target::low_cannot_store_register): Define.
(the_low_target): Remove the op fields.
* linux-arm-low.cc (class arm_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(arm_cannot_fetch_register): Turn into...
(arm_target::low_cannot_fetch_register): ...this.
(arm_cannot_store_register): Turn into...
(arm_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-bfin-low.cc (class bfin_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(bfin_cannot_fetch_register): Turn into...
(bfin_target::low_cannot_fetch_register): ...this.
(bfin_cannot_store_register): Turn into...
(bfin_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-cris-low.cc (class cris_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(cris_cannot_fetch_register): Turn into...
(cris_target::low_cannot_fetch_register): ...this.
(cris_cannot_store_register): Turn into...
(cris_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-crisv32-low.cc (class crisv32_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(crisv32_target::low_cannot_fetch_register)
(crisv32_target::low_cannot_store_register): Define.
(the_low_target): Remove the op fields.
* linux-ia64-low.cc (class ia64_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(ia64_cannot_fetch_register): Turn into...
(ia64_target::low_cannot_fetch_register): ...this.
(ia64_cannot_store_register): Turn into...
(ia64_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-m32r-low.cc (class m32r_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(m32r_cannot_fetch_register): Turn into...
(m32r_target::low_cannot_fetch_register): ...this.
(m32r_cannot_store_register): Turn into...
(m32r_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-m68k-low.cc (class m68k_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(m68k_cannot_fetch_register): Turn into...
(m68k_target::low_cannot_fetch_register): ...this.
(m68k_cannot_store_register): Turn into...
(m68k_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-mips-low.cc (class mips_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(mips_cannot_fetch_register): Turn into...
(mips_target::low_cannot_fetch_register): ...this.
(mips_cannot_store_register): Turn into...
(mips_target::low_cannot_store_register): ...this.
(get_usrregs_info): Inline at the call sites in
low_cannot_fetch_register and low_cannot_store_register,
and remove.
(the_low_target): Remove the op fields.
* linux-nios2-low.cc (class nios2_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(nios2_cannot_fetch_register): Turn into...
(nios2_target::low_cannot_fetch_register): ...this.
(nios2_cannot_store_register): Turn into...
(nios2_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-ppc-low.cc (class ppc_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(ppc_cannot_fetch_register): Turn into...
(ppc_target::low_cannot_fetch_register): ...this.
(ppc_cannot_store_register): Turn into...
(ppc_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-riscv-low.cc (class riscv_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(riscv_target::low_cannot_fetch_register)
(riscv_target::low_cannot_store_register): Define.
(the_low_target): Remove the op fields.
* linux-s390-low.cc (class s390_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(s390_cannot_fetch_register): Turn into...
(s390_target::low_cannot_fetch_register): ...this.
(s390_cannot_store_register): Turn into...
(s390_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-sh-low.cc (class sh_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(sh_cannot_fetch_register): Turn into...
(sh_target::low_cannot_fetch_register): ...this.
(sh_cannot_store_register): Turn into...
(sh_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-sparc-low.cc (class sparc_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(sparc_cannot_fetch_register): Turn into...
(sparc_target::low_cannot_fetch_register): ...this.
(sparc_cannot_store_register): Turn into...
(sparc_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-tic6x-low.cc (class tic6x_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(tic6x_cannot_fetch_register): Turn into...
(tic6x_target::low_cannot_fetch_register): ...this.
(tic6x_cannot_store_register): Turn into...
(tic6x_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-tile-low.cc (class tile_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(tile_cannot_fetch_register): Turn into...
(tile_target::low_cannot_fetch_register): ...this.
(tile_cannot_store_register): Turn into...
(tile_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-xtensa-low.cc (class xtensa_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(xtensa_target::low_cannot_fetch_register)
(xtensa_target::low_cannot_store_register): Define.
(the_low_target): Remove the op fields.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:23 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'regs_info' into a method
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Turn the 'regs_info' linux target op into a method of
linux_process_target.
* linux-low.h (struct linux_target_ops) <regs_info>: Remove.
(class linux_process_target) <get_regs_info>: Define.
Update the callers below.
* linux-low.cc (linux_process_target::fetch_registers)
(linux_process_target::store_registers)
* proc-service.cc (gregset_info)
* linux-x86-low.cc (class x86_target) <get_regs_info>: Declare.
(x86_linux_regs_info): Turn into ...
(x86_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target) <get_regs_info>:
Declare.
(aarch64_regs_info): Turn into ...
(aarch64_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-arm-low.cc (class arm_target) <get_regs_info>: Declare.
(arm_regs_info): Turn into ...
(arm_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-bfin-low.cc (class bfin_target) <get_regs_info>: Declare.
(bfin_regs_info): Turn into ...
(bfin_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-cris-low.cc (class cris_target) <get_regs_info>: Declare.
(cris_regs_info): Turn into ...
(cris_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-crisv32-low.cc (class crisv32_target) <get_regs_info>:
Declare.
(crisv32_regs_info): Turn into ...
(crisv32_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-ia64-low.cc (class ia64_target) <get_regs_info>: Declare.
(ia64_regs_info): Turn into ...
(ia64_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-m32r-low.cc (class m32r_target) <get_regs_info>: Declare.
(m32r_regs_info): Turn into ...
(m32r_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-m68k-low.cc (class m68k_target) <get_regs_info>: Declare.
(m68k_regs_info): Turn into ...
(m68k_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-mips-low.cc (class mips_target) <get_regs_info>: Declare.
(mips_regs_info): Turn into ...
(mips_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
(get_usrregs_info): Update the call to the op.
* linux-nios2-low.cc (class nios2_target) <get_regs_info>: Declare.
(nios2_regs_info): Turn into ...
(nios2_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-ppc-low.cc (class ppc_target) <get_regs_info>: Declare.
(ppc_regs_info): Turn into ...
(ppc_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-riscv-low.cc (class riscv_target) <get_regs_info>: Declare.
(riscv_regs_info): Turn into ...
(riscv_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-s390-low.cc (class s390_target) <get_regs_info>: Declare.
(s390_regs_info): Turn into ...
(s390_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
(s390_collect_ptrace_register)
(s390_supply_ptrace_register)
(s390_fill_gregset): Update the call to the op.
* linux-sh-low.cc (class sh_target) <get_regs_info>: Declare.
(sh_regs_info): Turn into ...
(sh_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-sparc-low.cc (class sparc_target) <get_regs_info>: Declare.
(sparc_regs_info): Turn into ...
(sparc_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-tic6x-low.cc (class tic6x_target) <get_regs_info>: Declare.
(tic6x_regs_info): Turn into ...
(tic6x_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-tile-low.cc (class tile_target) <get_regs_info>: Declare.
(tile_regs_info): Turn into ...
(tile_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-xtensa-low.cc (class xtensa_target) <get_regs_info>:
Declare.
(xtensa_regs_info): Turn into ...
(xtensa_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:23 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'arch_setup' into a method
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Turn the 'arch_setup' linux target op into a method of
linux_process_target.
* linux-low.h (struct linux_target_ops) <arch_setup>: Delete.
(class linux_process_target) <arch_setup_thread>
<low_arch_setup>: New declarations.
* linux-low.cc (linux_arch_setup): Delete.
(linux_arch_setup_thread): Turn into...
(linux_process_target::arch_setup_thread): ... this.
Update the callers below.
(linux_process_target::handle_extended_wait)
(linux_process_target::post_create_inferior)
(linux_process_target::filter_event)
* linux-x86-low.cc (class x86_target) <low_arch_setup>: New
declaration.
(x86_linux_update_xmltarget): Turn into...
(x86_target::update_xmltarget): ...this.
(x86_linux_process_qsupported): Update the call to
x86_linux_update_xmltarget.
(x86_arch_setup): Turn into ...
(x86_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target) <low_arch_setup>: New
declaration.
(aarch64_arch_setup): Turn into ...
(aarch64_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-arm-low.cc (class arm_target) <low_arch_setup>: New
declaration.
(arm_arch_setup): Turn into ...
(arm_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-bfin-low.cc (class bfin_target) <low_arch_setup>: New
declaration.
(bfin_arch_setup): Turn into ...
(bfin_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-cris-low.cc (class cris_target) <low_arch_setup>: New
declaration.
(cris_arch_setup): Turn into ...
(cris_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-crisv32-low.cc (class crisv32_target) <low_arch_setup>: New
declaration.
(crisv32_arch_setup): Turn into ...
(crisv32_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-ia64-low.cc (class ia64_target) <low_arch_setup>: New
declaration.
(ia64_arch_setup): Turn into ...
(ia64_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-m32r-low.cc (class m32r_target) <low_arch_setup>: New
declaration.
(m32r_arch_setup): Turn into ...
(m32r_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-m68k-low.cc (class m68k_target) <low_arch_setup>: New
declaration.
(m68k_arch_setup): Turn into ...
(m68k_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-mips-low.cc (class mips_target) <low_arch_setup>: New
declaration.
(mips_arch_setup): Turn into ...
(mips_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-nios2-low.cc (class nios2_target) <low_arch_setup>: New
declaration.
(nios2_arch_setup): Turn into ...
(nios2_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-ppc-low.cc (class ppc_target) <low_arch_setup>: New
declaration.
(ppc_arch_setup): Turn into ...
(ppc_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-riscv-low.cc (class riscv_target) <low_arch_setup>: New
declaration.
(riscv_arch_setup): Turn into ...
(riscv_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-s390-low.cc (class s390_target) <low_arch_setup>: New
declaration.
(s390_arch_setup): Turn into ...
(s390_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-sh-low.cc (class sh_target) <low_arch_setup>: New
declaration.
(sh_arch_setup): Turn into ...
(sh_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-sparc-low.cc (class sparc_target) <low_arch_setup>: New
declaration.
(sparc_arch_setup): Turn into ...
(sparc_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-tic6x-low.cc (class tic6x_target) <low_arch_setup>: New
declaration.
(tic6x_arch_setup): Turn into ...
(tic6x_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-tile-low.cc (class tile_target) <low_arch_setup>: New
declaration.
(tile_arch_setup): Turn into ...
(tile_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-xtensa-low.cc (class xtensa_target) <low_arch_setup>: New
declaration.
(xtensa_arch_setup): Turn into ...
(xtensa_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:23 +0000 (15:11 +0200)]
gdbserver/linux-low: start turning linux target ops into methods
This is the beginning of a series of patches that convert the linux
low targets into classes derived from linux_process_target. At the
end of the series we obtain a class hierarchy that looks like this:
process_stratum_target
^
|
|-- linux_process_target
^
|
|-- x86_target (defined in linux-x86-low)
|-- aarch64_target (defined in linux-aarch64-low)
|-- ppc_target (defined in linux-ppc-low)
|-- ...
In several cases, linux_process_target simply forwards a target op
request to a corresponding linux_target_ops function. For these
cases, the definition in linux_process_target will be removed and the
definition will be left to the deriving linux low target class; using
inheritance provides a nice and natural, object-oriented
simplification in these cases.
The series converts linux_target_ops into protected methods of
linux_process_target one by one. Throughout the series, based on the
needs, static functions defined in linux-low.cc are converted to
private methods of linux_process_target as well. This is done either
as separate patches or as integrated into a patch that convert a
particular linux_target_op into a method.
The series ends with the patch titled "gdbserver/linux-low: delete
'linux_target_ops' and 'the_low_target'".
Built and regression-tested on x86_64-linux. The following linux low
targets have been built (but not tested) via cross-compilation:
aarch64, arm, m68k, mips, ppc, riscv, s390, sh, sparc. The other
targets (bfin, cris, crisv32, ia64, m32r, nios2, tic6x, tile, xtensa)
were neither built nor tested.
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* linux-low.h (the_linux_target): New extern declaration.
* linux-low.cc (initialize_low): Use 'the_linux_target' to set
'the_target'.
(the_linux_target): Remove.
* linux-x86-low.cc (class x86_target): New class.
(the_x86_target): New static object.
(the_linux_target): Define as pointer to the_x86_target.
* linux-aarch64-low.cc (class aarch64_target): New class.
(the_aarch64_target): New static object.
(the_linux_target): Define as pointer to the_aarch64_target.
* linux-arm-low.cc (class arm_target): New class.
(the_arm_target): New static object.
(the_linux_target): Define as pointer to the_arm_target.
* linux-bfin-low.cc (class bfin_target): New class.
(the_bfin_target): New static object.
(the_linux_target): Define as pointer to the_bfin_target.
* linux-cris-low.cc (class cris_target): New class.
(the_cris_target): New static object.
(the_linux_target): Define as pointer to the_cris_target.
* linux-crisv32-low.cc (class crisv32_target): New class.
(the_crisv32_target): New static object.
(the_linux_target): Define as pointer to the_crisv32_target.
* linux-ia64-low.cc (class ia64_target): New class.
(the_ia64_target): New static object.
(the_linux_target): Define as pointer to the_ia64_target.
* linux-m32r-low.cc (class m32r_target): New class.
(the_m32r_target): New static object.
(the_linux_target): Define as pointer to the_m32r_target.
* linux-m68k-low.cc (class m68k_target): New class.
(the_m68k_target): New static object.
(the_linux_target): Define as pointer to the_m68k_target.
* linux-mips-low.cc (class mips_target): New class.
(the_mips_target): New static object.
(the_linux_target): Define as pointer to the_mips_target.
* linux-nios2-low.cc (class nios2_target): New class.
(the_nios2_target): New static object.
(the_linux_target): Define as pointer to the_nios2_target.
* linux-ppc-low.cc (class ppc_target): New class.
(the_ppc_target): New static object.
(the_linux_target): Define as pointer to the_ppc_target.
* linux-riscv-low.cc (class riscv_target): New class.
(the_riscv_target): New static object.
(the_linux_target): Define as pointer to the_riscv_target.
* linux-s390-low.cc (class s390_target): New class.
(the_s390_target): New static object.
(the_linux_target): Define as pointer to the_s390_target.
* linux-sh-low.cc (class sh_target): New class.
(the_sh_target): New static object.
(the_linux_target): Define as pointer to the_sh_target.
* linux-sparc-low.cc (class sparc_target): New class.
(the_sparc_target): New static object.
(the_linux_target): Define as pointer to the_sparc_target.
* linux-tic6x-low.cc (class tic6x_target): New class.
(the_tic6x_target): New static object.
(the_linux_target): Define as pointer to the_tic6x_target.
* linux-tile-low.cc (class tile_target): New class.
(the_tile_target): New static object.
(the_linux_target): Define as pointer to the_tile_target.
* linux-xtensa-low.cc (class xtensa_target): New class.
(the_xtensa_target): New static object.
(the_linux_target): Define as pointer to the_xtensa_target.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:22 +0000 (15:11 +0200)]
gdbserver/linux-low: turn some static functions into private methods
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Turn some static functions in linux-low.cc into private methods of
linux_process_target.
* linux-low.cc (handle_extended_wait): Turn into ...
(linux_process_target::handle_extended_wait): ...this. Call
'mourn' on 'this' object instead of 'the_target'.
(maybe_move_out_of_jump_pad): Turn into...
(linux_process_target::maybe_move_out_of_jump_pad): ...this.
(linux_low_filter_event): Turn into...
(linux_process_target::filter_event): ...this.
(linux_wait_for_event_filtered): Turn into...
(linux_process_target::wait_for_event_filtered): ...this.
(linux_wait_for_event): Turn into...
(linux_process_target::wait_for_event): ...this.
(linux_wait_1): Turn into...
(linux_process_target::wait_1): ...this.
(wait_for_sigstop): Turn into...
(linux_process_target::wait_for_sigstop): ...this.
(move_out_of_jump_pad_callback): Turn into...
(linux_process_target::move_out_of_jump_pad): ...this.
(stop_all_lwps): Turn into...
(linux_process_target::stop_all_lwps): ...this.
(start_step_over): Turn into...
(linux_process_target::start_step_over): ...this.
(complete_ongoing_step_over): Turn into...
(linux_process_target::complete_ongoing_step_over): ...this.
(proceed_all_lwps): Turn into...
(linux_process_target::proceed_all_lwps): ...this.
(unstop_all_lwps): Turn into...
(linux_process_target::unstop_all_lwps): ...this.
* linux-low.h (class linux_process_target)
<handle_extended_wait>
<maybe_move_out_of_jump_pad>
filter_event>
<wait_for_event_filtered>
<wait_for_event>
<wait_1>
<wait_for_sigstop>
<move_out_of_jump_pad>
<stop_all_lwps>
<start_step_over>
<complete_ongoing_step_over>
<proceed_all_lwps>
<unstop_all_lwps>: Declare.
Update the callers below.
* linux-low.cc (linux_process_target::attach): Update.
(linux_process_target::stabilize_threads): Ditto.
(linux_process_target::wait): Ditto.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:22 +0000 (15:11 +0200)]
gdbserver: make linux target op 'cannot_store_register' a predicate function
The comment for the linux target op 'cannot_store_register' states the
following:
/* Returns 0 if we can store the register, 1 if we can not
store the register, and 2 if failure to store the register
is acceptable. */
There is only one low target, linux-ppc-low, that potentially returns
2. There are two places that call the 'cannot_store_register' target
op in linux-low.cc. None of these locations distinguish a '2' from a
'1'. Hence, to simplify the definition, make the function a predicate
that returns either 0 or 1. This is also consistent with the
companion function, 'cannot_fetch_register'.
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* linux-low.h (struct linux_target_ops): Update the comment for
'cannot_store_register' to return 0 or 1.
* linux-ppc-low.cc (ppc_cannot_store_register): Return 1 instead
of 2.
LiliCui [Fri, 6 Mar 2020 06:38:15 +0000 (14:38 +0800)]
Add support for intel SERIALIZE instruction
gas/
* config/tc-i386.c (cpu_arch): Add .serialize.
(cpu_noarch): Likewise.
* doc/c-i386.texi: Document serialize.
* testsuite/gas/i386/i386.exp: Run serialize tests
* testsuite/gas/i386/serialize.d: Likewise.
* testsuite/gas/i386/x86-64-serialize.d: Likewise.
* testsuite/gas/i386/serialize.s: Likewise.
opcodes/
* i386-dis.c (prefix_table): New instructions serialize.
* i386-gen.c (cpu_flag_init): Add CPU_SERIALIZE_FLAGS,
CPU_ANY_SERIALIZE_FLAGS.
(cpu_flags): Add CpuSERIALIZE.
* i386-opc.h (enum): Add CpuSERIALIZE.
(i386_cpu_flags): Add cpuserialize.
* i386-opc.tbl: Add SERIALIZE insns.
* i386-init.h: Regenerate.
* i386-tbl.h: Likewise.
H.J. Lu [Thu, 2 Apr 2020 11:44:01 +0000 (04:44 -0700)]
linux-x86.exp: Compile with -I../bfd
Compile with -I../bfd to include <bfd_stdint.h> in PR ld/25749 tests.
* testsuite/ld-elf/linux-x86.exp (check_pr25749a): Compile with
-I../bfd.
(check_pr25749b): Likewise.
Rainer Orth [Thu, 2 Apr 2020 08:52:57 +0000 (10:52 +0200)]
ld: Disable ifunc tests on Solaris
A couple of ld ifunc tests currently FAIL on 64-bit Solaris/x86:
FAIL: ld-ifunc/ifunc-10-x86-64
FAIL: ld-ifunc/ifunc-11-x86-64
FAIL: ld-ifunc/ifunc-12-x86-64
FAIL: ld-ifunc/ifunc-13-x86-64
FAIL: ld-ifunc/ifunc-14a-x86-64
FAIL: ld-ifunc/ifunc-14b-x86-64
FAIL: ld-ifunc/ifunc-14c-x86-64
FAIL: ld-ifunc/ifunc-14d-x86-64
FAIL: ld-ifunc/ifunc-14e-x86-64
FAIL: ld-ifunc/ifunc-14f-x86-64
FAIL: ld-ifunc/ifunc-15-x86-64
FAIL: ld-ifunc/ifunc-17a-x86-64
FAIL: ld-ifunc/ifunc-17b-x86-64
FAIL: ld-ifunc/ifunc-2-local-x86-64-now
FAIL: ld-ifunc/ifunc-2-local-x86-64
FAIL: ld-ifunc/ifunc-2-x86-64-now
FAIL: ld-ifunc/ifunc-2-x86-64
FAIL: ld-ifunc/ifunc-20-x86-64
FAIL: ld-ifunc/pr17154-x86-64-now
FAIL: ld-ifunc/pr17154-x86-64
For one, the actual error is weird:
./ld-new: target elf64-x86-64 not found
failed with: <./ld-new: target elf64-x86-64 not found>, no expected output
FAIL: ld-ifunc/ifunc-10-x86-64
although ld -V does report the elf_x86_64 emulation as supported:
$ ./ld/ld-new -V
GNU ld (GNU Binutils) 2.34.50.
20200328
Supported emulations:
elf_x86_64_sol2
elf_x86_64
[...]
When using ld -m elf_x86_64_sol2 instead, one of the testcases links
successfully.
However, there's no point in pursuing this: Solaris does not support
ifunc, as can be seen in <sys/elf.h>:
/*
* GNU/Linux specific symbol type not used by Solaris
*/
#define STT_GNU_IFUNC 10
and never will, given that it has symbol capabilities as solution to
effectively the same problem:
http://www.linker-aliens.org/blogs/rie/entry/symbol_capabilitie/
Therefore this patch disables ifunc testing on Solaris completely by
removing Solaris from binutils/testsuite/lib/binutils-common.exp
(supports_gnu_osabi). The ifunc part is justified above. SHF_GNU_MBIND is
in the OS-specific range and conflicts with
#define SHF_SUNW_REALLOC 0x01000000 /* internal: krtld realloc */
While the comment suggests this might be relocatable without too much
problems, the description of mbind (no formal spec AFAICS, just the
comment in the binutils patch submission) strongly suggests that this
isn't relevant to Solaris at all.
Indirectly, clearing supports_gnu_osabi on Solaris disables
supports_gnu_unique. Again, Solaris <sys/elf.h> has
/*
* GNU/Linux specific binding not used by Solaris
*/
#define STB_GNU_UNIQUE 10
so this seems the right thing to do.
Afterwards, one can remove the explicit mentions of *-*-solaris2* in
quite a number of (but not all) the ld-ifunc dump file notarget lists.
There's one fallout, though: two gas tests now XPASS because they are
xfail'ed for !supports_gnu_osabi:
XPASS: mbind sections 12
XPASS: mbind section contents 16
XPASS: mbind sections 16
XPASS: mbind section contents 16
To fix that, I've changed
#xfail: ![supports_gnu_osabi]
to notarget.
Tested on x86_64-pc-solaris2.11, i386-pc-solaris2.11,
x86_64-pc-linux-gnu, and i686-pc-linux-gnu.
ld:
* testsuite/ld-ifunc/ifunc-10-i386.d: Remove *-*-solaris2* from
notarget.
* ifunc-11-i386.d: Likewise.
* ifunc-12-i386.d: Likewise.
* ifunc-13-i386.d: Likewise.
* ifunc-14a-i386.d: Likewise.
* ifunc-14b-i386.d: Likewise.
* ifunc-14c-i386.d: Likewise.
* ifunc-14d-i386.d: Likewise.
* ifunc-14e-i386.d: Likewise.
* ifunc-14f-i386.d: Likewise.
* ifunc-15-i386.d: Likewise.
* ifunc-16-i386-now.d: Likewise.
* ifunc-16-i386.d: Likewise.
* ifunc-17a-i386.d: Likewise.
* ifunc-17b-i386.d: Likewise.
* ifunc-18a-i386.d: Likewise.
* ifunc-18b-i386.d: Likewise.
* ifunc-19a-i386.d: Likewise.
* ifunc-19b-i386.d: Likewise.
* ifunc-2-i386-now.d: Likewise.
* ifunc-2-i386.d: Likewise.
* ifunc-2-local-i386-now.d: Likewise.
* ifunc-2-local-i386.d: Likewise.
* ifunc-20-i386.d: Likewise.
* ifunc-21-i386.d: Likewise.
* ifunc-22-i386.d: Likewise.
* ifunc-5a-i386.d: Likewise.
* ifunc-5a-local-i386.d: Likewise.
* ifunc-5b-i386.d: Likewise.
* ifunc-5b-local-i386.d: Likewise.
* ifunc-5r-local-i386.d: Likewise.
* ifunc-6a-i386.d: Likewise.
* ifunc-6b-i386.d: Likewise.
* ifunc-7a-i386.d: Likewise.
* ifunc-7b-i386.d: Likewise.
* ifunc-8-i386.d: Likewise.
* ifunc-9-i386.d: Likewise.
* pr17154-i386-now.d: Likewise.
* pr17154-i386.d: Likewise.
* ifunc-23a-x86.d: Remove notarget.
* ifunc-24a-x86.d: Likewise.
* ifunc-25a-x86.d: Likewise.
gas:
* testsuite/gas/elf/section12a.d: Use notarget instead of xfail.
* testsuite/gas/elf/section12b.d: Likewise.
* testsuite/gas/elf/section16a.d: Likewise.
* testsuite/gas/elf/section16b.d: Likewise.
binutils:
* testsuite/lib/binutils-common.exp (supports_gnu_osabi): Don't
enable on *-*-solaris*.
Gunther Nikl [Thu, 2 Apr 2020 07:57:45 +0000 (08:57 +0100)]
[PATCH gas/m68k] Fix a register range check
* config/tc-m68k.c (m68k_ip): Fix range check for index register
with a suppressed address register.
Tom de Vries [Thu, 2 Apr 2020 07:46:00 +0000 (09:46 +0200)]
[gdb/testsuite] Fix silent timeout in gdb.multi/multi-target.exp
While running test-case gdb.multi/multi-target.exp, I observed a silent
timeout related to "monitor exit".
By making the timeout explicit in an expect clause in gdbserver_gdb_exit:
...
+ timeout {
+ warning "Timed out waiting for EOF in server after $monitor_exit"
+ }
...
we get in the log:
...
monitor exit^M
"monitor" command not supported by this target.^M
(gdb) WARNING: Timed out waiting for EOF in server after monitor exit
...
What happens is the following:
- the inferior 5 is selected
- a breakpoint is set in inferior 1
- the breakpoint triggers and we switch to inferior 1
- setup is called by test_continue, which calls clean_restart, which calls
gdbserver_gdb_exit (due to load_lib gdbserver-support.exp)
- gdbserver_gdb_exit issues "monitor exit"
- gdb responds with "not supported by this target" because inferior 1 is
native
Fix this by keeping a list of server_spawn_id, and cleaning those up before
calling gdbserver_gdb_exit.
This reduces testing time from 1m22s to 32s.
gdb/testsuite/ChangeLog:
2020-04-02 Tom de Vries <tdevries@suse.de>
* lib/gdbserver-support.exp (gdbserver_exit): Factor out of ...
(gdbserver_gdb_exit): ... here. Add timeout warning.
* gdb.multi/multi-target.exp (server_spawn_ids): New global var.
(connect_target_extended_remote): Append new server_spawn_id to
server_spawn_ids.
(cleanup): New proc.
(setup, <toplevel>): Call cleanup.
Nick Clifton [Thu, 2 Apr 2020 07:38:48 +0000 (08:38 +0100)]
Replace "use use" in a warning message with "use".
PR ld/25747
* ldfile.c (ldfile_open_file): Fix typo in warning message.