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. */
51 pyr_do_registers_info (regnum
)
54 /* On a pyr, we know a virtual register can always fit in an long.
55 Here (and elsewhere) we take advantage of that. Yuk. */
56 long raw_regs
[MAX_REGISTER_RAW_SIZE
*NUM_REGS
];
59 for (i
= 0 ; i
< 64 ; i
++) {
60 read_relative_register_raw_bytes(i
, raw_regs
+i
);
63 pyr_print_registers (raw_regs
, regnum
);
65 for (i
= 0; i
< NUM_REGS
; i
++)
67 long val
= raw_regs
[i
];
69 fputs_filtered (reg_names
[i
], stdout
);
71 print_spaces_filtered (6 - strlen (reg_names
[i
]), stdout
);
73 printf_filtered ("0");
75 printf_filtered ("0x%08x %d", val
, val
);
76 printf_filtered("\n");
80 /*** Debugging editions of various macros from m-pyr.h ****/
82 CORE_ADDR
frame_locals_address (frame
)
85 register int addr
= find_saved_register (frame
,CFP_REGNUM
);
86 register int result
= read_memory_integer (addr
, 4);
87 #ifdef PYRAMID_CONTROL_FRAME_DEBUGGING
89 "\t[[..frame_locals:%8x, %s= %x @%x fcfp= %x foo= %x\n\t gr13=%x pr13=%x tr13=%x @%x]]\n",
91 reg_names
[CFP_REGNUM
],
93 frame
->frame_cfp
, (CFP_REGNUM
),
96 read_register(13), read_register(29), read_register(61),
97 find_saved_register(frame
, 61));
98 #endif /* PYRAMID_CONTROL_FRAME_DEBUGGING */
100 /* FIXME: I thought read_register (CFP_REGNUM) should be the right answer;
101 or at least CFP_REGNUM relative to FRAME (ie, result).
102 There seems to be a bug in the way the innermost frame is set up. */
104 return ((frame
->next
) ? result
: frame
->frame_cfp
);
107 CORE_ADDR
frame_args_addr (frame
)
110 register int addr
= find_saved_register (frame
,CFP_REGNUM
);
111 register int result
= read_memory_integer (addr
, 4);
113 #ifdef PYRAMID_CONTROL_FRAME_DEBUGGING
115 "\t[[..frame_args:%8x, %s= %x @%x fcfp= %x r_r= %x\n\t gr13=%x pr13=%x tr13=%x @%x]]\n",
117 reg_names
[CFP_REGNUM
],
119 frame
->frame_cfp
, read_register(CFP_REGNUM
),
121 read_register(13), read_register(29), read_register(61),
122 find_saved_register(frame
, 61));
123 #endif /* PYRAMID_CONTROL_FRAME_DEBUGGING */
125 /* FIXME: I thought read_register (CFP_REGNUM) should be the right answer;
126 or at least CFP_REGNUM relative to FRAME (ie, result).
127 There seems to be a bug in the way the innermost frame is set up. */
128 return ((frame
->next
) ? result
: frame
->frame_cfp
);
This page took 0.033155 seconds and 4 git commands to generate.