OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.3/] [gdb/] [d30v-tdep.c] - Blame information for rev 1773

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1181 sfurman
/* OBSOLETE /* Target-dependent code for Mitsubishi D30V, for GDB. */
2
/* OBSOLETE  */
3
/* OBSOLETE    Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software */
4
/* OBSOLETE    Foundation, Inc. */
5
/* OBSOLETE  */
6
/* OBSOLETE    This file is part of GDB. */
7
/* OBSOLETE  */
8
/* OBSOLETE    This program is free software; you can redistribute it and/or modify */
9
/* OBSOLETE    it under the terms of the GNU General Public License as published by */
10
/* OBSOLETE    the Free Software Foundation; either version 2 of the License, or */
11
/* OBSOLETE    (at your option) any later version. */
12
/* OBSOLETE  */
13
/* OBSOLETE    This program is distributed in the hope that it will be useful, */
14
/* OBSOLETE    but WITHOUT ANY WARRANTY; without even the implied warranty of */
15
/* OBSOLETE    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the */
16
/* OBSOLETE    GNU General Public License for more details. */
17
/* OBSOLETE  */
18
/* OBSOLETE    You should have received a copy of the GNU General Public License */
19
/* OBSOLETE    along with this program; if not, write to the Free Software */
20
/* OBSOLETE    Foundation, Inc., 59 Temple Place - Suite 330, */
21
/* OBSOLETE    Boston, MA 02111-1307, USA.  */ */
22
/* OBSOLETE  */
23
/* OBSOLETE /*  Contributed by Martin Hunt, hunt@cygnus.com */ */
24
/* OBSOLETE  */
25
/* OBSOLETE #include "defs.h" */
26
/* OBSOLETE #include "frame.h" */
27
/* OBSOLETE #include "obstack.h" */
28
/* OBSOLETE #include "symtab.h" */
29
/* OBSOLETE #include "gdbtypes.h" */
30
/* OBSOLETE #include "gdbcmd.h" */
31
/* OBSOLETE #include "gdbcore.h" */
32
/* OBSOLETE #include "gdb_string.h" */
33
/* OBSOLETE #include "value.h" */
34
/* OBSOLETE #include "inferior.h" */
35
/* OBSOLETE #include "dis-asm.h" */
36
/* OBSOLETE #include "symfile.h" */
37
/* OBSOLETE #include "objfiles.h" */
38
/* OBSOLETE #include "regcache.h" */
39
/* OBSOLETE  */
40
/* OBSOLETE #include "language.h" /* For local_hex_string() */ */
41
/* OBSOLETE  */
42
/* OBSOLETE void d30v_frame_find_saved_regs (struct frame_info *fi, */
43
/* OBSOLETE                              struct frame_saved_regs *fsr); */
44
/* OBSOLETE void d30v_frame_find_saved_regs_offsets (struct frame_info *fi, */
45
/* OBSOLETE                                      struct frame_saved_regs *fsr); */
46
/* OBSOLETE static void d30v_pop_dummy_frame (struct frame_info *fi); */
47
/* OBSOLETE static void d30v_print_flags (void); */
48
/* OBSOLETE static void print_flags_command (char *, int); */
49
/* OBSOLETE  */
50
/* OBSOLETE /* the following defines assume: */
51
/* OBSOLETE    fp is r61, lr is r62, sp is r63, and ?? is r22 */
52
/* OBSOLETE    if that changes, they will need to be updated */ */
53
/* OBSOLETE  */
54
/* OBSOLETE #define OP_MASK_ALL_BUT_RA  0x0ffc0fff      /* throw away Ra, keep the rest */ */
55
/* OBSOLETE  */
56
/* OBSOLETE #define OP_STW_SPM          0x054c0fc0      /* stw Ra, @(sp-) */ */
57
/* OBSOLETE #define OP_STW_SP_R0                0x05400fc0      /* stw Ra, @(sp,r0) */ */
58
/* OBSOLETE #define OP_STW_SP_IMM0              0x05480fc0      /* st Ra, @(sp, 0x0) */ */
59
/* OBSOLETE #define OP_STW_R22P_R0              0x05440580      /* stw Ra, @(r22+,r0) */ */
60
/* OBSOLETE  */
61
/* OBSOLETE #define OP_ST2W_SPM         0x056c0fc0      /* st2w Ra, @(sp-) */ */
62
/* OBSOLETE #define OP_ST2W_SP_R0               0x05600fc0      /* st2w Ra, @(sp, r0) */ */
63
/* OBSOLETE #define OP_ST2W_SP_IMM0             0x05680fc0      /* st2w Ra, @(sp, 0x0) */ */
64
/* OBSOLETE #define OP_ST2W_R22P_R0             0x05640580      /* st2w Ra, @(r22+, r0) */ */
65
/* OBSOLETE  */
66
/* OBSOLETE #define OP_MASK_OPCODE              0x0ffc0000      /* just the opcode, ign operands */ */
67
/* OBSOLETE #define OP_NOP                      0x00f00000      /* nop */ */
68
/* OBSOLETE  */
69
/* OBSOLETE #define OP_MASK_ALL_BUT_IMM 0x0fffffc0      /* throw away imm, keep the rest */ */
70
/* OBSOLETE #define OP_SUB_SP_IMM               0x082bffc0      /* sub sp,sp,imm */ */
71
/* OBSOLETE #define OP_ADD_SP_IMM               0x080bffc0      /* add sp,sp,imm */ */
72
/* OBSOLETE #define OP_ADD_R22_SP_IMM   0x08096fc0      /* add r22,sp,imm */ */
73
/* OBSOLETE #define OP_STW_FP_SP_IMM    0x054bdfc0      /* stw fp,@(sp,imm) */ */
74
/* OBSOLETE #define OP_OR_SP_R0_IMM             0x03abf000      /* or sp,r0,imm */ */
75
/* OBSOLETE  */
76
/* OBSOLETE /* no mask */ */
77
/* OBSOLETE #define OP_OR_FP_R0_SP              0x03a3d03f      /* or fp,r0,sp */ */
78
/* OBSOLETE #define OP_OR_FP_SP_R0              0x03a3dfc0      /* or fp,sp,r0 */ */
79
/* OBSOLETE #define OP_OR_FP_IMM0_SP    0x03abd03f      /* or fp,0x0,sp */ */
80
/* OBSOLETE #define OP_STW_FP_R22P_R0   0x0547d580      /* stw fp,@(r22+,r0) */ */
81
/* OBSOLETE #define OP_STW_LR_R22P_R0   0x0547e580      /* stw lr,@(r22+,r0) */ */
82
/* OBSOLETE  */
83
/* OBSOLETE #define OP_MASK_OP_AND_RB   0x0ff80fc0      /* keep op and rb,throw away rest */ */
84
/* OBSOLETE #define OP_STW_SP_IMM               0x05480fc0      /* stw Ra,@(sp,imm) */ */
85
/* OBSOLETE #define OP_ST2W_SP_IMM              0x05680fc0      /* st2w Ra,@(sp,imm) */ */
86
/* OBSOLETE #define OP_STW_FP_IMM               0x05480f40      /* stw Ra,@(fp,imm) */ */
87
/* OBSOLETE #define OP_STW_FP_R0                0x05400f40      /* stw Ra,@(fp,r0) */ */
88
/* OBSOLETE  */
89
/* OBSOLETE #define OP_MASK_FM_BIT              0x80000000 */
90
/* OBSOLETE #define OP_MASK_CC_BITS             0x70000000 */
91
/* OBSOLETE #define OP_MASK_SUB_INST    0x0fffffff */
92
/* OBSOLETE  */
93
/* OBSOLETE #define EXTRACT_RA(op)              (((op) >> 12) & 0x3f) */
94
/* OBSOLETE #define EXTRACT_RB(op)              (((op) >> 6) & 0x3f) */
95
/* OBSOLETE #define EXTRACT_RC(op)              (((op) & 0x3f) */
96
/* OBSOLETE #define EXTRACT_UIMM6(op)   ((op) & 0x3f) */
97
/* OBSOLETE #define EXTRACT_IMM6(op)    ((((int)EXTRACT_UIMM6(op)) << 26) >> 26) */
98
/* OBSOLETE #define EXTRACT_IMM26(op)   ((((op)&0x0ff00000) >> 2) | ((op)&0x0003ffff)) */
99
/* OBSOLETE #define EXTRACT_IMM32(opl, opr)     ((EXTRACT_UIMM6(opl) << 26)|EXTRACT_IMM26(opr)) */
100
/* OBSOLETE  */
101
/* OBSOLETE  */
102
/* OBSOLETE int */
103
/* OBSOLETE d30v_frame_chain_valid (CORE_ADDR chain, struct frame_info *fi) */
104
/* OBSOLETE { */
105
/* OBSOLETE #if 0 */
106
/* OBSOLETE   return ((chain) != 0 && (fi) != 0 && (fi)->return_pc != 0); */
107
/* OBSOLETE #else */
108
/* OBSOLETE   return ((chain) != 0 && (fi) != 0 && (fi)->frame <= chain); */
109
/* OBSOLETE #endif */
110
/* OBSOLETE } */
111
/* OBSOLETE  */
112
/* OBSOLETE /* Discard from the stack the innermost frame, restoring all saved */
113
/* OBSOLETE    registers.  */ */
114
/* OBSOLETE  */
115
/* OBSOLETE void */
116
/* OBSOLETE d30v_pop_frame (void) */
117
/* OBSOLETE { */
118
/* OBSOLETE   struct frame_info *frame = get_current_frame (); */
119
/* OBSOLETE   CORE_ADDR fp; */
120
/* OBSOLETE   int regnum; */
121
/* OBSOLETE   struct frame_saved_regs fsr; */
122
/* OBSOLETE   char raw_buffer[8]; */
123
/* OBSOLETE  */
124
/* OBSOLETE   fp = FRAME_FP (frame); */
125
/* OBSOLETE   if (frame->dummy) */
126
/* OBSOLETE     { */
127
/* OBSOLETE       d30v_pop_dummy_frame (frame); */
128
/* OBSOLETE       return; */
129
/* OBSOLETE     } */
130
/* OBSOLETE  */
131
/* OBSOLETE   /* fill out fsr with the address of where each */ */
132
/* OBSOLETE   /* register was stored in the frame */ */
133
/* OBSOLETE   get_frame_saved_regs (frame, &fsr); */
134
/* OBSOLETE  */
135
/* OBSOLETE   /* now update the current registers with the old values */ */
136
/* OBSOLETE   for (regnum = A0_REGNUM; regnum < A0_REGNUM + 2; regnum++) */
137
/* OBSOLETE     { */
138
/* OBSOLETE       if (fsr.regs[regnum]) */
139
/* OBSOLETE     { */
140
/* OBSOLETE       read_memory (fsr.regs[regnum], raw_buffer, 8); */
141
/* OBSOLETE       write_register_bytes (REGISTER_BYTE (regnum), raw_buffer, 8); */
142
/* OBSOLETE     } */
143
/* OBSOLETE     } */
144
/* OBSOLETE   for (regnum = 0; regnum < SP_REGNUM; regnum++) */
145
/* OBSOLETE     { */
146
/* OBSOLETE       if (fsr.regs[regnum]) */
147
/* OBSOLETE     { */
148
/* OBSOLETE       write_register (regnum, read_memory_unsigned_integer (fsr.regs[regnum], 4)); */
149
/* OBSOLETE     } */
150
/* OBSOLETE     } */
151
/* OBSOLETE   if (fsr.regs[PSW_REGNUM]) */
152
/* OBSOLETE     { */
153
/* OBSOLETE       write_register (PSW_REGNUM, read_memory_unsigned_integer (fsr.regs[PSW_REGNUM], 4)); */
154
/* OBSOLETE     } */
155
/* OBSOLETE  */
156
/* OBSOLETE   write_register (PC_REGNUM, read_register (LR_REGNUM)); */
157
/* OBSOLETE   write_register (SP_REGNUM, fp + frame->size); */
158
/* OBSOLETE   target_store_registers (-1); */
159
/* OBSOLETE   flush_cached_frames (); */
160
/* OBSOLETE } */
161
/* OBSOLETE  */
162
/* OBSOLETE static int */
163
/* OBSOLETE check_prologue (unsigned long op) */
164
/* OBSOLETE { */
165
/* OBSOLETE   /* add sp,sp,imm -- observed */ */
166
/* OBSOLETE   if ((op & OP_MASK_ALL_BUT_IMM) == OP_ADD_SP_IMM) */
167
/* OBSOLETE     return 1; */
168
/* OBSOLETE  */
169
/* OBSOLETE   /* add r22,sp,imm -- observed */ */
170
/* OBSOLETE   if ((op & OP_MASK_ALL_BUT_IMM) == OP_ADD_R22_SP_IMM) */
171
/* OBSOLETE     return 1; */
172
/* OBSOLETE  */
173
/* OBSOLETE   /* or  fp,r0,sp -- observed */ */
174
/* OBSOLETE   if (op == OP_OR_FP_R0_SP) */
175
/* OBSOLETE     return 1; */
176
/* OBSOLETE  */
177
/* OBSOLETE   /* nop */ */
178
/* OBSOLETE   if ((op & OP_MASK_OPCODE) == OP_NOP) */
179
/* OBSOLETE     return 1; */
180
/* OBSOLETE  */
181
/* OBSOLETE   /* stw  Ra,@(sp,r0) */ */
182
/* OBSOLETE   if ((op & OP_MASK_ALL_BUT_RA) == OP_STW_SP_R0) */
183
/* OBSOLETE     return 1; */
184
/* OBSOLETE  */
185
/* OBSOLETE   /* stw  Ra,@(sp,0x0) */ */
186
/* OBSOLETE   if ((op & OP_MASK_ALL_BUT_RA) == OP_STW_SP_IMM0) */
187
/* OBSOLETE     return 1; */
188
/* OBSOLETE  */
189
/* OBSOLETE   /* st2w  Ra,@(sp,r0) */ */
190
/* OBSOLETE   if ((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_SP_R0) */
191
/* OBSOLETE     return 1; */
192
/* OBSOLETE  */
193
/* OBSOLETE   /* st2w  Ra,@(sp,0x0) */ */
194
/* OBSOLETE   if ((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_SP_IMM0) */
195
/* OBSOLETE     return 1; */
196
/* OBSOLETE  */
197
/* OBSOLETE   /* stw fp, @(r22+,r0) -- observed */ */
198
/* OBSOLETE   if (op == OP_STW_FP_R22P_R0) */
199
/* OBSOLETE     return 1; */
200
/* OBSOLETE  */
201
/* OBSOLETE   /* stw r62, @(r22+,r0) -- observed */ */
202
/* OBSOLETE   if (op == OP_STW_LR_R22P_R0) */
203
/* OBSOLETE     return 1; */
204
/* OBSOLETE  */
205
/* OBSOLETE   /* stw Ra, @(fp,r0) -- observed */ */
206
/* OBSOLETE   if ((op & OP_MASK_ALL_BUT_RA) == OP_STW_FP_R0) */
207
/* OBSOLETE     return 1;                       /* first arg */ */
208
/* OBSOLETE  */
209
/* OBSOLETE   /* stw Ra, @(fp,imm) -- observed */ */
210
/* OBSOLETE   if ((op & OP_MASK_OP_AND_RB) == OP_STW_FP_IMM) */
211
/* OBSOLETE     return 1;                       /* second and subsequent args */ */
212
/* OBSOLETE  */
213
/* OBSOLETE   /* stw fp,@(sp,imm) -- observed */ */
214
/* OBSOLETE   if ((op & OP_MASK_ALL_BUT_IMM) == OP_STW_FP_SP_IMM) */
215
/* OBSOLETE     return 1; */
216
/* OBSOLETE  */
217
/* OBSOLETE   /* st2w Ra,@(r22+,r0) */ */
218
/* OBSOLETE   if ((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_R22P_R0) */
219
/* OBSOLETE     return 1; */
220
/* OBSOLETE  */
221
/* OBSOLETE   /* stw  Ra, @(sp-) */ */
222
/* OBSOLETE   if ((op & OP_MASK_ALL_BUT_RA) == OP_STW_SPM) */
223
/* OBSOLETE     return 1; */
224
/* OBSOLETE  */
225
/* OBSOLETE   /* st2w  Ra, @(sp-) */ */
226
/* OBSOLETE   if ((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_SPM) */
227
/* OBSOLETE     return 1; */
228
/* OBSOLETE  */
229
/* OBSOLETE   /* sub.?  sp,sp,imm */ */
230
/* OBSOLETE   if ((op & OP_MASK_ALL_BUT_IMM) == OP_SUB_SP_IMM) */
231
/* OBSOLETE     return 1; */
232
/* OBSOLETE  */
233
/* OBSOLETE   return 0; */
234
/* OBSOLETE } */
235
/* OBSOLETE  */
236
/* OBSOLETE CORE_ADDR */
237
/* OBSOLETE d30v_skip_prologue (CORE_ADDR pc) */
238
/* OBSOLETE { */
239
/* OBSOLETE   unsigned long op[2]; */
240
/* OBSOLETE   unsigned long opl, opr;   /* left / right sub operations */ */
241
/* OBSOLETE   unsigned long fm0, fm1;   /* left / right mode bits */ */
242
/* OBSOLETE   unsigned long cc0, cc1; */
243
/* OBSOLETE   unsigned long op1, op2; */
244
/* OBSOLETE   CORE_ADDR func_addr, func_end; */
245
/* OBSOLETE   struct symtab_and_line sal; */
246
/* OBSOLETE  */
247
/* OBSOLETE   /* If we have line debugging information, then the end of the */ */
248
/* OBSOLETE   /* prologue should the first assembly instruction of  the first source line */ */
249
/* OBSOLETE   if (find_pc_partial_function (pc, NULL, &func_addr, &func_end)) */
250
/* OBSOLETE     { */
251
/* OBSOLETE       sal = find_pc_line (func_addr, 0); */
252
/* OBSOLETE       if (sal.end && sal.end < func_end) */
253
/* OBSOLETE     return sal.end; */
254
/* OBSOLETE     } */
255
/* OBSOLETE  */
256
/* OBSOLETE   if (target_read_memory (pc, (char *) &op[0], 8)) */
257
/* OBSOLETE     return pc;                      /* Can't access it -- assume no prologue. */ */
258
/* OBSOLETE  */
259
/* OBSOLETE   while (1) */
260
/* OBSOLETE     { */
261
/* OBSOLETE       opl = (unsigned long) read_memory_integer (pc, 4); */
262
/* OBSOLETE       opr = (unsigned long) read_memory_integer (pc + 4, 4); */
263
/* OBSOLETE  */
264
/* OBSOLETE       fm0 = (opl & OP_MASK_FM_BIT); */
265
/* OBSOLETE       fm1 = (opr & OP_MASK_FM_BIT); */
266
/* OBSOLETE  */
267
/* OBSOLETE       cc0 = (opl & OP_MASK_CC_BITS); */
268
/* OBSOLETE       cc1 = (opr & OP_MASK_CC_BITS); */
269
/* OBSOLETE  */
270
/* OBSOLETE       opl = (opl & OP_MASK_SUB_INST); */
271
/* OBSOLETE       opr = (opr & OP_MASK_SUB_INST); */
272
/* OBSOLETE  */
273
/* OBSOLETE       if (fm0 && fm1) */
274
/* OBSOLETE     { */
275
/* OBSOLETE       /* long instruction (opl contains the opcode) */ */
276
/* OBSOLETE       if (((opl & OP_MASK_ALL_BUT_IMM) != OP_ADD_SP_IMM) &&         /* add sp,sp,imm */ */
277
/* OBSOLETE           ((opl & OP_MASK_ALL_BUT_IMM) != OP_ADD_R22_SP_IMM) &&     /* add r22,sp,imm */ */
278
/* OBSOLETE           ((opl & OP_MASK_OP_AND_RB) != OP_STW_SP_IMM) &&   /* stw Ra, @(sp,imm) */ */
279
/* OBSOLETE           ((opl & OP_MASK_OP_AND_RB) != OP_ST2W_SP_IMM))    /* st2w Ra, @(sp,imm) */ */
280
/* OBSOLETE         break; */
281
/* OBSOLETE     } */
282
/* OBSOLETE       else */
283
/* OBSOLETE     { */
284
/* OBSOLETE       /* short instructions */ */
285
/* OBSOLETE       if (fm0 && !fm1) */
286
/* OBSOLETE         { */
287
/* OBSOLETE           op1 = opr; */
288
/* OBSOLETE           op2 = opl; */
289
/* OBSOLETE         } */
290
/* OBSOLETE       else */
291
/* OBSOLETE         { */
292
/* OBSOLETE           op1 = opl; */
293
/* OBSOLETE           op2 = opr; */
294
/* OBSOLETE         } */
295
/* OBSOLETE       if (check_prologue (op1)) */
296
/* OBSOLETE         { */
297
/* OBSOLETE           if (!check_prologue (op2)) */
298
/* OBSOLETE             { */
299
/* OBSOLETE               /* if the previous opcode was really part of the prologue */ */
300
/* OBSOLETE               /* and not just a NOP, then we want to break after both instructions */ */
301
/* OBSOLETE               if ((op1 & OP_MASK_OPCODE) != OP_NOP) */
302
/* OBSOLETE                 pc += 8; */
303
/* OBSOLETE               break; */
304
/* OBSOLETE             } */
305
/* OBSOLETE         } */
306
/* OBSOLETE       else */
307
/* OBSOLETE         break; */
308
/* OBSOLETE     } */
309
/* OBSOLETE       pc += 8; */
310
/* OBSOLETE     } */
311
/* OBSOLETE   return pc; */
312
/* OBSOLETE } */
313
/* OBSOLETE  */
314
/* OBSOLETE static int end_of_stack; */
315
/* OBSOLETE  */
316
/* OBSOLETE /* Given a GDB frame, determine the address of the calling function's frame. */
317
/* OBSOLETE    This will be used to create a new GDB frame struct, and then */
318
/* OBSOLETE    INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame. */
319
/* OBSOLETE  */ */
320
/* OBSOLETE  */
321
/* OBSOLETE CORE_ADDR */
322
/* OBSOLETE d30v_frame_chain (struct frame_info *frame) */
323
/* OBSOLETE { */
324
/* OBSOLETE   struct frame_saved_regs fsr; */
325
/* OBSOLETE  */
326
/* OBSOLETE   d30v_frame_find_saved_regs (frame, &fsr); */
327
/* OBSOLETE  */
328
/* OBSOLETE   if (end_of_stack) */
329
/* OBSOLETE     return (CORE_ADDR) 0; */
330
/* OBSOLETE  */
331
/* OBSOLETE   if (frame->return_pc == IMEM_START) */
332
/* OBSOLETE     return (CORE_ADDR) 0; */
333
/* OBSOLETE  */
334
/* OBSOLETE   if (!fsr.regs[FP_REGNUM]) */
335
/* OBSOLETE     { */
336
/* OBSOLETE       if (!fsr.regs[SP_REGNUM] || fsr.regs[SP_REGNUM] == STACK_START) */
337
/* OBSOLETE     return (CORE_ADDR) 0; */
338
/* OBSOLETE  */
339
/* OBSOLETE       return fsr.regs[SP_REGNUM]; */
340
/* OBSOLETE     } */
341
/* OBSOLETE  */
342
/* OBSOLETE   if (!read_memory_unsigned_integer (fsr.regs[FP_REGNUM], 4)) */
343
/* OBSOLETE     return (CORE_ADDR) 0; */
344
/* OBSOLETE  */
345
/* OBSOLETE   return read_memory_unsigned_integer (fsr.regs[FP_REGNUM], 4); */
346
/* OBSOLETE } */
347
/* OBSOLETE  */
348
/* OBSOLETE static int next_addr, uses_frame; */
349
/* OBSOLETE static int frame_size; */
350
/* OBSOLETE  */
351
/* OBSOLETE static int */
352
/* OBSOLETE prologue_find_regs (unsigned long op, struct frame_saved_regs *fsr, */
353
/* OBSOLETE                 CORE_ADDR addr) */
354
/* OBSOLETE { */
355
/* OBSOLETE   int n; */
356
/* OBSOLETE   int offset; */
357
/* OBSOLETE  */
358
/* OBSOLETE   /* add sp,sp,imm -- observed */ */
359
/* OBSOLETE   if ((op & OP_MASK_ALL_BUT_IMM) == OP_ADD_SP_IMM) */
360
/* OBSOLETE     { */
361
/* OBSOLETE       offset = EXTRACT_IMM6 (op); */
362
/* OBSOLETE       /*next_addr += offset; */ */
363
/* OBSOLETE       frame_size += -offset; */
364
/* OBSOLETE       return 1; */
365
/* OBSOLETE     } */
366
/* OBSOLETE  */
367
/* OBSOLETE   /* add r22,sp,imm -- observed */ */
368
/* OBSOLETE   if ((op & OP_MASK_ALL_BUT_IMM) == OP_ADD_R22_SP_IMM) */
369
/* OBSOLETE     { */
370
/* OBSOLETE       offset = EXTRACT_IMM6 (op); */
371
/* OBSOLETE       next_addr = (offset - frame_size); */
372
/* OBSOLETE       return 1; */
373
/* OBSOLETE     } */
374
/* OBSOLETE  */
375
/* OBSOLETE   /* stw Ra, @(fp, offset) -- observed */ */
376
/* OBSOLETE   if ((op & OP_MASK_OP_AND_RB) == OP_STW_FP_IMM) */
377
/* OBSOLETE     { */
378
/* OBSOLETE       n = EXTRACT_RA (op); */
379
/* OBSOLETE       offset = EXTRACT_IMM6 (op); */
380
/* OBSOLETE       fsr->regs[n] = (offset - frame_size); */
381
/* OBSOLETE       return 1; */
382
/* OBSOLETE     } */
383
/* OBSOLETE  */
384
/* OBSOLETE   /* stw Ra, @(fp, r0) -- observed */ */
385
/* OBSOLETE   if ((op & OP_MASK_ALL_BUT_RA) == OP_STW_FP_R0) */
386
/* OBSOLETE     { */
387
/* OBSOLETE       n = EXTRACT_RA (op); */
388
/* OBSOLETE       fsr->regs[n] = (-frame_size); */
389
/* OBSOLETE       return 1; */
390
/* OBSOLETE     } */
391
/* OBSOLETE  */
392
/* OBSOLETE   /* or  fp,0,sp -- observed */ */
393
/* OBSOLETE   if ((op == OP_OR_FP_R0_SP) || */
394
/* OBSOLETE       (op == OP_OR_FP_SP_R0) || */
395
/* OBSOLETE       (op == OP_OR_FP_IMM0_SP)) */
396
/* OBSOLETE     { */
397
/* OBSOLETE       uses_frame = 1; */
398
/* OBSOLETE       return 1; */
399
/* OBSOLETE     } */
400
/* OBSOLETE  */
401
/* OBSOLETE   /* nop */ */
402
/* OBSOLETE   if ((op & OP_MASK_OPCODE) == OP_NOP) */
403
/* OBSOLETE     return 1; */
404
/* OBSOLETE  */
405
/* OBSOLETE   /* stw Ra,@(r22+,r0) -- observed */ */
406
/* OBSOLETE   if ((op & OP_MASK_ALL_BUT_RA) == OP_STW_R22P_R0) */
407
/* OBSOLETE     { */
408
/* OBSOLETE       n = EXTRACT_RA (op); */
409
/* OBSOLETE       fsr->regs[n] = next_addr; */
410
/* OBSOLETE       next_addr += 4; */
411
/* OBSOLETE       return 1; */
412
/* OBSOLETE     } */
413
/* OBSOLETE #if 0                               /* subsumed in pattern above */ */
414
/* OBSOLETE   /* stw fp,@(r22+,r0) -- observed */ */
415
/* OBSOLETE   if (op == OP_STW_FP_R22P_R0) */
416
/* OBSOLETE     { */
417
/* OBSOLETE       fsr->regs[FP_REGNUM] = next_addr;             /* XXX */ */
418
/* OBSOLETE       next_addr += 4; */
419
/* OBSOLETE       return 1; */
420
/* OBSOLETE     } */
421
/* OBSOLETE  */
422
/* OBSOLETE   /* stw r62,@(r22+,r0) -- observed */ */
423
/* OBSOLETE   if (op == OP_STW_LR_R22P_R0) */
424
/* OBSOLETE     { */
425
/* OBSOLETE       fsr->regs[LR_REGNUM] = next_addr; */
426
/* OBSOLETE       next_addr += 4; */
427
/* OBSOLETE       return 1; */
428
/* OBSOLETE     } */
429
/* OBSOLETE #endif */
430
/* OBSOLETE   /* st2w Ra,@(r22+,r0) -- observed */ */
431
/* OBSOLETE   if ((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_R22P_R0) */
432
/* OBSOLETE     { */
433
/* OBSOLETE       n = EXTRACT_RA (op); */
434
/* OBSOLETE       fsr->regs[n] = next_addr; */
435
/* OBSOLETE       fsr->regs[n + 1] = next_addr + 4; */
436
/* OBSOLETE       next_addr += 8; */
437
/* OBSOLETE       return 1; */
438
/* OBSOLETE     } */
439
/* OBSOLETE  */
440
/* OBSOLETE   /* stw  rn, @(sp-) */ */
441
/* OBSOLETE   if ((op & OP_MASK_ALL_BUT_RA) == OP_STW_SPM) */
442
/* OBSOLETE     { */
443
/* OBSOLETE       n = EXTRACT_RA (op); */
444
/* OBSOLETE       fsr->regs[n] = next_addr; */
445
/* OBSOLETE       next_addr -= 4; */
446
/* OBSOLETE       return 1; */
447
/* OBSOLETE     } */
448
/* OBSOLETE  */
449
/* OBSOLETE   /* st2w  Ra, @(sp-) */ */
450
/* OBSOLETE   else if ((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_SPM) */
451
/* OBSOLETE     { */
452
/* OBSOLETE       n = EXTRACT_RA (op); */
453
/* OBSOLETE       fsr->regs[n] = next_addr; */
454
/* OBSOLETE       fsr->regs[n + 1] = next_addr + 4; */
455
/* OBSOLETE       next_addr -= 8; */
456
/* OBSOLETE       return 1; */
457
/* OBSOLETE     } */
458
/* OBSOLETE  */
459
/* OBSOLETE   /* sub  sp,sp,imm */ */
460
/* OBSOLETE   if ((op & OP_MASK_ALL_BUT_IMM) == OP_SUB_SP_IMM) */
461
/* OBSOLETE     { */
462
/* OBSOLETE       offset = EXTRACT_IMM6 (op); */
463
/* OBSOLETE       frame_size += -offset; */
464
/* OBSOLETE       return 1; */
465
/* OBSOLETE     } */
466
/* OBSOLETE  */
467
/* OBSOLETE   /* st  rn, @(sp,0) -- observed */ */
468
/* OBSOLETE   if (((op & OP_MASK_ALL_BUT_RA) == OP_STW_SP_R0) || */
469
/* OBSOLETE       ((op & OP_MASK_ALL_BUT_RA) == OP_STW_SP_IMM0)) */
470
/* OBSOLETE     { */
471
/* OBSOLETE       n = EXTRACT_RA (op); */
472
/* OBSOLETE       fsr->regs[n] = (-frame_size); */
473
/* OBSOLETE       return 1; */
474
/* OBSOLETE     } */
475
/* OBSOLETE  */
476
/* OBSOLETE   /* st2w  rn, @(sp,0) */ */
477
/* OBSOLETE   if (((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_SP_R0) || */
478
/* OBSOLETE       ((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_SP_IMM0)) */
479
/* OBSOLETE     { */
480
/* OBSOLETE       n = EXTRACT_RA (op); */
481
/* OBSOLETE       fsr->regs[n] = (-frame_size); */
482
/* OBSOLETE       fsr->regs[n + 1] = (-frame_size) + 4; */
483
/* OBSOLETE       return 1; */
484
/* OBSOLETE     } */
485
/* OBSOLETE  */
486
/* OBSOLETE   /* stw fp,@(sp,imm) -- observed */ */
487
/* OBSOLETE   if ((op & OP_MASK_ALL_BUT_IMM) == OP_STW_FP_SP_IMM) */
488
/* OBSOLETE     { */
489
/* OBSOLETE       offset = EXTRACT_IMM6 (op); */
490
/* OBSOLETE       fsr->regs[FP_REGNUM] = (offset - frame_size); */
491
/* OBSOLETE       return 1; */
492
/* OBSOLETE     } */
493
/* OBSOLETE   return 0; */
494
/* OBSOLETE } */
495
/* OBSOLETE  */
496
/* OBSOLETE /* Put here the code to store, into a struct frame_saved_regs, the */
497
/* OBSOLETE    addresses of the saved registers of frame described by FRAME_INFO. */
498
/* OBSOLETE    This includes special registers such as pc and fp saved in special */
499
/* OBSOLETE    ways in the stack frame.  sp is even more special: the address we */
500
/* OBSOLETE    return for it IS the sp for the next frame. */ */
501
/* OBSOLETE void */
502
/* OBSOLETE d30v_frame_find_saved_regs (struct frame_info *fi, struct frame_saved_regs *fsr) */
503
/* OBSOLETE { */
504
/* OBSOLETE   CORE_ADDR fp, pc; */
505
/* OBSOLETE   unsigned long opl, opr; */
506
/* OBSOLETE   unsigned long op1, op2; */
507
/* OBSOLETE   unsigned long fm0, fm1; */
508
/* OBSOLETE   int i; */
509
/* OBSOLETE  */
510
/* OBSOLETE   fp = fi->frame; */
511
/* OBSOLETE   memset (fsr, 0, sizeof (*fsr)); */
512
/* OBSOLETE   next_addr = 0; */
513
/* OBSOLETE   frame_size = 0; */
514
/* OBSOLETE   end_of_stack = 0; */
515
/* OBSOLETE  */
516
/* OBSOLETE   uses_frame = 0; */
517
/* OBSOLETE  */
518
/* OBSOLETE   d30v_frame_find_saved_regs_offsets (fi, fsr); */
519
/* OBSOLETE  */
520
/* OBSOLETE   fi->size = frame_size; */
521
/* OBSOLETE  */
522
/* OBSOLETE   if (!fp) */
523
/* OBSOLETE     fp = read_register (SP_REGNUM); */
524
/* OBSOLETE  */
525
/* OBSOLETE   for (i = 0; i < NUM_REGS - 1; i++) */
526
/* OBSOLETE     if (fsr->regs[i]) */
527
/* OBSOLETE       { */
528
/* OBSOLETE     fsr->regs[i] = fsr->regs[i] + fp + frame_size; */
529
/* OBSOLETE       } */
530
/* OBSOLETE  */
531
/* OBSOLETE   if (fsr->regs[LR_REGNUM]) */
532
/* OBSOLETE     fi->return_pc = read_memory_unsigned_integer (fsr->regs[LR_REGNUM], 4); */
533
/* OBSOLETE   else */
534
/* OBSOLETE     fi->return_pc = read_register (LR_REGNUM); */
535
/* OBSOLETE  */
536
/* OBSOLETE   /* the SP is not normally (ever?) saved, but check anyway */ */
537
/* OBSOLETE   if (!fsr->regs[SP_REGNUM]) */
538
/* OBSOLETE     { */
539
/* OBSOLETE       /* if the FP was saved, that means the current FP is valid, */ */
540
/* OBSOLETE       /* otherwise, it isn't being used, so we use the SP instead */ */
541
/* OBSOLETE       if (uses_frame) */
542
/* OBSOLETE     fsr->regs[SP_REGNUM] = read_register (FP_REGNUM) + fi->size; */
543
/* OBSOLETE       else */
544
/* OBSOLETE     { */
545
/* OBSOLETE       fsr->regs[SP_REGNUM] = fp + fi->size; */
546
/* OBSOLETE       fi->frameless = 1; */
547
/* OBSOLETE       fsr->regs[FP_REGNUM] = 0; */
548
/* OBSOLETE     } */
549
/* OBSOLETE     } */
550
/* OBSOLETE } */
551
/* OBSOLETE  */
552
/* OBSOLETE void */
553
/* OBSOLETE d30v_frame_find_saved_regs_offsets (struct frame_info *fi, */
554
/* OBSOLETE                                 struct frame_saved_regs *fsr) */
555
/* OBSOLETE { */
556
/* OBSOLETE   CORE_ADDR fp, pc; */
557
/* OBSOLETE   unsigned long opl, opr; */
558
/* OBSOLETE   unsigned long op1, op2; */
559
/* OBSOLETE   unsigned long fm0, fm1; */
560
/* OBSOLETE   int i; */
561
/* OBSOLETE  */
562
/* OBSOLETE   fp = fi->frame; */
563
/* OBSOLETE   memset (fsr, 0, sizeof (*fsr)); */
564
/* OBSOLETE   next_addr = 0; */
565
/* OBSOLETE   frame_size = 0; */
566
/* OBSOLETE   end_of_stack = 0; */
567
/* OBSOLETE  */
568
/* OBSOLETE   pc = get_pc_function_start (fi->pc); */
569
/* OBSOLETE  */
570
/* OBSOLETE   uses_frame = 0; */
571
/* OBSOLETE   while (pc < fi->pc) */
572
/* OBSOLETE     { */
573
/* OBSOLETE       opl = (unsigned long) read_memory_integer (pc, 4); */
574
/* OBSOLETE       opr = (unsigned long) read_memory_integer (pc + 4, 4); */
575
/* OBSOLETE  */
576
/* OBSOLETE       fm0 = (opl & OP_MASK_FM_BIT); */
577
/* OBSOLETE       fm1 = (opr & OP_MASK_FM_BIT); */
578
/* OBSOLETE  */
579
/* OBSOLETE       opl = (opl & OP_MASK_SUB_INST); */
580
/* OBSOLETE       opr = (opr & OP_MASK_SUB_INST); */
581
/* OBSOLETE  */
582
/* OBSOLETE       if (fm0 && fm1) */
583
/* OBSOLETE     { */
584
/* OBSOLETE       /* long instruction */ */
585
/* OBSOLETE       if ((opl & OP_MASK_ALL_BUT_IMM) == OP_ADD_SP_IMM) */
586
/* OBSOLETE         { */
587
/* OBSOLETE           /* add sp,sp,n */ */
588
/* OBSOLETE           long offset = EXTRACT_IMM32 (opl, opr); */
589
/* OBSOLETE           frame_size += -offset; */
590
/* OBSOLETE         } */
591
/* OBSOLETE       else if ((opl & OP_MASK_ALL_BUT_IMM) == OP_ADD_R22_SP_IMM) */
592
/* OBSOLETE         { */
593
/* OBSOLETE           /* add r22,sp,offset */ */
594
/* OBSOLETE           long offset = EXTRACT_IMM32 (opl, opr); */
595
/* OBSOLETE           next_addr = (offset - frame_size); */
596
/* OBSOLETE         } */
597
/* OBSOLETE       else if ((opl & OP_MASK_OP_AND_RB) == OP_STW_SP_IMM) */
598
/* OBSOLETE         { */
599
/* OBSOLETE           /* st Ra, @(sp,imm) */ */
600
/* OBSOLETE           long offset = EXTRACT_IMM32 (opl, opr); */
601
/* OBSOLETE           short n = EXTRACT_RA (opl); */
602
/* OBSOLETE           fsr->regs[n] = (offset - frame_size); */
603
/* OBSOLETE         } */
604
/* OBSOLETE       else if ((opl & OP_MASK_OP_AND_RB) == OP_ST2W_SP_IMM) */
605
/* OBSOLETE         { */
606
/* OBSOLETE           /* st2w Ra, @(sp,offset) */ */
607
/* OBSOLETE           long offset = EXTRACT_IMM32 (opl, opr); */
608
/* OBSOLETE           short n = EXTRACT_RA (opl); */
609
/* OBSOLETE           fsr->regs[n] = (offset - frame_size); */
610
/* OBSOLETE           fsr->regs[n + 1] = (offset - frame_size) + 4; */
611
/* OBSOLETE         } */
612
/* OBSOLETE       else if ((opl & OP_MASK_ALL_BUT_IMM) == OP_OR_SP_R0_IMM) */
613
/* OBSOLETE         { */
614
/* OBSOLETE           end_of_stack = 1; */
615
/* OBSOLETE         } */
616
/* OBSOLETE       else */
617
/* OBSOLETE         break; */
618
/* OBSOLETE     } */
619
/* OBSOLETE       else */
620
/* OBSOLETE     { */
621
/* OBSOLETE       /* short instructions */ */
622
/* OBSOLETE       if (fm0 && !fm1) */
623
/* OBSOLETE         { */
624
/* OBSOLETE           op2 = opl; */
625
/* OBSOLETE           op1 = opr; */
626
/* OBSOLETE         } */
627
/* OBSOLETE       else */
628
/* OBSOLETE         { */
629
/* OBSOLETE           op1 = opl; */
630
/* OBSOLETE           op2 = opr; */
631
/* OBSOLETE         } */
632
/* OBSOLETE       if (!prologue_find_regs (op1, fsr, pc) || !prologue_find_regs (op2, fsr, pc)) */
633
/* OBSOLETE         break; */
634
/* OBSOLETE     } */
635
/* OBSOLETE       pc += 8; */
636
/* OBSOLETE     } */
637
/* OBSOLETE  */
638
/* OBSOLETE #if 0 */
639
/* OBSOLETE   fi->size = frame_size; */
640
/* OBSOLETE  */
641
/* OBSOLETE   if (!fp) */
642
/* OBSOLETE     fp = read_register (SP_REGNUM); */
643
/* OBSOLETE  */
644
/* OBSOLETE   for (i = 0; i < NUM_REGS - 1; i++) */
645
/* OBSOLETE     if (fsr->regs[i]) */
646
/* OBSOLETE       { */
647
/* OBSOLETE     fsr->regs[i] = fsr->regs[i] + fp + frame_size; */
648
/* OBSOLETE       } */
649
/* OBSOLETE  */
650
/* OBSOLETE   if (fsr->regs[LR_REGNUM]) */
651
/* OBSOLETE     fi->return_pc = read_memory_unsigned_integer (fsr->regs[LR_REGNUM], 4); */
652
/* OBSOLETE   else */
653
/* OBSOLETE     fi->return_pc = read_register (LR_REGNUM); */
654
/* OBSOLETE  */
655
/* OBSOLETE   /* the SP is not normally (ever?) saved, but check anyway */ */
656
/* OBSOLETE   if (!fsr->regs[SP_REGNUM]) */
657
/* OBSOLETE     { */
658
/* OBSOLETE       /* if the FP was saved, that means the current FP is valid, */ */
659
/* OBSOLETE       /* otherwise, it isn't being used, so we use the SP instead */ */
660
/* OBSOLETE       if (uses_frame) */
661
/* OBSOLETE     fsr->regs[SP_REGNUM] = read_register (FP_REGNUM) + fi->size; */
662
/* OBSOLETE       else */
663
/* OBSOLETE     { */
664
/* OBSOLETE       fsr->regs[SP_REGNUM] = fp + fi->size; */
665
/* OBSOLETE       fi->frameless = 1; */
666
/* OBSOLETE       fsr->regs[FP_REGNUM] = 0; */
667
/* OBSOLETE     } */
668
/* OBSOLETE     } */
669
/* OBSOLETE #endif */
670
/* OBSOLETE } */
671
/* OBSOLETE  */
672
/* OBSOLETE void */
673
/* OBSOLETE d30v_init_extra_frame_info (int fromleaf, struct frame_info *fi) */
674
/* OBSOLETE { */
675
/* OBSOLETE   struct frame_saved_regs dummy; */
676
/* OBSOLETE  */
677
/* OBSOLETE   if (fi->next && (fi->pc == 0)) */
678
/* OBSOLETE     fi->pc = fi->next->return_pc; */
679
/* OBSOLETE  */
680
/* OBSOLETE   d30v_frame_find_saved_regs_offsets (fi, &dummy); */
681
/* OBSOLETE  */
682
/* OBSOLETE   if (uses_frame == 0) */
683
/* OBSOLETE     fi->frameless = 1; */
684
/* OBSOLETE   else */
685
/* OBSOLETE     fi->frameless = 0; */
686
/* OBSOLETE  */
687
/* OBSOLETE   if ((fi->next == 0) && (uses_frame == 0)) */
688
/* OBSOLETE     /* innermost frame and it's "frameless", */
689
/* OBSOLETE        so the fi->frame field is wrong, fix it! */ */
690
/* OBSOLETE     fi->frame = read_sp (); */
691
/* OBSOLETE  */
692
/* OBSOLETE   if (dummy.regs[LR_REGNUM]) */
693
/* OBSOLETE     { */
694
/* OBSOLETE       /* it was saved, grab it! */ */
695
/* OBSOLETE       dummy.regs[LR_REGNUM] += (fi->frame + frame_size); */
696
/* OBSOLETE       fi->return_pc = read_memory_unsigned_integer (dummy.regs[LR_REGNUM], 4); */
697
/* OBSOLETE     } */
698
/* OBSOLETE   else */
699
/* OBSOLETE     fi->return_pc = read_register (LR_REGNUM); */
700
/* OBSOLETE } */
701
/* OBSOLETE  */
702
/* OBSOLETE void */
703
/* OBSOLETE d30v_init_frame_pc (int fromleaf, struct frame_info *prev) */
704
/* OBSOLETE { */
705
/* OBSOLETE   /* default value, put here so we can breakpoint on it and */
706
/* OBSOLETE      see if the default value is really the right thing to use */ */
707
/* OBSOLETE   prev->pc = (fromleaf ? SAVED_PC_AFTER_CALL (prev->next) : \ */
708
/* OBSOLETE           prev->next ? FRAME_SAVED_PC (prev->next) : read_pc ()); */
709
/* OBSOLETE } */
710
/* OBSOLETE  */
711
/* OBSOLETE static void d30v_print_register (int regnum, int tabular); */
712
/* OBSOLETE  */
713
/* OBSOLETE static void */
714
/* OBSOLETE d30v_print_register (int regnum, int tabular) */
715
/* OBSOLETE { */
716
/* OBSOLETE   if (regnum < A0_REGNUM) */
717
/* OBSOLETE     { */
718
/* OBSOLETE       if (tabular) */
719
/* OBSOLETE     printf_filtered ("%08lx", (long) read_register (regnum)); */
720
/* OBSOLETE       else */
721
/* OBSOLETE     printf_filtered ("0x%lx %ld", */
722
/* OBSOLETE                      (long) read_register (regnum), */
723
/* OBSOLETE                      (long) read_register (regnum)); */
724
/* OBSOLETE     } */
725
/* OBSOLETE   else */
726
/* OBSOLETE     { */
727
/* OBSOLETE       char regbuf[MAX_REGISTER_RAW_SIZE]; */
728
/* OBSOLETE  */
729
/* OBSOLETE       frame_register_read (selected_frame, regnum, regbuf); */
730
/* OBSOLETE  */
731
/* OBSOLETE       val_print (REGISTER_VIRTUAL_TYPE (regnum), regbuf, 0, 0, */
732
/* OBSOLETE              gdb_stdout, 'x', 1, 0, Val_pretty_default); */
733
/* OBSOLETE  */
734
/* OBSOLETE       if (!tabular) */
735
/* OBSOLETE     { */
736
/* OBSOLETE       printf_filtered ("    "); */
737
/* OBSOLETE       val_print (REGISTER_VIRTUAL_TYPE (regnum), regbuf, 0, 0, */
738
/* OBSOLETE                  gdb_stdout, 'd', 1, 0, Val_pretty_default); */
739
/* OBSOLETE     } */
740
/* OBSOLETE     } */
741
/* OBSOLETE } */
742
/* OBSOLETE  */
743
/* OBSOLETE static void */
744
/* OBSOLETE d30v_print_flags (void) */
745
/* OBSOLETE { */
746
/* OBSOLETE   long psw = read_register (PSW_REGNUM); */
747
/* OBSOLETE   printf_filtered ("flags #1"); */
748
/* OBSOLETE   printf_filtered ("   (sm) %d", (psw & PSW_SM) != 0); */
749
/* OBSOLETE   printf_filtered ("   (ea) %d", (psw & PSW_EA) != 0); */
750
/* OBSOLETE   printf_filtered ("   (db) %d", (psw & PSW_DB) != 0); */
751
/* OBSOLETE   printf_filtered ("   (ds) %d", (psw & PSW_DS) != 0); */
752
/* OBSOLETE   printf_filtered ("   (ie) %d", (psw & PSW_IE) != 0); */
753
/* OBSOLETE   printf_filtered ("   (rp) %d", (psw & PSW_RP) != 0); */
754
/* OBSOLETE   printf_filtered ("   (md) %d\n", (psw & PSW_MD) != 0); */
755
/* OBSOLETE  */
756
/* OBSOLETE   printf_filtered ("flags #2"); */
757
/* OBSOLETE   printf_filtered ("   (f0) %d", (psw & PSW_F0) != 0); */
758
/* OBSOLETE   printf_filtered ("   (f1) %d", (psw & PSW_F1) != 0); */
759
/* OBSOLETE   printf_filtered ("   (f2) %d", (psw & PSW_F2) != 0); */
760
/* OBSOLETE   printf_filtered ("   (f3) %d", (psw & PSW_F3) != 0); */
761
/* OBSOLETE   printf_filtered ("    (s) %d", (psw & PSW_S) != 0); */
762
/* OBSOLETE   printf_filtered ("    (v) %d", (psw & PSW_V) != 0); */
763
/* OBSOLETE   printf_filtered ("   (va) %d", (psw & PSW_VA) != 0); */
764
/* OBSOLETE   printf_filtered ("    (c) %d\n", (psw & PSW_C) != 0); */
765
/* OBSOLETE } */
766
/* OBSOLETE  */
767
/* OBSOLETE static void */
768
/* OBSOLETE print_flags_command (char *args, int from_tty) */
769
/* OBSOLETE { */
770
/* OBSOLETE   d30v_print_flags (); */
771
/* OBSOLETE } */
772
/* OBSOLETE  */
773
/* OBSOLETE void */
774
/* OBSOLETE d30v_do_registers_info (int regnum, int fpregs) */
775
/* OBSOLETE { */
776
/* OBSOLETE   long long num1, num2; */
777
/* OBSOLETE   long psw; */
778
/* OBSOLETE  */
779
/* OBSOLETE   if (regnum != -1) */
780
/* OBSOLETE     { */
781
/* OBSOLETE       if (REGISTER_NAME (0) == NULL || REGISTER_NAME (0)[0] == '\000') */
782
/* OBSOLETE     return; */
783
/* OBSOLETE  */
784
/* OBSOLETE       printf_filtered ("%s ", REGISTER_NAME (regnum)); */
785
/* OBSOLETE       d30v_print_register (regnum, 0); */
786
/* OBSOLETE  */
787
/* OBSOLETE       printf_filtered ("\n"); */
788
/* OBSOLETE       return; */
789
/* OBSOLETE     } */
790
/* OBSOLETE  */
791
/* OBSOLETE   /* Have to print all the registers.  Format them nicely.  */ */
792
/* OBSOLETE  */
793
/* OBSOLETE   printf_filtered ("PC="); */
794
/* OBSOLETE   print_address (read_pc (), gdb_stdout); */
795
/* OBSOLETE  */
796
/* OBSOLETE   printf_filtered (" PSW="); */
797
/* OBSOLETE   d30v_print_register (PSW_REGNUM, 1); */
798
/* OBSOLETE  */
799
/* OBSOLETE   printf_filtered (" BPC="); */
800
/* OBSOLETE   print_address (read_register (BPC_REGNUM), gdb_stdout); */
801
/* OBSOLETE  */
802
/* OBSOLETE   printf_filtered (" BPSW="); */
803
/* OBSOLETE   d30v_print_register (BPSW_REGNUM, 1); */
804
/* OBSOLETE   printf_filtered ("\n"); */
805
/* OBSOLETE  */
806
/* OBSOLETE   printf_filtered ("DPC="); */
807
/* OBSOLETE   print_address (read_register (DPC_REGNUM), gdb_stdout); */
808
/* OBSOLETE  */
809
/* OBSOLETE   printf_filtered (" DPSW="); */
810
/* OBSOLETE   d30v_print_register (DPSW_REGNUM, 1); */
811
/* OBSOLETE  */
812
/* OBSOLETE   printf_filtered (" IBA="); */
813
/* OBSOLETE   print_address (read_register (IBA_REGNUM), gdb_stdout); */
814
/* OBSOLETE   printf_filtered ("\n"); */
815
/* OBSOLETE  */
816
/* OBSOLETE   printf_filtered ("RPT_C="); */
817
/* OBSOLETE   d30v_print_register (RPT_C_REGNUM, 1); */
818
/* OBSOLETE  */
819
/* OBSOLETE   printf_filtered (" RPT_S="); */
820
/* OBSOLETE   print_address (read_register (RPT_S_REGNUM), gdb_stdout); */
821
/* OBSOLETE  */
822
/* OBSOLETE   printf_filtered (" RPT_E="); */
823
/* OBSOLETE   print_address (read_register (RPT_E_REGNUM), gdb_stdout); */
824
/* OBSOLETE   printf_filtered ("\n"); */
825
/* OBSOLETE  */
826
/* OBSOLETE   printf_filtered ("MOD_S="); */
827
/* OBSOLETE   print_address (read_register (MOD_S_REGNUM), gdb_stdout); */
828
/* OBSOLETE  */
829
/* OBSOLETE   printf_filtered (" MOD_E="); */
830
/* OBSOLETE   print_address (read_register (MOD_E_REGNUM), gdb_stdout); */
831
/* OBSOLETE   printf_filtered ("\n"); */
832
/* OBSOLETE  */
833
/* OBSOLETE   printf_filtered ("EIT_VB="); */
834
/* OBSOLETE   print_address (read_register (EIT_VB_REGNUM), gdb_stdout); */
835
/* OBSOLETE  */
836
/* OBSOLETE   printf_filtered (" INT_S="); */
837
/* OBSOLETE   d30v_print_register (INT_S_REGNUM, 1); */
838
/* OBSOLETE  */
839
/* OBSOLETE   printf_filtered (" INT_M="); */
840
/* OBSOLETE   d30v_print_register (INT_M_REGNUM, 1); */
841
/* OBSOLETE   printf_filtered ("\n"); */
842
/* OBSOLETE  */
843
/* OBSOLETE   d30v_print_flags (); */
844
/* OBSOLETE   for (regnum = 0; regnum <= 63;) */
845
/* OBSOLETE     { */
846
/* OBSOLETE       int i; */
847
/* OBSOLETE  */
848
/* OBSOLETE       printf_filtered ("R%d-R%d ", regnum, regnum + 7); */
849
/* OBSOLETE       if (regnum < 10) */
850
/* OBSOLETE     printf_filtered (" "); */
851
/* OBSOLETE       if (regnum + 7 < 10) */
852
/* OBSOLETE     printf_filtered (" "); */
853
/* OBSOLETE  */
854
/* OBSOLETE       for (i = 0; i < 8; i++) */
855
/* OBSOLETE     { */
856
/* OBSOLETE       printf_filtered (" "); */
857
/* OBSOLETE       d30v_print_register (regnum++, 1); */
858
/* OBSOLETE     } */
859
/* OBSOLETE  */
860
/* OBSOLETE       printf_filtered ("\n"); */
861
/* OBSOLETE     } */
862
/* OBSOLETE  */
863
/* OBSOLETE   printf_filtered ("A0-A1    "); */
864
/* OBSOLETE  */
865
/* OBSOLETE   d30v_print_register (A0_REGNUM, 1); */
866
/* OBSOLETE   printf_filtered ("    "); */
867
/* OBSOLETE   d30v_print_register (A1_REGNUM, 1); */
868
/* OBSOLETE   printf_filtered ("\n"); */
869
/* OBSOLETE } */
870
/* OBSOLETE  */
871
/* OBSOLETE CORE_ADDR */
872
/* OBSOLETE d30v_fix_call_dummy (char *dummyname, CORE_ADDR start_sp, CORE_ADDR fun, */
873
/* OBSOLETE                  int nargs, struct value **args, */
874
/* OBSOLETE                  struct type *type, int gcc_p) */
875
/* OBSOLETE { */
876
/* OBSOLETE   int regnum; */
877
/* OBSOLETE   CORE_ADDR sp; */
878
/* OBSOLETE   char buffer[MAX_REGISTER_RAW_SIZE]; */
879
/* OBSOLETE   struct frame_info *frame = get_current_frame (); */
880
/* OBSOLETE   frame->dummy = start_sp; */
881
/* OBSOLETE   /*start_sp |= DMEM_START; */ */
882
/* OBSOLETE  */
883
/* OBSOLETE   sp = start_sp; */
884
/* OBSOLETE   for (regnum = 0; regnum < NUM_REGS; regnum++) */
885
/* OBSOLETE     { */
886
/* OBSOLETE       sp -= REGISTER_RAW_SIZE (regnum); */
887
/* OBSOLETE       store_address (buffer, REGISTER_RAW_SIZE (regnum), read_register (regnum)); */
888
/* OBSOLETE       write_memory (sp, buffer, REGISTER_RAW_SIZE (regnum)); */
889
/* OBSOLETE     } */
890
/* OBSOLETE   write_register (SP_REGNUM, (LONGEST) sp); */
891
/* OBSOLETE   /* now we need to load LR with the return address */ */
892
/* OBSOLETE   write_register (LR_REGNUM, (LONGEST) d30v_call_dummy_address ()); */
893
/* OBSOLETE   return sp; */
894
/* OBSOLETE } */
895
/* OBSOLETE  */
896
/* OBSOLETE static void */
897
/* OBSOLETE d30v_pop_dummy_frame (struct frame_info *fi) */
898
/* OBSOLETE { */
899
/* OBSOLETE   CORE_ADDR sp = fi->dummy; */
900
/* OBSOLETE   int regnum; */
901
/* OBSOLETE  */
902
/* OBSOLETE   for (regnum = 0; regnum < NUM_REGS; regnum++) */
903
/* OBSOLETE     { */
904
/* OBSOLETE       sp -= REGISTER_RAW_SIZE (regnum); */
905
/* OBSOLETE       write_register (regnum, read_memory_unsigned_integer (sp, REGISTER_RAW_SIZE (regnum))); */
906
/* OBSOLETE     } */
907
/* OBSOLETE   flush_cached_frames ();   /* needed? */ */
908
/* OBSOLETE } */
909
/* OBSOLETE  */
910
/* OBSOLETE  */
911
/* OBSOLETE CORE_ADDR */
912
/* OBSOLETE d30v_push_arguments (int nargs, struct value **args, CORE_ADDR sp, */
913
/* OBSOLETE                  int struct_return, CORE_ADDR struct_addr) */
914
/* OBSOLETE { */
915
/* OBSOLETE   int i, len, index = 0, regnum = 2; */
916
/* OBSOLETE   char buffer[4], *contents; */
917
/* OBSOLETE   LONGEST val; */
918
/* OBSOLETE   CORE_ADDR ptrs[10]; */
919
/* OBSOLETE  */
920
/* OBSOLETE #if 0 */
921
/* OBSOLETE   /* Pass 1. Put all large args on stack */ */
922
/* OBSOLETE   for (i = 0; i < nargs; i++) */
923
/* OBSOLETE     { */
924
/* OBSOLETE       struct value *arg = args[i]; */
925
/* OBSOLETE       struct type *arg_type = check_typedef (VALUE_TYPE (arg)); */
926
/* OBSOLETE       len = TYPE_LENGTH (arg_type); */
927
/* OBSOLETE       contents = VALUE_CONTENTS (arg); */
928
/* OBSOLETE       val = extract_signed_integer (contents, len); */
929
/* OBSOLETE       if (len > 4) */
930
/* OBSOLETE     { */
931
/* OBSOLETE       /* put on stack and pass pointers */ */
932
/* OBSOLETE       sp -= len; */
933
/* OBSOLETE       write_memory (sp, contents, len); */
934
/* OBSOLETE       ptrs[index++] = sp; */
935
/* OBSOLETE     } */
936
/* OBSOLETE     } */
937
/* OBSOLETE #endif */
938
/* OBSOLETE   index = 0; */
939
/* OBSOLETE  */
940
/* OBSOLETE   for (i = 0; i < nargs; i++) */
941
/* OBSOLETE     { */
942
/* OBSOLETE       struct value *arg = args[i]; */
943
/* OBSOLETE       struct type *arg_type = check_typedef (VALUE_TYPE (arg)); */
944
/* OBSOLETE       len = TYPE_LENGTH (arg_type); */
945
/* OBSOLETE       contents = VALUE_CONTENTS (arg); */
946
/* OBSOLETE       if (len > 4) */
947
/* OBSOLETE     { */
948
/* OBSOLETE       /* we need multiple registers */ */
949
/* OBSOLETE       int ndx; */
950
/* OBSOLETE  */
951
/* OBSOLETE       for (ndx = 0; len > 0; ndx += 8, len -= 8) */
952
/* OBSOLETE         { */
953
/* OBSOLETE           if (regnum & 1) */
954
/* OBSOLETE             regnum++;       /* all args > 4 bytes start in even register */ */
955
/* OBSOLETE  */
956
/* OBSOLETE           if (regnum < 18) */
957
/* OBSOLETE             { */
958
/* OBSOLETE               val = extract_signed_integer (&contents[ndx], 4); */
959
/* OBSOLETE               write_register (regnum++, val); */
960
/* OBSOLETE  */
961
/* OBSOLETE               if (len >= 8) */
962
/* OBSOLETE                 val = extract_signed_integer (&contents[ndx + 4], 4); */
963
/* OBSOLETE               else */
964
/* OBSOLETE                 val = extract_signed_integer (&contents[ndx + 4], len - 4); */
965
/* OBSOLETE               write_register (regnum++, val); */
966
/* OBSOLETE             } */
967
/* OBSOLETE           else */
968
/* OBSOLETE             { */
969
/* OBSOLETE               /* no more registers available.  put it on the stack */ */
970
/* OBSOLETE  */
971
/* OBSOLETE               /* all args > 4 bytes are padded to a multiple of 8 bytes */
972
/* OBSOLETE                  and start on an 8 byte boundary */ */
973
/* OBSOLETE               if (sp & 7) */
974
/* OBSOLETE                 sp -= (sp & 7);     /* align it */ */
975
/* OBSOLETE  */
976
/* OBSOLETE               sp -= ((len + 7) & ~7);       /* allocate space */ */
977
/* OBSOLETE               write_memory (sp, &contents[ndx], len); */
978
/* OBSOLETE               break; */
979
/* OBSOLETE             } */
980
/* OBSOLETE         } */
981
/* OBSOLETE     } */
982
/* OBSOLETE       else */
983
/* OBSOLETE     { */
984
/* OBSOLETE       if (regnum < 18) */
985
/* OBSOLETE         { */
986
/* OBSOLETE           val = extract_signed_integer (contents, len); */
987
/* OBSOLETE           write_register (regnum++, val); */
988
/* OBSOLETE         } */
989
/* OBSOLETE       else */
990
/* OBSOLETE         { */
991
/* OBSOLETE           /* all args are padded to a multiple of 4 bytes (at least) */ */
992
/* OBSOLETE           sp -= ((len + 3) & ~3); */
993
/* OBSOLETE           write_memory (sp, contents, len); */
994
/* OBSOLETE         } */
995
/* OBSOLETE     } */
996
/* OBSOLETE     } */
997
/* OBSOLETE   if (sp & 7) */
998
/* OBSOLETE     /* stack pointer is not on an 8 byte boundary -- align it */ */
999
/* OBSOLETE     sp -= (sp & 7); */
1000
/* OBSOLETE   return sp; */
1001
/* OBSOLETE } */
1002
/* OBSOLETE  */
1003
/* OBSOLETE  */
1004
/* OBSOLETE /* pick an out-of-the-way place to set the return value */ */
1005
/* OBSOLETE /* for an inferior function call.  The link register is set to this  */ */
1006
/* OBSOLETE /* value and a momentary breakpoint is set there.  When the breakpoint */ */
1007
/* OBSOLETE /* is hit, the dummy frame is popped and the previous environment is */ */
1008
/* OBSOLETE /* restored. */ */
1009
/* OBSOLETE  */
1010
/* OBSOLETE CORE_ADDR */
1011
/* OBSOLETE d30v_call_dummy_address (void) */
1012
/* OBSOLETE { */
1013
/* OBSOLETE   CORE_ADDR entry; */
1014
/* OBSOLETE   struct minimal_symbol *sym; */
1015
/* OBSOLETE  */
1016
/* OBSOLETE   entry = entry_point_address (); */
1017
/* OBSOLETE  */
1018
/* OBSOLETE   if (entry != 0) */
1019
/* OBSOLETE     return entry; */
1020
/* OBSOLETE  */
1021
/* OBSOLETE   sym = lookup_minimal_symbol ("_start", NULL, symfile_objfile); */
1022
/* OBSOLETE  */
1023
/* OBSOLETE   if (!sym || MSYMBOL_TYPE (sym) != mst_text) */
1024
/* OBSOLETE     return 0; */
1025
/* OBSOLETE   else */
1026
/* OBSOLETE     return SYMBOL_VALUE_ADDRESS (sym); */
1027
/* OBSOLETE } */
1028
/* OBSOLETE  */
1029
/* OBSOLETE /* Given a return value in `regbuf' with a type `valtype',  */
1030
/* OBSOLETE    extract and copy its value into `valbuf'.  */ */
1031
/* OBSOLETE  */
1032
/* OBSOLETE void */
1033
/* OBSOLETE d30v_extract_return_value (struct type *valtype, char regbuf[REGISTER_BYTES], */
1034
/* OBSOLETE                        char *valbuf) */
1035
/* OBSOLETE { */
1036
/* OBSOLETE   memcpy (valbuf, regbuf + REGISTER_BYTE (2), TYPE_LENGTH (valtype)); */
1037
/* OBSOLETE } */
1038
/* OBSOLETE  */
1039
/* OBSOLETE /* The following code implements access to, and display of, the D30V's */
1040
/* OBSOLETE    instruction trace buffer.  The buffer consists of 64K or more */
1041
/* OBSOLETE    4-byte words of data, of which each words includes an 8-bit count, */
1042
/* OBSOLETE    an 8-bit segment number, and a 16-bit instruction address. */
1043
/* OBSOLETE  */
1044
/* OBSOLETE    In theory, the trace buffer is continuously capturing instruction */
1045
/* OBSOLETE    data that the CPU presents on its "debug bus", but in practice, the */
1046
/* OBSOLETE    ROMified GDB stub only enables tracing when it continues or steps */
1047
/* OBSOLETE    the program, and stops tracing when the program stops; so it */
1048
/* OBSOLETE    actually works for GDB to read the buffer counter out of memory and */
1049
/* OBSOLETE    then read each trace word.  The counter records where the tracing */
1050
/* OBSOLETE    stops, but there is no record of where it started, so we remember */
1051
/* OBSOLETE    the PC when we resumed and then search backwards in the trace */
1052
/* OBSOLETE    buffer for a word that includes that address.  This is not perfect, */
1053
/* OBSOLETE    because you will miss trace data if the resumption PC is the target */
1054
/* OBSOLETE    of a branch.  (The value of the buffer counter is semi-random, any */
1055
/* OBSOLETE    trace data from a previous program stop is gone.)  */ */
1056
/* OBSOLETE  */
1057
/* OBSOLETE /* The address of the last word recorded in the trace buffer.  */ */
1058
/* OBSOLETE  */
1059
/* OBSOLETE #define DBBC_ADDR (0xd80000) */
1060
/* OBSOLETE  */
1061
/* OBSOLETE /* The base of the trace buffer, at least for the "Board_0".  */ */
1062
/* OBSOLETE  */
1063
/* OBSOLETE #define TRACE_BUFFER_BASE (0xf40000) */
1064
/* OBSOLETE  */
1065
/* OBSOLETE static void trace_command (char *, int); */
1066
/* OBSOLETE  */
1067
/* OBSOLETE static void untrace_command (char *, int); */
1068
/* OBSOLETE  */
1069
/* OBSOLETE static void trace_info (char *, int); */
1070
/* OBSOLETE  */
1071
/* OBSOLETE static void tdisassemble_command (char *, int); */
1072
/* OBSOLETE  */
1073
/* OBSOLETE static void display_trace (int, int); */
1074
/* OBSOLETE  */
1075
/* OBSOLETE /* True when instruction traces are being collected.  */ */
1076
/* OBSOLETE  */
1077
/* OBSOLETE static int tracing; */
1078
/* OBSOLETE  */
1079
/* OBSOLETE /* Remembered PC.  */ */
1080
/* OBSOLETE  */
1081
/* OBSOLETE static CORE_ADDR last_pc; */
1082
/* OBSOLETE  */
1083
/* OBSOLETE /* True when trace output should be displayed whenever program stops.  */ */
1084
/* OBSOLETE  */
1085
/* OBSOLETE static int trace_display; */
1086
/* OBSOLETE  */
1087
/* OBSOLETE /* True when trace listing should include source lines.  */ */
1088
/* OBSOLETE  */
1089
/* OBSOLETE static int default_trace_show_source = 1; */
1090
/* OBSOLETE  */
1091
/* OBSOLETE struct trace_buffer */
1092
/* OBSOLETE   { */
1093
/* OBSOLETE     int size; */
1094
/* OBSOLETE     short *counts; */
1095
/* OBSOLETE     CORE_ADDR *addrs; */
1096
/* OBSOLETE   } */
1097
/* OBSOLETE trace_data; */
1098
/* OBSOLETE  */
1099
/* OBSOLETE static void */
1100
/* OBSOLETE trace_command (char *args, int from_tty) */
1101
/* OBSOLETE { */
1102
/* OBSOLETE   /* Clear the host-side trace buffer, allocating space if needed.  */ */
1103
/* OBSOLETE   trace_data.size = 0; */
1104
/* OBSOLETE   if (trace_data.counts == NULL) */
1105
/* OBSOLETE     trace_data.counts = (short *) xmalloc (65536 * sizeof (short)); */
1106
/* OBSOLETE   if (trace_data.addrs == NULL) */
1107
/* OBSOLETE     trace_data.addrs = (CORE_ADDR *) xmalloc (65536 * sizeof (CORE_ADDR)); */
1108
/* OBSOLETE  */
1109
/* OBSOLETE   tracing = 1; */
1110
/* OBSOLETE  */
1111
/* OBSOLETE   printf_filtered ("Tracing is now on.\n"); */
1112
/* OBSOLETE } */
1113
/* OBSOLETE  */
1114
/* OBSOLETE static void */
1115
/* OBSOLETE untrace_command (char *args, int from_tty) */
1116
/* OBSOLETE { */
1117
/* OBSOLETE   tracing = 0; */
1118
/* OBSOLETE  */
1119
/* OBSOLETE   printf_filtered ("Tracing is now off.\n"); */
1120
/* OBSOLETE } */
1121
/* OBSOLETE  */
1122
/* OBSOLETE static void */
1123
/* OBSOLETE trace_info (char *args, int from_tty) */
1124
/* OBSOLETE { */
1125
/* OBSOLETE   int i; */
1126
/* OBSOLETE  */
1127
/* OBSOLETE   if (trace_data.size) */
1128
/* OBSOLETE     { */
1129
/* OBSOLETE       printf_filtered ("%d entries in trace buffer:\n", trace_data.size); */
1130
/* OBSOLETE  */
1131
/* OBSOLETE       for (i = 0; i < trace_data.size; ++i) */
1132
/* OBSOLETE     { */
1133
/* OBSOLETE       printf_filtered ("%d: %d instruction%s at 0x%s\n", */
1134
/* OBSOLETE                        i, trace_data.counts[i], */
1135
/* OBSOLETE                        (trace_data.counts[i] == 1 ? "" : "s"), */
1136
/* OBSOLETE                        paddr_nz (trace_data.addrs[i])); */
1137
/* OBSOLETE     } */
1138
/* OBSOLETE     } */
1139
/* OBSOLETE   else */
1140
/* OBSOLETE     printf_filtered ("No entries in trace buffer.\n"); */
1141
/* OBSOLETE  */
1142
/* OBSOLETE   printf_filtered ("Tracing is currently %s.\n", (tracing ? "on" : "off")); */
1143
/* OBSOLETE } */
1144
/* OBSOLETE  */
1145
/* OBSOLETE /* Print the instruction at address MEMADDR in debugged memory, */
1146
/* OBSOLETE    on STREAM.  Returns length of the instruction, in bytes.  */ */
1147
/* OBSOLETE  */
1148
/* OBSOLETE static int */
1149
/* OBSOLETE print_insn (CORE_ADDR memaddr, struct ui_file *stream) */
1150
/* OBSOLETE { */
1151
/* OBSOLETE   /* If there's no disassembler, something is very wrong.  */ */
1152
/* OBSOLETE   if (tm_print_insn == NULL) */
1153
/* OBSOLETE     internal_error (__FILE__, __LINE__, */
1154
/* OBSOLETE                 "print_insn: no disassembler"); */
1155
/* OBSOLETE  */
1156
/* OBSOLETE   if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) */
1157
/* OBSOLETE     tm_print_insn_info.endian = BFD_ENDIAN_BIG; */
1158
/* OBSOLETE   else */
1159
/* OBSOLETE     tm_print_insn_info.endian = BFD_ENDIAN_LITTLE; */
1160
/* OBSOLETE   return TARGET_PRINT_INSN (memaddr, &tm_print_insn_info); */
1161
/* OBSOLETE } */
1162
/* OBSOLETE  */
1163
/* OBSOLETE void */
1164
/* OBSOLETE d30v_eva_prepare_to_trace (void) */
1165
/* OBSOLETE { */
1166
/* OBSOLETE   if (!tracing) */
1167
/* OBSOLETE     return; */
1168
/* OBSOLETE  */
1169
/* OBSOLETE   last_pc = read_register (PC_REGNUM); */
1170
/* OBSOLETE } */
1171
/* OBSOLETE  */
1172
/* OBSOLETE /* Collect trace data from the target board and format it into a form */
1173
/* OBSOLETE    more useful for display.  */ */
1174
/* OBSOLETE  */
1175
/* OBSOLETE void */
1176
/* OBSOLETE d30v_eva_get_trace_data (void) */
1177
/* OBSOLETE { */
1178
/* OBSOLETE   int count, i, j, oldsize; */
1179
/* OBSOLETE   int trace_addr, trace_seg, trace_cnt, next_cnt; */
1180
/* OBSOLETE   unsigned int last_trace, trace_word, next_word; */
1181
/* OBSOLETE   unsigned int *tmpspace; */
1182
/* OBSOLETE  */
1183
/* OBSOLETE   if (!tracing) */
1184
/* OBSOLETE     return; */
1185
/* OBSOLETE  */
1186
/* OBSOLETE   tmpspace = xmalloc (65536 * sizeof (unsigned int)); */
1187
/* OBSOLETE  */
1188
/* OBSOLETE   last_trace = read_memory_unsigned_integer (DBBC_ADDR, 2) << 2; */
1189
/* OBSOLETE  */
1190
/* OBSOLETE   /* Collect buffer contents from the target, stopping when we reach */
1191
/* OBSOLETE      the word recorded when execution resumed.  */ */
1192
/* OBSOLETE  */
1193
/* OBSOLETE   count = 0; */
1194
/* OBSOLETE   while (last_trace > 0) */
1195
/* OBSOLETE     { */
1196
/* OBSOLETE       QUIT; */
1197
/* OBSOLETE       trace_word = */
1198
/* OBSOLETE     read_memory_unsigned_integer (TRACE_BUFFER_BASE + last_trace, 4); */
1199
/* OBSOLETE       trace_addr = trace_word & 0xffff; */
1200
/* OBSOLETE       last_trace -= 4; */
1201
/* OBSOLETE       /* Ignore an apparently nonsensical entry.  */ */
1202
/* OBSOLETE       if (trace_addr == 0xffd5) */
1203
/* OBSOLETE     continue; */
1204
/* OBSOLETE       tmpspace[count++] = trace_word; */
1205
/* OBSOLETE       if (trace_addr == last_pc) */
1206
/* OBSOLETE     break; */
1207
/* OBSOLETE       if (count > 65535) */
1208
/* OBSOLETE     break; */
1209
/* OBSOLETE     } */
1210
/* OBSOLETE  */
1211
/* OBSOLETE   /* Move the data to the host-side trace buffer, adjusting counts to */
1212
/* OBSOLETE      include the last instruction executed and transforming the address */
1213
/* OBSOLETE      into something that GDB likes.  */ */
1214
/* OBSOLETE  */
1215
/* OBSOLETE   for (i = 0; i < count; ++i) */
1216
/* OBSOLETE     { */
1217
/* OBSOLETE       trace_word = tmpspace[i]; */
1218
/* OBSOLETE       next_word = ((i == 0) ? 0 : tmpspace[i - 1]); */
1219
/* OBSOLETE       trace_addr = trace_word & 0xffff; */
1220
/* OBSOLETE       next_cnt = (next_word >> 24) & 0xff; */
1221
/* OBSOLETE       j = trace_data.size + count - i - 1; */
1222
/* OBSOLETE       trace_data.addrs[j] = (trace_addr << 2) + 0x1000000; */
1223
/* OBSOLETE       trace_data.counts[j] = next_cnt + 1; */
1224
/* OBSOLETE     } */
1225
/* OBSOLETE  */
1226
/* OBSOLETE   oldsize = trace_data.size; */
1227
/* OBSOLETE   trace_data.size += count; */
1228
/* OBSOLETE  */
1229
/* OBSOLETE   xfree (tmpspace); */
1230
/* OBSOLETE  */
1231
/* OBSOLETE   if (trace_display) */
1232
/* OBSOLETE     display_trace (oldsize, trace_data.size); */
1233
/* OBSOLETE } */
1234
/* OBSOLETE  */
1235
/* OBSOLETE static void */
1236
/* OBSOLETE tdisassemble_command (char *arg, int from_tty) */
1237
/* OBSOLETE { */
1238
/* OBSOLETE   int i, count; */
1239
/* OBSOLETE   CORE_ADDR low, high; */
1240
/* OBSOLETE   char *space_index; */
1241
/* OBSOLETE  */
1242
/* OBSOLETE   if (!arg) */
1243
/* OBSOLETE     { */
1244
/* OBSOLETE       low = 0; */
1245
/* OBSOLETE       high = trace_data.size; */
1246
/* OBSOLETE     } */
1247
/* OBSOLETE   else if (!(space_index = (char *) strchr (arg, ' '))) */
1248
/* OBSOLETE     { */
1249
/* OBSOLETE       low = parse_and_eval_address (arg); */
1250
/* OBSOLETE       high = low + 5; */
1251
/* OBSOLETE     } */
1252
/* OBSOLETE   else */
1253
/* OBSOLETE     { */
1254
/* OBSOLETE       /* Two arguments.  */ */
1255
/* OBSOLETE       *space_index = '\0'; */
1256
/* OBSOLETE       low = parse_and_eval_address (arg); */
1257
/* OBSOLETE       high = parse_and_eval_address (space_index + 1); */
1258
/* OBSOLETE       if (high < low) */
1259
/* OBSOLETE     high = low; */
1260
/* OBSOLETE     } */
1261
/* OBSOLETE  */
1262
/* OBSOLETE   printf_filtered ("Dump of trace from %s to %s:\n", */
1263
/* OBSOLETE                paddr_u (low), */
1264
/* OBSOLETE                paddr_u (high)); */
1265
/* OBSOLETE  */
1266
/* OBSOLETE   display_trace (low, high); */
1267
/* OBSOLETE  */
1268
/* OBSOLETE   printf_filtered ("End of trace dump.\n"); */
1269
/* OBSOLETE   gdb_flush (gdb_stdout); */
1270
/* OBSOLETE } */
1271
/* OBSOLETE  */
1272
/* OBSOLETE static void */
1273
/* OBSOLETE display_trace (int low, int high) */
1274
/* OBSOLETE { */
1275
/* OBSOLETE   int i, count, trace_show_source, first, suppress; */
1276
/* OBSOLETE   CORE_ADDR next_address; */
1277
/* OBSOLETE  */
1278
/* OBSOLETE   trace_show_source = default_trace_show_source; */
1279
/* OBSOLETE   if (!have_full_symbols () && !have_partial_symbols ()) */
1280
/* OBSOLETE     { */
1281
/* OBSOLETE       trace_show_source = 0; */
1282
/* OBSOLETE       printf_filtered ("No symbol table is loaded.  Use the \"file\" command.\n"); */
1283
/* OBSOLETE       printf_filtered ("Trace will not display any source.\n"); */
1284
/* OBSOLETE     } */
1285
/* OBSOLETE  */
1286
/* OBSOLETE   first = 1; */
1287
/* OBSOLETE   suppress = 0; */
1288
/* OBSOLETE   for (i = low; i < high; ++i) */
1289
/* OBSOLETE     { */
1290
/* OBSOLETE       next_address = trace_data.addrs[i]; */
1291
/* OBSOLETE       count = trace_data.counts[i]; */
1292
/* OBSOLETE       while (count-- > 0) */
1293
/* OBSOLETE     { */
1294
/* OBSOLETE       QUIT; */
1295
/* OBSOLETE       if (trace_show_source) */
1296
/* OBSOLETE         { */
1297
/* OBSOLETE           struct symtab_and_line sal, sal_prev; */
1298
/* OBSOLETE  */
1299
/* OBSOLETE           sal_prev = find_pc_line (next_address - 4, 0); */
1300
/* OBSOLETE           sal = find_pc_line (next_address, 0); */
1301
/* OBSOLETE  */
1302
/* OBSOLETE           if (sal.symtab) */
1303
/* OBSOLETE             { */
1304
/* OBSOLETE               if (first || sal.line != sal_prev.line) */
1305
/* OBSOLETE                 print_source_lines (sal.symtab, sal.line, sal.line + 1, 0); */
1306
/* OBSOLETE               suppress = 0; */
1307
/* OBSOLETE             } */
1308
/* OBSOLETE           else */
1309
/* OBSOLETE             { */
1310
/* OBSOLETE               if (!suppress) */
1311
/* OBSOLETE                 /* FIXME-32x64--assumes sal.pc fits in long.  */ */
1312
/* OBSOLETE                 printf_filtered ("No source file for address %s.\n", */
1313
/* OBSOLETE                              local_hex_string ((unsigned long) sal.pc)); */
1314
/* OBSOLETE               suppress = 1; */
1315
/* OBSOLETE             } */
1316
/* OBSOLETE         } */
1317
/* OBSOLETE       first = 0; */
1318
/* OBSOLETE       print_address (next_address, gdb_stdout); */
1319
/* OBSOLETE       printf_filtered (":"); */
1320
/* OBSOLETE       printf_filtered ("\t"); */
1321
/* OBSOLETE       wrap_here ("    "); */
1322
/* OBSOLETE       next_address = next_address + print_insn (next_address, gdb_stdout); */
1323
/* OBSOLETE       printf_filtered ("\n"); */
1324
/* OBSOLETE       gdb_flush (gdb_stdout); */
1325
/* OBSOLETE     } */
1326
/* OBSOLETE     } */
1327
/* OBSOLETE } */
1328
/* OBSOLETE  */
1329
/* OBSOLETE extern void (*target_resume_hook) (void); */
1330
/* OBSOLETE extern void (*target_wait_loop_hook) (void); */
1331
/* OBSOLETE  */
1332
/* OBSOLETE void */
1333
/* OBSOLETE _initialize_d30v_tdep (void) */
1334
/* OBSOLETE { */
1335
/* OBSOLETE   tm_print_insn = print_insn_d30v; */
1336
/* OBSOLETE  */
1337
/* OBSOLETE   target_resume_hook = d30v_eva_prepare_to_trace; */
1338
/* OBSOLETE   target_wait_loop_hook = d30v_eva_get_trace_data; */
1339
/* OBSOLETE  */
1340
/* OBSOLETE   add_info ("flags", print_flags_command, "Print d30v flags."); */
1341
/* OBSOLETE  */
1342
/* OBSOLETE   add_com ("trace", class_support, trace_command, */
1343
/* OBSOLETE        "Enable tracing of instruction execution."); */
1344
/* OBSOLETE  */
1345
/* OBSOLETE   add_com ("untrace", class_support, untrace_command, */
1346
/* OBSOLETE        "Disable tracing of instruction execution."); */
1347
/* OBSOLETE  */
1348
/* OBSOLETE   add_com ("tdisassemble", class_vars, tdisassemble_command, */
1349
/* OBSOLETE        "Disassemble the trace buffer.\n\ */
1350
/* OBSOLETE Two optional arguments specify a range of trace buffer entries\n\ */
1351
/* OBSOLETE as reported by info trace (NOT addresses!)."); */
1352
/* OBSOLETE  */
1353
/* OBSOLETE   add_info ("trace", trace_info, */
1354
/* OBSOLETE         "Display info about the trace data buffer."); */
1355
/* OBSOLETE  */
1356
/* OBSOLETE   add_show_from_set (add_set_cmd ("tracedisplay", no_class, */
1357
/* OBSOLETE                               var_integer, (char *) &trace_display, */
1358
/* OBSOLETE                          "Set automatic display of trace.\n", &setlist), */
1359
/* OBSOLETE                  &showlist); */
1360
/* OBSOLETE   add_show_from_set (add_set_cmd ("tracesource", no_class, */
1361
/* OBSOLETE                        var_integer, (char *) &default_trace_show_source, */
1362
/* OBSOLETE                   "Set display of source code with trace.\n", &setlist), */
1363
/* OBSOLETE                  &showlist); */
1364
/* OBSOLETE  */
1365
/* OBSOLETE } */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.