1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
--- src/gnu/usr.bin/gdb/gdb/freebsd-nat.c.orig Mon Sep 14 15:49:02 1998
+++ src/gnu/usr.bin/gdb/gdb/freebsd-nat.c Thu May 23 21:36:56 2002
@@ -115,9 +115,7 @@
for (regno = 0; regno < NUM_REGS; regno++)
{
cregno = tregmap[regno];
- if (cregno == tFS)
- addr = offsetof (struct user, u_pcb) + offsetof (struct pcb, pcb_fs);
- else if (cregno == tGS)
+ if (cregno == tGS)
addr = offsetof (struct user, u_pcb) + offsetof (struct pcb, pcb_gs);
else
addr = offset + 4 * cregno;
@@ -136,7 +134,7 @@
error ("Register %s not found in core file.", reg_names[bad_reg]);
}
- addr = offsetof (struct user, u_pcb) + offsetof (struct pcb, pcb_savefpu);
+ addr = offsetof (struct user, u_pcb) + offsetof (struct pcb, pcb_save);
memcpy (&pcb_savefpu, core_reg_sect + addr, sizeof pcb_savefpu);
}
@@ -166,7 +164,6 @@
extern void print_387_status_word ();
#define fpstate save87
-#define U_FPSTATE(u) u.u_pcb.pcb_savefpu
static void
i387_to_double (from, to)
@@ -331,36 +328,14 @@
void
i386_float_info ()
{
- struct user u; /* just for address computations */
- int i;
- /* fpstate defined in <sys/user.h> */
+ struct fpstate fps;
struct fpstate *fpstatep;
- char buf[sizeof (struct fpstate) + 2 * sizeof (int)];
- unsigned int uaddr;
- char fpvalid;
- unsigned int rounded_addr;
- unsigned int rounded_size;
- /*extern int corechan;*/
- int skip;
extern int inferior_pid;
- uaddr = (char *)&U_FPSTATE(u) - (char *)&u;
if (inferior_pid != 0 && core_bfd == NULL)
{
- int *ip;
-
- rounded_addr = uaddr & -sizeof (int);
- rounded_size = (((uaddr + sizeof (struct fpstate)) - uaddr) +
- sizeof (int) - 1) / sizeof (int);
- skip = uaddr - rounded_addr;
-
- ip = (int *)buf;
- for (i = 0; i < rounded_size; i++)
- {
- *ip++ = ptrace (PT_READ_U, inferior_pid, (caddr_t)rounded_addr, 0);
- rounded_addr += sizeof (int);
- }
- fpstatep = (struct fpstate *)(buf + skip);
+ ptrace(PT_GETFPREGS, inferior_pid, (caddr_t)&fps, 0);
+ fpstatep = &fps;
}
else
fpstatep = &pcb_savefpu;
|