Commit Graph

100603 Commits

Author SHA1 Message Date
Tom Tromey d4d947ae37 Update partial_symtab comment
The introductory comment for partial_symtab has been mildly incorrect
since the partial symtab code was changed to allocate partial symtabs
with "new".  This patch removes the incorrect text.

gdb/ChangeLog
2020-02-21  Tom Tromey  <tom@tromey.com>

	* psympriv.h (struct partial_symtab): Update comment.
2020-02-21 14:44:41 -07:00
Tom de Vries 755251522a [gdb/testsuite] Fix gdb.go/methods.exp
With gccgo-6/7, we have:
...
FAIL: gdb.go/methods.exp: setting breakpoint at main.T.Foo
XFAIL: gdb.go/methods.exp: going to first breakpoint \
  (the program exited)
FAIL: gdb.go/methods.exp: setting breakpoint at (*main.T).Bar
XFAIL: gdb.go/methods.exp: going to second breakpoint \
  (the program is no longer running)
...

And with gccgo-8/9/10, we have:
...
PASS: gdb.go/methods.exp: setting breakpoint 1
XFAIL: gdb.go/methods.exp: going to first breakpoint
FAIL: gdb.go/methods.exp: setting breakpoint at (*main.T).Bar
XFAIL: gdb.go/methods.exp: going to second breakpoint \
  (the program exited)
...

The first test passes and fails with different messages:
...
FAIL: gdb.go/methods.exp: setting breakpoint at main.T.Foo
...
or:
...
PASS: gdb.go/methods.exp: setting breakpoint 1
...
Fix this by removing the explicit pass call and using the message argument for
gdb_breakpoint, for both breakpoint locations.

The setup of the xfails is non-specific:
...
setup_xfail "*-*-*" ;# mangling issues IIRC
...
so let's start with removing these.

The first FAIL with gccgo-6:
...
FAIL: gdb.go/methods.exp: setting breakpoint at main.T.Foo
...
is due an incorrect DW_AT_name attribute:
...
    #    <554>   DW_AT_name        : main.Foo.N6_main.T
...
Fix this by recognizing the incorrect attribute, and xfailing the test.

Furthermore, if setting the breakpoint fails, there's not much point in trying
to continue to the breakpoint:
...
FAIL: gdb.go/methods.exp: setting breakpoint at main.T.Foo
FAIL: gdb.go/methods.exp: going to first breakpoint (the program exited)
...
Fix this by skipping the second test if the first one fails, also for the
second breakpoint.

With gccgo-10, we manage to set the first breakpoint, but continuing to
breakpoint test fails:
...
PASS: gdb.go/methods.exp: setting breakpoint 1
FAIL: gdb.go/methods.exp: going to first breakpoint
...
This is due to an incorrect regexp, requiring a colon in front of the
breakpoint location.  Fix this for both breakpoints.

Setting the second breakpoint fails:
...
FAIL: gdb.go/methods.exp: setting breakpoint at (*main.T).Bar
...
presumably because the breakpoint location "(*main.T).Bar" does not follow the
naming convention explained at https://golang.org/doc/gdb#Naming.  Fix this by
updating the breakpoint location to "main.(*T).Bar".

Still this test fails, for gccgo-6/7 because of an incorrect DW_AT_name
attribute:
...
    # <529>   DW_AT_name        : main.Bar.pN6_main.T
...
and for gccgo-8/9/10 because of incorrect DW_AT_name/DW_AT_linkage_name
attributes (filed as gcc PR93866):
...
    #    <6e5>   DW_AT_name        : main.Bar..1main.T
    #    <6ec>   DW_AT_linkage_name: main.T.Bar
..
Add xfails for both of these.

All in all, now we have with gccgo-6/7:
...
XFAIL: gdb.go/methods.exp: setting breakpoint at main.T.Foo
XFAIL: gdb.go/methods.exp: setting breakpoint at main.(*T).Bar
...
and with gccgo-8/9/10, we have:
...
PASS: gdb.go/methods.exp: setting breakpoint at main.T.Foo
PASS: gdb.go/methods.exp: going to first breakpoint
XFAIL: gdb.go/methods.exp: setting breakpoint at main.(*T).Bar
...

Tested on x86_64-linux with gccgo-6/7/8/9/10.

gdb/testsuite/ChangeLog:

2020-02-21  Tom de Vries  <tdevries@suse.de>

	PR go/18926
	* lib/gdb.exp (bp_location2/bp_location2_regexp): Fix.
	Remove blanket xfails.  Use message argument for gdb_breakpoint.
	Make continuing to breakpoint test conditional on setting breakpoint.
	Fix continuing to breakpoint regexp.  Add xfails for gccgo-6/7
	DW_AT_name attribute.  Add xfail for GCC PR93866.
2020-02-21 20:47:28 +01:00
Tom Tromey e94e944bf2 Fix two more mips-tdep.h declarations
My earlier patch to fix a declaration mismatch in mips-tdep.h missed a
couple of spots.  Basically, I sent it too soon.

This patch fixes a couple more mismatches between a declaration (using
bfd_vma) and the definition (using CORE_ADDR).

gdb/ChangeLog
2020-02-21  Tom Tromey  <tromey@adacore.com>

	* mips-tdep.h (mips_pc_is_mips16, mips_pc_is_micromips): Parameter
	type is CORE_ADDR.
2020-02-21 08:45:14 -07:00
Tom de Vries 1eb7317953 [gdb] Fix cc-with-dwz regression
I noticed a regression with board cc-with-dwz:
...
FAIL: gdb.cp/m-static.exp: static const int initialized elsewhere
FAIL: gdb.cp/m-static.exp: info variable everywhere
...

The problem started with commit 0494dbecdf "Consolidate partial symtab
dependency reading".

The commit replaces the dwarf2_psymtab::expand_psymtab specific reading of
dependencies, which contains a "dependencies[i]->user == NULL" test, with a
generic partial_symtab::read_dependencies call, which does not test the user
field.

This patch fixes the regression by adding back the test, in the generic
partial_symtab::read_dependencies.

Build and reg-tested on x86_64-linux.

Tested natively, as well as with boards cc-with-dwz and cc-with-dwz-m.

The patch fixes all 33 regressions with cc-with-dwz, and all 2929 regression
with cc-with-dwz-m.

gdb/ChangeLog:

2020-02-21  Tom de Vries  <tdevries@suse.de>

	PR gdb/25534
	* psymtab.c (partial_symtab::read_dependencies): Don't read dependency
	if dependencies[i]->user != NULL.
2020-02-21 16:36:48 +01:00
Andrew Burgess bd360d3048 gdb/testsuite: Add test for case where gdb_demangle returns NULL
This adds a test for the commit:

  commit 4f180d5396
  Date:   Fri Feb 21 08:19:21 2020 -0700

      Check for null result from gdb_demangle

gdb/testsuite/ChangeLog:

	* gdb.dwarf2/cpp-linkage-name.c: New file.
	* gdb.dwarf2/cpp-linkage-name.exp: New file.
2020-02-21 15:31:47 +00:00
Ali Tamur via gdb-patches 4f180d5396 Check for null result from gdb_demangle
I am sending this patch on behalf of kmoy@google.com, who discovered the bug
and wrote the fix.

gdb_demangle can return null for strings that don't properly demangle. The null
check was mistakenly removed in commit 43816ebc33. Without this check, GDB
aborts when loading symbols from some binaries.

gdb/ChangeLog
2020-02-21  Ali Tamur  <tamur@google.com>

	* dwarf2/read.c (dwarf2_name): Add null check.
2020-02-21 08:19:21 -07:00
Alan Modra a4425a57c7 Fuzzers whining about mach-o support
It's very easy to make bfd/mach-o.c allocate huge amounts of memory
with fuzzed binaries.  This make it a little harder.

The patch also fixes a number of places where an attempt to detect
overflow of multiplication was done with code like
  if (x * 4 < x)
    /* overflow case */
That of course doesn't work.  There are plenty of values of x that
overflow x * 4 but (x * 4) mod 2^n is greater than x.  For example
with 16-bit types, 0x6000 * 4 = 0x18000 mod 2^16 = 0x8000.

	* mach-o.c (bfd_mach_o_canonicalize_relocs): Fix ineffective
	overflow check.
	(bfd_mach_o_canonicalize_reloc): Likewise.
	(bfd_mach_o_canonicalize_dynamic_reloc): Likewise.  Sanity check
	counts and offsets against file size.
	(bfd_mach_o_build_dysymtab): Fix ineffective overflow check.
	(bfd_mach_o_mangle_sections): Remove unnecessary overflow check.
	(bfd_mach_o_read_symtab_symbols): Sanity check count and offset
	against file size.  Delete symbol table error message.
	(bfd_mach_o_read_dysymtab): Sanity check counts and offsets
	against file size.
	(bfd_mach_o_read_symtab): Likewise.
	(bfd_mach_o_read_command): Pass file size.
	(bfd_mach_o_scan): Sanity check command count against file size.
2020-02-21 22:16:43 +10:30
Shahab Vahedi c7adb09f35 Fix typo in gdb/testsuite/ChangeLog
The date of my last patch's entry in gdb/testsuite/ChangeLog was
wrong. This fixes it.
2020-02-21 10:31:50 +01:00
Shahab Vahedi 24ac169ac5 gdb/testsuite: Regenerate the testglue if it is not in
For running the  DejaGnu  tests,  some  esoteric  configurations
may require a testglue.   This,  for  instance,  is  true  about
testing ARC  targets  which  uses  its  own  DejaGnu  board  and
a simulator which does not support returning the program's  exit
code.  Therefore, for those  tests  that  use  "gdb_compile",  a
"gdb_tg.o"  file  is  compiled  and  linked   into   the   final
executable.

There  are  tests  that  invoke  "gdb_compile"  from   different
directories.   Let's  take  a   look   at   an   example   test:
gdb.base/fullname.exp.  The purpose of this  test  is  to  build
the executable from different directories (absolute vs. relative
vs.  other) and then check if gdb can handle setting breakpoints
accordingly.

When  "gdb_compile"  generates  the  "gdb_tg.o",  it  does   not
do it again  for  the  same  test.   Although  this  might  seem
efficient, it can lead to  problems  when  changing  directories
before the next compile:

  gdb compile failed, arc-elf32-gcc: error: gdb_tg.o:
  No such file or directory

This patch checks if the wrapper file ("gdb_tg.o") is  still  in
reach and if it is not, it will stimulate  the  regeneration  of
the wrapper.

It is worth mentioning that GCC's  DejaGnu  tests  handle  these
scenarios as well and they seem to be more efficient in doing so
by saving the library paths and manipulating them  if  necessary
[1].  However, for GDB tests, that  require  less  compilations,
I think the proposed solution should be fine compared to a  more
full fledged solution from GCC.  The glue file in  our  case  is
only 2 KiB.

Last but not least, I ran the x86_64 tests on an x86_64 host and
found no regression.

[1]
Avid  coders  may  look  for  "set_ld_library_path_env_vars"  in
gcc/testsuite/lib/target-libpath.exp.

gdb/testsuite/ChangeLog:

	* lib/gdb.exp (gdb_wrapper_init): Reset
	"gdb_wrapper_initialized" to 0 if "wrapper_file" does
	not exist.
2020-02-21 09:59:30 +01:00
Tom Tromey 22b6cd7043 Fix latent bug in dwarf2_find_containing_comp_unit
dwarf2_find_containing_comp_unit has this in its binary search:

      if (mid_cu->is_dwz > offset_in_dwz
	  || (mid_cu->is_dwz == offset_in_dwz
	      && mid_cu->sect_off + mid_cu->length >= sect_off))
	high = mid;

The intent here is to determine whether SECT_OFF appears in or before
MID_CU.

I believe this has an off-by-one error, and that the check should use
">" rather than ">=".  If the two side are equal, then SECT_OFF
actually appears at the start of the next CU.

I've had this patch kicking around for ages but I forget how I found
the problem.

gdb/ChangeLog
2020-02-20  Tom Tromey  <tom@tromey.com>

	* dwarf2/read.c (dwarf2_find_containing_comp_unit): Use ">", not
	">=", in binary search.
	(dwarf2_find_containing_comp_unit): New overload.
	(run_test): New self-test.
	(_initialize_dwarf2_read): Register new test.
2020-02-20 18:22:09 -07:00
Nelson Chu 54b2aec10d RISC-V: Support the read-only CSR checking.
CSRRW and CSRRWI always write CSR.  CSRRS, CSRRC, CSRRSI and CSRRCI write CSR
when RS1 isn't zero.  The CSR is read only if the [11:10] bits of CSR address
is 0x3.  The read-only CSR can not be written by the CSR instructions.

	gas/
	* config/tc-riscv.c (riscv_ip): New boolean insn_with_csr to indicate
	we are assembling instruction with CSR.  Call riscv_csr_read_only_check
	after parsing all arguments.
	(enum csr_insn_type): New enum is used to classify the CSR instruction.
	(riscv_csr_insn_type, riscv_csr_read_only_check): New functions.  These
	are used to check if we write a read-only CSR by the CSR instruction.

	* testsuite/gas/riscv/priv-reg-fail-read-only-01.s: New testcase.  Test
	all CSR for the read-only CSR checking.
	* testsuite/gas/riscv/priv-reg-fail-read-only-01.d: Likewise.
	* testsuite/gas/riscv/priv-reg-fail-read-only-01.l: Likewise.
	* testsuite/gas/riscv/priv-reg-fail-read-only-02.s: New testcase.  Test
	all CSR instructions for the read-only CSR checking.
	* testsuite/gas/riscv/priv-reg-fail-read-only-02.d: Likewise.
	* testsuite/gas/riscv/priv-reg-fail-read-only-02.l: Likewise.
2020-02-20 16:49:09 -08:00
Nelson Chu 2ca89224b1 RISC-V: Disable the CSR checking by default.
Add new .option `csr-check/no-csr-check` and GAS option `-mcsr-check
/-mno-csr-check` to enbale/disable the CSR checking.  Disable the CSR
checking by default.

	gas/
	* config/tc-riscv.c: Add new .option and GAS options to enbale/disable
	the CSR checking.  We disable the CSR checking by default.
	(reg_lookup_internal): Check the `riscv_opts.csr_check`
	before we doing the CSR checking.

	* doc/c-riscv.texi: Add description for the new .option and assembler
	options.

	* testsuite/gas/riscv/priv-reg-fail-fext.d: Add `-mcsr-check` to enable
	the CSR checking.
	* testsuite/gas/riscv/priv-reg-fail-rv32-only.d: Likewise.
2020-02-20 16:49:09 -08:00
Nelson Chu bd0cf5a6ba RISC-V: Support the ISA-dependent CSR checking.
According to the riscv privilege spec, some CSR are only valid when rv32 or
the specific extension is set.  We extend the DECLARE_CSR and DECLARE_CSR_ALIAS
to record more informaton we need, and then check whether the CSR is valid
according to these information.  We report warning message when the CSR is
invalid, so we have a choice between error and warning by --fatal-warnings
option.  Also, a --no-warn/-W option is used to turn the warnings off, if
people don't want the warnings.

	gas/
	* config/tc-riscv.c (enum riscv_csr_class): New enum.  Used to decide
	whether or not this CSR is legal in the current ISA string.
	(struct riscv_csr_extra): New structure to hold all extra information
	of CSR.
	(riscv_init_csr_hash): New function.  According to the DECLARE_CSR and
	DECLARE_CSR_ALIAS, insert CSR extra information into csr_extra_hash.
	Call hash_reg_name to insert CSR address into reg_names_hash.
	(md_begin): Call riscv_init_csr_hashes for each DECLARE_CSR.
	(reg_csr_lookup_internal, riscv_csr_class_check): New functions.
	Decide whether the CSR is valid according to the csr_extra_hash.
	(init_opcode_hash): Update 'if (hash_error != NULL)' as hash_error is
	not a boolean.  This is same as riscv_init_csr_hash, so keep the
	consistent usage.

	* testsuite/gas/riscv/csr-dw-regnums.d: Add -march=rv32if option.
	* testsuite/gas/riscv/priv-reg.d: Add f-ext by -march option.
	* testsuite/gas/riscv/priv-reg-fail-fext.d: New testcase.  The source
	file is `priv-reg.s`, and the ISA is rv32i without f-ext, so the
	f-ext CSR are not allowed.
	* testsuite/gas/riscv/priv-reg-fail-fext.l: Likewise.
	* testsuite/gas/riscv/priv-reg-fail-rv32-only.d: New testcase.  The
	source file is `priv-reg.s`, and the ISA is rv64if, so the
	rv32-only CSR are not allowed.
	* testsuite/gas/riscv/priv-reg-fail-rv32-only.l: Likewise.

	include/
	* opcode/riscv-opc.h: Extend DECLARE_CSR and DECLARE_CSR_ALIAS to
	record riscv_csr_class.

	opcodes/
	* riscv-dis.c (print_insn_args): Updated since the DECLARE_CSR is changed.

	gdb/
	* riscv-tdep.c: Updated since the DECLARE_CSR is changed.
	* riscv-tdep.h: Likewise.
	* features/riscv/rebuild-csr-xml.sh: Generate the 64bit-csr.xml without
	rv32-only CSR.
	* features/riscv/64bit-csr.xml: Regernated.

	binutils/
	* dwarf.c: Updated since the DECLARE_CSR is changed.
2020-02-20 16:49:09 -08:00
Alan Modra 10a95fcc1f pdp11 reloc processing
This allows pdp11 to handle 32-bit fixups that can be applied by gas,
and improves the error message emitted when the required reloc isn't
available.

	* config/tc-pdp11.c (md_apply_fix): Handle BFD_RELOC_32.
	(tc_gen_reloc): Only give a BAD_CASE assertion on pcrel relocs.
2020-02-21 10:47:05 +10:30
Alan Modra dda2980f54 PR25569, PDP11 ld -s clobbers last data byte
This patch fixes an ancient wart in aout support, in that text and
data section sizes are rounded up for alignment rather that just the
corresponding header sizes.  Changing section sizes could conceivably
result in buffer overflows if section contents were held in memory.
Also, keeping the original section sizes allows this PR to be fixed
nicely.

bfd/
	PR 25569
	* aoutx.h (adjust_o_magic, adjust_z_magic, adjust_n_magic): Use
	"text", "data" and "bss" section pointer vars.  Don't update
	section size, just exec header sizes.
	(adjust_sizes_and_vmas): Don't update text section size.  Set
	initial exec header a_text.  Print exec headers sizes.
	* pdp11.c (adjust_o_magic, adjust_z_magic, adjust_n_magic),
	(adjust_sizes_and_vmas): Similarly.  Formatting.
	(final_link): Correct final file extension.
gas/
	PR 25569
	* config/obj-aout.c (obj_aout_frob_file_before_fix): Don't loop
	on section size adjustment, instead perform another write if
	exec header size is larger than section size.
2020-02-21 10:47:05 +10:30
GDB Administrator 6565bf67ad Automatic date update in version.in 2020-02-21 00:01:08 +00:00
Sergio Durigan Junior 3f702acd7d Make '{putchar,fputc}_unfiltered' use 'fputs_unfiltered'
There is currently a regression when using
'{putchar,fputc}_unfiltered' with 'puts_unfiltered' which was
introduced by one of the commits that reworked the unfiltered print
code.

The regression makes it impossible to use '{putchar,fputc}_unfiltered'
with 'puts_unfiltered', because the former writes directly to the
ui_file stream using 'stream->write', while the latter uses a buffered
mechanism (see 'wrap_buffer') and delays the printing.

