Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@mvista.com>
To: Mark Kettenis <kettenis@wins.uva.nl>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [PATCH] Make ARM/Linux build on current glibc
Date: Wed, 07 Nov 2001 08:22:00 -0000	[thread overview]
Message-ID: <20011117153753.A25243@nevyn.them.org> (raw)
In-Reply-To: <200110311818.f9VIIRb21686@delius.kettenis.local>

On Wed, Oct 31, 2001 at 07:18:27PM +0100, Mark Kettenis wrote:
> Ah, I missed `struct pt_regs'.  Hmm.  On the i386 ptrace(PTRACE_GETREGS,...)
> doesn't return a `struct pt_regs'.
> 
>    <sys/user.h> now uses a "struct user_regs" instead, but we can't use
>    that without requiring glibc 2.2.x.
> 
> I'd use elf_gregset_t instead.  Should work with all versions of glibc
> as long as you include <sys/procfs.h>.  Looks like there's quite a bit
> of redundant code in arm-linux-nat.c.  Feel free to clean it up a bit :-).

Committed the attached.  My testsuite runs are abysmal, because I crash
in one of the floatformat functions, but I think that may be an issue
with my tools - this machine has no hardware floating point, and yet
the compiler generated an FP move for ldexp()'s return value.


-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer

2001-11-17  Daniel Jacobowitz  <drow@mvista.com>

	* arm-linux-nat.c: Don't include <asm/ptrace.h>.
	(fetch_register): Use elf_gregset_t instead of struct pt_regs.
	(fetch_regs): Likewise.
	(store_register): Likewise.
	(store_regs): Likewise.

Index: gdb/arm-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-linux-nat.c,v
retrieving revision 1.13
diff -u -p -r1.13 arm-linux-nat.c
--- arm-linux-nat.c	2001/10/31 15:56:33	1.13
+++ arm-linux-nat.c	2001/11/17 16:33:00
@@ -29,8 +29,6 @@
 #include <sys/utsname.h>
 #include <sys/procfs.h>
 
-#include <asm/ptrace.h>
-
 /* Prototypes for supply_gregset etc. */
 #include "gregset.h"
 
@@ -397,7 +395,7 @@ static void
 fetch_register (int regno)
 {
   int ret, tid;
-  struct pt_regs regs;
+  elf_gregset_t regs;
 
   /* Get the thread id for the ptrace call.  */
   tid = GET_THREAD_ID (inferior_ptid);
@@ -410,20 +408,20 @@ fetch_register (int regno)
     }
 
   if (regno >= A1_REGNUM && regno < PC_REGNUM)
-    supply_register (regno, (char *) &regs.uregs[regno]);
+    supply_register (regno, (char *) &regs[regno]);
 
   if (PS_REGNUM == regno)
     {
       if (arm_apcs_32)
-        supply_register (PS_REGNUM, (char *) &regs.uregs[CPSR_REGNUM]);
+        supply_register (PS_REGNUM, (char *) &regs[CPSR_REGNUM]);
       else
-        supply_register (PS_REGNUM, (char *) &regs.uregs[PC_REGNUM]);
+        supply_register (PS_REGNUM, (char *) &regs[PC_REGNUM]);
     }
     
   if (PC_REGNUM == regno)
     { 
-      regs.uregs[PC_REGNUM] = ADDR_BITS_REMOVE (regs.uregs[PC_REGNUM]);
-      supply_register (PC_REGNUM, (char *) &regs.uregs[PC_REGNUM]);
+      regs[PC_REGNUM] = ADDR_BITS_REMOVE (regs[PC_REGNUM]);
+      supply_register (PC_REGNUM, (char *) &regs[PC_REGNUM]);
     }
 }
 
@@ -434,7 +432,7 @@ static void
 fetch_regs (void)
 {
   int ret, regno, tid;
-  struct pt_regs regs;
+  elf_gregset_t regs;
 
   /* Get the thread id for the ptrace call.  */
   tid = GET_THREAD_ID (inferior_ptid);
@@ -447,15 +445,15 @@ fetch_regs (void)
     }
 
   for (regno = A1_REGNUM; regno < PC_REGNUM; regno++)
-    supply_register (regno, (char *) &regs.uregs[regno]);
+    supply_register (regno, (char *) &regs[regno]);
 
   if (arm_apcs_32)
-    supply_register (PS_REGNUM, (char *) &regs.uregs[CPSR_REGNUM]);
+    supply_register (PS_REGNUM, (char *) &regs[CPSR_REGNUM]);
   else
-    supply_register (PS_REGNUM, (char *) &regs.uregs[PC_REGNUM]);
+    supply_register (PS_REGNUM, (char *) &regs[PC_REGNUM]);
 
-  regs.uregs[PC_REGNUM] = ADDR_BITS_REMOVE (regs.uregs[PC_REGNUM]);
-  supply_register (PC_REGNUM, (char *) &regs.uregs[PC_REGNUM]);
+  regs[PC_REGNUM] = ADDR_BITS_REMOVE (regs[PC_REGNUM]);
+  supply_register (PC_REGNUM, (char *) &regs[PC_REGNUM]);
 }
 
 /* Store all general registers of the process from the values in
@@ -465,7 +463,7 @@ static void
 store_register (int regno)
 {
   int ret, tid;
-  struct pt_regs regs;
+  elf_gregset_t regs;
   
   if (!register_valid[regno])
     return;
@@ -482,7 +480,7 @@ store_register (int regno)
     }
 
   if (regno >= A1_REGNUM && regno <= PC_REGNUM)
-    read_register_gen (regno, (char *) &regs.uregs[regno]);
+    read_register_gen (regno, (char *) &regs[regno]);
 
   ret = ptrace (PTRACE_SETREGS, tid, 0, &regs);
   if (ret < 0)
@@ -496,7 +494,7 @@ static void
 store_regs (void)
 {
   int ret, regno, tid;
-  struct pt_regs regs;
+  elf_gregset_t regs;
 
   /* Get the thread id for the ptrace call.  */
   tid = GET_THREAD_ID (inferior_ptid);
@@ -512,7 +510,7 @@ store_regs (void)
   for (regno = A1_REGNUM; regno <= PC_REGNUM; regno++)
     {
       if (register_valid[regno])
-	read_register_gen (regno, (char *) &regs.uregs[regno]);
+	read_register_gen (regno, (char *) &regs[regno]);
     }
 
   ret = ptrace (PTRACE_SETREGS, tid, 0, &regs);


      parent reply	other threads:[~2001-11-17 20:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-31  7:57 Daniel Jacobowitz
2001-10-31  7:58 ` Daniel Jacobowitz
     [not found]   ` <s3ilmhr23gn.fsf@debye.wins.uva.nl>
2001-10-31  8:20     ` Daniel Jacobowitz
2001-10-31 10:18       ` Mark Kettenis
2001-10-31 10:57         ` Daniel Jacobowitz
2001-11-07  8:22         ` Daniel Jacobowitz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20011117153753.A25243@nevyn.them.org \
    --to=drow@mvista.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=kettenis@wins.uva.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox