1 /* Target-machine dependent code for Motorola 88000 series, for GDB.
2 Copyright (C) 1988, 1990, 1991 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
28 #include <sys/types.h>
31 #include <sys/param.h>
36 #ifndef USER /* added to support BCS ptrace_user */
38 #define USER ptrace_user
40 #include <sys/ioctl.h>
50 void frame_find_saved_regs ();
53 /* Given a GDB frame, determine the address of the calling function's frame.
54 This will be used to create a new GDB frame struct, and then
55 INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame.
57 For us, the frame address is its stack pointer value, so we look up
58 the function prologue to determine the caller's sp value, and return it. */
61 frame_chain (thisframe)
65 frame_find_saved_regs (thisframe, (struct frame_saved_regs *) 0);
66 /* NOTE: this depends on frame_find_saved_regs returning the VALUE, not
67 the ADDRESS, of SP_REGNUM. It also depends on the cache of
68 frame_find_saved_regs results. */
69 if (thisframe->fsr->regs[SP_REGNUM])
70 return thisframe->fsr->regs[SP_REGNUM];
72 return thisframe->frame; /* Leaf fn -- next frame up has same SP. */
76 frameless_function_invocation (frame)
80 frame_find_saved_regs (frame, (struct frame_saved_regs *) 0);
81 /* NOTE: this depends on frame_find_saved_regs returning the VALUE, not
82 the ADDRESS, of SP_REGNUM. It also depends on the cache of
83 frame_find_saved_regs results. */
84 if (frame->fsr->regs[SP_REGNUM])
85 return 0; /* Frameful -- return addr saved somewhere */
87 return 1; /* Frameless -- no saved return address */
91 frame_chain_valid (chain, thisframe)
93 struct frame_info *thisframe;
96 && outside_startup_file (FRAME_SAVED_PC (thisframe)));
100 frame_chain_combine (chain, thisframe)
107 init_extra_frame_info (fromleaf, fi)
109 struct frame_info *fi;
111 fi->fsr = 0; /* Not yet allocated */
112 fi->args_pointer = 0; /* Unknown */
113 fi->locals_pointer = 0; /* Unknown */
117 init_frame_pc (fromleaf, prev)
119 struct frame_info *prev;
121 /* FIXME, for now it's the default from blockframe.c. If it stays that
122 way, remove it entirely from here. */
123 prev->pc = (fromleaf ? SAVED_PC_AFTER_CALL (prev->next) :
124 prev->next ? FRAME_SAVED_PC (prev->next) : read_pc ());
128 /* Examine an m88k function prologue, recording the addresses at which
129 registers are saved explicitly by the prologue code, and returning
130 the address of the first instruction after the prologue (but not
131 after the instruction at address LIMIT, as explained below).
133 LIMIT places an upper bound on addresses of the instructions to be
134 examined. If the prologue code scan reaches LIMIT, the scan is
135 aborted and LIMIT is returned. This is used, when examining the
136 prologue for the current frame, to keep examine_prologue () from
137 claiming that a given register has been saved when in fact the
138 instruction that saves it has not yet been executed. LIMIT is used
139 at other times to stop the scan when we hit code after the true
140 function prologue (e.g. for the first source line) which might
141 otherwise be mistaken for function prologue.
143 The format of the function prologue matched by this routine is
144 derived from examination of the source to gcc 1.95, particularly
145 the routine output_prologue () in config/out-m88k.c.
147 subu r31,r31,n # stack pointer update
149 (st rn,r31,offset)? # save incoming regs
150 (st.d rn,r31,offset)?
152 (addu r30,r31,n)? # frame pointer update
154 (pic sequence)? # PIC code prologue
157 /* Macros for extracting fields from instructions. */
159 #define BITMASK(pos, width) (((0x1 << (width)) - 1) << (pos))
160 #define EXTRACT_FIELD(val, pos, width) ((val) >> (pos) & BITMASK (0, width))
162 /* Prologue code that handles position-independent-code setup. */
164 struct pic_prologue_code {
165 unsigned long insn, mask;
168 static struct pic_prologue_code pic_prologue_code [] = {
169 /* FIXME -- until this is translated to hex, we won't match it... */
171 /* or r10,r1,0 (if not saved) */
173 /* or.u r25,r0,const */
174 /*LabN: or r25,r25,const2 */
176 /* or r1,r10,0 (if not saved) */
179 /* Fetch the instruction at ADDR, returning 0 if ADDR is beyond LIM or
180 is not the address of a valid instruction, the address of the next
181 instruction beyond ADDR otherwise. *PWORD1 receives the first word
182 of the instruction. PWORD2 is ignored -- a remnant of the original
185 #define NEXT_PROLOGUE_INSN(addr, lim, pword1, pword2) \
186 (((addr) < (lim)) ? next_insn (addr, pword1) : 0)
188 /* Read the m88k instruction at 'memaddr' and return the address of
189 the next instruction after that, or 0 if 'memaddr' is not the
190 address of a valid instruction. The instruction
191 is stored at 'pword1'. */
194 next_insn (memaddr, pword1)
195 unsigned long *pword1;
198 unsigned long buf[1];
200 read_memory (memaddr, buf, sizeof (buf));
202 SWAP_TARGET_AND_HOST (pword1, sizeof (long));
207 /* Read a register from frames called by us (or from the hardware regs). */
210 read_next_frame_reg(fi, regno)
214 for (; fi; fi = fi->next) {
215 if (regno == SP_REGNUM) return fi->frame;
216 else if (fi->fsr->regs[regno])
217 return read_memory_integer(fi->fsr->regs[regno], 4);
219 return read_register(regno);
222 /* Examine the prologue of a function. `ip' points to the first instruction.
223 `limit' is the limit of the prologue (e.g. the addr of the first
224 linenumber, or perhaps the program counter if we're stepping through).
225 `frame_sp' is the stack pointer value in use in this frame.
226 `fsr' is a pointer to a frame_saved_regs structure into which we put
227 info about the registers saved by this frame.
228 `fi' is a struct frame_info pointer; we fill in various fields in it
229 to reflect the offsets of the arg pointer and the locals pointer. */
232 examine_prologue (ip, limit, frame_sp, fsr, fi)
233 register CORE_ADDR ip;
234 register CORE_ADDR limit;
236 struct frame_saved_regs *fsr;
237 struct frame_info *fi;
239 register CORE_ADDR next_ip;
241 register struct pic_prologue_code *pcode;
242 unsigned int insn1, insn2;
244 char must_adjust[32]; /* If set, must adjust offsets in fsr */
245 int sp_offset = -1; /* -1 means not set (valid must be mult of 8) */
246 int fp_offset = -1; /* -1 means not set */
249 bzero (must_adjust, sizeof (must_adjust));
250 next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn1, &insn2);
252 /* Accept an optional "subu sp,sp,n" to set up the stack pointer. */
254 #define SUBU_SP_INSN 0x67ff0000
255 #define SUBU_SP_MASK 0xffff0007 /* Note offset must be mult. of 8 */
256 #define SUBU_OFFSET(x) ((unsigned)(x & 0xFFFF))
258 ((insn1 & SUBU_SP_MASK) == SUBU_SP_INSN)) /* subu r31, r31, N */
260 sp_offset = -SUBU_OFFSET (insn1);
262 next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn1, &insn2);
265 /* The function must start with a stack-pointer adjustment, or
266 we don't know WHAT'S going on... */
270 /* Accept zero or more instances of "st rx,sp,n" or "st.d rx,sp,n".
271 This may cause us to mistake the copying of a register
272 parameter to the frame for the saving of a callee-saved
273 register, but that can't be helped, since with the
274 "-fcall-saved" flag, any register can be made callee-saved.
275 This probably doesn't matter, since the ``saved'' caller's values of
276 non-callee-saved registers are not relevant anyway. */
278 #define STD_STACK_INSN 0x201f0000
279 #define STD_STACK_MASK 0xfc1f0000
280 #define ST_STACK_INSN 0x241f0000
281 #define ST_STACK_MASK 0xfc1f0000
282 #define ST_OFFSET(x) ((unsigned)((x) & 0xFFFF))
283 #define ST_SRC(x) EXTRACT_FIELD ((x), 21, 5)
287 if ((insn1 & ST_STACK_MASK) == ST_STACK_INSN)
289 else if ((insn1 & STD_STACK_MASK) == STD_STACK_INSN)
294 src = ST_SRC (insn1);
295 offset = ST_OFFSET (insn1);
298 must_adjust[src] = 1;
299 fsr->regs[src++] = offset; /* Will be adjusted later */
303 next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn1, &insn2);
306 /* Accept an optional "addu r30,r31,n" to set up the frame pointer. */
308 #define ADDU_FP_INSN 0x63df0000
309 #define ADDU_FP_MASK 0xffff0000
310 #define ADDU_OFFSET(x) ((unsigned)(x & 0xFFFF))
312 ((insn1 & ADDU_FP_MASK) == ADDU_FP_INSN)) /* addu r30, r31, N */
314 fp_offset = ADDU_OFFSET (insn1);
316 next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn1, &insn2);
319 /* Accept the PIC prologue code if present. */
321 pcode = pic_prologue_code;
322 size = sizeof (pic_prologue_code) / sizeof (*pic_prologue_code);
323 /* If return addr is saved, we don't use first or last insn of PICstuff. */
324 if (fsr->regs[SRP_REGNUM]) {
329 while (size-- && next_ip && (pcode->insn == (pcode->mask & insn1)))
333 next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn1, &insn2);
336 /* We're done with the prologue. If we don't care about the stack
337 frame itself, just return. (Note that fsr->regs has been trashed,
338 but the one caller who calls with fi==0 passes a dummy there.) */
344 sp_offset original negative displacement of SP
345 fp_offset positive displacement between new SP and new FP, or -1
346 fsr->regs[0..31] offset from original SP where reg is stored
347 must_adjust[0..31] set if corresp. offset was set
349 The current SP (frame_sp) might not be the original new SP as set
350 by the function prologue, if alloca has been called. This can
351 only occur if fp_offset is set, though (the compiler allocates an
352 FP when it sees alloca). In that case, we have the FP,
353 and can calculate the original new SP from the FP.
355 Then, we figure out where the arguments and locals are, and
356 relocate the offsets in fsr->regs to absolute addresses. */
358 if (fp_offset != -1) {
359 /* We have a frame pointer, so get it, and base our calc's on it. */
360 frame_fp = (CORE_ADDR) read_next_frame_reg (fi->next, FP_REGNUM);
361 frame_sp = frame_fp - fp_offset;
363 /* We have no frame pointer, therefore frame_sp is still the same value
364 as set by prologue. But where is the frame itself? */
365 if (must_adjust[SRP_REGNUM]) {
366 /* Function header saved SRP (r1), the return address. Frame starts
367 4 bytes down from where it was saved. */
368 frame_fp = frame_sp + fsr->regs[SRP_REGNUM] - 4;
369 fi->locals_pointer = frame_fp;
371 /* Function header didn't save SRP (r1), so we are in a leaf fn or
372 are otherwise confused. */
377 /* The locals are relative to the FP (whether it exists as an allocated
378 register, or just as an assumed offset from the SP) */
379 fi->locals_pointer = frame_fp;
381 /* The arguments are just above the SP as it was before we adjusted it
383 fi->args_pointer = frame_sp - sp_offset;
385 /* Now that we know the SP value used by the prologue, we know where
386 it saved all the registers. */
387 for (src = 0; src < 32; src++)
388 if (must_adjust[src])
389 fsr->regs[src] += frame_sp;
391 /* The saved value of the SP is always known. */
393 if (fsr->regs[SP_REGNUM] != 0
394 && fsr->regs[SP_REGNUM] != frame_sp - sp_offset)
395 fprintf(stderr, "Bad saved SP value %x != %x, offset %x!\n",
396 fsr->regs[SP_REGNUM],
397 frame_sp - sp_offset, sp_offset);
399 fsr->regs[SP_REGNUM] = frame_sp - sp_offset;
404 /* Given an ip value corresponding to the start of a function,
405 return the ip of the first instruction after the function
412 struct frame_saved_regs saved_regs_dummy;
413 struct symtab_and_line sal;
416 sal = find_pc_line (ip, 0);
417 limit = (sal.end) ? sal.end : 0xffffffff;
419 return (examine_prologue (ip, limit, (FRAME_ADDR) 0, &saved_regs_dummy,
420 (struct frame_info *)0 ));
423 /* Put here the code to store, into a struct frame_saved_regs,
424 the addresses of the saved registers of frame described by FRAME_INFO.
425 This includes special registers such as pc and fp saved in special
426 ways in the stack frame. sp is even more special:
427 the address we return for it IS the sp for the next frame.
429 We cache the result of doing this in the frame_cache_obstack, since
430 it is fairly expensive. */
433 frame_find_saved_regs (fi, fsr)
434 struct frame_info *fi;
435 struct frame_saved_regs *fsr;
437 register CORE_ADDR next_addr;
438 register CORE_ADDR *saved_regs;
440 register struct frame_saved_regs *cache_fsr;
441 extern struct obstack frame_cache_obstack;
443 struct symtab_and_line sal;
448 cache_fsr = (struct frame_saved_regs *)
449 obstack_alloc (&frame_cache_obstack,
450 sizeof (struct frame_saved_regs));
451 bzero (cache_fsr, sizeof (struct frame_saved_regs));
454 /* Find the start and end of the function prologue. If the PC
455 is in the function prologue, we only consider the part that
456 has executed already. */
458 ip = get_pc_function_start (fi->pc);
459 sal = find_pc_line (ip, 0);
460 limit = (sal.end && sal.end < fi->pc) ? sal.end: fi->pc;
462 /* This will fill in fields in *fi as well as in cache_fsr. */
463 examine_prologue (ip, limit, fi->frame, cache_fsr, fi);
470 /* Return the address of the locals block for the frame
471 described by FI. Returns 0 if the address is unknown.
472 NOTE! Frame locals are referred to by negative offsets from the
473 argument pointer, so this is the same as frame_args_address(). */
476 frame_locals_address (fi)
477 struct frame_info *fi;
479 register FRAME frame;
480 struct frame_saved_regs fsr;
483 if (fi->args_pointer) /* Cached value is likely there. */
484 return fi->args_pointer;
486 /* Nope, generate it. */
488 get_frame_saved_regs (fi, &fsr);
490 return fi->args_pointer;
493 /* Return the address of the argument block for the frame
494 described by FI. Returns 0 if the address is unknown. */
497 frame_args_address (fi)
498 struct frame_info *fi;
500 register FRAME frame;
501 struct frame_saved_regs fsr;
504 if (fi->args_pointer) /* Cached value is likely there. */
505 return fi->args_pointer;
507 /* Nope, generate it. */
509 get_frame_saved_regs (fi, &fsr);
511 return fi->args_pointer;
514 /* Return the saved PC from this frame.
516 If the frame has a memory copy of SRP_REGNUM, use that. If not,
517 just use the register SRP_REGNUM itself. */
520 frame_saved_pc (frame)
523 return read_next_frame_reg(frame, SRP_REGNUM);
527 #if TARGET_BYTE_ORDER != HOST_BYTE_ORDER
529 #else /* Host and target byte order the same. */
530 #define SINGLE_EXP_BITS 8
531 #define DOUBLE_EXP_BITS 11
535 /* fp points to a single precision OR double precision
536 * floating point value; len is the number of bytes, either 4 or 8.
537 * Returns 1 iff fp points to a valid IEEE floating point number.
538 * Returns 0 if fp points to a denormalized number or a NaN
545 exponent = exponent << 1 >> (32 - SINGLE_EXP_BITS - 1);
546 return ((exponent == -1) || (! exponent && *fp));
551 exponent = exponent << 1 >> (32 - DOUBLE_EXP_BITS - 1);
552 return ((exponent == -1) || (! exponent && *fp * *(fp+1)));
556 #endif /* Host and target byte order the same. */
559 pushed_size (prev_words, v)
563 switch (TYPE_CODE (VALUE_TYPE (v)))
565 case TYPE_CODE_VOID: /* Void type (values zero length) */
567 return 0; /* That was easy! */
569 case TYPE_CODE_PTR: /* Pointer type */
570 case TYPE_CODE_ENUM: /* Enumeration type */
571 case TYPE_CODE_INT: /* Integer type */
572 case TYPE_CODE_REF: /* C++ Reference types */
573 case TYPE_CODE_ARRAY: /* Array type, lower bound zero */
577 case TYPE_CODE_FLT: /* Floating type */
579 if (TYPE_LENGTH (VALUE_TYPE (v)) == 4)
582 /* Assume that it must be a double. */
583 if (prev_words & 1) /* at an odd-word boundary */
584 return 3; /* round to 8-byte boundary */
588 case TYPE_CODE_STRUCT: /* C struct or Pascal record */
589 case TYPE_CODE_UNION: /* C union or Pascal variant part */
591 return (((TYPE_LENGTH (VALUE_TYPE (v)) + 3) / 4) * 4);
593 case TYPE_CODE_FUNC: /* Function type */
594 case TYPE_CODE_SET: /* Pascal sets */
595 case TYPE_CODE_RANGE: /* Range (integers within bounds) */
596 case TYPE_CODE_PASCAL_ARRAY: /* Array with explicit type of index */
597 case TYPE_CODE_MEMBER: /* Member type */
598 case TYPE_CODE_METHOD: /* Method type */
599 /* Don't know how to pass these yet. */
601 case TYPE_CODE_UNDEF: /* Not used; catches errors */
608 store_parm_word (address, val)
612 write_memory (address, &val, 4);
616 store_parm (prev_words, left_parm_addr, v)
617 unsigned int prev_words;
618 CORE_ADDR left_parm_addr;
621 CORE_ADDR start = left_parm_addr + (prev_words * 4);
622 int *val_addr = (int *)VALUE_CONTENTS(v);
624 switch (TYPE_CODE (VALUE_TYPE (v)))
626 case TYPE_CODE_VOID: /* Void type (values zero length) */
630 case TYPE_CODE_PTR: /* Pointer type */
631 case TYPE_CODE_ENUM: /* Enumeration type */
632 case TYPE_CODE_INT: /* Integer type */
633 case TYPE_CODE_ARRAY: /* Array type, lower bound zero */
634 case TYPE_CODE_REF: /* C++ Reference types */
636 store_parm_word (start, *val_addr);
639 case TYPE_CODE_FLT: /* Floating type */
641 if (TYPE_LENGTH (VALUE_TYPE (v)) == 4)
643 store_parm_word (start, *val_addr);
648 store_parm_word (start + ((prev_words & 1) * 4), val_addr[0]);
649 store_parm_word (start + ((prev_words & 1) * 4) + 4, val_addr[1]);
650 return 2 + (prev_words & 1);
653 case TYPE_CODE_STRUCT: /* C struct or Pascal record */
654 case TYPE_CODE_UNION: /* C union or Pascal variant part */
657 unsigned int words = (((TYPE_LENGTH (VALUE_TYPE (v)) + 3) / 4) * 4);
660 for (word = 0; word < words; word++)
661 store_parm_word (start + (word * 4), val_addr[word]);
670 /* This routine sets up all of the parameter values needed to make a pseudo
671 call. The name "push_parameters" is a misnomer on some archs,
672 because (on the m88k) most parameters generally end up being passed in
673 registers rather than on the stack. In this routine however, we do
674 end up storing *all* parameter values onto the stack (even if we will
675 realize later that some of these stores were unnecessary). */
677 #define FIRST_PARM_REGNUM 2
680 push_parameters (return_type, struct_conv, nargs, args)
681 struct type *return_type;
687 unsigned int p_words = 0;
688 CORE_ADDR left_parm_addr;
690 /* Start out by creating a space for the return value (if need be). We
691 only need to do this if the return value is a struct or union. If we
692 do make a space for a struct or union return value, then we must also
693 arrange for the base address of that space to go into r12, which is the
694 standard place to pass the address of the return value area to the
695 callee. Note that only structs and unions are returned in this fashion.
696 Ints, enums, pointers, and floats are returned into r2. Doubles are
697 returned into the register pair {r2,r3}. Note also that the space
698 reserved for a struct or union return value only has to be word aligned
699 (not double-word) but it is double-word aligned here anyway (just in
700 case that becomes important someday). */
702 switch (TYPE_CODE (return_type))
704 case TYPE_CODE_STRUCT:
705 case TYPE_CODE_UNION:
707 int return_bytes = ((TYPE_LENGTH (return_type) + 7) / 8) * 8;
710 rv_addr = read_register (SP_REGNUM) - return_bytes;
712 write_register (SP_REGNUM, rv_addr); /* push space onto the stack */
713 write_register (SRA_REGNUM, rv_addr);/* set return value register */
717 /* Here we make a pre-pass on the whole parameter list to figure out exactly
718 how many words worth of stuff we are going to pass. */
720 for (p_words = 0, parm_num = 0; parm_num < nargs; parm_num++)
721 p_words += pushed_size (p_words, value_arg_coerce (args[parm_num]));
723 /* Now, check to see if we have to round up the number of parameter words
724 to get up to the next 8-bytes boundary. This may be necessary because
725 of the software convention to always keep the stack aligned on an 8-byte
729 p_words++; /* round to 8-byte boundary */
731 /* Now figure out the absolute address of the leftmost parameter, and update
732 the stack pointer to point at that address. */
734 left_parm_addr = read_register (SP_REGNUM) - (p_words * 4);
735 write_register (SP_REGNUM, left_parm_addr);
737 /* Now we can go through all of the parameters (in left-to-right order)
738 and write them to their parameter stack slots. Note that we are not
739 really "pushing" the parameter values. The stack space for these values
740 was already allocated above. Now we are just filling it up. */
742 for (p_words = 0, parm_num = 0; parm_num < nargs; parm_num++)
744 store_parm (p_words, left_parm_addr, value_arg_coerce (args[parm_num]));
746 /* Now that we are all done storing the parameter values into the stack, we
747 must go back and load up the parameter registers with the values from the
748 corresponding stack slots. Note that in the two cases of (a) gaps in the
749 parameter word sequence causes by (otherwise) misaligned doubles, and (b)
750 slots correcponding to structs or unions, the work we do here in loading
751 some parameter registers may be unnecessary, but who cares? */
753 for (p_words = 0; p_words < 8; p_words++)
755 write_register (FIRST_PARM_REGNUM + p_words,
756 read_memory_integer (left_parm_addr + (p_words * 4), 4));
763 error ("Feature not implemented for the m88k yet.");
768 collect_returned_value (rval, value_type, struct_return, nargs, args)
770 struct type *value_type;
775 char retbuf[REGISTER_BYTES];
777 bcopy (registers, retbuf, REGISTER_BYTES);
778 *rval = value_being_returned (value_type, retbuf, struct_return);
783 /* Now handled in a machine independent way with CALL_DUMMY_LOCATION. */
784 /* Stuff a breakpoint instruction onto the stack (or elsewhere if the stack
785 is not a good place for it). Return the address at which the instruction
786 got stuffed, or zero if we were unable to stuff it anywhere. */
791 static char breakpoint_insn[] = BREAKPOINT;
792 extern CORE_ADDR text_end; /* of inferior */
793 static char readback_buffer[] = BREAKPOINT;
796 /* With a little bit of luck, we can just stash the breakpoint instruction
797 in the word just beyond the end of normal text space. For systems on
798 which the hardware will not allow us to execute out of the stack segment,
799 we have to hope that we *are* at least allowed to effectively extend the
800 text segment by one word. If the actual end of user's the text segment
801 happens to fall right at a page boundary this trick may fail. Note that
802 we check for this by reading after writing, and comparing in order to
803 be sure that the write worked. */
805 write_memory (text_end, &breakpoint_insn, 4);
807 /* Fill the readback buffer with some garbage which is certain to be
808 unequal to the breakpoint insn. That way we can tell if the
809 following read doesn't actually succeed. */
811 for (i = 0; i < sizeof (readback_buffer); i++)
812 readback_buffer[i] = ~ readback_buffer[i]; /* Invert the bits */
814 /* Now check that the breakpoint insn was successfully installed. */
816 read_memory (text_end, readback_buffer, sizeof (readback_buffer));
817 for (i = 0; i < sizeof (readback_buffer); i++)
818 if (readback_buffer[i] != breakpoint_insn[i])
819 return 0; /* Failed to install! */