Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(336)

Unified Diff: gdb/m68klinux-nat.c

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gdb/m68k-tdep.c ('k') | gdb/m68klinux-tdep.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/m68klinux-nat.c
diff --git a/gdb/m68klinux-nat.c b/gdb/m68klinux-nat.c
index 60e4373c8c6f23f776f621d5842cf74b1c969362..3be7c14b1f885b624e680660847ca9611317db77 100644
--- a/gdb/m68klinux-nat.c
+++ b/gdb/m68klinux-nat.c
@@ -51,6 +51,13 @@
/* Prototypes for supply_gregset etc. */
#include "gregset.h"
+
+/* Defines ps_err_e, struct ps_prochandle. */
+#include "gdb_proc_service.h"
+
+#ifndef PTRACE_GET_THREAD_AREA
+#define PTRACE_GET_THREAD_AREA 25
+#endif
/* This table must line up with gdbarch_register_name in "m68k-tdep.c". */
static const int regmap[] =
@@ -69,20 +76,20 @@ static const int regmap[] =
#define NUM_GREGS (18)
#define MAX_NUM_REGS (NUM_GREGS + 11)
-int
+static int
getregs_supplies (int regno)
{
return 0 <= regno && regno < NUM_GREGS;
}
-int
+static int
getfpregs_supplies (int regno)
{
return M68K_FP0_REGNUM <= regno && regno <= M68K_FPI_REGNUM;
}
/* Does the current host support the GETREGS request? */
-int have_ptrace_getregs =
+static int have_ptrace_getregs =
#ifdef HAVE_PTRACE_GETREGS
1
#else
@@ -100,7 +107,7 @@ static void
fetch_register (struct regcache *regcache, int regno)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
- long regaddr;
+ long regaddr, val;
int i;
char buf[MAX_REGISTER_SIZE];
int tid;
@@ -115,7 +122,8 @@ fetch_register (struct regcache *regcache, int regno)
for (i = 0; i < register_size (gdbarch, regno); i += sizeof (long))
{
errno = 0;
- *(long *) &buf[i] = ptrace (PTRACE_PEEKUSER, tid, regaddr, 0);
+ val = ptrace (PTRACE_PEEKUSER, tid, regaddr, 0);
+ memcpy (&buf[i], &val, sizeof (long));
regaddr += sizeof (long);
if (errno != 0)
error (_("Couldn't read register %s (#%d): %s."),
@@ -153,7 +161,7 @@ static void
store_register (const struct regcache *regcache, int regno)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
- long regaddr;
+ long regaddr, val;
int i;
int tid;
char buf[MAX_REGISTER_SIZE];
@@ -173,7 +181,8 @@ store_register (const struct regcache *regcache, int regno)
for (i = 0; i < register_size (gdbarch, regno); i += sizeof (long))
{
errno = 0;
- ptrace (PTRACE_POKEUSER, tid, regaddr, *(long *) &buf[i]);
+ memcpy (&val, &buf[i], sizeof (long));
+ ptrace (PTRACE_POKEUSER, tid, regaddr, val);
regaddr += sizeof (long);
if (errno != 0)
error (_("Couldn't write register %s (#%d): %s."),
@@ -556,6 +565,24 @@ fetch_core_registers (struct regcache *regcache,
}
+/* Fetch the thread-local storage pointer for libthread_db. */
+
+ps_err_e
+ps_get_thread_area (const struct ps_prochandle *ph,
+ lwpid_t lwpid, int idx, void **base)
+{
+ if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) < 0)
+ return PS_ERR;
+
+ /* IDX is the bias from the thread pointer to the beginning of the
+ thread descriptor. It has to be subtracted due to implementation
+ quirks in libthread_db. */
+ *base = (char *) *base - idx;
+
+ return PS_OK;
+}
+
+
/* Register that we are able to handle GNU/Linux ELF core file
formats. */
« no previous file with comments | « gdb/m68k-tdep.c ('k') | gdb/m68klinux-tdep.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698