If you do a quick & dirty hack on e.g. top.c:show_gdb_datadir:

  @@ -2088,6 +2088,13 @@ static void
   show_gdb_datadir (struct ui_file *file, int from_tty,
		    struct cmd_list_element *c, const char *value)
   {
  +  putchar_unfiltered ('\n');
  +  puts_unfiltered ("TEST");
  +  putchar_unfiltered ('>');
  +  puts_unfiltered ("PUTS");
  +  putchar_unfiltered ('\n');

rebuild GDB and invoke the "show data-directory" command, you will
see:

  (gdb) show data-directory

  >
  TESTPUTSGDB's data directory is "/usr/local/share/gdb".

Note how the '>' was printed before the output, and "TEST" and "PUTS"
were printed together.

My first attempt to fix this was to always call 'flush_wrap_buffer' at
the end of 'fputs_maybe_filtered', since it seemed to me that the
function should always print what was requested.  But I wasn't sure
this was the right thing to do, so I talked to Tom on IRC and he gave
me another, simpler idea: make '{putchar,fputc}_unfiltered' call into
the already existing 'fputs_unfiltered' function.

This patch implements the idea.  I regtested it on the Buildbot, and
no regressions were detected.

gdb/ChangeLog:
2020-02-20  Sergio Durigan Junior  <sergiodj@redhat.com>
	    Tom Tromey  <tom@tromey.com>

	* utils.c (fputs_maybe_filtered): Call 'stream->puts' instead
	of 'fputc_unfiltered'.
	(putchar_unfiltered): Call 'fputc_unfiltered'.
	(fputc_unfiltered): Call 'fputs_unfiltered'.
2020-02-20 16:02:37 -05:00
Tom de Vries a9c798035d [gdb/testsuite] Fix hello.go xpass
With gdb.go/hello.go, we run into an xpass:
...
Thread 1 "hello" hit Breakpoint 1, main.main () at hello.go:7^M
7       func main () {^M
(gdb) print st^M
$1 = 0x0 ""^M
(gdb) XPASS: gdb.go/hello.exp: starting string check
...

The xfail is setup as follows:
...
\# This used to print "", i.e., the local "st" initialized as "".
setup_xfail "*-*-*"

gdb_test "print st" \
    ".* = $hex \"\"" \
    "starting string check"
...

It's not clear what gccgo/gc PR this xfail refers to.

It's also not clear why the empty string is both:
- listed as reason for xfail, and
- used in the pass pattern.

Furthermore, there's a comment in the hello.go testcase:
...
  st := "Hello, world!" // this intentionally shadows the global "st"
...
while there's no global st variable present, only a variable myst:
...
var myst = "Shall we?"
...

Fix this by splitting up the test-case in two test-cases, hello.{go,exp} and
global-local-var-shadow.{go,exp}.

In hello.exp we no longer attempt to print st before its declaration.  In
hello.go we remove the myst variable as well the comment related to shadowing.

In global-local-var-shadow.go, we rename myst to st, such that the comment
related to shadowing is correct.  In global-local-var-shadow.exp we attempt to
print the value of st before the local definition, which should print the
value of the global definition, and xfail this with reference to GCC PR93844.

Tested on x86_64-linux, with gccgo 10.

gdb/testsuite/ChangeLog:

2020-02-20  Tom de Vries  <tdevries@suse.de>

	PR go/17018
	* gdb.go/hello.exp: Copy ...
	* gdb.go/global-local-var-shadow.exp: ... here.  New file.  Expect
	print of st to print value of global definition. Add xfail for GCC
	PR93844.
	* gdb.go/hello.exp: Remove printing of st before definition.
	* gdb.go/hello.go: Copy ...
	* gdb.go/global-local-var-shadow.go: ... here. New test.  Rename myst
	to st.
	* gdb.go/hello.go: Remove myst.  Remove comment about shadowing.
2020-02-20 17:46:17 +01:00
Tankut Baris Aktemur 52405d85ec gdbserver: finish turning the target ops vector into a class
Now that 'process_stratum_target' has a single field left, namely 'pt'
of type 'process_target', and that all the requests to a
'process_stratum_target' are forwarded to 'pt', meld the
'process_target' class into 'process_stratum_target'.

This essentially means

1. All the references of the form 'the_target->pt' become 'the_target'.

2. All the uses of the name 'process_target' become
   'process_stratum_target'.

3. The platform-specific target op vectors (e.g. linux_target_ops) are
   removed and instances of their "process target" classes are used
   instead.

gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* target.h (struct process_stratum_target): Remove.
	(class process_target): Rename to ...
	(class process_stratum_target): ... this.
	* linux-low.h (class linux_process_target): Derive from
	'process_stratum_target'.
	* linux-low.cc (linux_target_ops): Remove.
	(initialize_low): Set the_target to the singleton instance of
	linux_process_target.
	* lynx-low.h (class lynx_process_target): Derive from
	'process_stratum_target'.
	* lynx-low.cc (lynx_target_ops): Remove.
	(initialize_low): Set the_target to the singleton instance of
	lynx_process_target.
	* nto-low.h (class nto_process_target): Derive from
	'process_stratum_target'.
	* nto-low.cc (nto_target_ops): Remove.
	(initialize_low): Set the_target to the singleton instance of
	nto_process_target.
	* win32-low.h (class win32_process_target): Derive from
	'process_stratum_target'.
	* win32-low.cc (win32_target_ops): Remove.
	(initialize_low): Set the_target to the singleton instance of
	win32_process_target.

	Replace 'the_target->pt' with 'the_target' in the uses below.

	* hostio.cc (hostio_error)
	(handle_setfs)
	(handle_open)
	(handle_unlink)
	(handle_readlink)
	* linux-aarch32-low.cc (arm_breakpoint_at)
	* linux-aarch64-low.cc (aarch64_breakpoint_at)
	* linux-arm-low.cc (arm_sigreturn_next_pc)
	(arm_get_hwcap)
	(arm_get_syscall_trapinfo)
	* linux-cris-low.cc (cris_breakpoint_at)
	* linux-crisv32-low.cc (cris_breakpoint_at)
	* linux-low.cc (handle_extended_wait)
	(linux_wait_1)
	(linux_read_memory)
	(linux_process_target::breakpoint_kind_from_pc)
	(linux_get_auxv)
	* linux-m32r-low.cc (m32r_breakpoint_at)
	* linux-mips-low.cc (mips_breakpoint_at)
	* linux-nios2-low.cc (nios2_breakpoint_at)
	* linux-ppc-low.cc (ppc_breakpoint_at)
	* linux-s390-low.cc (s390_get_hwcap)
	* linux-sh-low.cc (sh_breakpoint_at)
	* linux-sparc-low.cc (sparc_fill_gregset_to_stack)
	(sparc_store_gregset_from_stack)
	(sparc_breakpoint_at)
	* linux-tic6x-low.cc (tic6x_breakpoint_at)
	* linux-tile-low.cc (tile_breakpoint_at)
	* linux-x86-low.cc (x86_breakpoint_at)
	* linux-xtensa-low.cc (xtensa_breakpoint_at)
	* mem-break.cc (bp_size)
	(bp_opcode)
	(insert_memory_breakpoint)
	(set_raw_breakpoint_at)
	(delete_raw_breakpoint)
	(z_type_supported)
	(uninsert_raw_breakpoint)
	(reinsert_raw_breakpoint)
	(validate_inserted_breakpoint)
	* regcache.cc (regcache_read_pc)
	(regcache_write_pc)
	* remote-utils.cc (putpkt_binary_1)
	(input_interrupt)
	(getpkt)
	(prepare_resume_reply)
	* server.cc (handle_general_set)
	(handle_detach)
	(handle_qxfer_auxv)
	(handle_qxfer_exec_file)
	(handle_qxfer_libraries_svr4)
	(handle_qxfer_osdata)
	(handle_qxfer_siginfo)
	(handle_qxfer_fdpic)
	(handle_query)
	(resume)
	(handle_v_requests)
	(queue_stop_reply_callback)
	(captured_main)
	* target.cc (prepare_to_access_memory)
	(done_accessing_memory)
	(read_inferior_memory)
	(target_write_memory)
	(target_stop_and_wait)
	(target_wait)
	(target_mourn_inferior)
	(target_continue_no_signal)
	(target_continue)
	(target_supports_multi_process)
	(kill_inferior)
	* target.h
	(target_create_inferior)
	(target_post_create_inferior)
	(myattach)
	(target_supports_fork_events)
	(target_supports_vfork_events)
	(target_supports_exec_events)
	(target_handle_new_gdb_connection)
	(detach_inferior)
	(mythread_alive)
	(fetch_inferior_registers)
	(store_inferior_registers)
	(join_inferior)
	(target_supports_non_stop)
	(target_async)
	(target_process_qsupported)
	(target_supports_catch_syscall)
	(target_get_ipa_tdesc_idx)
	(target_supports_tracepoints)
	(target_supports_fast_tracepoints)
	(target_get_min_fast_tracepoint_insn_len)
	(target_thread_stopped)
	(target_pause_all)
	(target_unpause_all)
	(target_stabilize_threads)
	(target_install_fast_tracepoint_jump_pad)
	(target_emit_ops)
	(target_supports_disable_randomization)
	(target_supports_agent)
	(target_enable_btrace)
	(target_disable_btrace)
	(target_read_btrace)
	(target_read_btrace_conf)
	(target_supports_range_stepping)
	(target_supports_stopped_by_sw_breakpoint)
	(target_stopped_by_sw_breakpoint)
	(target_supports_stopped_by_hw_breakpoint)
	(target_supports_hardware_single_step)
	(target_stopped_by_hw_breakpoint)
	(target_breakpoint_kind_from_pc)
	(target_breakpoint_kind_from_current_state)
	(target_supports_software_single_step)
	(target_core_of_thread)
	(target_thread_name)
	(target_thread_handle)
	* win32-low.cc (do_initial_child_stuff)

	Rename target op default definitions listed below.

	* target.cc (process_target::post_create_inferior): Rename as ...
	(process_stratum_target::post_create_inferior): ... this.
	(process_target::prepare_to_access_memory): Rename as ...
	(process_stratum_target::prepare_to_access_memory): ... this.
	(process_target::done_accessing_memory): Rename as ...
	(process_stratum_target::done_accessing_memory): ... this.
	(process_target::look_up_symbols): Rename as ...
	(process_stratum_target::look_up_symbols): ... this.
	(process_target::supports_read_auxv): Rename as ...
	(process_stratum_target::supports_read_auxv): ... this.
	(process_target::read_auxv): Rename as ...
	(process_stratum_target::read_auxv): ... this.
	(process_target::supports_z_point_type): Rename as ...
	(process_stratum_target::supports_z_point_type): ... this.
	(process_target::insert_point): Rename as ...
	(process_stratum_target::insert_point): ... this.
	(process_target::remove_point): Rename as ...
	(process_stratum_target::remove_point): ... this.
	(process_target::stopped_by_sw_breakpoint): Rename as ...
	(process_stratum_target::stopped_by_sw_breakpoint): ... this.
	(process_target::supports_stopped_by_sw_breakpoint): Rename as ...
	(process_stratum_target::supports_stopped_by_sw_breakpoint): ... this.
	(process_target::stopped_by_hw_breakpoint): Rename as ...
	(process_stratum_target::stopped_by_hw_breakpoint): ... this.
	(process_target::supports_stopped_by_hw_breakpoint): Rename as ...
	(process_stratum_target::supports_stopped_by_hw_breakpoint): ... this.
	(process_target::supports_hardware_single_step): Rename as ...
	(process_stratum_target::supports_hardware_single_step): ... this.
	(process_target::stopped_by_watchpoint): Rename as ...
	(process_stratum_target::stopped_by_watchpoint): ... this.
	(process_target::stopped_data_address): Rename as ...
	(process_stratum_target::stopped_data_address): ... this.
	(process_target::supports_read_offsets): Rename as ...
	(process_stratum_target::supports_read_offsets): ... this.
	(process_target::read_offsets): Rename as ...
	(process_stratum_target::read_offsets): ... this.
	(process_target::supports_get_tls_address): Rename as ...
	(process_stratum_target::supports_get_tls_address): ... this.
	(process_target::get_tls_address): Rename as ...
	(process_stratum_target::get_tls_address): ... this.
	(process_target::hostio_last_error): Rename as ...
	(process_stratum_target::hostio_last_error): ... this.
	(process_target::supports_qxfer_osdata): Rename as ...
	(process_stratum_target::supports_qxfer_osdata): ... this.
	(process_target::qxfer_osdata): Rename as ...
	(process_stratum_target::qxfer_osdata): ... this.
	(process_target::supports_qxfer_siginfo): Rename as ...
	(process_stratum_target::supports_qxfer_siginfo): ... this.
	(process_target::qxfer_siginfo): Rename as ...
	(process_stratum_target::qxfer_siginfo): ... this.
	(process_target::supports_non_stop): Rename as ...
	(process_stratum_target::supports_non_stop): ... this.
	(process_target::async): Rename as ...
	(process_stratum_target::async): ... this.
	(process_target::start_non_stop): Rename as ...
	(process_stratum_target::start_non_stop): ... this.
	(process_target::supports_multi_process): Rename as ...
	(process_stratum_target::supports_multi_process): ... this.
	(process_target::supports_fork_events): Rename as ...
	(process_stratum_target::supports_fork_events): ... this.
	(process_target::supports_vfork_events): Rename as ...
	(process_stratum_target::supports_vfork_events): ... this.
	(process_target::supports_exec_events): Rename as ...
	(process_stratum_target::supports_exec_events): ... this.
	(process_target::handle_new_gdb_connection): Rename as ...
	(process_stratum_target::handle_new_gdb_connection): ... this.
	(process_target::handle_monitor_command): Rename as ...
	(process_stratum_target::handle_monitor_command): ... this.
	(process_target::core_of_thread): Rename as ...
	(process_stratum_target::core_of_thread): ... this.
	(process_target::supports_read_loadmap): Rename as ...
	(process_stratum_target::supports_read_loadmap): ... this.
	(process_target::read_loadmap): Rename as ...
	(process_stratum_target::read_loadmap): ... this.
	(process_target::process_qsupported): Rename as ...
	(process_stratum_target::process_qsupported): ... this.
	(process_target::supports_tracepoints): Rename as ...
	(process_stratum_target::supports_tracepoints): ... this.
	(process_target::read_pc): Rename as ...
	(process_stratum_target::read_pc): ... this.
	(process_target::write_pc): Rename as ...
	(process_stratum_target::write_pc): ... this.
	(process_target::supports_thread_stopped): Rename as ...
	(process_stratum_target::supports_thread_stopped): ... this.
	(process_target::thread_stopped): Rename as ...
	(process_stratum_target::thread_stopped): ... this.
	(process_target::supports_get_tib_address): Rename as ...
	(process_stratum_target::supports_get_tib_address): ... this.
	(process_target::get_tib_address): Rename as ...
	(process_stratum_target::get_tib_address): ... this.
	(process_target::pause_all): Rename as ...
	(process_stratum_target::pause_all): ... this.
	(process_target::unpause_all): Rename as ...
	(process_stratum_target::unpause_all): ... this.
	(process_target::stabilize_threads): Rename as ...
	(process_stratum_target::stabilize_threads): ... this.
	(process_target::supports_fast_tracepoints): Rename as ...
	(process_stratum_target::supports_fast_tracepoints): ... this.
	(process_target::get_min_fast_tracepoint_insn_len): Rename as ...
	(process_stratum_target::get_min_fast_tracepoint_insn_len): ... this.
	(process_target::emit_ops): Rename as ...
	(process_stratum_target::emit_ops): ... this.
	(process_target::supports_disable_randomization): Rename as ...
	(process_stratum_target::supports_disable_randomization): ... this.
	(process_target::supports_qxfer_libraries_svr4): Rename as ...
	(process_stratum_target::supports_qxfer_libraries_svr4): ... this.
	(process_target::qxfer_libraries_svr4): Rename as ...
	(process_stratum_target::qxfer_libraries_svr4): ... this.
	(process_target::supports_agent): Rename as ...
	(process_stratum_target::supports_agent): ... this.
	(process_target::enable_btrace): Rename as ...
	(process_stratum_target::enable_btrace): ... this.
	(process_target::disable_btrace): Rename as ...
	(process_stratum_target::disable_btrace): ... this.
	(process_target::read_btrace): Rename as ...
	(process_stratum_target::read_btrace): ... this.
	(process_target::read_btrace_conf): Rename as ...
	(process_stratum_target::read_btrace_conf): ... this.
	(process_target::supports_range_stepping): Rename as ...
	(process_stratum_target::supports_range_stepping): ... this.
	(process_target::supports_pid_to_exec_file): Rename as ...
	(process_stratum_target::supports_pid_to_exec_file): ... this.
	(process_target::pid_to_exec_file): Rename as ...
	(process_stratum_target::pid_to_exec_file): ... this.
	(process_target::supports_multifs): Rename as ...
	(process_stratum_target::supports_multifs): ... this.
	(process_target::multifs_open): Rename as ...
	(process_stratum_target::multifs_open): ... this.
	(process_target::multifs_unlink): Rename as ...
	(process_stratum_target::multifs_unlink): ... this.
	(process_target::multifs_readlink): Rename as ...
	(process_stratum_target::multifs_readlink): ... this.
	(process_target::breakpoint_kind_from_pc): Rename as ...
	(process_stratum_target::breakpoint_kind_from_pc): ... this.
	(process_target::breakpoint_kind_from_current_state): Rename as ...
	(process_stratum_target::breakpoint_kind_from_current_state): ... this.
	(process_target::thread_name): Rename as ...
	(process_stratum_target::thread_name): ... this.
	(process_target::thread_handle): Rename as ...
	(process_stratum_target::thread_handle): ... this.
	(process_target::supports_software_single_step): Rename as ...
	(process_stratum_target::supports_software_single_step): ... this.
	(process_target::supports_catch_syscall): Rename as ...
	(process_stratum_target::supports_catch_syscall): ... this.
	(process_target::get_ipa_tdesc_idx): Rename as ...
	(process_stratum_target::get_ipa_tdesc_idx): ... this.
2020-02-20 17:35:20 +01:00
Pedro Alves 478f9adff5 gdbserver: simply copy the pointer in 'set_target_ops'
The 'set_target_ops' function takes a target op vector and creates a
clone of it via XNEW and memcpy.  This is not necessary.  'the_target'
is a singleton, and the argument that is passed to 'set_target_ops' is
always the address of a global, static object.  Therefore, update the
implementation to simply copy the pointer.

gdbserver/ChangeLog:
2020-02-20  Pedro Alves  <palves@redhat.com>

	* target.cc (set_target_ops): Simply copy the given target pointer
	instead of creating a copy of the pointed object.
2020-02-20 17:35:20 +01:00
Tankut Baris Aktemur d633e83140 gdbserver: turn target op 'get_ipa_tdesc_idx' into a method
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's get_ipa_tdesc_idx op into a method
	of process_target.

	* target.h (struct process_stratum_target): Remove the target op.
	(class process_target): Add the target op.
	(target_get_ipa_tdesc_idx): Update the macro.
	* target.cc (process_target::get_ipa_tdesc_idx): Define.

	Update the derived classes and callers below.

	* linux-low.cc (linux_target_ops): Update.
	(linux_get_ipa_tdesc_idx): Turn into ...
	(linux_process_target::get_ipa_tdesc_idx): ... this.
	* linux-low.h (class linux_process_target): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	* nto-low.cc (nto_target_ops): Update.
	* win32-low.cc (win32_target_ops): Update.
2020-02-20 17:35:19 +01:00
Tankut Baris Aktemur bc8d3ae432 gdbserver: turn target op 'supports_catch_syscall' into a method
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's supports_catch_syscall op into a
	method of process_target.

	* target.h (struct process_stratum_target): Remove the target op.
	(class process_target): Add the target op.
	(target_supports_catch_syscall): Update the macro.
	* target.cc (process_target::supports_catch_syscall): Define.

	Update the derived classes and callers below.

	* linux-low.cc (linux_target_ops): Update.
	(linux_supports_catch_syscall): Turn into ...
	(linux_process_target::supports_catch_syscall): ... this.
	* linux-low.h (class linux_process_target): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	* nto-low.cc (nto_target_ops): Update.
	* win32-low.cc (win32_target_ops): Update.
2020-02-20 17:35:19 +01:00
Tankut Baris Aktemur 5303a34f90 gdbserver: turn target op 'supports_software_single_step' into a method
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's supports_software_single_step op
	into a method of process_target.

	* target.h (struct process_stratum_target): Remove the target op.
	(class process_target): Add the target op.
	(target_supports_software_single_step): Update the macro.
	* target.cc (process_target::supports_software_single_step): Define.

	Update the derived classes and callers below.

	* linux-low.cc (linux_target_ops): Update.
	(linux_supports_software_single_step): Turn into ...
	(linux_process_target::supports_software_single_step): ... this.
	* linux-low.h (class linux_process_target): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	* nto-low.cc (nto_target_ops): Update.
	* win32-low.cc (win32_target_ops): Update.
2020-02-20 17:35:19 +01:00
Tankut Baris Aktemur 7f63b89b3a gdbserver: turn target ops 'thread_name' and 'thread_handle' into methods
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's thread_name and thread_handle ops
	into methods of process_target.

	* target.h (struct process_stratum_target): Remove the target ops.
	(class process_target): Add the target ops.
	(target_thread_name): Update the macro.
	(target_thread_handle): Update the macro.
	* target.cc (process_target::thread_name): Define.
	(process_target::thread_handle): Define.

	Update the derived classes and callers below.

	* linux-low.cc (linux_target_ops): Update.
	(linux_process_target::thread_name): Define.
	(linux_process_target::thread_handle): Define.
	* linux-low.h (class linux_process_target): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	* nto-low.cc (nto_target_ops): Update.
	* win32-low.cc (win32_target_ops): Update.
2020-02-20 17:35:18 +01:00
Tankut Baris Aktemur d367006fb7 gdbserver: turn breakpoint kind-related target ops into methods
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's breakpoint_kind_from_pc,
	sw_breakpoint_from_kind, and breakpoint_kind_from_current_state
	ops into methods of process_target.

	* target.h (struct process_stratum_target): Remove the target op.
	(class process_target): Add the target op.
	(target_breakpoint_kind_from_pc): Update the macro.
	(target_breakpoint_kind_from_current_state): Update the macro.
	(default_breakpoint_kind_from_pc): Remove declaration.
	* target.cc (default_breakpoint_kind_from_pc): Turn into ...
	(process_target::breakpoint_kind_from_pc): ... this.
	(process_target::breakpoint_kind_from_current_state): Define.

	Update the derived classes and callers below.

	* mem-break.cc (bp_size): Update.
	(bp_opcode): Update.
	* linux-low.cc (linux_target_ops): Update.
	(linux_wait_1): Update.
	(linux_breakpoint_kind_from_pc): Turn into ...
	(linux_process_target::breakpoint_kind_from_pc): ... this.
	(linux_sw_breakpoint_from_kind): Turn into ...
	(linux_process_target::sw_breakpoint_from_kind): ... this.
	(linux_breakpoint_kind_from_current_state): Turn into ...
	(linux_process_target::breakpoint_kind_from_current_state): ... this.
	* linux-low.h (class linux_process_target): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	(lynx_process_target::sw_breakpoint_from_kind): Define.
	* lynx-low.h (class lynx_process_target): Update.
	* nto-low.cc (nto_target_ops): Update.
	(nto_sw_breakpoint_from_kind): Turn into ...
	(nto_process_target::sw_breakpoint_from_kind): ... this.
	* nto-low.h (class nto_process_target): Update.
	* win32-low.cc (win32_target_ops): Update.
	(win32_sw_breakpoint_from_kind): Turn into ...
	(win32_process_target::sw_breakpoint_from_kind): ... this.
	* win32-low.h (class win32_process_target): Update.
2020-02-20 17:35:18 +01:00
Tankut Baris Aktemur c9b7b80460 gdbserver: turn target ops 'multifs_{open, readlink, unlink}' into methods
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's multifs_open, multifs_readlink,
	multifs_unlink ops into methods of process_target.

	* target.h (struct process_stratum_target): Remove the target ops.
	(class process_target): Add the target ops.  Also add
	'supports_multifs'.
	* target.cc: Include "fcntl.h", "unistd.h", "sys/types.h", and
	"sys/stat.h".
	(process_target::supports_multifs): Define.
	(process_target::multifs_open): Define.
	(process_target::multifs_readlink): Define.
	(process_target::multifs_unlink): Define.

	Update the derived classes and callers below.

	* hostio.cc (handle_setfs): Update.
	(handle_open): Update.
	(handle_unlink): Update.
	(handle_readlink): Update.
	* linux-low.cc (linux_target_ops): Update.
	(linux_process_target::supports_multifs): Define.
	(linux_process_target::multifs_open): Define.
	(linux_process_target::multifs_readlink): Define.
	(linux_process_target::multifs_unlink): Define.
	* linux-low.h (class linux_process_target): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	* nto-low.cc (nto_target_ops): Update.
	* win32-low.cc (win32_target_ops): Update.
2020-02-20 17:35:18 +01:00
Tankut Baris Aktemur 8247b8236b gdbserver: turn target op 'pid_to_exec_file' into a method
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's pid_to_exec_file op into a method
	of process_target.

	* target.h (struct process_stratum_target): Remove the target op.
	(class process_target): Add the target op.  Also add
	'supports_pid_to_exec_file'.
	* target.cc (process_target::pid_to_exec_file): Define.
	(process_target::supports_pid_to_exec_file): Define.

	Update the derived classes and callers below.

	* server.cc (handle_qxfer_exec_file): Update.
	(handle_query): Update.
	* linux-low.cc (linux_target_ops): Update.
	(linux_process_target::supports_pid_to_exec_file): Define.
	(linux_process_target::pid_to_exec_file): Define.
	* linux-low.h (class linux_process_target): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	* nto-low.cc (nto_target_ops): Update.
	* win32-low.cc (win32_target_ops): Update.
2020-02-20 17:35:17 +01:00
Tankut Baris Aktemur 2526e0cd95 gdbserver: turn target op 'supports_range_stepping' into a method
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's supports_range_stepping op into a
	method of process_target.

	* target.h (struct process_stratum_target): Remove the target op.
	(class process_target): Add the target op.
	(target_supports_range_stepping): Update the macro.
	* target.cc (process_target::supports_range_stepping): Define.

	Update the derived classes and callers below.

	* linux-low.cc (linux_target_ops): Update.
	(linux_supports_range_stepping): Turn into ...
	(linux_process_target::supports_range_stepping): ... this.
	* linux-low.h (class linux_process_target): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	* nto-low.cc (nto_target_ops): Update.
	* win32-low.cc (win32_target_ops): Update.
2020-02-20 17:35:17 +01:00
Tankut Baris Aktemur 79597bdd56 gdbserver: turn btrace-related target ops into methods
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's btrace-related ops (enable_btrace,
	disable_btrace, read_btrace, read_btrace_conf) into methods of
	process_target.

	* target.h (struct process_stratum_target): Remove the target ops.
	(class process_target): Add the target ops.
	(target_enable_btrace): Update.
	(target_disable_btrace): Update.
	(target_read_btrace): Update.
	(target_read_btrace_conf): Update.
	* target.cc (process_target::enable_btrace): Define.
	(process_target::disable_btrace): Define.
	(process_target::read_btrace): Define.
	(process_target::read_btrace_conf): Define.

	Update the derived classes and callers below.

	* linux-low.cc (linux_target_ops): Update.
	(linux_process_target:enable_btrace): Define as a wrapper around
	linux_enable_btrace.
	(linux_low_disable_btrace): Turn into ...
	(linux_process_target::disable_btrace): ... this.
	(linux_low_read_btrace): Turn into ...
	(linux_process_target::read_btrace): ... this.
	(linux_low_btrace_conf): Turn into ...
	(linux_process_target::read_btrace_conf): ... this.
	* linux-low.h (class linux_process_target): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	* nto-low.cc (nto_target_ops): Update.
	* win32-low.cc (win32_target_ops): Update.
2020-02-20 17:35:17 +01:00
Tankut Baris Aktemur c0245cb999 gdbserver: turn target op 'supports_agent' into a method
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's supports_agent op into a method of
	process_target.

	* target.h (struct process_stratum_target): Remove the target op.
	(class process_target): Add the target op.
	(target_supports_agent): Update the macro.
	* target.cc (process_target::supports_agent): Define.

	Update the derived classes and callers below.

	* linux-low.cc (linux_target_ops): Update.
	(linux_supports_agent): Turn into ...
	(linux_process_target::supports_agent): ... this.
	* linux-low.h (class linux_process_target): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	* nto-low.cc (nto_target_ops): Update.
	* win32-low.cc (win32_target_ops): Update.
2020-02-20 17:35:16 +01:00
Tankut Baris Aktemur 974387bb25 gdbserver: turn target op 'qxfer_libraries_svr4' into a method
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's qxfer_libraries_svr4 op into a
	method of process_target.

	* target.h (struct process_stratum_target): Remove the target op.
	(class process_target): Add the target op.  Also add
	'supports_qxfer_libraries_svr4'.
	* target.cc (process_target::qxfer_libraries_svr4): Define.
	(process_target::supports_qxfer_libraries_svr4): Define.

	Update the derived classes and callers below.

	* server.cc (handle_qxfer_libraries_svr4): Update.
	(handle_query): Update.
	* linux-low.cc (linux_target_ops): Update.
	(linux_process_target::supports_qxfer_libraries_svr4): Define.
	(linux_qxfer_libraries_svr4): Turn into ...
	(linux_process_target::qxfer_libraries_svr4): ... this.
	* linux-low.h (class linux_process_target): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	* nto-low.cc (nto_target_ops): Update.
	* win32-low.cc (win32_target_ops): Update.
2020-02-20 17:35:16 +01:00
Tankut Baris Aktemur c756403b17 gdbserver: turn target op 'supports_disable_randomization' into a method
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's supports_disable_randomization op
	into a method of process_target.

	* target.h (struct process_stratum_target): Remove the target op.
	(class process_target): Add the target op.
	(target_supports_disable_randomization): Update the macro.
	* target.cc (process_target::supports_disable_randomization): Define.

	Update the derived classes and callers below.

	* linux-low.cc (linux_target_ops): Update.
	(linux_supports_disable_randomization): Turn into ...
	(linux_process_target::supports_disable_randomization): ... this.
	* linux-low.h (class linux_process_target): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	* nto-low.cc (nto_target_ops): Update.
	* win32-low.cc (win32_target_ops): Update.
2020-02-20 17:35:16 +01:00
Tankut Baris Aktemur 345dafadc2 gdbserver: turn target op 'emit_ops' into a method
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's emit_ops op into a method of
	process_target.

	* target.h (struct process_stratum_target): Remove the target op.
	(class process_target): Add the target op.
	(target_emit_ops): Update the macro.
	* target.cc (process_target::emit_ops): Define.

	Update the derived classes and callers below.

	* linux-low.cc (linux_target_ops): Update.
	(linux_emit_ops): Turn into ...
	(linux_process_target::emit_ops): ... this.
	* linux-low.h (class linux_process_target): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	* nto-low.cc (nto_target_ops): Update.
	* win32-low.cc (win32_target_ops): Update.
2020-02-20 17:35:15 +01:00
Tankut Baris Aktemur c23c939174 gdbserver: turn fast tracepoint target ops into methods
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's install_fast_tracepoint_jump_pad
	and get_min_fast_tracepoint_insn_len ops into methods of
	process_target.

	* target.h (struct process_stratum_target): Remove the target ops.
	(class process_target): Add the target ops.  Also add
	'supports_fast_tracepoints'.
	(target_supports_fast_tracepoints): Update the macro.
	(target_get_min_fast_tracepoint_insn_len): Update the macro.
	(install_fast_tracepoint_jump_pad): Update and rename the macro
	to ...
	(target_install_fast_tracepoint_jump_pad): ... this.
	* target.cc (process_target::supports_fast_tracepoints): Define.
	(process_target::install_fast_tracepoint_jump_pad): Define.
	(process_target::get_min_fast_tracepoint_insn_len): Define.

	Update the derived classes and callers below.

	* tracepoint.cc (install_fast_tracepoint): Update.
	* linux-low.cc (linux_target_ops): Update.
	(linux_process_target::supports_fast_tracepoints): Define.
	(linux_install_fast_tracepoint_jump_pad): Turn into ...
	(linux_process_target::install_fast_tracepoint_jump_pad): ... this.
	(linux_get_min_fast_tracepoint_insn_len): Turn into ...
	(linux_process_target::get_min_fast_tracepoint_insn_len): ... this.
	* linux-low.h (class linux_process_target): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	* nto-low.cc (nto_target_ops): Update.
	* win32-low.cc (win32_target_ops): Update.
2020-02-20 17:35:15 +01:00
Tankut Baris Aktemur 5c9eb2f2b5 gdbserver: turn target op 'stabilize_threads' into a method
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's stabilize_threads op into a
	method of process_target.

	* target.h (struct process_stratum_target): Remove the target op.
	(class process_target): Add the target op.
	(target_stabilize_threads): Update the macro.
	* target.cc (process_target::stabilize_threads): Define.

	Update the derived classes and callers below.

	* server.cc (handle_status): Update.
	* tracepoint.cc (cmd_qtdp): Update.
	(cmd_qtstart): Update.
	* linux-low.cc (linux_target_ops): Update.
	(linux_stabilize_threads): Turn into ...
	(linux_process_target::stabilize_threads): ... this.
	(linux_wait_1): Update.
	* linux-low.h (class linux_process_target): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	* nto-low.cc (nto_target_ops): Update.
	* win32-low.cc (win32_target_ops): Update.
2020-02-20 17:35:15 +01:00
Tankut Baris Aktemur 29e8dc09ff gdbserver: turn target ops 'pause_all' and 'unpause_all' into methods
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's pause_all and unpause_all ops
	into methods of process_target.

	* target.h (struct process_stratum_target): Remove the target ops.
	(class process_target): Add the target ops.
	(pause_all): Update the macro and rename to...
	(target_pause_all): ... this.
	(unpause_all): Update the macro and rename to...
	(target_unpause_all): ... this.
	* target.cc (process_target::pause_all): Define.
	(process_target::unpause_all): Define.

	Update the derived classes and callers below.

	* server.cc (handle_status): Update.
	* tracepoint.cc (clear_installed_tracepoints): Update.
	(cmd_qtdp): Update.
	(cmd_qtstart): Update.
	(stop_tracing): Update.
	(cmd_qtstatus): Update.
	(upload_fast_traceframes): Update.
	(run_inferior_command): Update.
	* linux-low.cc (linux_target_ops): Update.
	(linux_pause_all): Turn into ...
	(linux_process_target::pause_all): ... this.
	(linux_unpause_all): Turn into ...
	(linux_process_target::unpause_all): ... this.
	(linux_process_target::prepare_to_access_memory): Update.
	(linux_process_target::done_accessing_memory): Update.
	* linux-low.h (class linux_process_target): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	* nto-low.cc (nto_target_ops): Update.
	* win32-low.cc (win32_target_ops): Update.
2020-02-20 17:35:14 +01:00
Tankut Baris Aktemur 4e2e869cb3 gdbserver: turn target op 'get_tib_address' into a method
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's get_tib_address op into a method of
	process_target.

	* target.h (struct process_stratum_target): Remove the target op.
	(class process_target): Add the target op.  Also add
	'supports_get_tib_address'.
	* target.cc (process_target::get_tib_address): Define.
	(process_target::supports_get_tib_address): Define.

	Update the derived classes and callers below.

	* server.cc (handle_query): Update.
	* linux-low.cc (win32_target_ops): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	* nto-low.cc (nto_target_ops): Update.
	* win32-low.cc (win32_target_ops): Update.
	(win32_process_target::supports_get_tib_address): Define.
	(win32_get_tib_address): Turn into ...
	(win32_process_target::get_tib_address): ... this.
	* win32-low.h (class win32_process_target): Update.
2020-02-20 17:35:14 +01:00
Tankut Baris Aktemur 68119632a0 gdbserver: turn target op 'thread_stopped' into a method
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's thread_stopped op into a method of
	process_target.

	* target.h (struct process_stratum_target): Remove the target op.
	(class process_target): Add the target op.  Also add
	'supports_thread_stopped'.
	(target_thread_stopped): Update the macro.
	* target.cc (process_target::thread_stopped): Define.
	(process_target::supports_thread_stopped): Define.
	(prepare_to_access_memory): Update.

	Update the derived classes and callers below.

	* server.cc (queue_stop_reply_callback): Update.
	* linux-low.cc (linux_target_ops): Update.
	(linux_process_target::supports_thread_stopped): Define.
	(linux_thread_stopped): Turn into ...
	(linux_process_target::thread_stopped): ... this.
	* linux-low.h (class linux_process_target): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	* nto-low.cc (nto_target_ops): Update.
	* win32-low.cc (win32_target_ops): Update.
2020-02-20 17:35:14 +01:00
Tankut Baris Aktemur 770d8f6a51 gdbserver: turn target ops 'read_pc' and 'write_pc' into methods
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's read_pc and write_pc ops into
	methods of process_target.

	* target.h (struct process_stratum_target): Remove the target ops.
	(class process_target): Add the target ops.
	* target.cc (process_target::read_pc): Define.
	(process_target::write_pc): Define.

	Update the derived classes and callers below.

	* regcache.cc (regcache_read_pc): Update.
	(regcache_write_pc): Update.
	* linux-low.cc (linux_target_ops): Update.
	(linux_read_pc): Turn into ...
	(linux_process_target::read_pc): ... this.
	(linux_write_pc): Turn into ...
	(linux_process_target::write_pc): ... this.
	* linux-low.h (class linux_process_target): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	* nto-low.cc (nto_target_ops): Update.
	* win32-low.cc (win32_target_ops): Update.
2020-02-20 17:35:13 +01:00
Tankut Baris Aktemur 290732bfb3 gdbserver: turn target op 'supports_tracepoints' into a method
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's supports_tracepoints op into a
	method of process_target.

	* target.h (struct process_stratum_target): Remove the target op.
	(class process_target): Add the target op.
	(target_supports_tracepoints): Update the macro.
	* target.cc (process_target::supports_tracepoints): Define.

	Update the derived classes and callers below.

	* linux-low.cc (linux_target_ops): Update.
	(linux_supports_tracepoints): Turn into ...
	(linux_process_target::supports_tracepoints): ... this.
	* linux-low.h (class linux_process_target): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	* nto-low.cc (nto_target_ops): Update.
	* win32-low.cc (win32_target_ops): Update.
2020-02-20 17:35:13 +01:00
Tankut Baris Aktemur 0df28b1b4b gdbserver: turn target op 'process_qsupported' into a method
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's process_qsupported op into a method
	of process_target.

	* target.h (struct process_stratum_target): Remove the target op.
	(class process_target): Add the target op.
	(target_process_qsupported): Update the macro.
	* target.cc (process_target::process_qsupported): Define.

	Update the derived classes and callers below.

	* linux-low.cc (linux_target_ops): Update.
	(linux_process_qsupported): Turn into ...
	(linux_process_target::process_qsupported): ... this.
	* linux-low.h (class linux_process_target): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	* nto-low.cc (nto_target_ops): Update.
	* win32-low.cc (win32_target_ops): Update.
2020-02-20 17:35:13 +01:00
Tankut Baris Aktemur 9da41fdae0 gdbserver: turn target op 'read_loadmap' into a method
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's read_loadmap op into a method of
	process_target.

	* target.h (struct process_stratum_target): Remove the target op.
	(class process_target): Add the target op.  Also add
	'supports_read_loadmap'.
	* target.cc (process_target::read_loadmap): Define.
	(process_target::supports_read_loadmap): Define.

	Update the derived classes and callers below.

	* server.cc (handle_qxfer_fdpic): Update.
	(handle_query): Update.
	* linux-low.cc (linux_target_ops): Update.
	(linux_process_target::supports_read_loadmap): Define.
	(linux_read_loadmap): Turn into ...
	(linux_process_target::read_loadmap): ... this.
	* linux-low.h (class linux_process_target): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	* nto-low.cc (nto_target_ops): Update.
	* win32-low.cc (win32_target_ops): Update.
2020-02-20 17:35:12 +01:00
Tankut Baris Aktemur 95a45fc165 gdbserver: turn target op 'core_of_thread' into a method
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's core_of_thread op into a method of
	process_target.

	* target.h (struct process_stratum_target): Remove the target op.
	(class process_target): Add the target op.
	(target_core_of_thread): Update the macro.
	* target.cc (process_target::core_of_thread): Define.

	Update the derived classes and callers below.

	* linux-low.cc (linux_target_ops): Update.
	(linux_process_target::core_of_thread): Define.
	* linux-low.h (class linux_process_target): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	* nto-low.cc (nto_target_ops): Update.
	* win32-low.cc (win32_target_ops): Update.
2020-02-20 17:35:12 +01:00
Tankut Baris Aktemur 55cf302157 gdbserver: turn target op 'handle_monitor_command' into a method
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's handle_monitor_command op into a
	method of process_target.

	* target.h (struct process_stratum_target): Remove the target op.
	(class process_target): Add the target op.
	(target_handle_monitor_command): Update the macro.
	* target.cc (process_target::handle_monitor_command): Define.

	Update the derived classes and callers below.

	* server.cc (handle_query): Update.
	* linux-low.cc (linux_target_ops): Update.
	(linux_process_target::handle_monitor_command): Define.
	* linux-low.h (class linux_process_target): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	* nto-low.cc (nto_target_ops): Update.
	* win32-low.cc (win32_target_ops): Update.
2020-02-20 17:35:12 +01:00
Tankut Baris Aktemur fb00dfcef0 gdbserver: turn target op 'handle_new_gdb_connection' into a method
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's handle_new_gdb_connection op into a
	method of process_target.

	* target.h (struct process_stratum_target): Remove the target op.
	(class process_target): Add the target op.
	(target_handle_new_gdb_connection): Update the macro.
	* target.cc (process_target::handle_new_gdb_connection): Define.

	Update the derived classes and callers below.

	* linux-low.cc (linux_target_ops): Update.
	(linux_handle_new_gdb_connection): Turn into ...
	(linux_process_target::handle_new_gdb_connection): ... this.
	* linux-low.h (class linux_process_target): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	* nto-low.cc (nto_target_ops): Update.
	* win32-low.cc (win32_target_ops): Update.
2020-02-20 17:35:11 +01:00
Tankut Baris Aktemur 9690a72ae5 gdbserver: turn target ops 'supports_{fork,vfork,exec}_events' into methods
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's supports_fork_events,
	supports_vfork_events, and supports_exec_events ops into methods
	of process_target.

	* target.h (struct process_stratum_target): Remove the target ops.
	(class process_target): Add the target ops.
	(target_supports_fork_events): Update the macro.
	(target_supports_vfork_events): Update the macro.
	(target_supports_exec_events): Update the macro.
	* target.cc (process_target::supports_fork_events): Define.
	(process_target::supports_vfork_events): Define.
	(process_target::supports_exec_events): Define.

	Update the derived classes and callers below.

	* linux-low.cc (linux_target_ops): Update.
	(linux_supports_fork_events): Turn into ...
	(linux_process_target::supports_fork_events): ... this.
	(linux_supports_vfork_events): Turn into ...
	(linux_process_target::supports_vfork_events): ... this.
	(linux_supports_exec_events): Turn into ...
	(linux_process_target::supports_exec_events): ... this.
	* linux-low.h (class linux_process_target): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	* nto-low.cc (nto_target_ops): Update.
	* win32-low.cc (win32_target_ops): Update.
2020-02-20 17:35:11 +01:00
Tankut Baris Aktemur 652aef7792 gdbserver: turn target op 'supports_multi_process' into a method
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's supports_multi_process op into a
	method of process_target.

	* target.h (struct process_stratum_target): Remove the target op.
	(class process_target): Add the target op.
	* target.cc (process_target::supports_multi_process): Define.
	(target_supports_multi_process): Update.

	Update the derived classes and callers below.

	* linux-low.cc (linux_target_ops): Update.
	(linux_supports_multi_process): Turn into ...
	(linux_process_target::supports_multi_process): ... this.
	* linux-low.h (class linux_process_target): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	* nto-low.cc (nto_target_ops): Update.
	* win32-low.cc (win32_target_ops): Update.
2020-02-20 17:35:11 +01:00
Tankut Baris Aktemur 0dc587d425 gdbserver: turn non-stop and async target ops into methods
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's supports_non_stop, async, and
	start_non_stop ops into methods of process_target.

	* target.h (struct process_stratum_target): Remove the target ops.
	(class process_target): Add the target ops.
	(target_supports_non_stop): Update the macro.
	(target_async): Update the macro.
	(start_non_stop): Remove declaration.
	* target.cc (process_target::supports_non_stop): Define.
	(process_target::async): Define.
	(process_target::start_non_stop): Define.
	(start_non_stop): Remove.

	Update the derived classes and callers below.

	* server.cc (handle_qxfer_siginfo): Update.
	(handle_query): Update.
	* linux-low.cc (linux_target_ops): Update.
	(linux_supports_non_stop): Turn into ...
	(linux_process_target::supports_non_stop): ... this.
	(linux_async): Turn into ...
	(linux_process_target::async): ... this.
	(linux_start_non_stop): Turn into ...
	(linux_process_target::start_non_stop): ... this.
	* linux-low.h (class linux_process_target): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	* nto-low.cc (nto_target_ops): Update.
	(nto_supports_non_stop): Remove; rely on the default behavior
	instead.
	* win32-low.cc (win32_target_ops): Update.
2020-02-20 17:35:10 +01:00
Tankut Baris Aktemur d7abedf7e7 gdbserver: turn target op 'qxfer_siginfo' into a method
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's qxfer_siginfo op into a method of
	process_target.

	* target.h (struct process_stratum_target): Remove the target op.
	(class process_target): Add the target op.  Also add
	'supports_qxfer_siginfo'.
	* target.cc (process_target::qxfer_siginfo): Define.
	(process_target::supports_qxfer_siginfo): Define.

	Update the derived classes and callers below.

	* server.cc (handle_qxfer_siginfo): Update.
	(handle_query): Update.
	* linux-low.cc (linux_target_ops): Update.
	(linux_process_target::supports_qxfer_siginfo): Define.
	(linux_xfer_siginfo): Turn into ...
	(linux_process_target::qxfer_siginfo): ... this.
	* linux-low.h (class linux_process_target): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	* nto-low.cc (nto_target_ops): Update.
	* win32-low.cc (win32_target_ops): Update.
2020-02-20 17:35:10 +01:00
Tankut Baris Aktemur 2d0795ee38 gdbserver: turn target op 'qxfer_osdata' into a method
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's qxfer_osdata op into a method of
	process_target.

	* target.h (struct process_stratum_target): Remove the target op.
	(class process_target): Add the target op.  Also add
	'supports_qxfer_osdata'.
	* target.cc (process_target::qxfer_osdata): Define.
	(process_target::supports_qxfer_osdata): Define.

	Update the derived classes and callers below.

	* server.cc (handle_qxfer_osdata): Update.
	(handle_query): Update.
	* linux-low.cc (linux_target_ops): Update.
	(linux_process_target::supports_qxfer_osdata): Define.
	(linux_qxfer_osdata): Turn into ...
	(linux_process_target::qxfer_osdata): ... this.
	* linux-low.h (class linux_process_target): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	* nto-low.cc (nto_target_ops): Update.
	* win32-low.cc (win32_target_ops): Update.
2020-02-20 17:35:10 +01:00