* objdump.c (SFILE): Add size field.
[deliverable/binutils-gdb.git] / gdb / rs6000-tdep.c
1 /* Target-dependent code for GDB, the GNU debugger.
2 Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997
3 Free Software Foundation, Inc.
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20
21 #include "defs.h"
22 #include "frame.h"
23 #include "inferior.h"
24 #include "symtab.h"
25 #include "target.h"
26 #include "gdbcore.h"
27 #include "symfile.h"
28 #include "objfiles.h"
29 #include "xcoffsolib.h"
30
31 extern struct obstack frame_cache_obstack;
32
33 extern int errno;
34
35 /* Breakpoint shadows for the single step instructions will be kept here. */
36
37 static struct sstep_breaks {
38 /* Address, or 0 if this is not in use. */
39 CORE_ADDR address;
40 /* Shadow contents. */
41 char data[4];
42 } stepBreaks[2];
43
44 /* Hook for determining the TOC address when calling functions in the
45 inferior under AIX. The initialization code in rs6000-nat.c sets
46 this hook to point to find_toc_address. */
47
48 CORE_ADDR (*find_toc_address_hook) PARAMS ((CORE_ADDR)) = NULL;
49
50 /* Static function prototypes */
51
52 static CORE_ADDR branch_dest PARAMS ((int opcode, int instr, CORE_ADDR pc,
53 CORE_ADDR safety));
54
55 static void frame_get_cache_fsr PARAMS ((struct frame_info *fi,
56 struct rs6000_framedata *fdatap));
57
58 static void pop_dummy_frame PARAMS ((void));
59
60 /* Calculate the destination of a branch/jump. Return -1 if not a branch. */
61
62 static CORE_ADDR
63 branch_dest (opcode, instr, pc, safety)
64 int opcode;
65 int instr;
66 CORE_ADDR pc;
67 CORE_ADDR safety;
68 {
69 CORE_ADDR dest;
70 int immediate;
71 int absolute;
72 int ext_op;
73
74 absolute = (int) ((instr >> 1) & 1);
75
76 switch (opcode) {
77 case 18 :
78 immediate = ((instr & ~3) << 6) >> 6; /* br unconditional */
79 if (absolute)
80 dest = immediate;
81 else
82 dest = pc + immediate;
83 break;
84
85 case 16 :
86 immediate = ((instr & ~3) << 16) >> 16; /* br conditional */
87 if (absolute)
88 dest = immediate;
89 else
90 dest = pc + immediate;
91 break;
92
93 case 19 :
94 ext_op = (instr>>1) & 0x3ff;
95
96 if (ext_op == 16) /* br conditional register */
97 {
98 dest = read_register (LR_REGNUM) & ~3;
99
100 /* If we are about to return from a signal handler, dest is
101 something like 0x3c90. The current frame is a signal handler
102 caller frame, upon completion of the sigreturn system call
103 execution will return to the saved PC in the frame. */
104 if (dest < TEXT_SEGMENT_BASE)
105 {
106 struct frame_info *fi;
107
108 fi = get_current_frame ();
109 if (fi != NULL)
110 dest = read_memory_integer (fi->frame + SIG_FRAME_PC_OFFSET,
111 4);
112 }
113 }
114
115 else if (ext_op == 528) /* br cond to count reg */
116 {
117 dest = read_register (CTR_REGNUM) & ~3;
118
119 /* If we are about to execute a system call, dest is something
120 like 0x22fc or 0x3b00. Upon completion the system call
121 will return to the address in the link register. */
122 if (dest < TEXT_SEGMENT_BASE)
123 dest = read_register (LR_REGNUM) & ~3;
124 }
125 else return -1;
126 break;
127
128 default: return -1;
129 }
130 return (dest < TEXT_SEGMENT_BASE) ? safety : dest;
131 }
132
133
134 /* Sequence of bytes for breakpoint instruction. */
135
136 #define BIG_BREAKPOINT { 0x7d, 0x82, 0x10, 0x08 }
137 #define LITTLE_BREAKPOINT { 0x08, 0x10, 0x82, 0x7d }
138
139 unsigned char *
140 rs6000_breakpoint_from_pc (bp_addr, bp_size)
141 CORE_ADDR *bp_addr;
142 int *bp_size;
143 {
144 static unsigned char big_breakpoint[] = BIG_BREAKPOINT;
145 static unsigned char little_breakpoint[] = LITTLE_BREAKPOINT;
146 *bp_size = 4;
147 if (TARGET_BYTE_ORDER == BIG_ENDIAN)
148 return big_breakpoint;
149 else
150 return little_breakpoint;
151 }
152
153
154 /* AIX does not support PT_STEP. Simulate it. */
155
156 void
157 rs6000_software_single_step (signal, insert_breakpoints_p)
158 enum target_signal signal;
159 int insert_breakpoints_p;
160 {
161 #define INSNLEN(OPCODE) 4
162
163 static char le_breakp[] = LITTLE_BREAKPOINT;
164 static char be_breakp[] = BIG_BREAKPOINT;
165 char *breakp = TARGET_BYTE_ORDER == BIG_ENDIAN ? be_breakp : le_breakp;
166 int ii, insn;
167 CORE_ADDR loc;
168 CORE_ADDR breaks[2];
169 int opcode;
170
171 if (insert_breakpoints_p) {
172
173 loc = read_pc ();
174
175 insn = read_memory_integer (loc, 4);
176
177 breaks[0] = loc + INSNLEN(insn);
178 opcode = insn >> 26;
179 breaks[1] = branch_dest (opcode, insn, loc, breaks[0]);
180
181 /* Don't put two breakpoints on the same address. */
182 if (breaks[1] == breaks[0])
183 breaks[1] = -1;
184
185 stepBreaks[1].address = 0;
186
187 for (ii=0; ii < 2; ++ii) {
188
189 /* ignore invalid breakpoint. */
190 if ( breaks[ii] == -1)
191 continue;
192
193 read_memory (breaks[ii], stepBreaks[ii].data, 4);
194
195 write_memory (breaks[ii], breakp, 4);
196 stepBreaks[ii].address = breaks[ii];
197 }
198
199 } else {
200
201 /* remove step breakpoints. */
202 for (ii=0; ii < 2; ++ii)
203 if (stepBreaks[ii].address != 0)
204 write_memory
205 (stepBreaks[ii].address, stepBreaks[ii].data, 4);
206
207 }
208 errno = 0; /* FIXME, don't ignore errors! */
209 /* What errors? {read,write}_memory call error(). */
210 }
211
212
213 /* return pc value after skipping a function prologue and also return
214 information about a function frame.
215
216 in struct rs6000_frameinfo fdata:
217 - frameless is TRUE, if function does not have a frame.
218 - nosavedpc is TRUE, if function does not save %pc value in its frame.
219 - offset is the number of bytes used in the frame to save registers.
220 - saved_gpr is the number of the first saved gpr.
221 - saved_fpr is the number of the first saved fpr.
222 - alloca_reg is the number of the register used for alloca() handling.
223 Otherwise -1.
224 - gpr_offset is the offset of the saved gprs
225 - fpr_offset is the offset of the saved fprs
226 - lr_offset is the offset of the saved lr
227 - cr_offset is the offset of the saved cr
228 */
229
230 #define SIGNED_SHORT(x) \
231 ((sizeof (short) == 2) \
232 ? ((int)(short)(x)) \
233 : ((int)((((x) & 0xffff) ^ 0x8000) - 0x8000)))
234
235 #define GET_SRC_REG(x) (((x) >> 21) & 0x1f)
236
237 CORE_ADDR
238 skip_prologue (pc, fdata)
239 CORE_ADDR pc;
240 struct rs6000_framedata *fdata;
241 {
242 CORE_ADDR orig_pc = pc;
243 char buf[4];
244 unsigned long op;
245 long offset = 0;
246 int lr_reg = 0;
247 int cr_reg = 0;
248 int reg;
249 int framep = 0;
250 int minimal_toc_loaded = 0;
251 static struct rs6000_framedata zero_frame;
252
253 *fdata = zero_frame;
254 fdata->saved_gpr = -1;
255 fdata->saved_fpr = -1;
256 fdata->alloca_reg = -1;
257 fdata->frameless = 1;
258 fdata->nosavedpc = 1;
259
260 if (target_read_memory (pc, buf, 4))
261 return pc; /* Can't access it -- assume no prologue. */
262
263 /* Assume that subsequent fetches can fail with low probability. */
264 pc -= 4;
265 for (;;)
266 {
267 pc += 4;
268 op = read_memory_integer (pc, 4);
269
270 if ((op & 0xfc1fffff) == 0x7c0802a6) { /* mflr Rx */
271 lr_reg = (op & 0x03e00000) | 0x90010000;
272 continue;
273
274 } else if ((op & 0xfc1fffff) == 0x7c000026) { /* mfcr Rx */
275 cr_reg = (op & 0x03e00000) | 0x90010000;
276 continue;
277
278 } else if ((op & 0xfc1f0000) == 0xd8010000) { /* stfd Rx,NUM(r1) */
279 reg = GET_SRC_REG (op);
280 if (fdata->saved_fpr == -1 || fdata->saved_fpr > reg) {
281 fdata->saved_fpr = reg;
282 fdata->fpr_offset = SIGNED_SHORT (op) + offset;
283 }
284 continue;
285
286 } else if (((op & 0xfc1f0000) == 0xbc010000) || /* stm Rx, NUM(r1) */
287 ((op & 0xfc1f0000) == 0x90010000 && /* st rx,NUM(r1),
288 rx >= r13 */
289 (op & 0x03e00000) >= 0x01a00000)) {
290
291 reg = GET_SRC_REG (op);
292 if (fdata->saved_gpr == -1 || fdata->saved_gpr > reg) {
293 fdata->saved_gpr = reg;
294 fdata->gpr_offset = SIGNED_SHORT (op) + offset;
295 }
296 continue;
297
298 } else if ((op & 0xffff0000) == 0x3c000000) { /* addis 0,0,NUM, used
299 for >= 32k frames */
300 fdata->offset = (op & 0x0000ffff) << 16;
301 fdata->frameless = 0;
302 continue;
303
304 } else if ((op & 0xffff0000) == 0x60000000) { /* ori 0,0,NUM, 2nd ha
305 lf of >= 32k frames */
306 fdata->offset |= (op & 0x0000ffff);
307 fdata->frameless = 0;
308 continue;
309
310 } else if ((op & 0xffff0000) == lr_reg) { /* st Rx,NUM(r1)
311 where Rx == lr */
312 fdata->lr_offset = SIGNED_SHORT (op) + offset;
313 fdata->nosavedpc = 0;
314 lr_reg = 0;
315 continue;
316
317 } else if ((op & 0xffff0000) == cr_reg) { /* st Rx,NUM(r1)
318 where Rx == cr */
319 fdata->cr_offset = SIGNED_SHORT (op) + offset;
320 cr_reg = 0;
321 continue;
322
323 } else if (op == 0x48000005) { /* bl .+4 used in
324 -mrelocatable */
325 continue;
326
327 } else if (op == 0x48000004) { /* b .+4 (xlc) */
328 break;
329
330 } else if (((op & 0xffff0000) == 0x801e0000 || /* lwz 0,NUM(r30), used
331 in V.4 -mrelocatable */
332 op == 0x7fc0f214) && /* add r30,r0,r30, used
333 in V.4 -mrelocatable */
334 lr_reg == 0x901e0000) {
335 continue;
336
337 } else if ((op & 0xffff0000) == 0x3fc00000 || /* addis 30,0,foo@ha, used
338 in V.4 -mminimal-toc */
339 (op & 0xffff0000) == 0x3bde0000) { /* addi 30,30,foo@l */
340 continue;
341
342 } else if ((op & 0xfc000000) == 0x48000000) { /* bl foo,
343 to save fprs??? */
344
345 fdata->frameless = 0;
346 /* Don't skip over the subroutine call if it is not within the first
347 three instructions of the prologue. */
348 if ((pc - orig_pc) > 8)
349 break;
350
351 op = read_memory_integer (pc+4, 4);
352
353 /* At this point, make sure this is not a trampoline function
354 (a function that simply calls another functions, and nothing else).
355 If the next is not a nop, this branch was part of the function
356 prologue. */
357
358 if (op == 0x4def7b82 || op == 0) /* crorc 15, 15, 15 */
359 break; /* don't skip over
360 this branch */
361 continue;
362
363 /* update stack pointer */
364 } else if ((op & 0xffff0000) == 0x94210000) { /* stu r1,NUM(r1) */
365 fdata->frameless = 0;
366 fdata->offset = SIGNED_SHORT (op);
367 offset = fdata->offset;
368 continue;
369
370 } else if (op == 0x7c21016e) { /* stwux 1,1,0 */
371 fdata->frameless = 0;
372 offset = fdata->offset;
373 continue;
374
375 /* Load up minimal toc pointer */
376 } else if ((op >> 22) == 0x20f
377 && ! minimal_toc_loaded) { /* l r31,... or l r30,... */
378 minimal_toc_loaded = 1;
379 continue;
380
381 /* store parameters in stack */
382 } else if ((op & 0xfc1f0000) == 0x90010000 || /* st rx,NUM(r1) */
383 (op & 0xfc1f0000) == 0xd8010000 || /* stfd Rx,NUM(r1) */
384 (op & 0xfc1f0000) == 0xfc010000) { /* frsp, fp?,NUM(r1) */
385 continue;
386
387 /* store parameters in stack via frame pointer */
388 } else if (framep &&
389 ((op & 0xfc1f0000) == 0x901f0000 || /* st rx,NUM(r1) */
390 (op & 0xfc1f0000) == 0xd81f0000 || /* stfd Rx,NUM(r1) */
391 (op & 0xfc1f0000) == 0xfc1f0000)) { /* frsp, fp?,NUM(r1) */
392 continue;
393
394 /* Set up frame pointer */
395 } else if (op == 0x603f0000 /* oril r31, r1, 0x0 */
396 || op == 0x7c3f0b78) { /* mr r31, r1 */
397 fdata->frameless = 0;
398 framep = 1;
399 fdata->alloca_reg = 31;
400 continue;
401
402 /* Another way to set up the frame pointer. */
403 } else if ((op & 0xfc1fffff) == 0x38010000) { /* addi rX, r1, 0x0 */
404 fdata->frameless = 0;
405 framep = 1;
406 fdata->alloca_reg = (op & ~0x38010000) >> 21;
407 continue;
408
409 } else {
410 break;
411 }
412 }
413
414 #if 0
415 /* I have problems with skipping over __main() that I need to address
416 * sometime. Previously, I used to use misc_function_vector which
417 * didn't work as well as I wanted to be. -MGO */
418
419 /* If the first thing after skipping a prolog is a branch to a function,
420 this might be a call to an initializer in main(), introduced by gcc2.
421 We'd like to skip over it as well. Fortunately, xlc does some extra
422 work before calling a function right after a prologue, thus we can
423 single out such gcc2 behaviour. */
424
425
426 if ((op & 0xfc000001) == 0x48000001) { /* bl foo, an initializer function? */
427 op = read_memory_integer (pc+4, 4);
428
429 if (op == 0x4def7b82) { /* cror 0xf, 0xf, 0xf (nop) */
430
431 /* check and see if we are in main. If so, skip over this initializer
432 function as well. */
433
434 tmp = find_pc_misc_function (pc);
435 if (tmp >= 0 && STREQ (misc_function_vector [tmp].name, "main"))
436 return pc + 8;
437 }
438 }
439 #endif /* 0 */
440
441 fdata->offset = - fdata->offset;
442 return pc;
443 }
444
445
446 /*************************************************************************
447 Support for creating pushind a dummy frame into the stack, and popping
448 frames, etc.
449 *************************************************************************/
450
451 /* The total size of dummy frame is 436, which is;
452
453 32 gpr's - 128 bytes
454 32 fpr's - 256 "
455 7 the rest - 28 "
456 and 24 extra bytes for the callee's link area. The last 24 bytes
457 for the link area might not be necessary, since it will be taken
458 care of by push_arguments(). */
459
460 #define DUMMY_FRAME_SIZE 436
461
462 #define DUMMY_FRAME_ADDR_SIZE 10
463
464 /* Make sure you initialize these in somewhere, in case gdb gives up what it
465 was debugging and starts debugging something else. FIXMEibm */
466
467 static int dummy_frame_count = 0;
468 static int dummy_frame_size = 0;
469 static CORE_ADDR *dummy_frame_addr = 0;
470
471 extern int stop_stack_dummy;
472
473 /* push a dummy frame into stack, save all register. Currently we are saving
474 only gpr's and fpr's, which is not good enough! FIXMEmgo */
475
476 void
477 push_dummy_frame ()
478 {
479 /* stack pointer. */
480 CORE_ADDR sp;
481 /* Same thing, target byte order. */
482 char sp_targ[4];
483
484 /* link register. */
485 CORE_ADDR pc;
486 /* Same thing, target byte order. */
487 char pc_targ[4];
488
489 /* Needed to figure out where to save the dummy link area.
490 FIXME: There should be an easier way to do this, no? tiemann 9/9/95. */
491 struct rs6000_framedata fdata;
492
493 int ii;
494
495 target_fetch_registers (-1);
496
497 if (dummy_frame_count >= dummy_frame_size) {
498 dummy_frame_size += DUMMY_FRAME_ADDR_SIZE;
499 if (dummy_frame_addr)
500 dummy_frame_addr = (CORE_ADDR*) xrealloc
501 (dummy_frame_addr, sizeof(CORE_ADDR) * (dummy_frame_size));
502 else
503 dummy_frame_addr = (CORE_ADDR*)
504 xmalloc (sizeof(CORE_ADDR) * (dummy_frame_size));
505 }
506
507 sp = read_register(SP_REGNUM);
508 pc = read_register(PC_REGNUM);
509 store_address (pc_targ, 4, pc);
510
511 skip_prologue (get_pc_function_start (pc) + FUNCTION_START_OFFSET, &fdata);
512
513 dummy_frame_addr [dummy_frame_count++] = sp;
514
515 /* Be careful! If the stack pointer is not decremented first, then kernel
516 thinks he is free to use the space underneath it. And kernel actually
517 uses that area for IPC purposes when executing ptrace(2) calls. So
518 before writing register values into the new frame, decrement and update
519 %sp first in order to secure your frame. */
520
521 /* FIXME: We don't check if the stack really has this much space.
522 This is a problem on the ppc simulator (which only grants one page
523 (4096 bytes) by default. */
524
525 write_register (SP_REGNUM, sp-DUMMY_FRAME_SIZE);
526
527 /* gdb relies on the state of current_frame. We'd better update it,
528 otherwise things like do_registers_info() wouldn't work properly! */
529
530 flush_cached_frames ();
531
532 /* save program counter in link register's space. */
533 write_memory (sp + (fdata.lr_offset ? fdata.lr_offset : DEFAULT_LR_SAVE),
534 pc_targ, 4);
535
536 /* save all floating point and general purpose registers here. */
537
538 /* fpr's, f0..f31 */
539 for (ii = 0; ii < 32; ++ii)
540 write_memory (sp-8-(ii*8), &registers[REGISTER_BYTE (31-ii+FP0_REGNUM)], 8);
541
542 /* gpr's r0..r31 */
543 for (ii=1; ii <=32; ++ii)
544 write_memory (sp-256-(ii*4), &registers[REGISTER_BYTE (32-ii)], 4);
545
546 /* so far, 32*2 + 32 words = 384 bytes have been written.
547 7 extra registers in our register set: pc, ps, cnd, lr, cnt, xer, mq */
548
549 for (ii=1; ii <= (LAST_SP_REGNUM-FIRST_SP_REGNUM+1); ++ii) {
550 write_memory (sp-384-(ii*4),
551 &registers[REGISTER_BYTE (FPLAST_REGNUM + ii)], 4);
552 }
553
554 /* Save sp or so called back chain right here. */
555 store_address (sp_targ, 4, sp);
556 write_memory (sp-DUMMY_FRAME_SIZE, sp_targ, 4);
557 sp -= DUMMY_FRAME_SIZE;
558
559 /* And finally, this is the back chain. */
560 write_memory (sp+8, pc_targ, 4);
561 }
562
563
564 /* Pop a dummy frame.
565
566 In rs6000 when we push a dummy frame, we save all of the registers. This
567 is usually done before user calls a function explicitly.
568
569 After a dummy frame is pushed, some instructions are copied into stack,
570 and stack pointer is decremented even more. Since we don't have a frame
571 pointer to get back to the parent frame of the dummy, we start having
572 trouble poping it. Therefore, we keep a dummy frame stack, keeping
573 addresses of dummy frames as such. When poping happens and when we
574 detect that was a dummy frame, we pop it back to its parent by using
575 dummy frame stack (`dummy_frame_addr' array).
576
577 FIXME: This whole concept is broken. You should be able to detect
578 a dummy stack frame *on the user's stack itself*. When you do,
579 then you know the format of that stack frame -- including its
580 saved SP register! There should *not* be a separate stack in the
581 GDB process that keeps track of these dummy frames! -- gnu@cygnus.com Aug92
582 */
583
584 static void
585 pop_dummy_frame ()
586 {
587 CORE_ADDR sp, pc;
588 int ii;
589 sp = dummy_frame_addr [--dummy_frame_count];
590
591 /* restore all fpr's. */
592 for (ii = 1; ii <= 32; ++ii)
593 read_memory (sp-(ii*8), &registers[REGISTER_BYTE (32-ii+FP0_REGNUM)], 8);
594
595 /* restore all gpr's */
596 for (ii=1; ii <= 32; ++ii) {
597 read_memory (sp-256-(ii*4), &registers[REGISTER_BYTE (32-ii)], 4);
598 }
599
600 /* restore the rest of the registers. */
601 for (ii=1; ii <=(LAST_SP_REGNUM-FIRST_SP_REGNUM+1); ++ii)
602 read_memory (sp-384-(ii*4),
603 &registers[REGISTER_BYTE (FPLAST_REGNUM + ii)], 4);
604
605 read_memory (sp-(DUMMY_FRAME_SIZE-8),
606 &registers [REGISTER_BYTE(PC_REGNUM)], 4);
607
608 /* when a dummy frame was being pushed, we had to decrement %sp first, in
609 order to secure astack space. Thus, saved %sp (or %r1) value, is not the
610 one we should restore. Change it with the one we need. */
611
612 memcpy (&registers [REGISTER_BYTE(FP_REGNUM)], (char *) &sp, sizeof (int));
613
614 /* Now we can restore all registers. */
615
616 target_store_registers (-1);
617 pc = read_pc ();
618 flush_cached_frames ();
619 }
620
621
622 /* pop the innermost frame, go back to the caller. */
623
624 void
625 pop_frame ()
626 {
627 CORE_ADDR pc, lr, sp, prev_sp; /* %pc, %lr, %sp */
628 struct rs6000_framedata fdata;
629 struct frame_info *frame = get_current_frame ();
630 int addr, ii;
631
632 pc = read_pc ();
633 sp = FRAME_FP (frame);
634
635 if (stop_stack_dummy)
636 {
637 #ifdef USE_GENERIC_DUMMY_FRAMES
638 generic_pop_dummy_frame ();
639 flush_cached_frames ();
640 return;
641 #else
642 if (dummy_frame_count)
643 pop_dummy_frame ();
644 return;
645 #endif
646 }
647
648 /* Make sure that all registers are valid. */
649 read_register_bytes (0, NULL, REGISTER_BYTES);
650
651 /* figure out previous %pc value. If the function is frameless, it is
652 still in the link register, otherwise walk the frames and retrieve the
653 saved %pc value in the previous frame. */
654
655 addr = get_pc_function_start (frame->pc) + FUNCTION_START_OFFSET;
656 (void) skip_prologue (addr, &fdata);
657
658 if (fdata.frameless)
659 prev_sp = sp;
660 else
661 prev_sp = read_memory_integer (sp, 4);
662 if (fdata.lr_offset == 0)
663 lr = read_register (LR_REGNUM);
664 else
665 lr = read_memory_integer (prev_sp + fdata.lr_offset, 4);
666
667 /* reset %pc value. */
668 write_register (PC_REGNUM, lr);
669
670 /* reset register values if any was saved earlier. */
671 addr = prev_sp - fdata.offset;
672
673 if (fdata.saved_gpr != -1)
674 for (ii = fdata.saved_gpr; ii <= 31; ++ii) {
675 read_memory (addr, &registers [REGISTER_BYTE (ii)], 4);
676 addr += 4;
677 }
678
679 if (fdata.saved_fpr != -1)
680 for (ii = fdata.saved_fpr; ii <= 31; ++ii) {
681 read_memory (addr, &registers [REGISTER_BYTE (ii+FP0_REGNUM)], 8);
682 addr += 8;
683 }
684
685 write_register (SP_REGNUM, prev_sp);
686 target_store_registers (-1);
687 flush_cached_frames ();
688 }
689
690 /* fixup the call sequence of a dummy function, with the real function address.
691 its argumets will be passed by gdb. */
692
693 void
694 rs6000_fix_call_dummy (dummyname, pc, fun, nargs, args, type, gcc_p)
695 char *dummyname;
696 CORE_ADDR pc;
697 CORE_ADDR fun;
698 int nargs;
699 value_ptr *args;
700 struct type *type;
701 int gcc_p;
702 {
703 #define TOC_ADDR_OFFSET 20
704 #define TARGET_ADDR_OFFSET 28
705
706 int ii;
707 CORE_ADDR target_addr;
708
709 if (find_toc_address_hook != NULL)
710 {
711 CORE_ADDR tocvalue;
712
713 tocvalue = (*find_toc_address_hook) (fun);
714 ii = *(int*)((char*)dummyname + TOC_ADDR_OFFSET);
715 ii = (ii & 0xffff0000) | (tocvalue >> 16);
716 *(int*)((char*)dummyname + TOC_ADDR_OFFSET) = ii;
717
718 ii = *(int*)((char*)dummyname + TOC_ADDR_OFFSET+4);
719 ii = (ii & 0xffff0000) | (tocvalue & 0x0000ffff);
720 *(int*)((char*)dummyname + TOC_ADDR_OFFSET+4) = ii;
721 }
722
723 target_addr = fun;
724 ii = *(int*)((char*)dummyname + TARGET_ADDR_OFFSET);
725 ii = (ii & 0xffff0000) | (target_addr >> 16);
726 *(int*)((char*)dummyname + TARGET_ADDR_OFFSET) = ii;
727
728 ii = *(int*)((char*)dummyname + TARGET_ADDR_OFFSET+4);
729 ii = (ii & 0xffff0000) | (target_addr & 0x0000ffff);
730 *(int*)((char*)dummyname + TARGET_ADDR_OFFSET+4) = ii;
731 }
732
733 /* Pass the arguments in either registers, or in the stack. In RS6000,
734 the first eight words of the argument list (that might be less than
735 eight parameters if some parameters occupy more than one word) are
736 passed in r3..r11 registers. float and double parameters are
737 passed in fpr's, in addition to that. Rest of the parameters if any
738 are passed in user stack. There might be cases in which half of the
739 parameter is copied into registers, the other half is pushed into
740 stack.
741
742 If the function is returning a structure, then the return address is passed
743 in r3, then the first 7 words of the parameters can be passed in registers,
744 starting from r4. */
745
746 CORE_ADDR
747 push_arguments (nargs, args, sp, struct_return, struct_addr)
748 int nargs;
749 value_ptr *args;
750 CORE_ADDR sp;
751 int struct_return;
752 CORE_ADDR struct_addr;
753 {
754 int ii;
755 int len = 0;
756 int argno; /* current argument number */
757 int argbytes; /* current argument byte */
758 char tmp_buffer [50];
759 int f_argno = 0; /* current floating point argno */
760
761 value_ptr arg = 0;
762 struct type *type;
763
764 CORE_ADDR saved_sp;
765
766 #ifndef USE_GENERIC_DUMMY_FRAMES
767 if ( dummy_frame_count <= 0)
768 printf_unfiltered ("FATAL ERROR -push_arguments()! frame not found!!\n");
769 #endif /* GENERIC_DUMMY_FRAMES */
770
771 /* The first eight words of ther arguments are passed in registers. Copy
772 them appropriately.
773
774 If the function is returning a `struct', then the first word (which
775 will be passed in r3) is used for struct return address. In that
776 case we should advance one word and start from r4 register to copy
777 parameters. */
778
779 ii = struct_return ? 1 : 0;
780
781 /*
782 effectively indirect call... gcc does...
783
784 return_val example( float, int);
785
786 eabi:
787 float in fp0, int in r3
788 offset of stack on overflow 8/16
789 for varargs, must go by type.
790 power open:
791 float in r3&r4, int in r5
792 offset of stack on overflow different
793 both:
794 return in r3 or f0. If no float, must study how gcc emulates floats;
795 pay attention to arg promotion.
796 User may have to cast\args to handle promotion correctly
797 since gdb won't know if prototype supplied or not.
798 */
799
800 for (argno=0, argbytes=0; argno < nargs && ii<8; ++ii) {
801
802 arg = args[argno];
803 type = check_typedef (VALUE_TYPE (arg));
804 len = TYPE_LENGTH (type);
805
806 if (TYPE_CODE (type) == TYPE_CODE_FLT) {
807
808 /* floating point arguments are passed in fpr's, as well as gpr's.
809 There are 13 fpr's reserved for passing parameters. At this point
810 there is no way we would run out of them. */
811
812 if (len > 8)
813 printf_unfiltered (
814 "Fatal Error: a floating point parameter #%d with a size > 8 is found!\n", argno);
815
816 memcpy (&registers[REGISTER_BYTE(FP0_REGNUM + 1 + f_argno)],
817 VALUE_CONTENTS (arg),
818 len);
819 ++f_argno;
820 }
821
822 if (len > 4) {
823
824 /* Argument takes more than one register. */
825 while (argbytes < len) {
826 memset (&registers[REGISTER_BYTE(ii+3)], 0, sizeof(int));
827 memcpy (&registers[REGISTER_BYTE(ii+3)],
828 ((char*)VALUE_CONTENTS (arg))+argbytes,
829 (len - argbytes) > 4 ? 4 : len - argbytes);
830 ++ii, argbytes += 4;
831
832 if (ii >= 8)
833 goto ran_out_of_registers_for_arguments;
834 }
835 argbytes = 0;
836 --ii;
837 }
838 else { /* Argument can fit in one register. No problem. */
839 memset (&registers[REGISTER_BYTE(ii+3)], 0, sizeof(int));
840 memcpy (&registers[REGISTER_BYTE(ii+3)], VALUE_CONTENTS (arg), len);
841 }
842 ++argno;
843 }
844
845 ran_out_of_registers_for_arguments:
846
847 #ifdef USE_GENERIC_DUMMY_FRAMES
848 saved_sp = read_sp ();
849 #else
850 /* location for 8 parameters are always reserved. */
851 sp -= 4 * 8;
852
853 /* another six words for back chain, TOC register, link register, etc. */
854 sp -= 24;
855 #endif /* GENERIC_DUMMY_FRAMES */
856 /* if there are more arguments, allocate space for them in
857 the stack, then push them starting from the ninth one. */
858
859 if ((argno < nargs) || argbytes) {
860 int space = 0, jj;
861
862 if (argbytes) {
863 space += ((len - argbytes + 3) & -4);
864 jj = argno + 1;
865 }
866 else
867 jj = argno;
868
869 for (; jj < nargs; ++jj) {
870 value_ptr val = args[jj];
871 space += ((TYPE_LENGTH (VALUE_TYPE (val))) + 3) & -4;
872 }
873
874 /* add location required for the rest of the parameters */
875 space = (space + 7) & -8;
876 sp -= space;
877
878 /* This is another instance we need to be concerned about securing our
879 stack space. If we write anything underneath %sp (r1), we might conflict
880 with the kernel who thinks he is free to use this area. So, update %sp
881 first before doing anything else. */
882
883 write_register (SP_REGNUM, sp);
884
885 /* if the last argument copied into the registers didn't fit there
886 completely, push the rest of it into stack. */
887
888 if (argbytes) {
889 write_memory (sp+24+(ii*4),
890 ((char*)VALUE_CONTENTS (arg))+argbytes,
891 len - argbytes);
892 ++argno;
893 ii += ((len - argbytes + 3) & -4) / 4;
894 }
895
896 /* push the rest of the arguments into stack. */
897 for (; argno < nargs; ++argno) {
898
899 arg = args[argno];
900 type = check_typedef (VALUE_TYPE (arg));
901 len = TYPE_LENGTH (type);
902
903
904 /* float types should be passed in fpr's, as well as in the stack. */
905 if (TYPE_CODE (type) == TYPE_CODE_FLT && f_argno < 13) {
906
907 if (len > 8)
908 printf_unfiltered (
909 "Fatal Error: a floating point parameter #%d with a size > 8 is found!\n", argno);
910
911 memcpy (&registers[REGISTER_BYTE(FP0_REGNUM + 1 + f_argno)],
912 VALUE_CONTENTS (arg),
913 len);
914 ++f_argno;
915 }
916
917 write_memory (sp+24+(ii*4), (char *) VALUE_CONTENTS (arg), len);
918 ii += ((len + 3) & -4) / 4;
919 }
920 }
921 else
922 /* Secure stack areas first, before doing anything else. */
923 write_register (SP_REGNUM, sp);
924
925 #ifndef USE_GENERIC_DUMMY_FRAMES
926 /* we want to copy 24 bytes of target's frame to dummy's frame,
927 then set back chain to point to new frame. */
928
929 saved_sp = dummy_frame_addr [dummy_frame_count - 1];
930 read_memory (saved_sp, tmp_buffer, 24);
931 write_memory (sp, tmp_buffer, 24);
932 #endif /* GENERIC_DUMMY_FRAMES */
933
934 /* set back chain properly */
935 store_address (tmp_buffer, 4, saved_sp);
936 write_memory (sp, tmp_buffer, 4);
937
938 target_store_registers (-1);
939 return sp;
940 }
941 #ifdef ELF_OBJECT_FORMAT
942
943 /* Function: ppc_push_return_address (pc, sp)
944 Set up the return address for the inferior function call. */
945
946 CORE_ADDR
947 ppc_push_return_address (pc, sp)
948 CORE_ADDR pc;
949 CORE_ADDR sp;
950 {
951 write_register (LR_REGNUM, CALL_DUMMY_ADDRESS ());
952 return sp;
953 }
954
955 #endif
956
957 /* a given return value in `regbuf' with a type `valtype', extract and copy its
958 value into `valbuf' */
959
960 void
961 extract_return_value (valtype, regbuf, valbuf)
962 struct type *valtype;
963 char regbuf[REGISTER_BYTES];
964 char *valbuf;
965 {
966 int offset = 0;
967
968 if (TYPE_CODE (valtype) == TYPE_CODE_FLT) {
969
970 double dd; float ff;
971 /* floats and doubles are returned in fpr1. fpr's have a size of 8 bytes.
972 We need to truncate the return value into float size (4 byte) if
973 necessary. */
974
975 if (TYPE_LENGTH (valtype) > 4) /* this is a double */
976 memcpy (valbuf,
977 &regbuf[REGISTER_BYTE (FP0_REGNUM + 1)],
978 TYPE_LENGTH (valtype));
979 else { /* float */
980 memcpy (&dd, &regbuf[REGISTER_BYTE (FP0_REGNUM + 1)], 8);
981 ff = (float)dd;
982 memcpy (valbuf, &ff, sizeof(float));
983 }
984 }
985 else {
986 /* return value is copied starting from r3. */
987 if (TARGET_BYTE_ORDER == BIG_ENDIAN
988 && TYPE_LENGTH (valtype) < REGISTER_RAW_SIZE (3))
989 offset = REGISTER_RAW_SIZE (3) - TYPE_LENGTH (valtype);
990
991 memcpy (valbuf,
992 regbuf + REGISTER_BYTE (3) + offset,
993 TYPE_LENGTH (valtype));
994 }
995 }
996
997
998 /* keep structure return address in this variable.
999 FIXME: This is a horrid kludge which should not be allowed to continue
1000 living. This only allows a single nested call to a structure-returning
1001 function. Come on, guys! -- gnu@cygnus.com, Aug 92 */
1002
1003 CORE_ADDR rs6000_struct_return_address;
1004
1005
1006 /* Indirect function calls use a piece of trampoline code to do context
1007 switching, i.e. to set the new TOC table. Skip such code if we are on
1008 its first instruction (as when we have single-stepped to here).
1009 Also skip shared library trampoline code (which is different from
1010 indirect function call trampolines).
1011 Result is desired PC to step until, or NULL if we are not in
1012 trampoline code. */
1013
1014 CORE_ADDR
1015 skip_trampoline_code (pc)
1016 CORE_ADDR pc;
1017 {
1018 register unsigned int ii, op;
1019 CORE_ADDR solib_target_pc;
1020
1021 static unsigned trampoline_code[] = {
1022 0x800b0000, /* l r0,0x0(r11) */
1023 0x90410014, /* st r2,0x14(r1) */
1024 0x7c0903a6, /* mtctr r0 */
1025 0x804b0004, /* l r2,0x4(r11) */
1026 0x816b0008, /* l r11,0x8(r11) */
1027 0x4e800420, /* bctr */
1028 0x4e800020, /* br */
1029 0
1030 };
1031
1032 /* If pc is in a shared library trampoline, return its target. */
1033 solib_target_pc = find_solib_trampoline_target (pc);
1034 if (solib_target_pc)
1035 return solib_target_pc;
1036
1037 for (ii=0; trampoline_code[ii]; ++ii) {
1038 op = read_memory_integer (pc + (ii*4), 4);
1039 if (op != trampoline_code [ii])
1040 return 0;
1041 }
1042 ii = read_register (11); /* r11 holds destination addr */
1043 pc = read_memory_integer (ii, 4); /* (r11) value */
1044 return pc;
1045 }
1046
1047 /* Determines whether the function FI has a frame on the stack or not. */
1048
1049 int
1050 frameless_function_invocation (fi)
1051 struct frame_info *fi;
1052 {
1053 CORE_ADDR func_start;
1054 struct rs6000_framedata fdata;
1055
1056 /* Don't even think about framelessness except on the innermost frame
1057 or if the function was interrupted by a signal. */
1058 if (fi->next != NULL && !fi->next->signal_handler_caller)
1059 return 0;
1060
1061 func_start = get_pc_function_start (fi->pc);
1062
1063 /* If we failed to find the start of the function, it is a mistake
1064 to inspect the instructions. */
1065
1066 if (!func_start)
1067 {
1068 /* A frame with a zero PC is usually created by dereferencing a NULL
1069 function pointer, normally causing an immediate core dump of the
1070 inferior. Mark function as frameless, as the inferior has no chance
1071 of setting up a stack frame. */
1072 if (fi->pc == 0)
1073 return 1;
1074 else
1075 return 0;
1076 }
1077
1078 func_start += FUNCTION_START_OFFSET;
1079 (void) skip_prologue (func_start, &fdata);
1080 return fdata.frameless;
1081 }
1082
1083 /* Return the PC saved in a frame */
1084
1085 unsigned long
1086 frame_saved_pc (fi)
1087 struct frame_info *fi;
1088 {
1089 CORE_ADDR func_start;
1090 struct rs6000_framedata fdata;
1091
1092 if (fi->signal_handler_caller)
1093 return read_memory_integer (fi->frame + SIG_FRAME_PC_OFFSET, 4);
1094
1095 #ifdef USE_GENERIC_DUMMY_FRAMES
1096 if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
1097 return generic_read_register_dummy(fi->pc, fi->frame, PC_REGNUM);
1098 #endif /* GENERIC_DUMMY_FRAMES */
1099
1100 func_start = get_pc_function_start (fi->pc) + FUNCTION_START_OFFSET;
1101
1102 /* If we failed to find the start of the function, it is a mistake
1103 to inspect the instructions. */
1104 if (!func_start)
1105 return 0;
1106
1107 (void) skip_prologue (func_start, &fdata);
1108
1109 if (fdata.lr_offset == 0 && fi->next != NULL)
1110 {
1111 if (fi->next->signal_handler_caller)
1112 return read_memory_integer (fi->next->frame + SIG_FRAME_LR_OFFSET, 4);
1113 else
1114 return read_memory_integer (rs6000_frame_chain (fi) + DEFAULT_LR_SAVE,
1115 4);
1116 }
1117
1118 if (fdata.lr_offset == 0)
1119 return read_register (LR_REGNUM);
1120
1121 return read_memory_integer (rs6000_frame_chain (fi) + fdata.lr_offset, 4);
1122 }
1123
1124 /* If saved registers of frame FI are not known yet, read and cache them.
1125 &FDATAP contains rs6000_framedata; TDATAP can be NULL,
1126 in which case the framedata are read. */
1127
1128 static void
1129 frame_get_cache_fsr (fi, fdatap)
1130 struct frame_info *fi;
1131 struct rs6000_framedata *fdatap;
1132 {
1133 int ii;
1134 CORE_ADDR frame_addr;
1135 struct rs6000_framedata work_fdata;
1136
1137 if (fi->cache_fsr)
1138 return;
1139
1140 if (fdatap == NULL) {
1141 fdatap = &work_fdata;
1142 (void) skip_prologue (get_pc_function_start (fi->pc), fdatap);
1143 }
1144
1145 fi->cache_fsr = (struct frame_saved_regs *)
1146 obstack_alloc (&frame_cache_obstack, sizeof (struct frame_saved_regs));
1147 memset (fi->cache_fsr, '\0', sizeof (struct frame_saved_regs));
1148
1149 if (fi->prev && fi->prev->frame)
1150 frame_addr = fi->prev->frame;
1151 else
1152 frame_addr = read_memory_integer (fi->frame, 4);
1153
1154 /* if != -1, fdatap->saved_fpr is the smallest number of saved_fpr.
1155 All fpr's from saved_fpr to fp31 are saved. */
1156
1157 if (fdatap->saved_fpr >= 0) {
1158 int fpr_offset = frame_addr + fdatap->fpr_offset;
1159 for (ii = fdatap->saved_fpr; ii < 32; ii++) {
1160 fi->cache_fsr->regs [FP0_REGNUM + ii] = fpr_offset;
1161 fpr_offset += 8;
1162 }
1163 }
1164
1165 /* if != -1, fdatap->saved_gpr is the smallest number of saved_gpr.
1166 All gpr's from saved_gpr to gpr31 are saved. */
1167
1168 if (fdatap->saved_gpr >= 0) {
1169 int gpr_offset = frame_addr + fdatap->gpr_offset;
1170 for (ii = fdatap->saved_gpr; ii < 32; ii++) {
1171 fi->cache_fsr->regs [ii] = gpr_offset;
1172 gpr_offset += 4;
1173 }
1174 }
1175
1176 /* If != 0, fdatap->cr_offset is the offset from the frame that holds
1177 the CR. */
1178 if (fdatap->cr_offset != 0)
1179 fi->cache_fsr->regs [CR_REGNUM] = frame_addr + fdatap->cr_offset;
1180
1181 /* If != 0, fdatap->lr_offset is the offset from the frame that holds
1182 the LR. */
1183 if (fdatap->lr_offset != 0)
1184 fi->cache_fsr->regs [LR_REGNUM] = frame_addr + fdatap->lr_offset;
1185 }
1186
1187 /* Return the address of a frame. This is the inital %sp value when the frame
1188 was first allocated. For functions calling alloca(), it might be saved in
1189 an alloca register. */
1190
1191 CORE_ADDR
1192 frame_initial_stack_address (fi)
1193 struct frame_info *fi;
1194 {
1195 CORE_ADDR tmpaddr;
1196 struct rs6000_framedata fdata;
1197 struct frame_info *callee_fi;
1198
1199 /* if the initial stack pointer (frame address) of this frame is known,
1200 just return it. */
1201
1202 if (fi->initial_sp)
1203 return fi->initial_sp;
1204
1205 /* find out if this function is using an alloca register.. */
1206
1207 (void) skip_prologue (get_pc_function_start (fi->pc), &fdata);
1208
1209 /* if saved registers of this frame are not known yet, read and cache them. */
1210
1211 if (!fi->cache_fsr)
1212 frame_get_cache_fsr (fi, &fdata);
1213
1214 /* If no alloca register used, then fi->frame is the value of the %sp for
1215 this frame, and it is good enough. */
1216
1217 if (fdata.alloca_reg < 0) {
1218 fi->initial_sp = fi->frame;
1219 return fi->initial_sp;
1220 }
1221
1222 /* This function has an alloca register. If this is the top-most frame
1223 (with the lowest address), the value in alloca register is good. */
1224
1225 if (!fi->next)
1226 return fi->initial_sp = read_register (fdata.alloca_reg);
1227
1228 /* Otherwise, this is a caller frame. Callee has usually already saved
1229 registers, but there are exceptions (such as when the callee
1230 has no parameters). Find the address in which caller's alloca
1231 register is saved. */
1232
1233 for (callee_fi = fi->next; callee_fi; callee_fi = callee_fi->next) {
1234
1235 if (!callee_fi->cache_fsr)
1236 frame_get_cache_fsr (callee_fi, NULL);
1237
1238 /* this is the address in which alloca register is saved. */
1239
1240 tmpaddr = callee_fi->cache_fsr->regs [fdata.alloca_reg];
1241 if (tmpaddr) {
1242 fi->initial_sp = read_memory_integer (tmpaddr, 4);
1243 return fi->initial_sp;
1244 }
1245
1246 /* Go look into deeper levels of the frame chain to see if any one of
1247 the callees has saved alloca register. */
1248 }
1249
1250 /* If alloca register was not saved, by the callee (or any of its callees)
1251 then the value in the register is still good. */
1252
1253 return fi->initial_sp = read_register (fdata.alloca_reg);
1254 }
1255
1256 CORE_ADDR
1257 rs6000_frame_chain (thisframe)
1258 struct frame_info *thisframe;
1259 {
1260 CORE_ADDR fp;
1261
1262 #ifdef USE_GENERIC_DUMMY_FRAMES
1263 if (PC_IN_CALL_DUMMY (thisframe->pc, thisframe->frame, thisframe->frame))
1264 return thisframe->frame; /* dummy frame same as caller's frame */
1265 #endif /* GENERIC_DUMMY_FRAMES */
1266
1267 if (inside_entry_file (thisframe->pc) ||
1268 thisframe->pc == entry_point_address ())
1269 return 0;
1270
1271 if (thisframe->signal_handler_caller)
1272 fp = read_memory_integer (thisframe->frame + SIG_FRAME_FP_OFFSET, 4);
1273 else if (thisframe->next != NULL
1274 && thisframe->next->signal_handler_caller
1275 && frameless_function_invocation (thisframe))
1276 /* A frameless function interrupted by a signal did not change the
1277 frame pointer. */
1278 fp = FRAME_FP (thisframe);
1279 else
1280 fp = read_memory_integer ((thisframe)->frame, 4);
1281
1282 #ifdef USE_GENERIC_DUMMY_FRAMES
1283 {
1284 CORE_ADDR fpp, lr;
1285
1286 lr = read_register (LR_REGNUM);
1287 if (lr == entry_point_address ())
1288 if (fp != 0 && (fpp = read_memory_integer (fp, 4)) != 0)
1289 if (PC_IN_CALL_DUMMY (lr, fpp, fpp))
1290 return fpp;
1291 }
1292 #endif /* GENERIC_DUMMY_FRAMES */
1293 return fp;
1294 }
1295 \f
1296 /* Return nonzero if ADDR (a function pointer) is in the data space and
1297 is therefore a special function pointer. */
1298
1299 int
1300 is_magic_function_pointer (addr)
1301 CORE_ADDR addr;
1302 {
1303 struct obj_section *s;
1304
1305 s = find_pc_section (addr);
1306 if (s && s->the_bfd_section->flags & SEC_CODE)
1307 return 0;
1308 else
1309 return 1;
1310 }
1311
1312 #ifdef GDB_TARGET_POWERPC
1313 int
1314 gdb_print_insn_powerpc (memaddr, info)
1315 bfd_vma memaddr;
1316 disassemble_info *info;
1317 {
1318 if (TARGET_BYTE_ORDER == BIG_ENDIAN)
1319 return print_insn_big_powerpc (memaddr, info);
1320 else
1321 return print_insn_little_powerpc (memaddr, info);
1322 }
1323 #endif
1324
1325 /* Function: get_saved_register
1326 Just call the generic_get_saved_register function. */
1327
1328 #ifdef USE_GENERIC_DUMMY_FRAMES
1329 void
1330 get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
1331 char *raw_buffer;
1332 int *optimized;
1333 CORE_ADDR *addrp;
1334 struct frame_info *frame;
1335 int regnum;
1336 enum lval_type *lval;
1337 {
1338 generic_get_saved_register (raw_buffer, optimized, addrp,
1339 frame, regnum, lval);
1340 }
1341 #endif
1342
1343
1344 void
1345 _initialize_rs6000_tdep ()
1346 {
1347 /* FIXME, this should not be decided via ifdef. */
1348 #ifdef GDB_TARGET_POWERPC
1349 tm_print_insn = gdb_print_insn_powerpc;
1350 #else
1351 tm_print_insn = print_insn_rs6000;
1352 #endif
1353 }
This page took 0.056256 seconds and 4 git commands to generate.