1 /* Low level interface to ptrace, for GDB when running under Unix.
2 Copyright (C) 1988, 1989 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
20 /*** Prettier register printing. ***/
22 /* Print registers in the same format as pyramid's dbx, adb, sdb. */
23 pyr_print_registers(reg_buf
, regnum
)
30 for (regno
= 0; regno
< 16; regno
++) {
31 printf
/*_filtered*/ ("%6.6s: %8x %6.6s: %8x %6s: %8x %6s: %8x\n",
32 reg_names
[regno
], reg_buf
[regno
],
33 reg_names
[regno
+16], reg_buf
[regno
+16],
34 reg_names
[regno
+32], reg_buf
[regno
+32],
35 reg_names
[regno
+48], reg_buf
[regno
+48]);
37 usp
= ptrace (3, inferior_pid
,
38 ((char *)&u
.u_pcb
.pcb_usp
) -
40 ksp
= ptrace (3, inferior_pid
,
41 ((char *)&u
.u_pcb
.pcb_ksp
) -
43 printf
/*_filtered*/ ("\n%6.6s: %8x %6.6s: %8x (%08x) %6.6s %8x\n",
44 reg_names
[CSP_REGNUM
],reg_buf
[CSP_REGNUM
],
45 reg_names
[KSP_REGNUM
], reg_buf
[KSP_REGNUM
], ksp
,
49 /* Print the register regnum, or all registers if regnum is -1.
50 fpregs is currently ignored. */
52 pyr_do_registers_info (regnum
, fpregs
)
56 /* On a pyr, we know a virtual register can always fit in an long.
57 Here (and elsewhere) we take advantage of that. Yuk. */
58 long raw_regs
[MAX_REGISTER_RAW_SIZE
*NUM_REGS
];
61 for (i
= 0 ; i
< 64 ; i
++) {
62 read_relative_register_raw_bytes(i
, raw_regs
+i
);
65 pyr_print_registers (raw_regs
, regnum
);
67 for (i
= 0; i
< NUM_REGS
; i
++)
69 long val
= raw_regs
[i
];
71 fputs_filtered (reg_names
[i
], stdout
);
73 print_spaces_filtered (6 - strlen (reg_names
[i
]), stdout
);
75 printf_filtered ("0");
77 printf_filtered ("0x%08x %d", val
, val
);
78 printf_filtered("\n");
82 /*** Debugging editions of various macros from m-pyr.h ****/
84 CORE_ADDR
frame_locals_address (frame
)
87 register int addr
= find_saved_register (frame
,CFP_REGNUM
);
88 register int result
= read_memory_integer (addr
, 4);
89 #ifdef PYRAMID_CONTROL_FRAME_DEBUGGING
91 "\t[[..frame_locals:%8x, %s= %x @%x fcfp= %x foo= %x\n\t gr13=%x pr13=%x tr13=%x @%x]]\n",
93 reg_names
[CFP_REGNUM
],
95 frame
->frame_cfp
, (CFP_REGNUM
),
98 read_register(13), read_register(29), read_register(61),
99 find_saved_register(frame
, 61));
100 #endif /* PYRAMID_CONTROL_FRAME_DEBUGGING */
102 /* FIXME: I thought read_register (CFP_REGNUM) should be the right answer;
103 or at least CFP_REGNUM relative to FRAME (ie, result).
104 There seems to be a bug in the way the innermost frame is set up. */
106 return ((frame
->next
) ? result
: frame
->frame_cfp
);
109 CORE_ADDR
frame_args_addr (frame
)
112 register int addr
= find_saved_register (frame
,CFP_REGNUM
);
113 register int result
= read_memory_integer (addr
, 4);
115 #ifdef PYRAMID_CONTROL_FRAME_DEBUGGING
117 "\t[[..frame_args:%8x, %s= %x @%x fcfp= %x r_r= %x\n\t gr13=%x pr13=%x tr13=%x @%x]]\n",
119 reg_names
[CFP_REGNUM
],
121 frame
->frame_cfp
, read_register(CFP_REGNUM
),
123 read_register(13), read_register(29), read_register(61),
124 find_saved_register(frame
, 61));
125 #endif /* PYRAMID_CONTROL_FRAME_DEBUGGING */
127 /* FIXME: I thought read_register (CFP_REGNUM) should be the right answer;
128 or at least CFP_REGNUM relative to FRAME (ie, result).
129 There seems to be a bug in the way the innermost frame is set up. */
130 return ((frame
->next
) ? result
: frame
->frame_cfp
);