Commit Graph

44 Commits

Author SHA1 Message Date
Antoine Tremblay dd37334957 Add the target_ops needed for software breakpoints in GDBServer.
This patch is in preparation for software breakpoints on ARM linux.  It
refactors breakpoint and breakpoint_len into breakpoint_kind_from_pc and
sw_breakpoint_from kind to prepare the case where we have multiple types of
breakpoints.

Kind is the type of breakpoint (hardware or software) to be inserted, usually it
is the lenght of the software breakpoint but can be something else depending on
the target.

This patch introduces the linux_target_ops breakpoint_kind_from_pc and
sw_breakpoint_from_kind.

breakpoint_kind_from_pc returns the breakpoint kind and adjusts the PC to the
real memory location in case a flag was present in the PC. E.g the instruction
mode on ARM.

sw_breakpoint_from_kind returns the software breakpoint for this kind as a
string of bytes, the length of the breakpoint is adjusted for the breakpoint's
size in memory.

For targets that have only one kind of breakpoint, the default value 0 is
returned by linux_breakpoint_kind_from_pc so that not all targets need to
implement the breakpoint_kind_from_pc operation.

No regressions, tested on Ubuntu 14.04 on ARMv7 and x86
With gdbserver-{native,extended} / { -marm -mthumb }

Also since the target_ops have been changed compilation was tested on
affected archs namely : aarch64, arm, bfin, cris, crisv32, m32r,
m68k, mips, nios2, ppc, s390, sparc, tic6x, tile, x86, steins.

Not tested : sh

gdb/gdbserver/ChangeLog:

	* linux-aarch64-low.c (aarch64_sw_breakpoint_from_kind): New function.
	(struct linux_target_ops) <breakpoint>: Remove.
	(struct linux_target_ops) <breakpoint_len>: Remove.
	(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
	(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
	* linux-arm-low.c (arm_breakpoint_kind_from_pc): New function.
	(arm_sw_breakpoint_from_kind): New function.
	* linux-bfin-low.c (bfin_sw_breakpoint_from_kind): New function.
	(struct linux_target_ops) <breakpoint>: Remove.
	(struct linux_target_ops) <breakpoint_len>: Remove.
	(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
	(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
	* linux-cris-low.c (cris_sw_breakpoint_from_kind): New function.
	(struct linux_target_ops) <breakpoint>: Remove.
	(struct linux_target_ops) <breakpoint_len>: Remove.
	(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
	(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
	* linux-crisv32-low.c (cris_sw_breakpoint_from_kind): New function.
	(struct linux_target_ops) <breakpoint>: Remove.
	(struct linux_target_ops) <breakpoint_len>: Remove.
	(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
	(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
	* linux-low.c (linux_wait_1): Call breakpoint_kind_from_pc
	and sw_breakpoint_from_kind to increment the pc.
	(linux_breakpoint_kind_from_pc): New function.
	(linux_sw_breakpoint_from_kind): New function.
	(struct target_ops) <sw_breakpoint_from_kind>: Initialize field.
	(initialize_low): Call breakpoint_kind_from_pc and
	sw_breakpoint_from_kind to replace breakpoint_data/len.
	* linux-low.h (struct linux_target_ops) <breakpoint_kind_from_pc>:
	New field.
	(struct linux_target_ops) <sw_breakpoint_from_kind>: Likewise.
	* linux-m32r-low.c (m32r_sw_breakpoint_from_kind): New function.
	(struct linux_target_ops) <breakpoint>: Remove.
	(struct linux_target_ops) <breakpoint_len>: Remove.
	(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
	(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
	* linux-m68k-low.c (m68k_sw_breakpoint_from_kind): New function.
	(struct linux_target_ops) <breakpoint>: Remove.
	(struct linux_target_ops) <breakpoint_len>: Remove.
	(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
	(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
	* linux-mips-low.c (mips_sw_breakpoint_from_kind): New function.
	(struct linux_target_ops) <breakpoint>: Remove.
	(struct linux_target_ops) <breakpoint_len>: Remove.
	(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
	(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
	* linux-nios2-low.c (nios2_sw_breakpoint_from_kind): New function.
	(struct linux_target_ops) <breakpoint>: Remove.
	(struct linux_target_ops) <breakpoint_len>: Remove.
	(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
	(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
	* linux-ppc-low.c (ppc_sw_breakpoint_from_kind): New function.
	(struct linux_target_ops) <breakpoint>: Remove.
	(struct linux_target_ops) <breakpoint_len>: Remove.
	(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
	(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
	* linux-s390-low.c (s390_sw_breakpoint_from_kind): New function.
	(struct linux_target_ops) <breakpoint>: Remove.
	(struct linux_target_ops) <breakpoint_len>: Remove.
	(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
	(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
	* linux-sh-low.c (sh_sw_breakpoint_from_kind): New function.
	(struct linux_target_ops) <breakpoint>: Remove.
	(struct linux_target_ops) <breakpoint_len>: Remove.
	(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
	(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
	* linux-sparc-low.c (sparc_sw_breakpoint_from_kind): New function.
	(struct linux_target_ops) <breakpoint>: Remove.
	(struct linux_target_ops) <breakpoint_len>: Remove.
	(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
	(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
	* linux-tic6x-low.c (tic6x_sw_breakpoint_from_kind): New function.
	(struct linux_target_ops) <breakpoint>: Remove.
	(struct linux_target_ops) <breakpoint_len>: Remove.
	(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
	(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
	* linux-tile-low.c (tile_sw_breakpoint_from_kind): New function.
	* linux-x86-low.c (x86_sw_breakpoint_from_kind): New function.
	(struct linux_target_ops) <breakpoint>: Remove.
	(struct linux_target_ops) <breakpoint_len>: Remove.
	(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
	(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
	* linux-xtensa-low.c (xtensa_sw_breakpoint_from_kind) New function.
	(struct linux_target_ops) <breakpoint>: Remove.
	(struct linux_target_ops) <breakpoint_len>: Remove.
	(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
	(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
2015-10-21 11:24:55 -04:00
Yao Qi cdf436294f Detect 64-bit-ness in PowerPC Book III-E
This patch is to teach both GDB and GDBServer to detect 64-bit inferior
correctly.  We find a problem that GDBServer is unable to detect on a
e5500 core processor.  Current GDBServer assumes that MSR is a 64-bit
register, but MSR is a 32-bit register in Book III-E.  This patch is
to fix this problem by checking the right bit in MSR, in order to handle
both Book III-S and Book III-E.  In order to detect Book III-S and
Book III-E, we check the PPC_FEATURE_BOOKE from the host's HWCAP (by
getauxval on glibc >= 2.16.  If getauxval doesn't exist, we implement
the fallback by parsing /proc/self/auxv), because it should an invariant
on the same machine cross different processes.

In order to share code, I add nat/ppc-linux.c for both GDB and
GDBserver side.

gdb:

2015-01-14  Yao Qi  <yao@codesourcery.com>

	* Makefile.in (ppc-linux.o): New rule.
	* config/powerpc/ppc64-linux.mh (NATDEPFILES): Add ppc-linux.o.
	* configure.ac: AC_CHECK_FUNCS(getauxval).
	* config.in: Re-generated.
	* configure: Re-generated.
	* nat/ppc-linux.h [__powerpc64__] (ppc64_64bit_inferior_p):
	Declare.
	* nat/ppc-linux.c: New file.
	* ppc-linux-nat.c (ppc_linux_target_wordsize) [__powerpc64__]:
	Call ppc64_64bit_inferior_p.

gdb/gdbserver:

2015-01-14  Yao Qi  <yao@codesourcery.com>

	* Makefile.in (SFILES): Add nat/ppc-linux.c.
	(ppc-linux.o): New rule.
	* configure.srv (powerpc*-*-linux*): Add ppc-linux.o.
	* configure.ac: AC_CHECK_FUNCS(getauxval).
	* config.in: Re-generated.
	* configure: Re-generated.
	* linux-ppc-low.c (ppc_arch_setup) [__powerpc64__]: Call
	ppc64_64bit_inferior_p
2015-01-14 22:28:27 +08:00
Yao Qi 514c533895 Move some ppc macros to nat/ppc-linux.h
When I use PPC_FEATURE_BOOKE in GDBserver, I find it is defined in GDB
but not in GDBserver.  After taking a further look, I find some macros
are duplicated between ppc-linux-nat.c and linux-ppc-low.c, so this
patch is to move them into nat/ppc-linux.h.

gdb/gdbserver:

2015-01-14  Yao Qi  <yao@codesourcery.com>

	* linux-ppc-low.c: Include "nat/ppc-linux.h".
	 (PPC_FEATURE_HAS_VSX): Move to nat/ppc-linux.h.
	(PPC_FEATURE_HAS_ALTIVEC,  PPC_FEATURE_HAS_SPE): Likewise.
	(PT_ORIG_R3, PT_TRAP): Likewise.
	(PTRACE_GETVSXREGS, PTRACE_SETVSXREGS): Likewise.
	(PTRACE_GETVRREGS, PTRACE_SETVRREGS): Likewise.
	(PTRACE_GETEVRREGS, PTRACE_SETEVRREGS): Likewise.

gdb:

2015-01-14  Yao Qi  <yao@codesourcery.com>

	* ppc-linux-nat.c (PT_ORIG_R3, PT_TRAP): Move to
	nat/ppc-linux.h.
	(PPC_FEATURE_CELL, PPC_FEATURE_BOOKE): Likewise.
	(PPC_FEATURE_HAS_DFP): Likewise.
	(PTRACE_GETVRREGS, PTRACE_SETVRREGS): Likewise.
	(PTRACE_GETVSXREGS, PTRACE_SETVSXREGS): Likewise.
	(PTRACE_GETEVRREGS, PTRACE_SETEVRREGS): Likewise.
	Include "nat/ppc-linux.h".
	* nat/ppc-linux.h: New file.
	* Makefile.in (HFILES_NO_SRCDIR): Add nat/ppc-linux.h.
2015-01-14 22:28:22 +08:00
Joel Brobecker 32d0add0a6 Update year range in copyright notice of all files owned by the GDB project.
gdb/ChangeLog:

        Update year range in copyright notice of all files.
2015-01-01 13:32:14 +04:00
Edjunior Barbosa Machado 2e4bb98a0e Fix ppc_collect/supply_ptrace_register() routines
This patch fixes the routines to collect and supply ptrace registers on ppc64le
gdbserver. Originally written for big endian arch, they were causing several
issues on little endian. With this fix, the number of unexpected failures in
the testsuite dropped from 263 to 72 on ppc64le.

gdb/gdbserver/ChangeLog

	* linux-ppc-low.c (ppc_collect_ptrace_register): Adjust routine to take
	endianness into account.
	(ppc_supply_ptrace_register): Likewise.
2014-09-08 13:37:23 -03:00
Pedro Alves 802e8e6d84 [GDBserver] Make Zx/zx packet handling idempotent.
This patch fixes hardware breakpoint regressions exposed by my fix for
"PR breakpoints/7143 - Watchpoint does not trigger when first set", at
https://sourceware.org/ml/gdb-patches/2014-03/msg00167.html

The testsuite caught them on Linux/x86_64, at least.  gdb.sum:

gdb.sum:

 FAIL: gdb.base/hbreak2.exp: next over recursive call
 FAIL: gdb.base/hbreak2.exp: backtrace from factorial(5.1)
 FAIL: gdb.base/hbreak2.exp: continue until exit at recursive next test

gdb.log:

 (gdb) next

 Program received signal SIGTRAP, Trace/breakpoint trap.
 factorial (value=4) at ../../../src/gdb/testsuite/gdb.base/break.c:113
 113       if (value > 1) {  /* set breakpoint 7 here */
 (gdb) FAIL: gdb.base/hbreak2.exp: next over recursive call

Actually, that patch just exposed a latent issue to "breakpoints
always-inserted off" mode, not really caused it.  After that patch,
GDB no longer removes breakpoints at each internal event, thus making
some scenarios behave like breakpoint always-inserted on.  The bug is
easy to trigger with always-inserted on.

The issue is that since the target-side breakpoint conditions support,
if the stub/server supports evaluating breakpoint conditions on the
target side, then GDB is sending duplicate Zx packets to the target
without removing them before, and GDBserver is not really expecting
that for Z packets other than Z0/z0.  E.g., with "set breakpoint
always-inserted on" and "set debug remote 1":

 (gdb) b main
 Sending packet: $m410943,1#ff...Packet received: 48
 Breakpoint 4 at 0x410943: file ../../../src/gdb/gdbserver/server.c, line 3028.
 Sending packet: $Z0,410943,1#48...Packet received: OK
                 ^^^^^^^^^^^^
 (gdb) b main
 Note: breakpoint 4 also set at pc 0x410943.
 Sending packet: $m410943,1#ff...Packet received: 48
 Breakpoint 5 at 0x410943: file ../../../src/gdb/gdbserver/server.c, line 3028.
 Sending packet: $Z0,410943,1#48...Packet received: OK
                 ^^^^^^^^^^^^
 (gdb) b main
 Note: breakpoints 4 and 5 also set at pc 0x410943.
 Sending packet: $m410943,1#ff...Packet received: 48
 Breakpoint 6 at 0x410943: file ../../../src/gdb/gdbserver/server.c, line 3028.
 Sending packet: $Z0,410943,1#48...Packet received: OK
                 ^^^^^^^^^^^^
 (gdb) del
 Delete all breakpoints? (y or n) y
 Sending packet: $Z0,410943,1#48...Packet received: OK
 Sending packet: $Z0,410943,1#48...Packet received: OK
 Sending packet: $z0,410943,1#68...Packet received: OK

And for Z1, similarly:

 (gdb) hbreak main
 Sending packet: $m410943,1#ff...Packet received: 48
 Hardware assisted breakpoint 4 at 0x410943: file ../../../src/gdb/gdbserver/server.c, line 3028.
 Sending packet: $Z1,410943,1#49...Packet received: OK
                 ^^^^^^^^^^^^
 Packet Z1 (hardware-breakpoint) is supported
 (gdb) hbreak main
 Note: breakpoint 4 also set at pc 0x410943.
 Sending packet: $m410943,1#ff...Packet received: 48
 Hardware assisted breakpoint 5 at 0x410943: file ../../../src/gdb/gdbserver/server.c, line 3028.
 Sending packet: $Z1,410943,1#49...Packet received: OK
                 ^^^^^^^^^^^^
 (gdb) hbreak main
 Note: breakpoints 4 and 5 also set at pc 0x410943.
 Sending packet: $m410943,1#ff...Packet received: 48
 Hardware assisted breakpoint 6 at 0x410943: file ../../../src/gdb/gdbserver/server.c, line 3028.
 Sending packet: $Z1,410943,1#49...Packet received: OK
                 ^^^^^^^^^^^^
 (gdb) del
 Delete all breakpoints? (y or n) y
 Sending packet: $Z1,410943,1#49...Packet received: OK
                 ^^^^^^^^^^^^
 Sending packet: $Z1,410943,1#49...Packet received: OK
                 ^^^^^^^^^^^^
 Sending packet: $z1,410943,1#69...Packet received: OK
                 ^^^^^^^^^^^^

So GDB sent a bunch of Z1 packets, and then when finally removing the
breakpoint, only one z1 packet was sent.  On the GDBserver side (with
monitor set debug-hw-points 1), in the Z1 case, we see:

 $ ./gdbserver :9999 ./gdbserver
 Process ./gdbserver created; pid = 8629
 Listening on port 9999
 Remote debugging from host 127.0.0.1
 insert_watchpoint (addr=410943, len=1, type=instruction-execute):
	 CONTROL (DR7): 00000101          STATUS (DR6): 00000000
	 DR0: addr=0x410943, ref.count=1  DR1: addr=0x0, ref.count=0
	 DR2: addr=0x0, ref.count=0  DR3: addr=0x0, ref.count=0
 insert_watchpoint (addr=410943, len=1, type=instruction-execute):
	 CONTROL (DR7): 00000101          STATUS (DR6): 00000000
	 DR0: addr=0x410943, ref.count=2  DR1: addr=0x0, ref.count=0
	 DR2: addr=0x0, ref.count=0  DR3: addr=0x0, ref.count=0
 insert_watchpoint (addr=410943, len=1, type=instruction-execute):
	 CONTROL (DR7): 00000101          STATUS (DR6): 00000000
	 DR0: addr=0x410943, ref.count=3  DR1: addr=0x0, ref.count=0
	 DR2: addr=0x0, ref.count=0  DR3: addr=0x0, ref.count=0
 insert_watchpoint (addr=410943, len=1, type=instruction-execute):
	 CONTROL (DR7): 00000101          STATUS (DR6): 00000000
	 DR0: addr=0x410943, ref.count=4  DR1: addr=0x0, ref.count=0
	 DR2: addr=0x0, ref.count=0  DR3: addr=0x0, ref.count=0
 insert_watchpoint (addr=410943, len=1, type=instruction-execute):
	 CONTROL (DR7): 00000101          STATUS (DR6): 00000000
	 DR0: addr=0x410943, ref.count=5  DR1: addr=0x0, ref.count=0
	 DR2: addr=0x0, ref.count=0  DR3: addr=0x0, ref.count=0
 remove_watchpoint (addr=410943, len=1, type=instruction-execute):
	 CONTROL (DR7): 00000101          STATUS (DR6): 00000000
	 DR0: addr=0x410943, ref.count=4  DR1: addr=0x0, ref.count=0
	 DR2: addr=0x0, ref.count=0  DR3: addr=0x0, ref.count=0

That's one insert_watchpoint call for each Z1 packet, and then one
remove_watchpoint call for the z1 packet.  Notice how ref.count
increased for each insert_watchpoint call, and then in the end, after
GDB told GDBserver to forget about the hardware breakpoint, GDBserver
ends with the the first debug register still with ref.count=4!  IOW,
the hardware breakpoint is left armed on the target, while on the GDB
end it's gone.  If the program happens to execute 0x410943 afterwards,
then the CPU traps, GDBserver reports the trap to GDB, and GDB not
having a breakpoint set at that address anymore, reports to the user a
spurious SIGTRAP.

This is exactly what is happening in the hbreak2.exp test, though in
that case, it's a shared library event that triggers a
breakpoint_re_set, when breakpoints are still inserted (because
nowadays GDB doesn't remove breakpoints while handling internal
events), and that recreates breakpoint locations, which likewise
forces breakpoint reinsertion and Zx packet resends...

That is a lot of bogus Zx duplication that should possibly be
addressed on the GDB side.  GDB resends Zx packets because the way to
change the target-side condition, is to resend the breakpoint to the
server with the new condition.  (That's an option in the packet: e.g.,
"Z1,410943,1;X3,220027" for "hbreak main if 0".  The packets in the
examples above are shorter because the breakpoints don't have
conditions attached).  GDB doesn't remove the breakpoint first before
reinserting it because that'd be bad for non-stop, as it'd open a
window where the inferior could miss the breakpoint.  The conditions
actually haven't changed between the resends, but GDB isn't smart
enough to realize that.

(TBC, if the target doesn't support target-side conditions, then GDB
doesn't trigger these resends (init_bp_location calls
mark_breakpoint_location_modified, and that does nothing if condition
evaluation is on the host side.  The resends are caused by the
'loc->condition_changed = condition_modified.'  line.)

But, even if GDB was made smarter, GDBserver should really still
handle the resends anyway.  So target-side conditions also aren't
really to blame.  The documentation of the Z/z packets says:

 "To avoid potential problems with duplicate packets, the operations
 should be implemented in an idempotent way."

As such, we may want to fix GDB, but we should definitely fix
GDBserver.  The fix is a prerequisite for target-side conditions on
hardware breakpoints anyway (and while at it, on watchpoints too).

GDBserver indeed already treats duplicate Z0 packets in an idempotent
way.  mem-break.c has the concept of high-level and low-level
breakpoints, somewhat similar to GDB's split of breakpoints vs
breakpoint locations, and keeps track of multiple breakpoints
referencing the same address/location, for the case of an internal
GDBserver breakpoint or a tracepoint being set at the same address as
a GDB breakpoint.  But, it only allows GDB to ever contribute one
reference to a software breakpoint location.  IOW, if gdbserver sees a
Z0 packet for the same address where it already had a GDB breakpoint
set, then GDBserver won't create another high-level GDB breakpoint.

However, mem-break.c only tracks GDB Z0 breakpoints.  The same logic
should apply to all kinds of Zx packets.  Currently, gdbserver passes
down each duplicate Zx (other than Z0) request directly to the
target->insert_point routine.  The x86 watchpoint support itself
refcounts watchpoint / hw breakpoint requests, to handle overlapping
watchpoints, and save debug registers.  But that code doesn't (and
really shouldn't) handle the duplicate requests, assuming that for
each insert there will be a corresponding remove.

So the fix is to generalize mem-break.c to track all kinds of Zx
breakpoints, and filter out duplicates.  As mentioned, this ends up
adding support for target-side conditions on hardware breakpoints and
watchpoints too (though GDB itself doesn't support the latter yet).

Probably the least obvious change in the patch is that it kind of
turns the breakpoint insert/remove APIs inside out.  Before, the
target methods were only called for GDB breakpoints.  The internal
breakpoint set/delete methods inserted memory breakpoints directly
bypassing the insert/remove target methods.  That's not good when the
target should use a debug API to set software breakpoints, instead of
relying on GDBserver patching memory with breakpoint instructions, as
is the case of NTO.

Now removal/insertion of all kinds of breakpoints/watchpoints, either
internal, or from GDB, always go through the target methods.  The
insert_point/remove_point methods no longer get passed a Z packet
type, but an internal/raw breakpoint type.  They're also passed a
pointer to the raw breakpoint itself (note that's still opaque outside
mem-break.c), so that insert_memory_breakpoint /
remove_memory_breakpoint have access to the breakpoint's shadow
buffer.  I first tried passing down a new structure based on GDB's
"struct bp_target_info" (actually with that name exactly), but then
decided against it as unnecessary complication.

As software/memory breakpoints work by poking at memory, when setting
a GDB Z0 breakpoint (but not internal breakpoints, as those can assume
the conditions are already right), we need to tell the target to
prepare to access memory (which on Linux means stop threads).  If that
operation fails, we need to return error to GDB.  Seeing an error, if
this is the first breakpoint of that type that GDB tries to insert,
GDB would then assume the breakpoint type is supported, but it may
actually not be.  So we need to check whether the type is supported at
all before preparing to access memory.  And to solve that, the patch
adds a new target->supports_z_point_type method that is called before
actually trying to insert the breakpoint.

Other than that, hopefully the change is more or less obvious.

New test added that exercises the hbreak2.exp regression in a more
direct way, without relying on a breakpoint re-set happening before
main is reached.

Tested by building GDBserver for:

 aarch64-linux-gnu
 arm-linux-gnueabihf
 i686-pc-linux-gnu
 i686-w64-mingw32
 m68k-linux-gnu
 mips-linux-gnu
 mips-uclinux
 nios2-linux-gnu
 powerpc-linux-gnu
 sh-linux-gnu
 tilegx-unknown-linux-gnu
 x86_64-redhat-linux
 x86_64-w64-mingw32

And also regression tested on x86_64 Fedora 20.

gdb/gdbserver/
2014-05-20  Pedro Alves  <palves@redhat.com>

	* linux-aarch64-low.c (aarch64_insert_point)
	(aarch64_remove_point): No longer check whether the type is
	supported here.  Adjust to new interface.
	(the_low_target): Install aarch64_supports_z_point_type as
	supports_z_point_type method.
	* linux-arm-low.c (raw_bkpt_type_to_arm_hwbp_type): New function.
	(arm_linux_hw_point_initialize): Take an enum raw_bkpt_type
	instead of a Z packet char.  Adjust.
	(arm_supports_z_point_type): New function.
	(arm_insert_point, arm_remove_point): Adjust to new interface.
	(the_low_target): Install arm_supports_z_point_type.
	* linux-crisv32-low.c (cris_supports_z_point_type): New function.
	(cris_insert_point, cris_remove_point): Adjust to new interface.
	Don't check whether the type is supported here.
	(the_low_target): Install cris_supports_z_point_type.
	* linux-low.c (linux_supports_z_point_type): New function.
	(linux_insert_point, linux_remove_point): Adjust to new interface.
	* linux-low.h (struct linux_target_ops) <insert_point,
	remove_point>: Take an enum raw_bkpt_type instead of a char.  Add
	raw_breakpoint pointer parameter.
	<supports_z_point_type>: New method.
	* linux-mips-low.c (mips_supports_z_point_type): New function.
	(mips_insert_point, mips_remove_point): Adjust to new interface.
	Use mips_supports_z_point_type.
	(the_low_target): Install mips_supports_z_point_type.
	* linux-ppc-low.c (the_low_target): Install NULL as
	supports_z_point_type method.
	* linux-s390-low.c (the_low_target): Install NULL as
	supports_z_point_type method.
	* linux-sparc-low.c (the_low_target): Install NULL as
	supports_z_point_type method.
	* linux-x86-low.c (x86_supports_z_point_type): New function.
	(x86_insert_point): Adjust to new insert_point interface.  Use
	insert_memory_breakpoint.  Adjust to new
	i386_low_insert_watchpoint interface.
	(x86_remove_point): Adjust to remove_point interface.  Use
	remove_memory_breakpoint.  Adjust to new
	i386_low_remove_watchpoint interface.
	(the_low_target): Install x86_supports_z_point_type.
	* lynx-low.c (lynx_target_ops): Install NULL as
	supports_z_point_type callback.
	* nto-low.c (nto_supports_z_point_type): New.
	(nto_insert_point, nto_remove_point): Adjust to new interface.
	(nto_target_ops): Install nto_supports_z_point_type.
	* mem-break.c: Adjust intro comment.
	(struct raw_breakpoint) <raw_type, size>: New fields.
	<inserted>: Update comment.
	<shlib_disabled>: Delete field.
	(enum bkpt_type) <gdb_breakpoint>: Delete value.
	<gdb_breakpoint_Z0, gdb_breakpoint_Z1, gdb_breakpoint_Z2,
	gdb_breakpoint_Z3, gdb_breakpoint_Z4>: New values.
	(raw_bkpt_type_to_target_hw_bp_type): New function.
	(find_enabled_raw_code_breakpoint_at): New function.
	(find_raw_breakpoint_at): New type and size parameters.  Use them.
	(insert_memory_breakpoint): New function, based off
	set_raw_breakpoint_at.
	(remove_memory_breakpoint): New function.
	(set_raw_breakpoint_at): Reimplement.
	(set_breakpoint): New, based on set_breakpoint_at.
	(set_breakpoint_at): Reimplement.
	(delete_raw_breakpoint): Go through the_target->remove_point
	instead of assuming memory breakpoints.
	(find_gdb_breakpoint_at): Delete.
	(Z_packet_to_bkpt_type, Z_packet_to_raw_bkpt_type): New functions.
	(find_gdb_breakpoint): New function.
	(set_gdb_breakpoint_at): Delete.
	(z_type_supported): New function.
	(set_gdb_breakpoint_1): New function, loosely based off
	set_gdb_breakpoint_at.
	(check_gdb_bp_preconditions, set_gdb_breakpoint): New functions.
	(delete_gdb_breakpoint_at): Delete.
	(delete_gdb_breakpoint_1): New function, loosely based off
	delete_gdb_breakpoint_at.
	(delete_gdb_breakpoint): New function.
	(clear_gdb_breakpoint_conditions): Rename to ...
	(clear_breakpoint_conditions): ... this.  Don't handle a NULL
	breakpoint.
	(add_condition_to_breakpoint): Make static.
	(add_breakpoint_condition): Take a struct breakpoint pointer
	instead of an address.  Adjust.
	(gdb_condition_true_at_breakpoint): Rename to ...
	(gdb_condition_true_at_breakpoint_z_type): ... this, and add
	z_type parameter.
	(gdb_condition_true_at_breakpoint): Reimplement.
	(add_breakpoint_commands): Take a struct breakpoint pointer
	instead of an address.  Adjust.
	(gdb_no_commands_at_breakpoint): Rename to ...
	(gdb_no_commands_at_breakpoint_z_type): ... this.  Add z_type
	parameter.  Return true if no breakpoint was found.  Change debug
	output.
	(gdb_no_commands_at_breakpoint): Reimplement.
	(run_breakpoint_commands): Rename to ...
	(run_breakpoint_commands_z_type): ... this.  Add z_type parameter,
	and change return type to boolean.
	(run_breakpoint_commands): New function.
	(gdb_breakpoint_here): Also check for Z1 breakpoints.
	(uninsert_raw_breakpoint): Don't try to reinsert a disabled
	breakpoint.  Go through the_target->remove_point instead of
	assuming memory breakpoint.
	(uninsert_breakpoints_at, uninsert_all_breakpoints): Uninsert
	software and hardware breakpoints.
	(reinsert_raw_breakpoint): Go through the_target->insert_point
	instead of assuming memory breakpoint.
	(reinsert_breakpoints_at, reinsert_all_breakpoints): Reinsert
	software and hardware breakpoints.
	(check_breakpoints, breakpoint_here, breakpoint_inserted_here):
	Check both software and hardware breakpoints.
	(validate_inserted_breakpoint): Assert the breakpoint is a
	software breakpoint.  Set the inserted flag to -1 instead of
	setting shlib_disabled.
	(delete_disabled_breakpoints): Adjust.
	(validate_breakpoints): Only validate software breakpoints.
	Adjust to inserted flag change.
	(check_mem_read, check_mem_write): Skip breakpoint types other
	than software breakpoints.  Adjust to inserted flag change.
	* mem-break.h (enum raw_bkpt_type): New enum.
	(raw_breakpoint, struct process_info): Forward declare.
	(Z_packet_to_target_hw_bp_type): Delete declaration.
	(raw_bkpt_type_to_target_hw_bp_type, Z_packet_to_raw_bkpt_type)
	(set_gdb_breakpoint, delete_gdb_breakpoint)
	(clear_breakpoint_conditions): New declarations.
	(set_gdb_breakpoint_at, clear_gdb_breakpoint_conditions): Delete.
	(breakpoint_inserted_here): Update comment.
	(add_breakpoint_condition, add_breakpoint_commands): Replace
	address parameter with a breakpoint pointer parameter.
	(gdb_breakpoint_here): Update comment.
	(delete_gdb_breakpoint_at): Delete.
	(insert_memory_breakpoint, remove_memory_breakpoint): Declare.
	* server.c (process_point_options): Take a struct breakpoint
	pointer instead of an address.  Adjust.
	(process_serial_event) <Z/z packets>: Use set_gdb_breakpoint and
	delete_gdb_breakpoint.
	* spu-low.c (spu_target_ops): Install NULL as
	supports_z_point_type method.
	* target.h: Include mem-break.h.
	(struct target_ops) <prepare_to_access_memory>: Update comment.
	<supports_z_point_type>: New field.
	<insert_point, remove_point>: Take an enum raw_bkpt_type argument
	instead of a char.  Also take a raw breakpoint pointer.
	* win32-arm-low.c (the_low_target): Install NULL as
	supports_z_point_type.
	* win32-i386-low.c (i386_supports_z_point_type): New function.
	(i386_insert_point, i386_remove_point): Adjust to new interface.
	(the_low_target): Install i386_supports_z_point_type.
	* win32-low.c (win32_supports_z_point_type): New function.
	(win32_insert_point, win32_remove_point): Adjust to new interface.
	(win32_target_ops): Install win32_supports_z_point_type.
	* win32-low.h (struct win32_target_ops):
	<supports_z_point_type>: New method.
	<insert_point, remove_point>: Take an enum raw_bkpt_type argument
	instead of a char.  Also take a raw breakpoint pointer.

gdb/testsuite/
2014-05-20  Pedro Alves  <palves@redhat.com>

	* gdb.base/break-idempotent.c: New file.
	* gdb.base/break-idempotent.exp: New file.
2014-05-20 18:42:30 +01:00
Joel Brobecker ecd75fc8ee Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
Pedro Alves 3aee891821 [GDBserver] Multi-process + multi-arch
This patch makes GDBserver support multi-process + biarch.

Currently, if you're debugging more than one process at once with a
single gdbserver (in extended-remote mode), then all processes must
have the same architecture (e.g., 64-bit vs 32-bit).  Otherwise, you
see this:

Added inferior 2
[Switching to inferior 2 [<null>] (<noexec>)]
Reading symbols from /home/pedro/gdb/tests/main32...done.
Temporary breakpoint 2 at 0x4004cf: main. (2 locations)
Starting program: /home/pedro/gdb/tests/main32
warning: Selected architecture i386 is not compatible with reported target architecture i386:x86-64
warning: Architecture rejected target-supplied description
Remote 'g' packet reply is too long: 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000090cfffff0000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000b042f7460000000000020000230000002b0000002b0000002b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007f03000000000000ffff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000801f00003b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
... etc, etc ...

Even though the process was running a 32-bit program, GDBserver sent
back to GDB a register set in 64-bit layout.

A patch (http://sourceware.org/ml/gdb-patches/2012-11/msg00228.html) a
while ago made GDB track a target_gdbarch per inferior, and as
consequence, fetch a target description per-inferior.  This patch is
the GDBserver counterpart, that makes GDBserver keep track of each
process'es XML target description and register layout.  So in the
example above, GDBserver will send the correct register set in 32-bit
layout to GDB.

A new "struct target_desc" object (tdesc for short) is added, that
holds the target description and register layout information about
each process.  Each `struct process_info' holds a pointer to a target
description.  The regcache also gains a pointer to a target
description, mainly for convenience, and parallel with GDB (and
possible future support for programs that flip processor modes).

The low target's arch_setup routines are responsible for setting the
process'es correct tdesc.  This isn't that much different to how
things were done before, except that instead of detecting the inferior
process'es architecture and calling the corresponding
init_registers_FOO routine, which would change the regcache layout
globals and recreate the threads' regcaches, the regcache.c globals
are gone, and the init_registers_$BAR routines now each initialize a
separate global struct target_desc object (one for each arch variant
GDBserver supports), and so all the init_registers_$BAR routines that
are built into GDBserver are called early at GDBserver startup time
(similarly to how GDB handles its built-in target descriptions), and
then the arch_setup routine is responsible for making
process_info->tdesc point to one of these target description globals.
The regcache module is all parameterized to get the regcache's layout
from the tdesc object instead of the old register_bytes, etc. globals.

The threads' regcaches are now created lazily.  The old scheme where
we created each of them when we added a new thread doesn't work
anymore, because we add the main thread/lwp before we see it stop for
the first time, and it is only when we see the thread stop for the
first time that we have a chance of determining the inferior's
architecture (through the_low_target.arch_setup).  Therefore when we
add the main thread we don't know which architecture/tdesc its
regcache should have.

This patch makes the gdb.multi/multi-arch.exp test now pass against
(extended-remote) GDBserver.  It currently fails, without this patch.

The IPA also uses the regcache, so it gains a new global struct
target_desc pointer, which points at the description of the process it
is loaded in.

Re. the linux-low.c & friends changes.  Since the register map
etc. may differ between processes (64-bit vs 32-bit) etc., the
linux_target_ops num_regs, regmap and regset_bitmap data fields are no
longer sufficient.  A new method is added in their place that returns
a pointer to a new struct that includes all info linux-low.c needs to
access registers of the current inferior.

The patch/discussion that originally introduced
linux-low.c:disabled_regsets mentions that the disabled_regsets set
may be different per mode (in a biarch setup), and indeed that is
cleared whenever we start a new (first) inferior, so that global is
moved as well behind the new `struct regs_info'.

On the x86 side:

I simply replaced the i387-fp.c:num_xmm_registers global with a check
for 64-bit or 32-bit process, which is equivalent to how the global
was set.  This avoided coming up with some more general mechanism that
would work for all targets that use this module (GNU/Linux, Windows,
etc.).

Tested:

  GNU/Linux IA64
  GNU/Linux MIPS64
  GNU/Linux PowerPC (Fedora 16)
  GNU/Linux s390x (Fedora 16)
  GNU/Linux sparc64 (Debian)
  GNU/Linux x86_64, -m64 and -m32 (Fedora 17)

Cross built, and smoke tested:

  i686-w64-mingw32, under Wine.
  GNU/Linux TI C6x, by Yao Qi.

Cross built but otherwise not tested:

  aarch64-linux-gnu
  arm-linux-gnu
  m68k-linux
  nios2-linux-gnu
  sh-linux-gnu
  spu
  tilegx-unknown-linux-gnu

Completely untested:

  GNU/Linux Blackfin
  GNU/Linux CRIS
  GNU/Linux CRISv32
  GNU/Linux TI Xtensa
  GNU/Linux M32R
  LynxOS
  QNX NTO

gdb/gdbserver/
2013-06-07  Pedro Alves  <palves@redhat.com>

	* Makefile.in (OBS): Add tdesc.o.
	(IPA_OBJS): Add tdesc-ipa.o.
	(tdesc-ipa.o): New rule.
	* ax.c (gdb_eval_agent_expr): Adjust register_size call to new
	interface.
	* linux-low.c (new_inferior): Delete.
	(disabled_regsets, num_regsets): Delete.
	(linux_add_process): Adjust to set the new per-process
	new_inferior flag.
	(linux_detach_one_lwp): Adjust to call regcache_invalidate_thread.
	(linux_wait_for_lwp): Adjust.  Only call arch_setup if the event
	was a stop.  When calling arch_setup, switch the current inferior
	to the thread that got an event.
	(linux_resume_one_lwp): Adjust to call regcache_invalidate_thread.
	(regsets_fetch_inferior_registers)
	(regsets_store_inferior_registers): New regsets_info parameter.
	Adjust to use it.
	(linux_register_in_regsets): New regs_info parameter.  Adjust to
	use it.
	(register_addr, fetch_register, store_register): New usrregs_info
	parameter.  Adjust to use it.
	(usr_fetch_inferior_registers, usr_store_inferior_registers): New
	parameter regs_info.  Adjust to use it.
	(linux_fetch_registers): Get the current inferior's regs_info, and
	adjust to use it.
	(linux_store_registers): Ditto.
	[HAVE_LINUX_REGSETS] (initialize_regsets_info): New.
	(initialize_low): Don't initialize the target_regsets here.  Call
	initialize_low_arch.
	* linux-low.h (target_regsets): Delete declaration.
	(struct regsets_info): New.
	(struct usrregs_info): New.
	(struct regs_info): New.
	(struct process_info_private) <new_inferior>: New field.
	(struct linux_target_ops): Delete the num_regs, regmap, and
	regset_bitmap fields.  New field regs_info.
	[HAVE_LINUX_REGSETS] (initialize_regsets_info): Declare.
	* i387-fp.c (num_xmm_registers): Delete.
	(i387_cache_to_fsave, i387_fsave_to_cache): Adjust find_regno
	calls to new interface.
	(i387_cache_to_fxsave, i387_cache_to_xsave, i387_fxsave_to_cache)
	(i387_xsave_to_cache): Adjust find_regno calls to new interface.
	Infer the number of xmm registers from the regcache's target
	description.
	* i387-fp.h (num_xmm_registers): Delete.
	* inferiors.c (add_thread): Don't install the thread's regcache
	here.
	* proc-service.c (gregset_info): Fetch the current inferior's
	regs_info.  Adjust to use it.
	* regcache.c: Include tdesc.h.
	(register_bytes, reg_defs, num_registers)
	(gdbserver_expedite_regs): Delete.
	(get_thread_regcache): If the thread doesn't have a regcache yet,
	create one, instead of aborting gdbserver.
	(regcache_invalidate_one): Rename to ...
	(regcache_invalidate_thread): ... this.
	(regcache_invalidate_one): New.
	(regcache_invalidate): Only invalidate registers of the current
	process.
	(init_register_cache): Add target_desc parameter, and use it.
	(new_register_cache): Ditto.  Assert the target description has a
	non zero registers_size.
	(regcache_cpy): Add assertions.  Adjust.
	(realloc_register_cache, set_register_cache): Delete.
	(registers_to_string, registers_from_string): Adjust.
	(find_register_by_name, find_regno, find_register_by_number)
	(register_cache_size): Add target_desc parameter, and use it.
	(free_register_cache_thread, free_register_cache_thread_one)
	(regcache_release, register_cache_size): New.
	(register_size): Add target_desc parameter, and use it.
	(register_data, supply_register, supply_register_zeroed)
	(supply_regblock, supply_register_by_name, collect_register)
	(collect_register_as_string, collect_register_by_name): Adjust.
	* regcache.h (struct target_desc): Forward declare.
	(struct regcache) <tdesc>: New field.
	(init_register_cache, new_register_cache): Add target_desc
	parameter.
	(regcache_invalidate_thread): Declare.
	(regcache_invalidate_one): Delete declaration.
	(regcache_release): Declare.
	(find_register_by_number, register_cache_size, register_size)
	(find_regno): Add target_desc parameter.
	(gdbserver_expedite_regs, gdbserver_xmltarget): Delete
	declarations.
	* remote-utils.c: Include tdesc.h.
	(outreg, prepare_resume_reply): Adjust.
	* server.c: Include tdesc.h.
	(gdbserver_xmltarget): Delete declaration.
	(get_features_xml, process_serial_event): Adjust.
	* server.h [IN_PROCESS_AGENT] (struct target_desc): Forward
	declare.
	(struct process_info) <tdesc>: New field.
	(ipa_tdesc): Declare.
	* tdesc.c: New file.
	* tdesc.h: New file.
	* tracepoint.c: Include tdesc.h.
	[IN_PROCESS_AGENT] (ipa_tdesc): Define.
	(get_context_regcache): Adjust to pass ipa_tdesc down.
	(do_action_at_tracepoint): Adjust to get the register cache size
	from the context regcache's description.
	(traceframe_walk_blocks): Adjust to get the register cache size
	from the current trace frame's description.
	(traceframe_get_pc): Adjust to get current trace frame's
	description and pass it down.
	(gdb_collect): Adjust to get the register cache size from the
	IPA's description.
	* linux-amd64-ipa.c (tdesc_amd64_linux): Declare.
	(gdbserver_xmltarget): Delete.
	(initialize_low_tracepoint): Set the ipa's target description.
	* linux-i386-ipa.c (tdesc_i386_linux): Declare.
	(initialize_low_tracepoint): Set the ipa's target description.
	* linux-x86-low.c: Include tdesc.h.
	[__x86_64__] (is_64bit_tdesc): New.
	(ps_get_thread_area, x86_get_thread_area): Use it.
	(i386_cannot_store_register): Rename to ...
	(x86_cannot_store_register): ... this.  Use is_64bit_tdesc.
	(i386_cannot_fetch_register): Rename to ...
	(x86_cannot_fetch_register): ... this.  Use is_64bit_tdesc.
	(x86_fill_gregset, x86_store_gregset): Adjust register_size calls
	to new interface.
	(target_regsets): Rename to ...
	(x86_regsets): ... this.
	(x86_get_pc, x86_set_pc): Adjust register_size calls to new
	interface.
	(x86_siginfo_fixup): Use is_64bit_tdesc.
	[__x86_64__] (tdesc_amd64_linux, tdesc_amd64_avx_linux)
	(tdesc_x32_avx_linux, tdesc_x32_linux)
	(tdesc_i386_linux, tdesc_i386_mmx_linux, tdesc_i386_avx_linux):
	Declare.
	(x86_linux_update_xmltarget): Delete.
	(I386_LINUX_XSAVE_XCR0_OFFSET): Define.
	(have_ptrace_getfpxregs, have_ptrace_getregset): New.
	(AMD64_LINUX_USER64_CS): New.
	(x86_linux_read_description): New, based on
	x86_linux_update_xmltarget.
	(same_process_callback): New.
	(x86_arch_setup_process_callback): New.
	(x86_linux_update_xmltarget): New.
	(x86_regsets_info): New.
	(amd64_linux_regs_info): New.
	(i386_linux_usrregs_info): New.
	(i386_linux_regs_info): New.
	(x86_linux_regs_info): New.
	(x86_arch_setup): Reimplement.
	(x86_install_fast_tracepoint_jump_pad): Use is_64bit_tdesc.
	(x86_emit_ops): Ditto.
	(the_low_target): Adjust.  Install x86_linux_regs_info,
	x86_cannot_fetch_register, and x86_cannot_store_register.
	(initialize_low_arch): New.
	* linux-ia64-low.c (tdesc_ia64): Declare.
	(ia64_fetch_register): Adjust.
	(ia64_usrregs_info, regs_info): New globals.
	(ia64_regs_info): New function.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
	* linux-sparc-low.c (tdesc_sparc64): Declare.
	(sparc_fill_gregset_to_stack, sparc_store_gregset_from_stack):
	Adjust.
	(sparc_arch_setup): New function.
	(sparc_regsets_info, sparc_usrregs_info, regs_info): New globals.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
	* linux-ppc-low.c (tdesc_powerpc_32l, tdesc_powerpc_altivec32l)
	(tdesc_powerpc_cell32l, tdesc_powerpc_vsx32l)
	(tdesc_powerpc_isa205_32l, tdesc_powerpc_isa205_altivec32l)
	(tdesc_powerpc_isa205_vsx32l, tdesc_powerpc_e500l)
	(tdesc_powerpc_64l, tdesc_powerpc_altivec64l)
	(tdesc_powerpc_cell64l, tdesc_powerpc_vsx64l)
	(tdesc_powerpc_isa205_64l, tdesc_powerpc_isa205_altivec64l)
	(tdesc_powerpc_isa205_vsx64l): Declare.
	(ppc_cannot_store_register, ppc_collect_ptrace_register)
	(ppc_supply_ptrace_register, parse_spufs_run, ppc_get_pc)
	(ppc_set_pc, ppc_get_hwcap): Adjust.
	(ppc_usrregs_info): Forward declare.
	(!__powerpc64__) ppc_regmap_adjusted: New global.
	(ppc_arch_setup): Adjust to the current process'es target
	description.
	(ppc_fill_vsxregset, ppc_store_vsxregset, ppc_fill_vrregset)
	(ppc_store_vrregset, ppc_fill_evrregset, ppc_store_evrregse)
	(ppc_store_evrregset): Adjust.
	(target_regsets): Rename to ...
	(ppc_regsets): ... this, and make static.
	(ppc_usrregs_info, ppc_regsets_info, regs_info): New globals.
	(ppc_regs_info): New function.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
	* linux-s390-low.c (tdesc_s390_linux32, tdesc_s390_linux32v1)
	(tdesc_s390_linux32v2, tdesc_s390_linux64, tdesc_s390_linux64v1)
	(tdesc_s390_linux64v2, tdesc_s390x_linux64, tdesc_s390x_linux64v1)
	(tdesc_s390x_linux64v2): Declare.
	(s390_collect_ptrace_register, s390_supply_ptrace_register)
	(s390_fill_gregset, s390_store_last_break): Adjust.
	(target_regsets): Rename to ...
	(s390_regsets): ... this, and make static.
	(s390_get_pc, s390_set_pc): Adjust.
	(s390_get_hwcap): New target_desc parameter, and use it.
	[__s390x__] (have_hwcap_s390_high_gprs): New global.
	(s390_arch_setup): Adjust to set the current process'es target
	description.  Don't adjust the regmap.
	(s390_usrregs_info, s390_regsets_info, regs_info): New globals.
	[__s390x__] (s390_usrregs_info_3264, s390_regsets_info_3264)
	(regs_info_3264): New globals.
	(s390_regs_info): New function.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
	* linux-mips-low.c (tdesc_mips_linux, tdesc_mips_dsp_linux)
	(tdesc_mips64_linux, tdesc_mips64_dsp_linux): Declare.
	[__mips64] (init_registers_mips_linux)
	(init_registers_mips_dsp_linux): Delete defines.
	[__mips64] (tdesc_mips_linux, tdesc_mips_dsp_linux): New defines.
	(have_dsp): New global.
	(mips_read_description): New, based on mips_arch_setup.
	(mips_arch_setup): Reimplement.
	(get_usrregs_info): New function.
	(mips_cannot_fetch_register, mips_cannot_store_register)
	(mips_get_pc, mips_set_pc, mips_fill_gregset, mips_store_gregset)
	(mips_fill_fpregset, mips_store_fpregset): Adjust.
	(target_regsets): Rename to ...
	(mips_regsets): ... this, and make static.
	(mips_regsets_info, mips_dsp_usrregs_info, mips_usrregs_info)
	(dsp_regs_info, regs_info): New globals.
	(mips_regs_info): New function.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
	* linux-arm-low.c (tdesc_arm, tdesc_arm_with_iwmmxt)
	(tdesc_arm_with_vfpv2, tdesc_arm_with_vfpv3, tdesc_arm_with_neon):
	Declare.
	(arm_fill_vfpregset, arm_store_vfpregset): Adjust.
	(arm_read_description): New, with bits factored from
	arm_arch_setup.
	(arm_arch_setup): Reimplement.
	(target_regsets): Rename to ...
	(arm_regsets): ... this, and make static.
	(arm_regsets_info, arm_usrregs_info, regs_info): New globals.
	(arm_regs_info): New function.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
	* linux-m68k-low.c (tdesc_m68k): Declare.
	(target_regsets): Rename to ...
	(m68k_regsets): ... this, and make static.
	(m68k_regsets_info, m68k_usrregs_info, regs_info): New globals.
	(m68k_regs_info): New function.
	(m68k_arch_setup): New function.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
	* linux-sh-low.c (tdesc_sharch): Declare.
	(target_regsets): Rename to ...
	(sh_regsets): ... this, and make static.
	(sh_regsets_info, sh_usrregs_info, regs_info): New globals.
	(sh_regs_info, sh_arch_setup): New functions.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
	* linux-bfin-low.c (tdesc_bfin): Declare.
	(bfin_arch_setup): New function.
	(bfin_usrregs_info, regs_info): New globals.
	(bfin_regs_info): New function.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
	* linux-cris-low.c (tdesc_cris): Declare.
	(cris_arch_setup): New function.
	(cris_usrregs_info, regs_info): New globals.
	(cris_regs_info): New function.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
	* linux-cris-low.c (tdesc_crisv32): Declare.
	(cris_arch_setup): New function.
	(cris_regsets_info, cris_usrregs_info, regs_info): New globals.
	(cris_regs_info): New function.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
	* linux-m32r-low.c (tdesc_m32r): Declare.
	(m32r_arch_setup): New function.
	(m32r_usrregs_info, regs_info): New globals.
	(m32r_regs_info): Adjust.
	(initialize_low_arch): New function.
	* linux-tic6x-low.c (tdesc_tic6x_c64xp_linux)
	(tdesc_tic6x_c64x_linux, tdesc_tic6x_c62x_linux): Declare.
	(tic6x_usrregs_info): Forward declare.
	(tic6x_read_description): New function, based on ...
	(tic6x_arch_setup): ... this.  Reimplement.
	(target_regsets): Rename to ...
	(tic6x_regsets): ... this, and make static.
	(tic6x_regsets_info, tic6x_usrregs_info, regs_info): New globals.
	(tic6x_regs_info): New function.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
	* linux-xtensa-low.c (tdesc_xtensa): Declare.
	(xtensa_fill_gregset, xtensa_store_gregset): Adjust.
	(target_regsets): Rename to ...
	(xtensa_regsets): ... this, and make static.
	(xtensa_regsets_info, xtensa_usrregs_info, regs_info): New
	globals.
	(xtensa_arch_setup, xtensa_regs_info): New functions.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
	* linux-nios2-low.c (tdesc_nios2_linux): Declare.
	(nios2_arch_setup): Set the current process'es tdesc.
	(target_regsets): Rename to ...
	(nios2_regsets): ... this.
	(nios2_regsets_info, nios2_usrregs_info, regs_info): New globals.
	(nios2_regs_info): New function.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
        * linux-aarch64-low.c (tdesc_aarch64): Declare.
        (aarch64_arch_setup): Set the current process'es tdesc.
        (target_regsets): Rename to ...
        (aarch64_regsets): ... this.
        (aarch64_regsets_info, aarch64_usrregs_info, regs_info): New globals.
        (aarch64_regs_info): New function.
        (the_low_target): Adjust.
        (initialize_low_arch): New function.
	* linux-tile-low.c (tdesc_tilegx, tdesc_tilegx32): Declare
	globals.
	(target_regsets): Rename to ...
	(tile_regsets): ... this.
	(tile_regsets_info, tile_usrregs_info, regs_info): New globals.
	(tile_regs_info): New function.
	(tile_arch_setup): Set the current process'es tdesc.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
	* spu-low.c (tdesc_spu): Declare.
	(spu_create_inferior, spu_attach): Set the new process'es tdesc.
	* win32-arm-low.c (tdesc_arm): Declare.
	(arm_arch_setup): New function.
	(the_low_target): Install arm_arch_setup instead of
	init_registers_arm.
	* win32-i386-low.c (tdesc_i386, tdesc_amd64): Declare.
	(init_windows_x86): Rename to ...
	(i386_arch_setup): ... this.  Set `win32_tdesc'.
	(the_low_target): Adjust.
	* win32-low.c (win32_tdesc): New global.
	(child_add_thread): Don't create the thread cache here.
	(do_initial_child_stuff): Set the new process'es tdesc.
	* win32-low.h (struct target_desc): Forward declare.
	(win32_tdesc): Declare.
	* lynx-i386-low.c (tdesc_i386): Declare global.
	(lynx_i386_arch_setup): Set `lynx_tdesc'.
	* lynx-low.c (lynx_tdesc): New global.
	(lynx_add_process): Set the new process'es tdesc.
	* lynx-low.h (struct target_desc): Forward declare.
	(lynx_tdesc): Declare global.
	* lynx-ppc-low.c (tdesc_powerpc_32): Declare global.
	(lynx_ppc_arch_setup): Set `lynx_tdesc'.
	* nto-low.c (nto_tdesc): New global.
	(do_attach): Set the new process'es tdesc.
	* nto-low.h (struct target_desc): Forward declare.
	(nto_tdesc): Declare.
	* nto-x86-low.c (tdesc_i386): Declare.
	(nto_x86_arch_setup): Set `nto_tdesc'.

gdb/
2013-06-07  Pedro Alves  <palves@redhat.com>

	* regformats/regdat.sh: Output #include tdesc.h.  Make globals
	static.  Output a global target description pointer.
	(init_registers_${name}): Adjust to initialize a
	target description structure.
2013-06-07 10:46:59 +00:00
Joel Brobecker 28e7fd6234 Update years in copyright notice for the GDB files.
Two modifications:
  1. The addition of 2013 to the copyright year range for every file;
  2. The use of a single year range, instead of potentially multiple
     year ranges, as approved by the FSF.
2013-01-01 06:33:28 +00:00
Pedro Alves c14dfd3206 2012-03-28 Pedro Alves <palves@redhat.com>
* linux-ia64-low.c (ia64_regmap): Map IA64_EC_REGNUM to PT_AR_EC.
	(IA64_GR0_REGNUM, IA64_FR0_REGNUM)
	(IA64_FR1_REGNUM): New defines.
	(ia64_fetch_register): New.
	(the_low_target): Install it.
	* linux-low.h (struct linux_target_ops) <fetch_register>: New
	field.
	* linux-low.c (linux_fetch_registers): Try the
	the_low_target.fetch_register hook first.

	* linux-arm-low.c (the_low_target): Adjust.
	* linux-bfin-low.c (the_low_target): Adjust.
	* linux-cris-low.c (the_low_target): Adjust.
	* linux-crisv32-low.c (the_low_target): Adjust.
	* linux-m32r-low.c (the_low_target): Adjust.
	* linux-m68k-low.c (the_low_target): Adjust.
	* linux-mips-low.c (the_low_target): Adjust.
	* linux-ppc-low.c (the_low_target): Adjust.
	* linux-s390-low.c (the_low_target): Adjust.
	* linux-sh-low.c (the_low_target): Adjust.
	* linux-sparc-low.c (the_low_target): Adjust.
	* linux-tic6x-low.c (the_low_target): Adjust.
	* linux-x86-low.c (the_low_target): Adjust.
	* linux-xtensa-low.c (the_low_target): Adjust.
2012-03-28 18:30:01 +00:00
Maciej W. Rozycki 1faeff088b gdb/
* features/mips-dsp.xml: New file.
	* features/mips64-dsp.xml: New file.
	* features/mips-dsp-linux.xml: New file.
	* features/mips64-dsp-linux.xml: New file.
	* features/Makefile (WHICH): Add mips-dsp-linux and
	mips64-dsp-linux.
	(mips-dsp-expedite, mips64-dsp-expedite): New variables.
	* features/mips-dsp-linux.c: New file.
	* features/mips64-dsp-linux.c: New file.
	* regformats/mips-dsp-linux.dat: New file.
	* regformats/mips64-dsp-linux.dat: New file.
	* mips-linux-nat.c (mips_linux_register_addr): Handle DSP
	registers.
	(mips64_linux_register_addr): Likewise.
	(mips64_linux_regsets_fetch_registers): Likewise.
	(mips64_linux_regsets_store_registers): Likewise.
	(mips64_linux_fetch_registers): Update call to
	mips64_linux_regsets_fetch_registers.
	(mips64_linux_store_registers): Update call to
	mips64_linux_regsets_store_registers.
	(mips_linux_read_description): Probe for DSP registers.
	(_initialize_mips_linux_nat): Call initialize_tdesc_mips_dsp_linux
	and initialize_tdesc_mips64_dsp_linux.
	* mips-linux-tdep.c (supply_gregset, mips64_supply_gregset):
	Remove padding of no longer used embedded register slots.
	* mips-linux-tdep.h (DSP_BASE, DSP_CONTROL): New macros.
	(MIPS_RESTART_REGNUM): Redefine enum value.
	* mips-tdep.c (mips_generic_reg_names): Remove trailing null
	strings.
	(mips_tx39_reg_names): Likewise.
	(mips_linux_reg_names): New array of register names for Linux
	targets.
	(mips_register_name): Check for a null pointer in
	mips_processor_reg_names and return an empty string.
	(mips_register_type): Exclude embedded registers for the IRIX
	and Linux ABIs.
	(mips_pseudo_register_type): Likewise.  Use dynamic numbers to
	refer to FP registers, LO, HI, BadVAddr, Cause and PC.  Handle
	DSP registers.
	(mips_stab_reg_to_regnum): Handle DSP accumulators.
	(mips_dwarf_dwarf2_ecoff_reg_to_regnum): Likewise.
	(mips_gdbarch_init): Likewise.  Initialize internal register
	indices for the Linux ABI.  Use dynamic numbers to refer to
	registers, as applicable, while parsing the target description.
	* mips-tdep.h (struct mips_regnum): Add dspacc/dspctl offsets.

	gdb/doc/
	* gdb.texinfo (MIPS Features): Add org.gnu.gdb.mips.dsp.

	gdb/gdbserver/
	* linux-low.h (linux_target_ops): Add regset_bitmap member.
	* linux-low.c (use_linux_regsets): New macro.
	[!HAVE_LINUX_REGSETS] (regsets_fetch_inferior_registers): Likewise.
	[!HAVE_LINUX_REGSETS] (regsets_store_inferior_registers): Likewise.
	(linux_register_in_regsets): New function.
	(usr_fetch_inferior_registers): Skip registers covered by
	regsets.
	(usr_store_inferior_registers): Likewise.
	(usr_fetch_inferior_registers): New macro.
	(usr_store_inferior_registers): Likewise.
	(linux_fetch_registers): Handle mixed regset/non-regset targets.
	(linux_store_registers): Likewise.
	* linux-mips-low.c (init_registers_mips_dsp_linux): New
	prototype.
	(init_registers_mips64_dsp_linux): Likewise.
	(init_registers_mips_linux): New macro.
	(init_registers_mips_dsp_linux): Likewise.
	(mips_dsp_num_regs): Likewise.
	(DSP_BASE, DSP_CONTROL): New fallback macros.
	(mips_base_regs): New macro.
	(mips_regmap): Use it.  Fix the size.
	(mips_dsp_regmap): New variable.
	(mips_dsp_regset_bitmap): Likewise.
	(mips_arch_setup): New function.
	(mips_cannot_fetch_register): Use the_low_target.regmap rather
	than mips_regmap.
	(mips_cannot_store_register): Likewise.
	(the_low_target): Update .arch_setup, .num_regs and .regmap
	initializers.  Add .regset_bitmap initializer.
	* linux-arm-low.c (the_low_target): Add .regset_bitmap
	initializer.
	* linux-bfin-low.c (the_low_target): Likewise.
	* linux-cris-low.c (the_low_target): Likewise.
	* linux-crisv32-low.c (the_low_target): Likewise.
	* linux-ia64-low.c (the_low_target): Likewise.
	* linux-m32r-low.c (the_low_target): Likewise.
	* linux-m68k-low.c (the_low_target): Likewise.
	* linux-ppc-low.c (the_low_target): Likewise.
	* linux-s390-low.c (the_low_target): Likewise.
	* linux-sh-low.c (the_low_target): Likewise.
	* linux-sparc-low.c (the_low_target): Likewise.
	* linux-tic6x-low.c (the_low_target): Likewise.
	* linux-x86-low.c (the_low_target): Likewise.
	* linux-xtensa-low.c (the_low_target): Likewise.
	* configure.srv <mips*-*-linux*>: Add mips-dsp-linux.o and
	mips64-dsp-linux.o to srv_regobj.  Add mips-dsp-linux.xml,
	mips64-dsp-linux.xml, mips-dsp.xml and mips64-dsp.xml to
	srv_xmlfiles.
	* Makefile.in (mips-dsp-linux.o, mips-dsp-linux.c): New targets.
	(mips64-dsp-linux.o, mips64-dsp-linux.c): Likewise.

	gdb/testsuite/
	* gdb.xml/tdesc-regs.exp: Add "mips-dsp.xml" to the list of MIPS
	core registers.
2012-03-01 22:19:48 +00:00
Joel Brobecker 0b30217134 Copyright year update in most files of the GDB Project.
gdb/ChangeLog:

        Copyright year update in most files of the GDB Project.
2012-01-04 08:17:56 +00:00
Michael Snyder 493e2a69a4 2011-01-05 Michael Snyder <msnyder@msnyder-server.eng.vmware.com>
* gdbreplay.c: Shorten lines of >= 80 columns.
	* linux-low.c: Ditto.
	* linux-ppc-low.c: Ditto.
	* linux-s390-low.c: Ditto.
	* linux-sparc-low.c: Ditto.
	* linux-x86-low.c: Ditto.
	* linux-xtensa-low.c: Ditto.
	* mem-break.c: Ditto.
	* nto-low.c: Ditto.
	* regcache.h: Ditto.
	* remote-utils.c: Ditto.
	* server.c: Ditto.
	* server.h: Ditto.
	* thread-db.c: Ditto.
	* tracepoint.c: Ditto.
	* utils.c: Ditto.
	* win32-low.h: Ditto.
2011-01-06 00:14:09 +00:00
Joel Brobecker 7b6bb8daac run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
Ulrich Weigand 92b729071e * linux-ppc-low.c (ppc_arch_setup): Use private regcache to test MSR.
* linux-s390-low.c (ppc_arch_setup): Use private regcache to test PSW.
2010-06-14 13:53:04 +00:00
H.J. Lu 1570b33e44 Add x86 AVX support to gdbserver.
2010-04-07  H.J. Lu  <hongjiu.lu@intel.com>

	* Makefile.in (clean): Updated.
	(i386-avx.o): New.
	(i386-avx.c): Likewise.
	(i386-avx-linux.o): Likewise.
	(i386-avx-linux.c): Likewise.
	(amd64-avx.o): Likewise.
	(amd64-avx.c): Likewise.
	(amd64-avx-linux.o): Likewise.
	(amd64-avx-linux.c): Likewise.

	* configure.srv (srv_i386_regobj): Add i386-avx.o.
	(srv_i386_linux_regobj): Add i386-avx-linux.o.
	(srv_amd64_regobj): Add amd64-avx.o.
	(srv_amd64_linux_regobj): Add amd64-avx-linux.o.
	(srv_i386_32bit_xmlfiles): Add i386/32bit-avx.xml.
	(srv_i386_64bit_xmlfiles): Add i386/64bit-avx.xml.
	(srv_i386_xmlfiles): Add i386/i386-avx.xml.
	(srv_amd64_xmlfiles): Add i386/amd64-avx.xml.
	(srv_i386_linux_xmlfiles): Add i386/i386-avx-linux.xml.
	(srv_amd64_linux_xmlfiles): Add i386/amd64-avx-linux.xml.

	* i387-fp.c: Include "i386-xstate.h".
	(i387_xsave): New.
	(i387_cache_to_xsave): Likewise.
	(i387_xsave_to_cache): Likewise.
	(x86_xcr0): Likewise.

	* i387-fp.h (i387_cache_to_xsave): Likewise.
	(i387_xsave_to_cache): Likewise.
	(x86_xcr0): Likewise.

	* linux-arm-low.c (target_regsets): Initialize nt_type to 0.
	* linux-crisv32-low.c (target_regsets): Likewise.
	* linux-m68k-low.c (target_regsets): Likewise.
	* linux-mips-low.c (target_regsets): Likewise.
	* linux-ppc-low.c (target_regsets): Likewise.
	* linux-s390-low.c (target_regsets): Likewise.
	* linux-sh-low.c (target_regsets): Likewise.
	* linux-sparc-low.c (target_regsets): Likewise.
	* linux-xtensa-low.c (target_regsets): Likewise.

	* linux-low.c: Include <sys/uio.h>.
	(regsets_fetch_inferior_registers): Support nt_type.
	(regsets_store_inferior_registers): Likewise.
	(linux_process_qsupported): New.
	(linux_target_ops): Add linux_process_qsupported.

	* linux-low.h (regset_info): Add nt_type.
	(linux_target_ops): Add process_qsupported.

	* linux-x86-low.c: Include "i386-xstate.h", "elf/common.h"
	and <sys/uio.h>.
	(init_registers_i386_avx_linux): New.
	(init_registers_amd64_avx_linux): Likewise.
	(xmltarget_i386_linux_no_xml): Likewise.
	(xmltarget_amd64_linux_no_xml): Likewise.
	(PTRACE_GETREGSET): Likewise.
	(PTRACE_SETREGSET): Likewise.
	(x86_fill_xstateregset): Likewise.
	(x86_store_xstateregset): Likewise.
	(use_xml): Likewise.
	(x86_linux_update_xmltarget): Likewise.
	(x86_linux_process_qsupported): Likewise.
	(target_regsets): Add NT_X86_XSTATE entry and Initialize nt_type.
	(x86_arch_setup): Don't call init_registers_amd64_linux nor
	init_registers_i386_linux here.  Call
	x86_linux_update_xmltarget.
	(the_low_target): Add x86_linux_process_qsupported.

	* server.c (handle_query): Call target_process_qsupported.

	* target.h (target_ops): Add process_qsupported.
	(target_process_qsupported): New.
2010-04-07 18:49:46 +00:00
Pedro Alves 3be029c76b * linux-ppc-low.c (ppc_arch_setup): Adjust to regcache
changes.
2010-01-21 22:10:18 +00:00
Pedro Alves 442ea88105 * regcache.h (struct thread_info): Forward declare.
(struct regcache): New.
	(new_register_cache): Adjust prototype.
	(get_thread_regcache): Declare.
	(free_register_cache): Adjust prototype.
	(registers_to_string, registers_from_string): Ditto.
	(supply_register, supply_register_by_name, collect_register)
	(collect_register_as_string, collect_register_by_name): Ditto.
	* regcache.c (struct inferior_regcache_data): Delete.
	(get_regcache): Rename to ...
	(get_thread_regcache): ... this.  Adjust.  Switch inferior before
	fetching registers.
	(regcache_invalidate_one): Adjust.
	(regcache_invalidate): Fix prototype.
	(new_register_cache): Return the new register cache.
	(free_register_cache): Change prototype.
	(realloc_register_cache): Adjust.
	(registers_to_string): Change prototype to take a regcache.  Adjust.
	(registers_from_string): Ditto.
	(register_data): Ditto.
	(supply_register): Ditto.
	(supply_register_by_name): Ditto.
	(collect_register): Ditto.
	(collect_register_as_string): Ditto.
	(collect_register_by_name): Ditto.
	* server.c (process_serial_event): Adjust.
	* linux-low.h (regset_fill_func, regset_store_func): Change
	prototype.
	(get_pc, set_pc, collect_ptrace_register, supply_ptrace_register):
	Change prototype.
	* linux-low.c (get_stop_pc): Adjust.
	(check_removed_breakpoint): Adjust.
	(linux_wait_for_event): Adjust.
	(linux_resume_one_lwp): Adjust.
	(fetch_register): Add regcache parameter.  Adjust.
	(usr_store_inferior_registers): Ditto.
	(regsets_fetch_inferior_registers): Ditto.
	(regsets_store_inferior_registers): Ditto.
	(linux_fetch_registers, linux_store_registers): Ditto.
	* i387-fp.c (i387_cache_to_fsave): Change prototype to take a
	regcache.  Adjust.
	(i387_fsave_to_cache, i387_cache_to_fxsave, i387_fxsave_to_cache): Ditto.
	* i387-fp.h (i387_cache_to_fsave, i387_fsave_to_cache): Change
	prototype to take a regcache.
	(i387_cache_to_fxsave, i387_fxsave_to_cache): Ditto.
	* remote-utils.c (convert_ascii_to_int, outreg)
	(prepare_resume_reply): Change prototype to take a regcache.
	Adjust.
	* target.h (struct target_ops) <fetch_registers, store_registers>:
	Change prototype to take a regcache.
	(fetch_inferior_registers, store_inferior_registers): Change
	prototype to take a regcache.  Adjust.
	* proc-service.c (ps_lgetregs): Adjust.
	* linux-x86-low.c (x86_fill_gregset, x86_store_gregset)
	(x86_fill_fpregset, x86_store_fpregset, x86_fill_fpxregset)
	(x86_store_fpxregset, x86_get_pc, x86_set_pc): Change prototype to
	take a regcache.  Adjust.
	* linux-arm-low.c (arm_fill_gregset, arm_store_gregset)
	(arm_fill_wmmxregset, arm_store_wmmxregset, arm_fill_vfpregset)
	(arm_store_vfpregset, arm_get_pc, arm_set_pc):
	(arm_breakpoint_at): Change prototype to take a regcache.  Adjust.
	* linux-cris-low.c (cris_get_pc, cris_set_pc)
	(cris_cannot_fetch_register):
	(cris_breakpoint_at): Change prototype to take a regcache.
	Adjust.
	* linux-crisv32-low.c (cris_get_pc, cris_set_pc,
	cris_reinsert_addr, cris_write_data_breakpoint): Change prototype
	to take a regcache.  Adjust.
	(cris_breakpoint_at, cris_insert_point, cris_remove_point):
	Adjust.
	* linux-m32r-low.c (m32r_get_pc, m32r_set_pc): Change prototype to
	take a regcache.  Adjust.
	* linux-m68k-low.c (m68k_fill_gregset, m68k_store_gregset)
	(m68k_fill_fpregset, m68k_store_fpregset, m68k_get_pc,
	(m68k_set_pc): Change prototype to take a regcache.  Adjust.
	* linux-mips-low.c (mips_get_pc):
	(mips_set_pc): Change prototype to take a regcache.  Adjust.
	(mips_reinsert_addr): Adjust.
	(mips_collect_register): Change prototype to take a regcache.
	Adjust.
	(mips_supply_register):
	(mips_collect_register_32bit, mips_supply_register_32bit)
	(mips_fill_gregset, mips_store_gregset, mips_fill_fpregset)
	(mips_store_fpregset): Ditto.
	* linux-ppc-low.c (ppc_supply_ptrace_register, ppc_supply_ptrace_register):
	Ditto.
	(parse_spufs_run): Adjust.
	(ppc_get_pc, ppc_set_pc, ppc_fill_gregset, ppc_fill_vsxregset)
	(ppc_store_vsxregset, ppc_fill_vrregset, ppc_store_vrregset)
	(ppc_fill_evrregset, ppc_store_evrregset): Change prototype to
	take a regcache.  Adjust.
	* linux-s390-low.c (s390_collect_ptrace_register)
	(s390_supply_ptrace_register, s390_fill_gregset, s390_get_pc)
	(s390_set_pc): Change prototype to take a regcache.  Adjust.
	(s390_arch_setup): Adjust.
	* linux-sh-low.c (sh_get_pc, sh_breakpoint_at)
	(sh_fill_gregset): Change prototype to take a regcache.  Adjust.
	* linux-sparc-low.c (sparc_fill_gregset_to_stack)
	(sparc_fill_gregset, sparc_store_gregset_from_stack)
	(sparc_store_gregset, sparc_get_pc): Change prototype to take a
	regcache.  Adjust.
	(sparc_breakpoint_at): Adjust.
	* linux-xtensa-low.c (xtensa_fill_gregset):
	(xtensa_store_gregset):
	(xtensa_fill_xtregset, xtensa_store_xtregset, xtensa_get_pc)
	(xtensa_set_pc): Change prototype to take a regcache.  Adjust.
	* nto-low.c (nto_fetch_registers, nto_store_registers): Change
	prototype to take a regcache.  Adjust.
	* win32-arm-low.c (arm_fetch_inferior_register)
	(arm_store_inferior_register): Change prototype to take a
	regcache.  Adjust.
	* win32-i386-low.c (i386_fetch_inferior_register)
	(i386_store_inferior_register): Change prototype to take a
	regcache.  Adjust.
	* win32-low.c (child_fetch_inferior_registers)
	(child_store_inferior_registers): Change prototype to take a
	regcache.  Adjust.
	(win32_wait): Adjust.
	(win32_fetch_inferior_registers): Change prototype to take a
	regcache.  Adjust.
	(win32_store_inferior_registers): Adjust.
	* win32-low.h (struct win32_target_ops) <fetch_inferior_register,
	store_inferior_register>: Change prototype to take a regcache.
2010-01-20 22:55:38 +00:00
Joel Brobecker 4c38e0a4fc Update copyright year in most headers.
Automatic update by copyright.sh.
2010-01-01 07:32:07 +00:00
Ulrich Weigand 0b9ff2c0a4 * linux-ppc-low.c (INSTR_SC, NR_spu_run): Define.
(parse_spufs_run): New function.
	(ppc_get_pc, ppc_set_pc): Detect and handle SPU PC.
	(ppc_breakpoint_at): Handle SPU breakpoints.
2009-07-31 15:30:03 +00:00
Ulrich Weigand f4d9badee6 ChangeLog:
* features/Makefile: Allow sub-platform specific expedite settings.
	(WHICH): Add rs6000/powerpc-cell32l and rs6000/powerpc-cell64l.
	(rs6000/powerpc-cell32l-expedite): Define.
	(rs6000/powerpc-cell64l-expedite): Likewise.
	* features/rs6000/powerpc-cell32l.xml: New file.
	* features/rs6000/powerpc-cell64l.xml: New file.
	* features/rs6000/powerpc-cell32l.c: New generated file.
	* features/rs6000/powerpc-cell64l.c: New generated file.

	* regformats/rs6000/powerpc-cell32l.dat: New generated file.
	* regformats/rs6000/powerpc-cell64l.dat: New generated file.

	* config/djgpp/fnchange.lst: Add mappings for new files.

	* ppc-linux-tdep.h (tdesc_powerpc_cell32l): Add prototype.
	(tdesc_powerpc_cell64l): Likewise.
	* ppc-linux-tdep.c: Include "features/rs6000/powerpc-cell32l.c"
	and "features/rs6000/powerpc-cell64l.c".
	(_initialize_ppc_linux_tdep): Initialize target descriptions.
	(ppc_linux_spu_section): New function.
	(ppc_linux_core_read_description): Detect Cell/B.E. core files.
	* ppc-linux-nat.c (PPC_FEATURE_CELL): Define.
	(ppc_linux_read_description): Detect Cell/B.E. architecture.

	* rs6000-tdep.c (rs6000_gdbarch_init): Do not trust BFD wordsize
	if exec file is not PowerPC architecture.

gdbserver/ChangeLog:

	* configure.srv (powerpc*-*-linux*): Add powerpc-cell32l.o
	and powerpc-cell64l.o to srv_regobj.  Add rs6000/powerpc-cell32l.xml
	and rs6000/powerpc-cell64l.xml to srv_xmlfiles.
	* Makefile.in (powerpc-cell32l.o, powerpc-cell32l.c): New rules.
	(powerpc-cell64l.o, powerpc-cell64l.c): Likewise.
	(clean): Handle powerpc-cell32l.c and powerpc-cell64l.c.
	* linux-ppc-low.c (PPC_FEATURE_CELL): Define.
	(init_registers_powerpc_cell32l): Add prototype.
	(init_registers_powerpc_cell64l): Likewise.
	(ppc_arch_setup): Detect Cell/B.E. architecture.
2009-07-31 15:23:21 +00:00
Thiago Jung Bauermann f04c6d38e2 gdb/
Fix size of FPSCR in Power 7 processors.
	* ppc-linux-nat.c (PPC_FEATURE_ARCH_2_05): Remove #define.
	(PPC_FEATURE_HAS_DFP): New #define.
	(ppc_linux_read_description): Check for DFP feature instead of
	ISA 2.05 to decide on size of the FPSCR.

gdbserver/
	Fix size of FPSCR in Power 7 processors.
	* linux-ppc-low.c (PPC_FEATURE_ARCH_2_05): Remove #define.
	(PPC_FEATURE_HAS_DFP): New #define.
	(ppc_arch_setup): Check for DFP feature instead of ISA 2.05 to decide on
	size of the FPSCR.
2009-03-25 21:15:04 +00:00
Joel Brobecker 0fb0cc7590 Updated copyright notices for most files. 2009-01-03 05:58:08 +00:00
Thiago Jung Bauermann 2c4ad78125 gdb/
* features/Makefile (rs6000/powerpc-isa205-32l-expedite,
	rs6000/powerpc-isa205-altivec32l-expedite,
	powerpc-isa205-vsx32l-expedite, rs6000/powerpc-isa205-64l-expedite,
	rs6000/powerpc-isa205-altivec64l-expedite,
	powerpc-isa205-vsx64l-expedite): New variables.
	* regformats/rs6000/powerpc-isa205-32l.dat: Generate.
	* regformats/rs6000/powerpc-isa205-altivec32l.dat: Generate.
	* regformats/rs6000/powerpc-isa205-vsx32l.dat: Generate.
	* regformats/rs6000/powerpc-isa205-64l.dat: Generate.
	* regformats/rs6000/powerpc-isa205-altivec64l.dat: Generate.
	* regformats/rs6000/powerpc-isa205-vsx64l.dat: Generate.

gdbserver/
	* Makefile.in (powerpc-isa205-32l.o, powerpc-isa205-32l.c,
	powerpc-isa205-altivec32l.o, powerpc-isa205-altivec32l.c,
	powerpc-isa205-vsx32l.o, powerpc-isa205-vsx32l.c,
	powerpc-isa205-64l.o, powerpc-isa205-64l.c,
	powerpc-isa205-altivec64l.o, powerpc-isa205-altivec64l.c,
	powerpc-isa205-vsx64l.o, powerpc-isa205-vsx64l.c): New targets.
	* configure.srv (powerpc*-*-linux*): Add ISA 2.05 object files and
	XML target descriptions.
	* linux-ppc-low.c (ppc_arch_setup): Init registers with 64-bit FPSCR
	when inferior is running on an ISA 2.05 or later processor.  Add
	special case to return offset for full 64-bit slot of FPSCR when
	in 32-bits.
2008-11-18 21:48:48 +00:00
Luis Machado 677c5bb1ab * doc/gdb.texinfo (PowerPC): Mention Extended FPR's for POWER7.
(PowerPC features): Mention feature set for VSX registers.

	* gdbserver/Makefile.in: Add required vsx dependencies.

	* gdbserver/linux-ppc-low: Define PPC_FEATURE_HAS_VSX.
	Declare init_registers_powerpc_vsx32l.
	Declare init_registers_powerpc_vsx64l.
	Define PTRACE_GETVSXREGS and PTRACE_SETVSXREGS.
	(ppc_arch_setup): Check for VSX in hwcap.
	(ppc_fill_vsxregset): New function.
	(ppc_store_vsxregset): New function.
	Add new VSX entry in regset_info target_regsets.

	* gdbserver/configure.srv: Add new VSX dependencies.
2008-08-18 15:46:08 +00:00
Ulrich Weigand 76b233ddaa * linux-ppc-low.c (ppc_collect_ptrace_register): Clear buffer. 2008-05-29 11:53:12 +00:00
Ulrich Weigand 7284e1bed8 ChangeLog:
* Makefile.in (ppc_linux_tdep_h): New macro.
	(powerpc_32l_c, powerpc_altivec32_c, powerpc_altivec32l_c): Likewise.
	(powerpc_64l_c, powerpc_altivec64_c, powerpc_altivec64l_c): Likewise.
	(powerpc_e500l_c): Likewise.
	(ppc-linux-nat.o): Update dependencies.
	(ppc-linux-tdep.o): Update dependencies.
	(rs6000-tdep.o): Update dependencies.

	* ppc-tdep.h (ppc_linux_memory_remove_breakpoint): Remove.
	(ppc_linux_svr4_fetch_link_map_offsets): Remove.
	(ppc_linux_gregset, ppc_linux_fpregset): Move to ppc-linux-tdep.h
	(ppc_supply_reg, ppc_collect_reg): Add prototypes.
	(tdesc_powerpc_e500): Remove.

	* rs6000.c: Include "features/rs6000/powerpc-altivec32.c"
	and "features/rs6000/powerpc-altivec64.c".
	(ppc_supply_reg, ppc_collect_reg): Make global.
	(variants): Use tdesc_powerpc_32 for "powerpc" and
	tdesc_powerpc_altivec64 for "powerpc64".
	(_initialize_rs6000_tdep): Initialize AltiVec descriptions.

	* ppc-linux-tdep.h: New file.

	* ppc-linux-tdep.c: Include "ppc-linux-tdep.c".
	Include "features/rs6000/powerpc-32l.c".
	Include "features/rs6000/powerpc-altivec32l.c".
	Include "features/rs6000/powerpc-64l.c".
	Include "features/rs6000/powerpc-altivec64l.c".
	Include "features/rs6000/powerpc-e500l.c".
	(ppc_linux_supply_gregset): New function.
	(ppc_linux_collect_gregset): Handle orig_r3 and trap registers.
	(ppc32_linux_gregset): Use ppc_linux_supply_gregset.
	(ppc64_linux_gregset): Likewise.
	(ppc_linux_sigtramp_cache): Handle orig_r3 and trap registers.
	(ppc_linux_trap_reg_p): New function.
	(ppc_linux_write_pc): New function.
	(ppc_linux_core_read_description): New function.
	(ppc_linux_init_abi): Install ppc_linux_write_pc and
	ppc_linux_core_read_description.  Install orig_r3 and trap
	registers if present in the target description.
	(_initialize_ppc_linux_tdep): Initialize Linux target descriptions.

	* ppc-linux-nat.c: Include "ppc-linux-tdep.h".
	(PT_ORIG_R3, PT_TRAP): Define if necessary.
	(ppc_register_u_addr): Handle orig_r3 and trap registers.
	(fetch_ppc_registers): Likewise.
	(store_ppc_registers): Likewise.
	(store_register): Likewise.
	(ppc_linux_read_description): Check whether AltiVec is supported.
	Check whether inferior is 32-bit or 64-bit.  Return the appropriate
	Linux target description.

	* features/Makefile (WHICH): Use rs6000/powerpc-32l and
	rs6000/powerpc-altivec32l instead of rs6000/powerpc-32.
	Use rs6000/powerpc-64l and rs6000/powerpc-altivec64l instead
	of rs6000/powerpc-64.  Use rs6000/powerpc-e500l instead of
	rs6000/powerpc-e500.  Update -expedite variables accordingly.

	* features/rs6000/power-spe.xml: Use regnum 73 for "acc".
	* features/rs6000/powerpc-32.xml: Do not include power-altivec.xml.
	* features/rs6000/powerpc-64.xml: Do not include power-altivec.xml.
	* features/rs6000/powerpc-e500.c: Regenerate.
	* features/rs6000/powerpc-32.c: Regenerate.
	* features/rs6000/powerpc-64.c: Regenerate.

	* features/rs6000/power-linux.xml: New file.
	* features/rs6000/power64-linux.xml: New file.
	* features/rs6000/powerpc-32l.xml: New file.
	* features/rs6000/powerpc-altivec32l.xml: New file.
	* features/rs6000/powerpc-64l.xml: New file.
	* features/rs6000/powerpc-altivec64l.xml: New file.
	* features/rs6000/powerpc-e500l.xml: New file.
	* features/rs6000/powerpc-32l.c: New (generated) file.
	* features/rs6000/powerpc-altivec32l.c: New (generated) file.
	* features/rs6000/powerpc-64l.c: New (generated) file.
	* features/rs6000/powerpc-altivec64l.c: New (generated) file.
	* features/rs6000/powerpc-e500l.xml: New (generated) file.

	* regformats/reg-ppc.dat: Remove.
	* regformats/reg-ppc64.dat: Remove.
	* regformats/rs6000/powerpc-32.dat: Remove.
	* regformats/rs6000/powerpc-64.dat: Remove.
	* regformats/rs6000/powerpc-e500.dat: Remove.
	* regformats/rs6000/powerpc-32l.dat: New (generated) file.
	* regformats/rs6000/powerpc-altivec32l.dat: New (generated) file.
	* regformats/rs6000/powerpc-64l.dat: New (generated) file.
	* regformats/rs6000/powerpc-altivec64l.dat: New (generated) file.
	* regformats/rs6000/powerpc-e500l.dat: New (generated) file.

gdbserver/ChangeLog:

	* configure.srv (powerpc*-*-linux*): Set srv_regobj to
	powerpc-32l.o, powerpc-altivec32l.o, powerpc-e500l.o,
	powerpc-64l.o, and powerpc-altivec64l.o.
	Remove rs6000/powerpc-32.xml, rs6000/powerpc-64.xml, and
	rs6000/powerpc-e500.xml; add rs6000/powerpc-32l.xml,
	rs6000/powerpc-altivec32l.xml, rs6000/powerpc-e500l.xml,
	rs6000/powerpc-64l.xml, rs6000/powerpc-altivec64l.xml,
	rs6000/power-linux.xml, and rs6000/power64-linux.xml
	to srv_xmlfiles.

	* Makefile.in (reg-ppc.o, reg-ppc.c): Remove, replace by ...
	(powerpc-32l.o, powerpc-32l.c): ... these new rules.
	(powerpc-32.o, powerpc-32.c): Remove, replace by ...
	(powerpc-altivec32l.o, powerpc-altivec32l.c): ... these new rules.
	(powerpc-e500.o, powerpc-e500.c): Remove, replace by ...
	(powerpc-e500l.o, powerpc-e500l.c): ... these new rules.
	(reg-ppc64.o, reg-ppc64.c): Remove, replace by ...
	(powerpc-64l.o, powerpc-64l.c): ... these new rules.
	(powerpc-64.o, powerpc-64.c): Remove, replace by ...
	(powerpc-altivec64l.o, powerpc-altivec64l.c): ... these new rules.
	(clean): Update.

	* linux-ppc-low.c (init_registers_ppc): Remove, replace by ...
	(init_registers_powerpc_32l): ... this new prototype.
	(init_registers_powerpc_32): Remove, replace by ...
	(init_registers_powerpc_altivec32l): ... this new prototype.
	(init_registers_powerpc_e500): Remove, replace by ...
	(init_registers_powerpc_e500l): ... this new prototype.
	(init_registers_ppc64): Remove, replace by ...
	(init_registers_powerpc_64l): ... this new prototype.
	(init_registers_powerpc_64): Remove, replace by ...
	(init_registers_powerpc_altivec64l): ... this new prototype.
	(ppc_num_regs): Set to 73.
	(PT_ORIG_R3, PT_TRAP): Define if necessary.
	(ppc_regmap, ppc_regmap_e500): Add values for orig_r3 and trap.
	(ppc_cannot_store_register): Handle orig_r3 and trap.
	(ppc_arch_setup): Update init_registers_... calls.
	(ppc_fill_gregset): Handle orig_r3 and trap.

	* inferiors.c (clear_inferiors): Reset current_inferior.
2008-05-03 17:16:44 +00:00
Ulrich Weigand c9b2f845a5 * linux-ppc-low.c (ppc_arch_setup): Reset ppc_hwcap after the
initial call to init_register_ppc64.
2008-04-21 20:31:22 +00:00
Ulrich Weigand b6430ec3fe * configure.srv [powerpc64-*-linux*]: Remove powerpc-e500.o from
srv_regobj.  Remove rs6000/powerpc-e500.xml and rs6000/power-spe.xml
	from reg_xmlfiles.
	* linux-ppc-low.c: Include <elf.h>.
	(PPC_FEATURE_HAS_ALTIVEC, PPC_FEATURE_HAS_SPE): Define.
	(ppc_hwcap): New global variable.
	(ppc_regmap): Remove __SPE__ #ifdef sections.
	(ppc_regmap_e500): New global variable.
	(ppc_cannot_store_register): Update __SPE__ special case.
	(ppc_get_hwcap): New function.
	(ppc_arch_setup): Use it to determine whether inferior supports
	AltiVec or SPE registers.  Set the_low_target.regmap if appropriate.
	(ppc_fill_vrregset, ppc_store_vrregset): Define unconditionally.
	Do not access registers if target does not support AltiVec.
	(ppc_fill_evrregset, ppc_store_evrregset): Define unconditionally.
	Do not access registers if target does not support SPE.
	(target_regsets): Unconditionally include AltiVec and SPE regsets.
2008-04-17 21:22:41 +00:00
Ulrich Weigand 6fe305f7fb ChangeLog:
* regformats/reg-ppc.dat: Rename "ps" to "msr".
	* regformats/reg-ppc64.dat: Likewise.

gdbserver/ChangeLog:

	* configure.srv [powerpc64-*-linux*]: Add all files mentioned for
	powerpc-*-linux* to srv_regobj and reg_xmlfiles.
	* linux-ppc-low.c (ppc_get_pc): Support bi-arch operation.
	(ppc_set_pc): Likewise.
	(ppc_arch_setup): New function.
	(ppc_fill_gregset): Call ppc_collect_ptrace_register instead
	of collect_register.
	(the_low_target): Use ppc_arch_setup as arch_setup initializer.
2008-02-28 05:57:45 +00:00
Ulrich Weigand 5b0a002e22 * configure.srv [powerpc64-*-linux*]: Use linux-ppc-low.o
instead of linux-ppc64-low.o.
	* linux-ppc64-low.c: Remove file.
	* Makefile.in (SFILES): Remove linux-ppc64-low.c.
	(linux-ppc64-low.o): Remove rule.

	* linux-ppc-low.c (init_registers_ppc64): Add prototype.
	(init_registers_powerpc_64): Likewise.
	(ppc_regmap): Conditionally define depending on __powerpc64__.
	(ppc_cannot_store_register): Do not special-case "fpscr" when
	compiled on __powerpc64__.
	(ppc_collect_ptrace_register): New function.
	(ppc_supply_ptrace_register): New function.
	(ppc_breakpoint): Change type to "unsigned int".
	(ppc_breakpoint_at): Change type of "insn" to "unsigned int".
	(the_low_target): Conditionally provide initializers for the
	arch_setup member depending on __powerpc64__.  Install
	collect_ptrace_register and supply_ptrace_register members.
2008-02-28 05:55:55 +00:00
Ulrich Weigand d05b4ac3aa gdb/ChangeLog:
* regformats/regdat.sh: Rename init_registers function in
	generated file to init_registers_${name}.

	* regformats/reg-crisv32.dat: Set "name" to crisv32.
	* regformats/reg-ppc64.dat: Set "name" to ppc64.
	* regformats/reg-s390x.dat: Set "name" to s390x.

gdbserver/ChangeLog:

	* server.h (init_registers): Remove prototype.

	* linux-low.h (struct linux_target_ops): Add arch_setup field.
	* linux-low.c (initialize_low): Call the_low_target.arch_setup ()
	instead of init_registers ().
	* linux-arm-low.c (init_registers_arm): Add prototype.
	(init_registers_arm_with_iwmmxt): Likewise.
	(the_low_target): Add initializer for arch_setup field.
	* linux-cris-low.c (init_registers_cris): Add prototype.
	(the_low_target): Add initializer for arch_setup field.
	* linux-crisv32-low.c (init_registers_crisv32): Add prototype.
	(the_low_target): Add initializer for arch_setup field.
	* linux-i386-low.c (init_registers_i386_linux): Add prototype.
	(the_low_target): Add initializer for arch_setup field.
	* linux-ia64-low.c (init_registers_ia64): Add prototype.
	(the_low_target): Add initializer for arch_setup field.
	* linux-m32r-low.c (init_registers_m32r): Add prototype.
	(the_low_target): Add initializer for arch_setup field.
	* linux-m68k-low.c (init_registers_m68k): Add prototype.
	(the_low_target): Add initializer for arch_setup field.
	* linux-mips-low.c (init_registers_mips_linux): Add prototype.
	(init_registers_mips64_linux): Likewise.
	(the_low_target): Add initializer for arch_setup field.
	* linux-ppc-low.c (init_registers_ppc): Add prototype.
	(init_registers_powerpc_32, init_registers_powerpc_e500): Likewise.
	(the_low_target): Add initializer for arch_setup field.
	* linux-ppc64-low.c (init_registers_ppc64): Add prototype.
	(init_registers_powerpc_64): Likewise.
	(the_low_target): Add initializer for arch_setup field.
	* linux-s390-low.c (init_registers_s390): Add prototype.
	(init_registers_s390x): Likewise.
	(the_low_target): Add initializer for arch_setup field.
	* linux-sh-low.c (init_registers_sh): Add prototype.
	(the_low_target): Add initializer for arch_setup field.
	* linux-x86-64-low.c (init_registers_x86_64_linux): Add prototype.
	(the_low_target): Add initializer for arch_setup field.
	* linux-xtensa-low.c (init_registers_xtensa): Add prototype.
	(the_low_target): Add initializer for arch_setup field.

	* win32-low.h (struct win32_target_ops): Add arch_setup field.
	* win32-low.c (initialize_low): Call the_low_target.arch_setup ()
	instead of init_registers ().
	* win32-arm-low.c (init_registers_arm): Add prototype.
	(the_low_target): Add initializer for arch_setup field.
	* win32-i386-low.c (init_registers_i386): Add prototype.
	(the_low_target): Add initializer for arch_setup field.

	* spu-low.c (init_registers_spu): Add prototype.
	(initialize_low): Call initialie_registers_spu () instead of
	initialize_registers ().
2008-02-27 03:27:40 +00:00
Daniel Jacobowitz 9b254dd1ce Updated copyright notices for most files. 2008-01-01 22:53:26 +00:00
Daniel Jacobowitz 30ed0a8f0b * Makefile.in (clean): Remove new files.
(powerpc-32.o, powerpc-32.c, powerpc-e500.o, powerpc-e500.c)
	(powerpc-64.o, powerpc-64.c): New rules.
	* configure.srv: Use alternate register sets for powerpc64-*-linux*
	with AltiVec, powerpc-*-linux* with AltiVec, and powerpc-*-linux*
	with SPE.
	* linux-ppc-low.c (ppc_regmap): Do not fetch the FP registers for
	SPE targets.
	(ppc_cannot_store_register): Do not check for FPSCR for SPE targets.
	(PTRACE_GETVRREGS, PTRACE_SETVRREGS, SIZEOF_VRREGS, ppc_fill_vrregset)
	(ppc_store_vrregset, PTRACE_GETEVRREGS, PTRACE_SETEVRREGS)
	(struct gdb_evrregset_t, ppc_fill_evrregset, ppc_store_evrregset): New.
	(target_regsets): Add AltiVec and SPE register sets.
	* configure.ac: Check for AltiVec and SPE.
	* linux-ppc64-low.c (PTRACE_GETVRREGS, PTRACE_SETVRREGS, SIZEOF_VRREGS)
	(ppc_fill_vrregset, ppc_store_vrregset): New.
	(target_regsets): Add AltiVec register set.
	* configure: Regenerated.

	* features/Makefile (WHICH): Add PowerPC register definitions.
	(rs6000/powerpc-32-expedite, rs6000/powerpc-e500-expedite)
	(rs6000/powerpc-64-expedite): New macros.
	($(outdir)/%.dat): Handle subdirectories.
	* regformats/rs6000/powerpc-32.dat, regformats/rs6000/powerpc-64.dat,
	regformats/rs6000/powerpc-e500.dat: New generated files.
2007-10-15 19:58:17 +00:00
Joel Brobecker a9762ec78a Switch the license of all .c files to GPLv3.
Switch the license of all .h files to GPLv3.
        Switch the license of all .cc files to GPLv3.
2007-08-23 18:08:50 +00:00
Daniel Jacobowitz 6aba47ca06 Copyright updates for 2007. 2007-01-09 17:59:20 +00:00
Eli Zaretskii 6f0f660e7b * linux-arm-low.c:
* linux-cris-low.c:
	* inferiors.c:
	* i387-fp.h:
	* i387-fp.c:
	* gdbreplay.c:
	* regcache.c:
	* proc-service.c:
	* mem-break.h:
	* mem-break.c:
	* linux-x86-64-low.c:
	* linux-sh-low.c:
	* linux-s390-low.c:
	* linux-ppc64-low.c:
	* linux-ppc-low.c:
	* linux-mips-low.c:
	* linux-m68k-low.c:
	* linux-m32r-low.c:
	* linux-low.h:
	* linux-low.c:
	* linux-ia64-low.c:
	* linux-i386-low.c:
	* linux-crisv32-low.c:
	* thread-db.c:
	* terminal.h:
	* target.h:
	* target.c:
	* server.h:
	* server.c:
	* remote-utils.c:
	* regcache.h:
	* utils.c:
	* Makefile.in:
	* configure.ac:
	* gdbserver.1: Add (C) after Copyright.  Update the FSF
	address.
2005-12-23 18:11:55 +00:00
Daniel Jacobowitz e9d25b9800 * configure.ac: Define HAVE_LINUX_REGSETS even if PTRACE_GETREGS
is not available.  Define HAVE_PTRACE_GETREGS if it is.
	* config.in, configure: Regenerated.
	* configure.srv: Set srv_linux_regsets for PowerPC and PowerPC64.
	* linux-i386-low.c, linux-m68k-low.c: Update to use
	HAVE_PTRACE_GETREGS.
	* linux-low.c (regsets_fetch_inferior_registers)
	(regsets_store_inferior_registers): Only return 0 if we processed
	GENERAL_REGS.
	* linux-ppc-low.c (ppc_fill_gregset, target_regsets): New.
	* linux-ppc64-low.c (ppc_fill_gregset, target_regsets): New.
2005-07-13 15:21:02 +00:00
Daniel Jacobowitz f450004a28 * acconfig.h: Remove.
* configure.ac: Add a test for socklen_t.  Use three-argument
	AC_DEFINE throughout.
	* config.in: Regenerated using autoheader 2.59.
	* configure: Regenerated.

	* gdbreplay.c (socklen_t): Provide a default.
	(remote_open): Use socklen_t.
	* remote-utils.c (socklen_t): Provide a default.
	(remote_open): Use socklen_t.
	(convert_int_to_ascii, convert_ascii_to_int, decode_M_packet): Use
	unsigned char.

	* i387-fp.c (struct i387_fsave, struct i387_fxsave): Use unsigned
	char for buffers.
	* linux-low.c (linux_read_memory, linux_write_memory)
	(linux_read_auxv): Likewise.
	* mem-break.c (breakpoint_data, set_breakpoint_data, check_mem_read)
	(check_mem_write): Likewise.
	* mem-break.h (set_breakpoint_data, check_mem_read, check_mem_write):
	Likewise.
	* regcache.c (struct inferior_rgcache_data, registers_to_string)
	(registers_from_string, register_data): Likewise.
	* server.c (handle_query, main): Likewise.
	* server.h (convert_ascii_to_int, convert_int_to_ascii)
	(decode_M_packet): Likewise.
	* target.c (read_inferior_memory, write_inferior_memory): Likewise.
	* target.h (struct target_ops): Update read_memory, write_memory,
	and read_auxv.
	(read_inferior_memory, write_inferior_memory): Update.
	* linux-low.h (struct linux_target_ops): Change type of breakpoint
	to unsigned char *.
	* linux-arm-low.c, linux-cris-low.c, linux-crisv32-low.c,
	linux-i386-low.c, linux-m32r-low.c, linux-m68k-low.c,
	linux-mips-low.c, linux-ppc-low.c, linux-ppc64-low.c,
	linux-s390-low.c, linux-sh-low.c: Update for changes in
	read_inferior_memory and the_low_target->breakpoint.
2005-06-13 01:59:22 +00:00
Daniel Jacobowitz 0d62e5e807 2002-06-11 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/thread-db.c: New file.
	* gdbserver/proc-service.c: New file.
	* gdbserver/acinclude.m4: New file.
	* gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h,
	proc-service.o, and thread-db.o.
	(linux-low.o): Add USE_THREAD_DB.
	* gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T,
	HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN.
	* gdbserver/aclocal.m4: Regenerated.
	* gdbserver/config.in: Regenerated.
	* gdbserver/configure: Regenerated.
	* gdbserver/configure.in: Check for proc_service.h, sys/procfs.h,
	thread_db.h, and linux/elf.h headrs.
	Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and
	PRFPREGSET_T_BROKEN.  Introduce srv_thread_depfiles and USE_THREAD_DB.
	Check for -lthread_db and thread support.
	* gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS,
	PowerPC, and SuperH.
	* gdbserver/i387-fp.c: Constify arguments.
	* gdbserver/i387-fp.h: Likewise.
	* gdbserver/inferiors.c: (struct thread_info): Renamed from
	`struct inferior_info'.  Remove PID member.  Use generic inferior
	list header.  All uses updated.
	(inferiors, signal_pid): Removed.
	(all_threads): New variable.
	(get_thread): Define.
	(add_inferior_to_list): New function.
	(for_each_inferior): New function.
	(change_inferior_id): New function.
	(add_inferior): Removed.
	(remove_inferior): New function.
	(add_thread): New function.
	(free_one_thread): New function.
	(remove_thread): New function.
	(clear_inferiors): Use for_each_inferior and free_one_thread.
	(find_inferior): New function.
	(find_inferior_id): New function.
	(inferior_target_data): Update argument type.
	(set_inferior_target_data): Likewise.
	(inferior_regcache_data): Likewise.
	(set_inferior_regcache_data): Likewise.
	* gdbserver/linux-low.c (linux_bp_reinsert): Remove.
	(all_processes, stopping_threads, using_thrads)
	(struct pending_signals, debug_threads, pid_of): New.
	(inferior_pid): Replace with macro.
	(struct inferior_linux_data): Remove.
	(get_stop_pc, add_process): New functions.
	(linux_create_inferior): Restore SIGRTMIN+1 before calling exec.
	Use add_process and add_thread.
	(linux_attach_lwp): New function, based on old linux_attach.  Use
	add_process and add_thread.  Set stop_expected for new threads.
	(linux_attach): New function.
	(linux_kill_one_process): New function.
	(linux_kill): Kill all LWPs.
	(linux_thread_alive): Use find_inferior_id.
	(check_removed_breakpoints, status_pending_p): New functions.
	(linux_wait_for_process): Renamed from linux_wait_for_one_inferior.
	Update.  Use WNOHANG.  Wait for cloned processes also.  Update process
	struct for the found process.
	(linux_wait_for_event): New function.
	(linux_wait): Use it.  Support LWPs.
	(send_sigstop, wait_for_sigstop, stop_all_processes)
	(linux_resume_one_process, linux_continue_one_process): New functions.
	(linux_resume): Support LWPs.
	(REGISTER_RAW_SIZE): Remove.
	(fetch_register): Use register_size instead.  Call supply_register.
	(usr_store_inferior_registers): Likewise.  Call collect_register.
	Fix recursive case.
	(regsets_fetch_inferior_registers): Improve error message.
	(regsets_store_inferior_registers): Add debugging.
	(linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB.
	(unstopped_p, linux_signal_pid): New functions.
	(linux_target_ops): Add linux_signal_pid.
	(linux_init_signals): New function.
	(initialize_low): Call it.  Initialize using_threads.
	* gdbserver/regcache.c (inferior_regcache_data): Add valid
	flag.
	(get_regcache): Fetch registers lazily.  Add fetch argument
	and update all callers.
	(regcache_invalidate_one, regcache_invalidate): New
	functions.
	(new_register_cache): Renamed from create_register_cache.
	Return the new regcache.
	(free_register_cache): Change argument to a void *.
	(registers_to_string, registers_from_string): Call get_regcache
	with fetch flag set.
	(register_data): Make static.  Pass fetch flag to get_regcache.
	(supply_register): Call get_regcache with fetch flag clear.
	(collect_register): Call get_regcache with fetch flag set.
	(collect_register_as_string): New function.
	* gdbserver/regcache.h: Update.
	* gdbserver/remote-utils.c (putpkt): Flush after debug output and use
	stderr.
	Handle input interrupts while waiting for an ACK.
	(input_interrupt): Use signal_pid method.
	(getpkt): Flush after debug output and use stderr.
	(outreg): Use collect_register_as_string.
	(new_thread_notify, dead_thread_notify): New functions.
	(prepare_resume_reply): Check using_threads.  Set thread_from_wait
	and general_thread.
	(look_up_one_symbol): Flush after debug output.
	* gdbserver/server.c (step_thread, server_waiting): New variables.
	(start_inferior): Don't use signal_pid.  Update call to mywait.
	(attach_inferior): Update call to mywait.
	(handle_query): Handle qfThreadInfo and qsThreadInfo.
	(main): Don't fetch/store registers explicitly.  Use
	set_desired_inferior.  Support proposed ``Hs'' packet.  Update
	calls to mywait.
	* gdbserver/server.h: Update.
	(struct inferior_list, struct_inferior_list_entry): New.
	* gdbserver/target.c (set_desired_inferior): New.
	(write_inferior_memory): Constify.
	(mywait): New function.
	* gdbserver/target.h: Update.
	(struct target_ops): New signal_pid method.
	(mywait): Removed macro, added prototype.

	* gdbserver/linux-low.h (regset_func): Removed.
	(regset_fill_func, regset_store_func): New.
	(enum regset_type): New.
	(struct regset_info): Add type field.  Use new operation types.
	(struct linux_target_ops): stop_pc renamed to get_pc.
	Add decr_pc_after_break and breakpoint_at.
	(get_process, get_thread_proess, get_process_thread)
	(strut process_info, all_processes, linux_attach_lwp)
	(thread_db_init): New.

	* gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc,
	arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New.
	(the_low_target): Add new members.
	* gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset)
	(i386_store_fpxregset): Constify.
	(target_regsets): Add new kind identifier.
	(i386_get_pc): Renamed from i386_stop_pc.  Simplify.
	(i386_set_pc): Add debugging.
	(i386_breakpoint_at): New function.
	(the_low_target): Add new members.
	* gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc)
	(mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr)
	(mips_breakpoint_at): New.
	(the_low_target): Add new members.
	* gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc)
	(ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New.
	(the_low_target): Add new members.
	* gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc)
	(sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New.
	(the_low_target): Add new members.
	* gdbserver/linux-x86-64-low.c (target_regsets): Add new kind
	identifier.
2002-06-11 17:32:40 +00:00
Daniel Jacobowitz bc1e36cac4 2002-04-11 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/linux-low.c (usr_store_inferior_registers): Support
        registers which are allowed to fail to store.
        * gdbserver/linux-low.h (linux_target_ops): Likewise.
        * gdbserver/linux-ppc-low.c (ppc_regmap): Support FPSCR.
        (ppc_cannot_store_register): FPSCR may not be storable.
        * regformats/reg-ppc.dat: Support FPSCR.
2002-04-11 20:30:08 +00:00
Daniel Jacobowitz 2ec06d2e41 2002-04-09 Daniel Jacobowitz <drow@mvista.com>
* linux-low.h: Remove obsolete prototypes.
	(struct linux_target_ops): New.
	(extern the_low_target): New.
	* linux-low.c (num_regs, regmap): Remove declarations.
	(register_addr): Use the_low_target explicitly.
	(fetch_register): Likewise.
	(usr_fetch_inferior_registers): Likewise.
	(usr_store_inferior_registers): Likewise.
	* linux-arm-low.c (num_regs): Remove.
	(arm_num_regs): Define.
	(arm_regmap): Renamed from regmap, made static.
	(arm_cannot_fetch_register): Renamed from cannot_fetch_register,
	made static.
	(arm_cannot_store_register): Renamed from cannot_store_register,
	made static.
	(the_low_target): New.
	* linux-i386-low.c (num_regs): Remove.
	(i386_num_regs): Define.
	(i386_regmap): Renamed from regmap, made static.
	(i386_cannot_fetch_register): Renamed from cannot_fetch_register,
	made static.
	(i386_cannot_store_register): Renamed from cannot_store_register,
	made static.
	(the_low_target): New.
	* linux-ia64-low.c (num_regs): Remove.
	(ia64_num_regs): Define.
	(ia64_regmap): Renamed from regmap, made static.
	(ia64_cannot_fetch_register): Renamed from cannot_fetch_register,
	made static.
	(ia64_cannot_store_register): Renamed from cannot_store_register,
	made static.
	(the_low_target): New.
	* linux-m68k-low.c (num_regs): Remove.
	(m68k_num_regs): Define.
	(m68k_regmap): Renamed from regmap, made static.
	(m68k_cannot_fetch_register): Renamed from cannot_fetch_register,
	made static.
	(m68k_cannot_store_register): Renamed from cannot_store_register,
	made static.
	(the_low_target): New.
	* linux-mips-low.c (num_regs): Remove.
	(mips_num_regs): Define.
	(mips_regmap): Renamed from regmap, made static.
	(mips_cannot_fetch_register): Renamed from cannot_fetch_register,
	made static.
	(mips_cannot_store_register): Renamed from cannot_store_register,
	made static.
	(the_low_target): New.
	* linux-ppc-low.c (num_regs): Remove.
	(ppc_num_regs): Define.
	(ppc_regmap): Renamed from regmap, made static.
	(ppc_cannot_fetch_register): Renamed from cannot_fetch_register,
	made static.
	(ppc_cannot_store_register): Renamed from cannot_store_register,
	made static.
	(the_low_target): New.
	* linux-s390-low.c (num_regs): Remove.
	(s390_num_regs): Define.
	(s390_regmap): Renamed from regmap, made static.
	(s390_cannot_fetch_register): Renamed from cannot_fetch_register,
	made static.
	(s390_cannot_store_register): Renamed from cannot_store_register,
	made static.
	(the_low_target): New.
	* linux-sh-low.c (num_regs): Remove.
	(sh_num_regs): Define.
	(sh_regmap): Renamed from regmap, made static.
	(sh_cannot_fetch_register): Renamed from cannot_fetch_register,
	made static.
	(sh_cannot_store_register): Renamed from cannot_store_register,
	made static.
	(the_low_target): New.
	* linux-x86-64-low.c (x86_64_regmap): Renamed from regmap.
	(the_low_target): New.
2002-04-09 22:44:43 +00:00
Daniel Jacobowitz 58caa3dcdb 2002-02-27 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/acconfig.h: New file.
        * gdbserver/i387-fp.c: New file.
        * gdbserver/i387-fp.h: New file.
        * gdbserver/linux-x86-64.c: New file.
        * regformats/reg-x86-64.dat: New file.
        * configure.tgt: Add x86_64-*-linux* gdbserver support.
        & gdbserver/configure.srv: Add x86_64-*-linux* and regset support.
        * gdbserver/configure.in: Add support for regsets.
        * gdbserver/config.in: Regenerate.
        * gdbserver/configure: Regenerate.
        * gdbserver/Makefile.in: Likewise.  Add $(linux_low_h).
        * gdbserver/linux-low.h: New file.
        * gdbserver/linux-low.c: Include "linux-low.h".  Add support
        for regsets.
        * gdbserver/linux-arm-low.c: Include "linux-low.h".
        * gdbserver/linux-ia64-low.c: Include "linux-low.h".
        * gdbserver/linux-m68k-low.c: Include "linux-low.h".
        * gdbserver/linux-mips-low.c: Include "linux-low.h".
        * gdbserver/linux-ppc-low.c: Include "linux-low.h".
        * gdbserver/linux-sh-low.c: Include "linux-low.h".
        * gdbserver/linux-i386-low.c: Include "linux-low.h".  Include
        "i387-fp.h".  Add PTRACE_GETREGS and friends.
        * gdbserver/regcache.c (supply_register): New function.
        (supply_register_by_name): New function.
        (collect_register): New function.
        (collect_register_by_name): New function.
2002-02-27 07:07:49 +00:00
Daniel Jacobowitz 0a30fbc4cf 2002-02-14 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/Makefile.in: Add regformats directory to INCLUDE_CFLAGS,
        and remove unused $(INCLUDE_DIR).
        Add regcache.c to OBS.
        Add generated register protocol files to clean target.
        Update dependencies for new objects, obsolete old target code.

        * gdbserver/linux-low.c: Remove all platform-specific code to
        new files.  Remove various dead code.  Update to use regcache
        functionality.
        * gdbserver/remote-utils.c (fromhex): Add return statement
        to quiet warning.
        (putpkt): Dynamically allocate buf2 because PBUFSIZ is no longer
        constant.
        (input_interrupt): Add integer parameter to match prototype
        of a signal handler.
        (outreg): Use register_data ().
        (prepare_resume_reply): Use gdbserver_expedite_regs.
        * gdbserver/server.c (main): Dynamically allocate own_buf because
        PBUFSIZ is no longer constant.  Use registers_to_string () and
        registers_from_string ().
        * gdbserver/server.h: No longer include "defs.h".  Add prototypes
        for error (), fatal (), and warning ().  Update definition of
        PBUFSIZ to use regcache functionality.  Add include guard.
        * gdbserver/utils.c (fatal): Add missing ``const''.
        (warning): New function.

        * regformats/regdat.sh: Include "regcache.h" in generated files.
        Provide init_registers () function.
        * regformats/regdef.h: Add prototype for set_register_cache ().
        Add include guard.

        * gdbserver/linux-arm-low.c: New file.
        * gdbserver/linux-i386-low.c: New file.
        * gdbserver/linux-ia64-low.c: New file.
        * gdbserver/linux-m68k-low.c: New file.
        * gdbserver/linux-mips-low.c: New file.
        * gdbserver/linux-ppc-low.c: New file.
        * gdbserver/linux-sh-low.c: New file.

        * gdbserver/regcache.c: New file.
        * gdbserver/regcache.h: New file.

        * gdbserver/low-linux.c: Removed obsolete file.
2002-02-14 06:21:24 +00:00