projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
change delegation for to_read_description
[deliverable/binutils-gdb.git]
/
gdb
/
hppa-linux-nat.c
diff --git
a/gdb/hppa-linux-nat.c
b/gdb/hppa-linux-nat.c
index dfc75b8e49453dbc30a4a62be6a84dd036b2fcee..58650d0eaced8b1a4143a15569d460f34b5c401f 100644
(file)
--- a/
gdb/hppa-linux-nat.c
+++ b/
gdb/hppa-linux-nat.c
@@
-1,12
+1,12
@@
/* Functions specific to running GDB native on HPPA running GNU/Linux.
/* Functions specific to running GDB native on HPPA running GNU/Linux.
- Copyright
2004, 2005
Free Software Foundation, Inc.
+ Copyright
(C) 2004-2014
Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version
2
of the License, or
+ the Free Software Foundation; either version
3
of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@
-15,14
+15,12
@@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
#include "gdbcore.h"
#include "regcache.h"
#include "defs.h"
#include "gdbcore.h"
#include "regcache.h"
-#include
"gdb_string.h"
+#include
<string.h>
#include "inferior.h"
#include "target.h"
#include "linux-nat.h"
#include "inferior.h"
#include "target.h"
#include "linux-nat.h"
@@
-31,15
+29,12
@@
#include <sys/ptrace.h>
#include <linux/version.h>
#include <sys/ptrace.h>
#include <linux/version.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,43)
-#include <asm/offset.h>
-#else
-#include <asm/offsets.h>
-#endif
+#include <asm/ptrace.h>
+#include "hppa-linux-offsets.h"
#include "hppa-tdep.h"
#include "hppa-tdep.h"
-/* Prototypes for supply_gregset etc. */
+/* Prototypes for supply_gregset etc.
*/
#include "gregset.h"
/* These must match the order of the register names.
#include "gregset.h"
/* These must match the order of the register names.
@@
-153,12
+148,12
@@
static const int u_offsets[] =
PT_FR31, PT_FR31 + 4,
};
PT_FR31, PT_FR31 + 4,
};
-CORE_ADDR
-register_addr (int regno, CORE_ADDR blockend)
+
static
CORE_ADDR
+
hppa_linux_
register_addr (int regno, CORE_ADDR blockend)
{
CORE_ADDR addr;
{
CORE_ADDR addr;
- if ((unsigned) regno >=
NUM_REGS
)
+ if ((unsigned) regno >=
ARRAY_SIZE (u_offsets)
)
error (_("Invalid register number %d."), regno);
if (u_offsets[regno] == -1)
error (_("Invalid register number %d."), regno);
if (u_offsets[regno] == -1)
@@
-216,52
+211,56
@@
static const int greg_map[] =
/* Fetch one register. */
static void
/* Fetch one register. */
static void
-fetch_register (int regno)
+fetch_register (
struct regcache *regcache,
int regno)
{
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
int tid;
int val;
int tid;
int val;
- if (
CANNOT_FETCH_REGISTER (
regno))
+ if (
gdbarch_cannot_fetch_register (gdbarch,
regno))
{
{
- regcache_raw_supply (
current_
regcache, regno, NULL);
+ regcache_raw_supply (regcache, regno, NULL);
return;
}
/* GNU/Linux LWP ID's are process ID's. */
return;
}
/* GNU/Linux LWP ID's are process ID's. */
- tid =
TIDGET
(inferior_ptid);
+ tid =
ptid_get_lwp
(inferior_ptid);
if (tid == 0)
if (tid == 0)
- tid =
PIDGET
(inferior_ptid); /* Not a threaded program. */
+ tid =
ptid_get_pid
(inferior_ptid); /* Not a threaded program. */
errno = 0;
errno = 0;
- val = ptrace (PTRACE_PEEKUSER, tid, register_addr (regno, 0), 0);
+ val = ptrace (PTRACE_PEEKUSER, tid,
hppa_linux_
register_addr (regno, 0), 0);
if (errno != 0)
if (errno != 0)
- error (_("Couldn't read register %s (#%d): %s."), REGISTER_NAME (regno),
+ error (_("Couldn't read register %s (#%d): %s."),
+ gdbarch_register_name (gdbarch, regno),
regno, safe_strerror (errno));
regno, safe_strerror (errno));
- regcache_raw_supply (
current_
regcache, regno, &val);
+ regcache_raw_supply (regcache, regno, &val);
}
}
-/* Store one register. */
+/* Store one register.
*/
static void
static void
-store_register (int regno)
+store_register (
const struct regcache *regcache,
int regno)
{
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
int tid;
int val;
int tid;
int val;
- if (
CANNOT_STORE_REGISTER (
regno))
+ if (
gdbarch_cannot_store_register (gdbarch,
regno))
return;
/* GNU/Linux LWP ID's are process ID's. */
return;
/* GNU/Linux LWP ID's are process ID's. */
- tid =
TIDGET
(inferior_ptid);
+ tid =
ptid_get_lwp
(inferior_ptid);
if (tid == 0)
if (tid == 0)
- tid =
PIDGET
(inferior_ptid); /* Not a threaded program. */
+ tid =
ptid_get_pid
(inferior_ptid); /* Not a threaded program. */
errno = 0;
errno = 0;
- regcache_raw_collect (
current_
regcache, regno, &val);
- ptrace (PTRACE_POKEUSER, tid, register_addr (regno, 0), val);
+ regcache_raw_collect (regcache, regno, &val);
+ ptrace (PTRACE_POKEUSER, tid,
hppa_linux_
register_addr (regno, 0), val);
if (errno != 0)
if (errno != 0)
- error (_("Couldn't write register %s (#%d): %s."), REGISTER_NAME (regno),
+ error (_("Couldn't write register %s (#%d): %s."),
+ gdbarch_register_name (gdbarch, regno),
regno, safe_strerror (errno));
}
regno, safe_strerror (errno));
}
@@
-270,16
+269,19
@@
store_register (int regno)
point registers depending upon the value of regno. */
static void
point registers depending upon the value of regno. */
static void
-hppa_linux_fetch_inferior_registers (int regno)
+hppa_linux_fetch_inferior_registers (struct target_ops *ops,
+ struct regcache *regcache, int regno)
{
if (-1 == regno)
{
{
if (-1 == regno)
{
- for (regno = 0; regno < NUM_REGS; regno++)
- fetch_register (regno);
+ for (regno = 0;
+ regno < gdbarch_num_regs (get_regcache_arch (regcache));
+ regno++)
+ fetch_register (regcache, regno);
}
else
{
}
else
{
- fetch_register (regno);
+ fetch_register (reg
cache, reg
no);
}
}
}
}
@@
-288,16
+290,19
@@
hppa_linux_fetch_inferior_registers (int regno)
point registers depending upon the value of regno. */
static void
point registers depending upon the value of regno. */
static void
-hppa_linux_store_inferior_registers (int regno)
+hppa_linux_store_inferior_registers (struct target_ops *ops,
+ struct regcache *regcache, int regno)
{
if (-1 == regno)
{
{
if (-1 == regno)
{
- for (regno = 0; regno < NUM_REGS; regno++)
- store_register (regno);
+ for (regno = 0;
+ regno < gdbarch_num_regs (get_regcache_arch (regcache));
+ regno++)
+ store_register (regcache, regno);
}
else
{
}
else
{
- store_register (regno);
+ store_register (reg
cache, reg
no);
}
}
}
}
@@
-305,15
+310,15
@@
hppa_linux_store_inferior_registers (int regno)
in *gregsetp. */
void
in *gregsetp. */
void
-supply_gregset (gdb_gregset_t *gregsetp)
+supply_gregset (
struct regcache *regcache, const
gdb_gregset_t *gregsetp)
{
int i;
{
int i;
-
greg_t *regp = (
elf_greg_t *) gregsetp;
+
const greg_t *regp = (const
elf_greg_t *) gregsetp;
for (i = 0; i < sizeof (greg_map) / sizeof (greg_map[0]); i++, regp++)
{
int regno = greg_map[i];
for (i = 0; i < sizeof (greg_map) / sizeof (greg_map[0]); i++, regp++)
{
int regno = greg_map[i];
- regcache_raw_supply (
current_
regcache, regno, regp);
+ regcache_raw_supply (regcache, regno, regp);
}
}
}
}
@@
-322,7
+327,8
@@
supply_gregset (gdb_gregset_t *gregsetp)
If regno is -1, do this for all registers. */
void
If regno is -1, do this for all registers. */
void
-fill_gregset (gdb_gregset_t *gregsetp, int regno)
+fill_gregset (const struct regcache *regcache,
+ gdb_gregset_t *gregsetp, int regno)
{
int i;
{
int i;
@@
-332,37
+338,37
@@
fill_gregset (gdb_gregset_t *gregsetp, int regno)
if (regno == -1 || regno == mregno)
{
if (regno == -1 || regno == mregno)
{
- regcache_raw_collect(
current_
regcache, mregno, &(*gregsetp)[i]);
+ regcache_raw_collect(regcache, mregno, &(*gregsetp)[i]);
}
}
}
/* Given a pointer to a floating point register set in /proc format
(fpregset_t *), unpack the register contents and supply them as gdb's
}
}
}
/* Given a pointer to a floating point register set in /proc format
(fpregset_t *), unpack the register contents and supply them as gdb's
- idea of the current floating point register values. */
+ idea of the current floating point register values.
*/
void
void
-supply_fpregset (gdb_fpregset_t *fpregsetp)
+supply_fpregset (
struct regcache *regcache, const
gdb_fpregset_t *fpregsetp)
{
int regi;
{
int regi;
- char *from;
+ c
onst c
har *from;
for (regi = 0; regi <= 31; regi++)
{
for (regi = 0; regi <= 31; regi++)
{
- from = (char *) &((*fpregsetp)[regi]);
- regcache_raw_supply (current_regcache, 2*regi + HPPA_FP0_REGNUM, from);
- regcache_raw_supply (current_regcache, 2*regi + HPPA_FP0_REGNUM + 1,
- from + 4);
+ from = (const char *) &((*fpregsetp)[regi]);
+ regcache_raw_supply (regcache, 2*regi + HPPA_FP0_REGNUM, from);
+ regcache_raw_supply (regcache, 2*regi + HPPA_FP0_REGNUM + 1, from + 4);
}
}
/* Given a pointer to a floating point register set in /proc format
(fpregset_t *), update the register specified by REGNO from gdb's idea
of the current floating point register set. If REGNO is -1, update
}
}
/* Given a pointer to a floating point register set in /proc format
(fpregset_t *), update the register specified by REGNO from gdb's idea
of the current floating point register set. If REGNO is -1, update
- them all. */
+ them all.
*/
void
void
-fill_fpregset (gdb_fpregset_t *fpregsetp, int regno)
+fill_fpregset (const struct regcache *regcache,
+ gdb_fpregset_t *fpregsetp, int regno)
{
int i;
{
int i;
@@
-373,7
+379,7
@@
fill_fpregset (gdb_fpregset_t *fpregsetp, int regno)
char *to = (char *) &((*fpregsetp)[(i - HPPA_FP0_REGNUM) / 2]);
if ((i - HPPA_FP0_REGNUM) & 1)
to += 4;
char *to = (char *) &((*fpregsetp)[(i - HPPA_FP0_REGNUM) / 2]);
if ((i - HPPA_FP0_REGNUM) & 1)
to += 4;
- regcache_raw_collect (
current_
regcache, i, to);
+ regcache_raw_collect (regcache, i, to);
}
}
}
}
@@
-392,5
+398,5
@@
_initialize_hppa_linux_nat (void)
t->to_store_registers = hppa_linux_store_inferior_registers;
/* Register the target. */
t->to_store_registers = hppa_linux_store_inferior_registers;
/* Register the target. */
- add_target (t);
+
linux_nat_
add_target (t);
}
}
This page took
0.02923 seconds
and
4
git commands to generate.