1 /* Target-dependent code for the ALPHA architecture, for GDB, the GNU Debugger.
2 Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
3 Free Software Foundation, Inc.
5 This file is part of GDB.
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.
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.
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,
20 Boston, MA 02111-1307, USA. */
32 #include "gdb_string.h"
36 #include "arch-utils.h"
40 #include "alpha-tdep.h"
42 static gdbarch_init_ftype alpha_gdbarch_init;
44 static gdbarch_register_name_ftype alpha_register_name;
45 static gdbarch_register_raw_size_ftype alpha_register_raw_size;
46 static gdbarch_register_virtual_size_ftype alpha_register_virtual_size;
47 static gdbarch_register_virtual_type_ftype alpha_register_virtual_type;
48 static gdbarch_register_byte_ftype alpha_register_byte;
49 static gdbarch_cannot_fetch_register_ftype alpha_cannot_fetch_register;
50 static gdbarch_cannot_store_register_ftype alpha_cannot_store_register;
51 static gdbarch_register_convertible_ftype alpha_register_convertible;
52 static gdbarch_register_convert_to_virtual_ftype
53 alpha_register_convert_to_virtual;
54 static gdbarch_register_convert_to_raw_ftype alpha_register_convert_to_raw;
55 static gdbarch_store_struct_return_ftype alpha_store_struct_return;
56 static gdbarch_extract_return_value_ftype alpha_extract_return_value;
57 static gdbarch_store_return_value_ftype alpha_store_return_value;
58 static gdbarch_extract_struct_value_address_ftype
59 alpha_extract_struct_value_address;
60 static gdbarch_use_struct_convention_ftype alpha_use_struct_convention;
62 static gdbarch_breakpoint_from_pc_ftype alpha_breakpoint_from_pc;
64 static gdbarch_frame_args_address_ftype alpha_frame_args_address;
65 static gdbarch_frame_locals_address_ftype alpha_frame_locals_address;
67 static gdbarch_skip_prologue_ftype alpha_skip_prologue;
68 static gdbarch_get_saved_register_ftype alpha_get_saved_register;
69 static gdbarch_saved_pc_after_call_ftype alpha_saved_pc_after_call;
70 static gdbarch_frame_chain_ftype alpha_frame_chain;
71 static gdbarch_frame_saved_pc_ftype alpha_frame_saved_pc;
72 static gdbarch_frame_init_saved_regs_ftype alpha_frame_init_saved_regs;
74 static gdbarch_push_arguments_ftype alpha_push_arguments;
75 static gdbarch_push_dummy_frame_ftype alpha_push_dummy_frame;
76 static gdbarch_pop_frame_ftype alpha_pop_frame;
77 static gdbarch_fix_call_dummy_ftype alpha_fix_call_dummy;
78 static gdbarch_init_frame_pc_first_ftype alpha_init_frame_pc_first;
79 static gdbarch_init_extra_frame_info_ftype alpha_init_extra_frame_info;
81 static gdbarch_get_longjmp_target_ftype alpha_get_longjmp_target;
83 struct frame_extra_info
85 alpha_extra_func_info_t proc_desc;
90 /* FIXME: Some of this code should perhaps be merged with mips-tdep.c. */
92 /* Prototypes for local functions. */
94 static void alpha_find_saved_regs (struct frame_info *);
96 static alpha_extra_func_info_t push_sigtramp_desc (CORE_ADDR low_addr);
98 static CORE_ADDR read_next_frame_reg (struct frame_info *, int);
100 static CORE_ADDR heuristic_proc_start (CORE_ADDR);
102 static alpha_extra_func_info_t heuristic_proc_desc (CORE_ADDR,
104 struct frame_info *);
106 static alpha_extra_func_info_t find_proc_desc (CORE_ADDR,
107 struct frame_info *);
110 static int alpha_in_lenient_prologue (CORE_ADDR, CORE_ADDR);
113 static void reinit_frame_cache_sfunc (char *, int, struct cmd_list_element *);
115 static CORE_ADDR after_prologue (CORE_ADDR pc,
116 alpha_extra_func_info_t proc_desc);
118 static int alpha_in_prologue (CORE_ADDR pc,
119 alpha_extra_func_info_t proc_desc);
121 static int alpha_about_to_return (CORE_ADDR pc);
123 void _initialize_alpha_tdep (void);
125 /* Heuristic_proc_start may hunt through the text section for a long
126 time across a 2400 baud serial line. Allows the user to limit this
128 static unsigned int heuristic_fence_post = 0;
130 /* Layout of a stack frame on the alpha:
133 pdr members: | 7th ... nth arg, |
134 | `pushed' by caller. |
136 ----------------|-------------------------------|<-- old_sp == vfp
139 | |localoff | Copies of 1st .. 6th |
140 | | | | | argument if necessary. |
142 | | | --- |-------------------------------|<-- FRAME_LOCALS_ADDRESS
144 | | | | Locals and temporaries. |
146 | | | |-------------------------------|
148 |-fregoffset | Saved float registers. |
154 | | -------|-------------------------------|
156 | | | Saved registers. |
163 | ----------|-------------------------------|
165 frameoffset | Argument build area, gets |
166 | | 7th ... nth arg for any |
167 | | called procedure. |
169 -------------|-------------------------------|<-- sp
174 #define PROC_LOW_ADDR(proc) ((proc)->pdr.adr) /* least address */
175 /* These next two fields are kind of being hijacked. I wonder if
176 iline is too small for the values it needs to hold, if GDB is
177 running on a 32-bit host. */
178 #define PROC_HIGH_ADDR(proc) ((proc)->pdr.iline) /* upper address bound */
179 #define PROC_DUMMY_FRAME(proc) ((proc)->pdr.cbLineOffset) /*CALL_DUMMY frame */
180 #define PROC_FRAME_OFFSET(proc) ((proc)->pdr.frameoffset)
181 #define PROC_FRAME_REG(proc) ((proc)->pdr.framereg)
182 #define PROC_REG_MASK(proc) ((proc)->pdr.regmask)
183 #define PROC_FREG_MASK(proc) ((proc)->pdr.fregmask)
184 #define PROC_REG_OFFSET(proc) ((proc)->pdr.regoffset)
185 #define PROC_FREG_OFFSET(proc) ((proc)->pdr.fregoffset)
186 #define PROC_PC_REG(proc) ((proc)->pdr.pcreg)
187 #define PROC_LOCALOFF(proc) ((proc)->pdr.localoff)
188 #define PROC_SYMBOL(proc) (*(struct symbol**)&(proc)->pdr.isym)
189 #define _PROC_MAGIC_ 0x0F0F0F0F
190 #define PROC_DESC_IS_DUMMY(proc) ((proc)->pdr.isym == _PROC_MAGIC_)
191 #define SET_PROC_DESC_IS_DUMMY(proc) ((proc)->pdr.isym = _PROC_MAGIC_)
193 struct linked_proc_info
195 struct alpha_extra_func_info info;
196 struct linked_proc_info *next;
198 *linked_proc_desc_table = NULL;
201 alpha_frame_past_sigtramp_frame (struct frame_info *frame, CORE_ADDR pc)
203 struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
205 if (tdep->skip_sigtramp_frame != NULL)
206 return (tdep->skip_sigtramp_frame (frame, pc));
212 alpha_dynamic_sigtramp_offset (CORE_ADDR pc)
214 struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
216 /* Must be provided by OS/ABI variant code if supported. */
217 if (tdep->dynamic_sigtramp_offset != NULL)
218 return (tdep->dynamic_sigtramp_offset (pc));
223 #define ALPHA_PROC_SIGTRAMP_MAGIC 0x0e0f0f0f
225 /* Return TRUE if the procedure descriptor PROC is a procedure
226 descriptor that refers to a dynamically generated signal
227 trampoline routine. */
229 alpha_proc_desc_is_dyn_sigtramp (struct alpha_extra_func_info *proc)
231 struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
233 if (tdep->dynamic_sigtramp_offset != NULL)
234 return (proc->pdr.isym == ALPHA_PROC_SIGTRAMP_MAGIC);
240 alpha_set_proc_desc_is_dyn_sigtramp (struct alpha_extra_func_info *proc)
242 struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
244 if (tdep->dynamic_sigtramp_offset != NULL)
245 proc->pdr.isym = ALPHA_PROC_SIGTRAMP_MAGIC;
248 /* Dynamically create a signal-handler caller procedure descriptor for
249 the signal-handler return code starting at address LOW_ADDR. The
250 descriptor is added to the linked_proc_desc_table. */
252 static alpha_extra_func_info_t
253 push_sigtramp_desc (CORE_ADDR low_addr)
255 struct linked_proc_info *link;
256 alpha_extra_func_info_t proc_desc;
258 link = (struct linked_proc_info *)
259 xmalloc (sizeof (struct linked_proc_info));
260 link->next = linked_proc_desc_table;
261 linked_proc_desc_table = link;
263 proc_desc = &link->info;
265 proc_desc->numargs = 0;
266 PROC_LOW_ADDR (proc_desc) = low_addr;
267 PROC_HIGH_ADDR (proc_desc) = low_addr + 3 * 4;
268 PROC_DUMMY_FRAME (proc_desc) = 0;
269 PROC_FRAME_OFFSET (proc_desc) = 0x298; /* sizeof(struct sigcontext_struct) */
270 PROC_FRAME_REG (proc_desc) = SP_REGNUM;
271 PROC_REG_MASK (proc_desc) = 0xffff;
272 PROC_FREG_MASK (proc_desc) = 0xffff;
273 PROC_PC_REG (proc_desc) = 26;
274 PROC_LOCALOFF (proc_desc) = 0;
275 alpha_set_proc_desc_is_dyn_sigtramp (proc_desc);
281 alpha_register_name (int regno)
283 static char *register_names[] =
285 "v0", "t0", "t1", "t2", "t3", "t4", "t5", "t6",
286 "t7", "s0", "s1", "s2", "s3", "s4", "s5", "fp",
287 "a0", "a1", "a2", "a3", "a4", "a5", "t8", "t9",
288 "t10", "t11", "ra", "t12", "at", "gp", "sp", "zero",
289 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
290 "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
291 "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
292 "f24", "f25", "f26", "f27", "f28", "f29", "f30", "fpcr",
298 if (regno >= (sizeof(register_names) / sizeof(*register_names)))
300 return (register_names[regno]);
304 alpha_cannot_fetch_register (int regno)
306 return (regno == FP_REGNUM || regno == ALPHA_ZERO_REGNUM);
310 alpha_cannot_store_register (int regno)
312 return (regno == FP_REGNUM || regno == ALPHA_ZERO_REGNUM);
316 alpha_register_convertible (int regno)
318 return (regno >= FP0_REGNUM && regno <= FP0_REGNUM + 31);
322 alpha_register_virtual_type (int regno)
324 return ((regno >= FP0_REGNUM && regno < (FP0_REGNUM+31))
325 ? builtin_type_double : builtin_type_long);
329 alpha_register_byte (int regno)
335 alpha_register_raw_size (int regno)
341 alpha_register_virtual_size (int regno)
348 alpha_sigcontext_addr (struct frame_info *fi)
350 struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
352 if (tdep->sigcontext_addr)
353 return (tdep->sigcontext_addr (fi));
358 /* Guaranteed to set frame->saved_regs to some values (it never leaves it
362 alpha_find_saved_regs (struct frame_info *frame)
365 CORE_ADDR reg_position;
367 alpha_extra_func_info_t proc_desc;
370 frame_saved_regs_zalloc (frame);
372 /* If it is the frame for __sigtramp, the saved registers are located
373 in a sigcontext structure somewhere on the stack. __sigtramp
374 passes a pointer to the sigcontext structure on the stack.
375 If the stack layout for __sigtramp changes, or if sigcontext offsets
376 change, we might have to update this code. */
377 #ifndef SIGFRAME_PC_OFF
378 #define SIGFRAME_PC_OFF (2 * 8)
379 #define SIGFRAME_REGSAVE_OFF (4 * 8)
380 #define SIGFRAME_FPREGSAVE_OFF (SIGFRAME_REGSAVE_OFF + 32 * 8 + 8)
382 if (frame->signal_handler_caller)
384 CORE_ADDR sigcontext_addr;
386 sigcontext_addr = alpha_sigcontext_addr (frame);
387 if (sigcontext_addr == 0)
389 /* Don't know where the sigcontext is; just bail. */
392 for (ireg = 0; ireg < 32; ireg++)
394 reg_position = sigcontext_addr + SIGFRAME_REGSAVE_OFF + ireg * 8;
395 frame->saved_regs[ireg] = reg_position;
397 for (ireg = 0; ireg < 32; ireg++)
399 reg_position = sigcontext_addr + SIGFRAME_FPREGSAVE_OFF + ireg * 8;
400 frame->saved_regs[FP0_REGNUM + ireg] = reg_position;
402 frame->saved_regs[PC_REGNUM] = sigcontext_addr + SIGFRAME_PC_OFF;
406 proc_desc = frame->extra_info->proc_desc;
407 if (proc_desc == NULL)
408 /* I'm not sure how/whether this can happen. Normally when we can't
409 find a proc_desc, we "synthesize" one using heuristic_proc_desc
410 and set the saved_regs right away. */
413 /* Fill in the offsets for the registers which gen_mask says
416 reg_position = frame->frame + PROC_REG_OFFSET (proc_desc);
417 mask = PROC_REG_MASK (proc_desc);
419 returnreg = PROC_PC_REG (proc_desc);
421 /* Note that RA is always saved first, regardless of its actual
423 if (mask & (1 << returnreg))
425 frame->saved_regs[returnreg] = reg_position;
427 mask &= ~(1 << returnreg); /* Clear bit for RA so we
428 don't save again later. */
431 for (ireg = 0; ireg <= 31; ++ireg)
432 if (mask & (1 << ireg))
434 frame->saved_regs[ireg] = reg_position;
438 /* Fill in the offsets for the registers which float_mask says
441 reg_position = frame->frame + PROC_FREG_OFFSET (proc_desc);
442 mask = PROC_FREG_MASK (proc_desc);
444 for (ireg = 0; ireg <= 31; ++ireg)
445 if (mask & (1 << ireg))
447 frame->saved_regs[FP0_REGNUM + ireg] = reg_position;
451 frame->saved_regs[PC_REGNUM] = frame->saved_regs[returnreg];
455 alpha_frame_init_saved_regs (struct frame_info *fi)
457 if (fi->saved_regs == NULL)
458 alpha_find_saved_regs (fi);
459 fi->saved_regs[SP_REGNUM] = fi->frame;
463 alpha_init_frame_pc_first (int fromleaf, struct frame_info *prev)
465 prev->pc = (fromleaf ? SAVED_PC_AFTER_CALL (prev->next) :
466 prev->next ? FRAME_SAVED_PC (prev->next) : read_pc ());
470 read_next_frame_reg (struct frame_info *fi, int regno)
472 for (; fi; fi = fi->next)
474 /* We have to get the saved sp from the sigcontext
475 if it is a signal handler frame. */
476 if (regno == SP_REGNUM && !fi->signal_handler_caller)
480 if (fi->saved_regs == NULL)
481 alpha_find_saved_regs (fi);
482 if (fi->saved_regs[regno])
483 return read_memory_integer (fi->saved_regs[regno], 8);
486 return read_register (regno);
490 alpha_frame_saved_pc (struct frame_info *frame)
492 alpha_extra_func_info_t proc_desc = frame->extra_info->proc_desc;
493 /* We have to get the saved pc from the sigcontext
494 if it is a signal handler frame. */
495 int pcreg = frame->signal_handler_caller ? PC_REGNUM
496 : frame->extra_info->pc_reg;
498 if (proc_desc && PROC_DESC_IS_DUMMY (proc_desc))
499 return read_memory_integer (frame->frame - 8, 8);
501 return read_next_frame_reg (frame, pcreg);
505 alpha_get_saved_register (char *raw_buffer,
508 struct frame_info *frame,
510 enum lval_type *lval)
514 if (!target_has_registers)
515 error ("No registers.");
517 /* Normal systems don't optimize out things with register numbers. */
518 if (optimized != NULL)
520 addr = find_saved_register (frame, regnum);
525 if (regnum == SP_REGNUM)
527 if (raw_buffer != NULL)
529 /* Put it back in target format. */
530 store_address (raw_buffer, REGISTER_RAW_SIZE (regnum),
537 if (raw_buffer != NULL)
538 target_read_memory (addr, raw_buffer, REGISTER_RAW_SIZE (regnum));
543 *lval = lval_register;
544 addr = REGISTER_BYTE (regnum);
545 if (raw_buffer != NULL)
546 read_register_gen (regnum, raw_buffer);
553 alpha_saved_pc_after_call (struct frame_info *frame)
555 CORE_ADDR pc = frame->pc;
557 alpha_extra_func_info_t proc_desc;
560 /* Skip over shared library trampoline if necessary. */
561 tmp = SKIP_TRAMPOLINE_CODE (pc);
565 proc_desc = find_proc_desc (pc, frame->next);
566 pcreg = proc_desc ? PROC_PC_REG (proc_desc) : ALPHA_RA_REGNUM;
568 if (frame->signal_handler_caller)
569 return alpha_frame_saved_pc (frame);
571 return read_register (pcreg);
575 static struct alpha_extra_func_info temp_proc_desc;
576 static CORE_ADDR temp_saved_regs[ALPHA_NUM_REGS];
578 /* Nonzero if instruction at PC is a return instruction. "ret
579 $zero,($ra),1" on alpha. */
582 alpha_about_to_return (CORE_ADDR pc)
584 return read_memory_integer (pc, 4) == 0x6bfa8001;
589 /* This fencepost looks highly suspicious to me. Removing it also
590 seems suspicious as it could affect remote debugging across serial
594 heuristic_proc_start (CORE_ADDR pc)
596 struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
597 CORE_ADDR start_pc = pc;
598 CORE_ADDR fence = start_pc - heuristic_fence_post;
603 if (heuristic_fence_post == UINT_MAX
604 || fence < tdep->vm_min_address)
605 fence = tdep->vm_min_address;
607 /* search back for previous return */
608 for (start_pc -= 4;; start_pc -= 4)
609 if (start_pc < fence)
611 /* It's not clear to me why we reach this point when
612 stop_soon_quietly, but with this test, at least we
613 don't print out warnings for every child forked (eg, on
615 if (!stop_soon_quietly)
617 static int blurb_printed = 0;
619 if (fence == tdep->vm_min_address)
620 warning ("Hit beginning of text section without finding");
622 warning ("Hit heuristic-fence-post without finding");
624 warning ("enclosing function for address 0x%s", paddr_nz (pc));
628 This warning occurs if you are debugging a function without any symbols\n\
629 (for example, in a stripped executable). In that case, you may wish to\n\
630 increase the size of the search with the `set heuristic-fence-post' command.\n\
632 Otherwise, you told GDB there was a function where there isn't one, or\n\
633 (more likely) you have encountered a bug in GDB.\n");
640 else if (alpha_about_to_return (start_pc))
643 start_pc += 4; /* skip return */
647 static alpha_extra_func_info_t
648 heuristic_proc_desc (CORE_ADDR start_pc, CORE_ADDR limit_pc,
649 struct frame_info *next_frame)
651 CORE_ADDR sp = read_next_frame_reg (next_frame, SP_REGNUM);
654 int has_frame_reg = 0;
655 unsigned long reg_mask = 0;
660 memset (&temp_proc_desc, '\0', sizeof (temp_proc_desc));
661 memset (&temp_saved_regs, '\0', SIZEOF_FRAME_SAVED_REGS);
662 PROC_LOW_ADDR (&temp_proc_desc) = start_pc;
664 if (start_pc + 200 < limit_pc)
665 limit_pc = start_pc + 200;
667 for (cur_pc = start_pc; cur_pc < limit_pc; cur_pc += 4)
673 status = read_memory_nobpt (cur_pc, buf, 4);
675 memory_error (status, cur_pc);
676 word = extract_unsigned_integer (buf, 4);
678 if ((word & 0xffff0000) == 0x23de0000) /* lda $sp,n($sp) */
681 frame_size += (-word) & 0xffff;
683 /* Exit loop if a positive stack adjustment is found, which
684 usually means that the stack cleanup code in the function
685 epilogue is reached. */
688 else if ((word & 0xfc1f0000) == 0xb41e0000 /* stq reg,n($sp) */
689 && (word & 0xffff0000) != 0xb7fe0000) /* reg != $zero */
691 int reg = (word & 0x03e00000) >> 21;
692 reg_mask |= 1 << reg;
693 temp_saved_regs[reg] = sp + (short) word;
695 /* Starting with OSF/1-3.2C, the system libraries are shipped
696 without local symbols, but they still contain procedure
697 descriptors without a symbol reference. GDB is currently
698 unable to find these procedure descriptors and uses
699 heuristic_proc_desc instead.
700 As some low level compiler support routines (__div*, __add*)
701 use a non-standard return address register, we have to
702 add some heuristics to determine the return address register,
703 or stepping over these routines will fail.
704 Usually the return address register is the first register
705 saved on the stack, but assembler optimization might
706 rearrange the register saves.
707 So we recognize only a few registers (t7, t9, ra) within
708 the procedure prologue as valid return address registers.
709 If we encounter a return instruction, we extract the
710 the return address register from it.
712 FIXME: Rewriting GDB to access the procedure descriptors,
713 e.g. via the minimal symbol table, might obviate this hack. */
715 && cur_pc < (start_pc + 80)
716 && (reg == ALPHA_T7_REGNUM || reg == ALPHA_T9_REGNUM
717 || reg == ALPHA_RA_REGNUM))
720 else if ((word & 0xffe0ffff) == 0x6be08001) /* ret zero,reg,1 */
721 pcreg = (word >> 16) & 0x1f;
722 else if (word == 0x47de040f) /* bis sp,sp fp */
727 /* If we haven't found a valid return address register yet,
728 keep searching in the procedure prologue. */
729 while (cur_pc < (limit_pc + 80) && cur_pc < (start_pc + 80))
734 if (read_memory_nobpt (cur_pc, buf, 4))
737 word = extract_unsigned_integer (buf, 4);
739 if ((word & 0xfc1f0000) == 0xb41e0000 /* stq reg,n($sp) */
740 && (word & 0xffff0000) != 0xb7fe0000) /* reg != $zero */
742 int reg = (word & 0x03e00000) >> 21;
743 if (reg == ALPHA_T7_REGNUM || reg == ALPHA_T9_REGNUM
744 || reg == ALPHA_RA_REGNUM)
750 else if ((word & 0xffe0ffff) == 0x6be08001) /* ret zero,reg,1 */
752 pcreg = (word >> 16) & 0x1f;
759 PROC_FRAME_REG (&temp_proc_desc) = ALPHA_GCC_FP_REGNUM;
761 PROC_FRAME_REG (&temp_proc_desc) = SP_REGNUM;
762 PROC_FRAME_OFFSET (&temp_proc_desc) = frame_size;
763 PROC_REG_MASK (&temp_proc_desc) = reg_mask;
764 PROC_PC_REG (&temp_proc_desc) = (pcreg == -1) ? ALPHA_RA_REGNUM : pcreg;
765 PROC_LOCALOFF (&temp_proc_desc) = 0; /* XXX - bogus */
766 return &temp_proc_desc;
769 /* This returns the PC of the first inst after the prologue. If we can't
770 find the prologue, then return 0. */
773 after_prologue (CORE_ADDR pc, alpha_extra_func_info_t proc_desc)
775 struct symtab_and_line sal;
776 CORE_ADDR func_addr, func_end;
779 proc_desc = find_proc_desc (pc, NULL);
783 if (alpha_proc_desc_is_dyn_sigtramp (proc_desc))
784 return PROC_LOW_ADDR (proc_desc); /* "prologue" is in kernel */
786 /* If function is frameless, then we need to do it the hard way. I
787 strongly suspect that frameless always means prologueless... */
788 if (PROC_FRAME_REG (proc_desc) == SP_REGNUM
789 && PROC_FRAME_OFFSET (proc_desc) == 0)
793 if (!find_pc_partial_function (pc, NULL, &func_addr, &func_end))
794 return 0; /* Unknown */
796 sal = find_pc_line (func_addr, 0);
798 if (sal.end < func_end)
801 /* The line after the prologue is after the end of the function. In this
802 case, tell the caller to find the prologue the hard way. */
807 /* Return non-zero if we *might* be in a function prologue. Return zero if we
808 are definitively *not* in a function prologue. */
811 alpha_in_prologue (CORE_ADDR pc, alpha_extra_func_info_t proc_desc)
813 CORE_ADDR after_prologue_pc;
815 after_prologue_pc = after_prologue (pc, proc_desc);
817 if (after_prologue_pc == 0
818 || pc < after_prologue_pc)
824 static alpha_extra_func_info_t
825 find_proc_desc (CORE_ADDR pc, struct frame_info *next_frame)
827 alpha_extra_func_info_t proc_desc;
832 /* Try to get the proc_desc from the linked call dummy proc_descs
833 if the pc is in the call dummy.
834 This is hairy. In the case of nested dummy calls we have to find the
835 right proc_desc, but we might not yet know the frame for the dummy
836 as it will be contained in the proc_desc we are searching for.
837 So we have to find the proc_desc whose frame is closest to the current
840 if (PC_IN_CALL_DUMMY (pc, 0, 0))
842 struct linked_proc_info *link;
843 CORE_ADDR sp = read_next_frame_reg (next_frame, SP_REGNUM);
844 alpha_extra_func_info_t found_proc_desc = NULL;
845 long min_distance = LONG_MAX;
847 for (link = linked_proc_desc_table; link; link = link->next)
849 long distance = (CORE_ADDR) PROC_DUMMY_FRAME (&link->info) - sp;
850 if (distance > 0 && distance < min_distance)
852 min_distance = distance;
853 found_proc_desc = &link->info;
856 if (found_proc_desc != NULL)
857 return found_proc_desc;
860 b = block_for_pc (pc);
862 find_pc_partial_function (pc, NULL, &startaddr, NULL);
867 if (startaddr > BLOCK_START (b))
868 /* This is the "pathological" case referred to in a comment in
869 print_frame_info. It might be better to move this check into
873 sym = lookup_symbol (MIPS_EFI_SYMBOL_NAME, b, LABEL_NAMESPACE,
877 /* If we never found a PDR for this function in symbol reading, then
878 examine prologues to find the information. */
879 if (sym && ((mips_extra_func_info_t) SYMBOL_VALUE (sym))->pdr.framereg == -1)
884 /* IF this is the topmost frame AND
885 * (this proc does not have debugging information OR
886 * the PC is in the procedure prologue)
887 * THEN create a "heuristic" proc_desc (by analyzing
888 * the actual code) to replace the "official" proc_desc.
890 proc_desc = (alpha_extra_func_info_t) SYMBOL_VALUE (sym);
891 if (next_frame == NULL)
893 if (PROC_DESC_IS_DUMMY (proc_desc) || alpha_in_prologue (pc, proc_desc))
895 alpha_extra_func_info_t found_heuristic =
896 heuristic_proc_desc (PROC_LOW_ADDR (proc_desc),
900 PROC_LOCALOFF (found_heuristic) =
901 PROC_LOCALOFF (proc_desc);
902 PROC_PC_REG (found_heuristic) = PROC_PC_REG (proc_desc);
903 proc_desc = found_heuristic;
912 /* Is linked_proc_desc_table really necessary? It only seems to be used
913 by procedure call dummys. However, the procedures being called ought
914 to have their own proc_descs, and even if they don't,
915 heuristic_proc_desc knows how to create them! */
917 register struct linked_proc_info *link;
918 for (link = linked_proc_desc_table; link; link = link->next)
919 if (PROC_LOW_ADDR (&link->info) <= pc
920 && PROC_HIGH_ADDR (&link->info) > pc)
923 /* If PC is inside a dynamically generated sigtramp handler,
924 create and push a procedure descriptor for that code: */
925 offset = alpha_dynamic_sigtramp_offset (pc);
927 return push_sigtramp_desc (pc - offset);
929 /* If heuristic_fence_post is non-zero, determine the procedure
930 start address by examining the instructions.
931 This allows us to find the start address of static functions which
932 have no symbolic information, as startaddr would have been set to
933 the preceding global function start address by the
934 find_pc_partial_function call above. */
935 if (startaddr == 0 || heuristic_fence_post != 0)
936 startaddr = heuristic_proc_start (pc);
939 heuristic_proc_desc (startaddr, pc, next_frame);
944 alpha_extra_func_info_t cached_proc_desc;
947 alpha_frame_chain (struct frame_info *frame)
949 alpha_extra_func_info_t proc_desc;
950 CORE_ADDR saved_pc = FRAME_SAVED_PC (frame);
952 if (saved_pc == 0 || inside_entry_file (saved_pc))
955 proc_desc = find_proc_desc (saved_pc, frame);
959 cached_proc_desc = proc_desc;
961 /* Fetch the frame pointer for a dummy frame from the procedure
963 if (PROC_DESC_IS_DUMMY (proc_desc))
964 return (CORE_ADDR) PROC_DUMMY_FRAME (proc_desc);
966 /* If no frame pointer and frame size is zero, we must be at end
967 of stack (or otherwise hosed). If we don't check frame size,
968 we loop forever if we see a zero size frame. */
969 if (PROC_FRAME_REG (proc_desc) == SP_REGNUM
970 && PROC_FRAME_OFFSET (proc_desc) == 0
971 /* The previous frame from a sigtramp frame might be frameless
972 and have frame size zero. */
973 && !frame->signal_handler_caller)
974 return alpha_frame_past_sigtramp_frame (frame, saved_pc);
976 return read_next_frame_reg (frame, PROC_FRAME_REG (proc_desc))
977 + PROC_FRAME_OFFSET (proc_desc);
981 alpha_print_extra_frame_info (struct frame_info *fi)
985 && fi->extra_info->proc_desc
986 && fi->extra_info->proc_desc->pdr.framereg < NUM_REGS)
987 printf_filtered (" frame pointer is at %s+%s\n",
988 REGISTER_NAME (fi->extra_info->proc_desc->pdr.framereg),
989 paddr_d (fi->extra_info->proc_desc->pdr.frameoffset));
993 alpha_init_extra_frame_info (int fromleaf, struct frame_info *frame)
995 /* Use proc_desc calculated in frame_chain */
996 alpha_extra_func_info_t proc_desc =
997 frame->next ? cached_proc_desc : find_proc_desc (frame->pc, frame->next);
999 frame->extra_info = (struct frame_extra_info *)
1000 frame_obstack_alloc (sizeof (struct frame_extra_info));
1002 frame->saved_regs = NULL;
1003 frame->extra_info->localoff = 0;
1004 frame->extra_info->pc_reg = ALPHA_RA_REGNUM;
1005 frame->extra_info->proc_desc = proc_desc == &temp_proc_desc ? 0 : proc_desc;
1008 /* Get the locals offset and the saved pc register from the
1009 procedure descriptor, they are valid even if we are in the
1010 middle of the prologue. */
1011 frame->extra_info->localoff = PROC_LOCALOFF (proc_desc);
1012 frame->extra_info->pc_reg = PROC_PC_REG (proc_desc);
1014 /* Fixup frame-pointer - only needed for top frame */
1016 /* Fetch the frame pointer for a dummy frame from the procedure
1018 if (PROC_DESC_IS_DUMMY (proc_desc))
1019 frame->frame = (CORE_ADDR) PROC_DUMMY_FRAME (proc_desc);
1021 /* This may not be quite right, if proc has a real frame register.
1022 Get the value of the frame relative sp, procedure might have been
1023 interrupted by a signal at it's very start. */
1024 else if (frame->pc == PROC_LOW_ADDR (proc_desc)
1025 && !alpha_proc_desc_is_dyn_sigtramp (proc_desc))
1026 frame->frame = read_next_frame_reg (frame->next, SP_REGNUM);
1028 frame->frame = read_next_frame_reg (frame->next, PROC_FRAME_REG (proc_desc))
1029 + PROC_FRAME_OFFSET (proc_desc);
1031 if (proc_desc == &temp_proc_desc)
1035 /* Do not set the saved registers for a sigtramp frame,
1036 alpha_find_saved_registers will do that for us.
1037 We can't use frame->signal_handler_caller, it is not yet set. */
1038 find_pc_partial_function (frame->pc, &name,
1039 (CORE_ADDR *) NULL, (CORE_ADDR *) NULL);
1040 if (!PC_IN_SIGTRAMP (frame->pc, name))
1042 frame->saved_regs = (CORE_ADDR *)
1043 frame_obstack_alloc (SIZEOF_FRAME_SAVED_REGS);
1044 memcpy (frame->saved_regs, temp_saved_regs,
1045 SIZEOF_FRAME_SAVED_REGS);
1046 frame->saved_regs[PC_REGNUM]
1047 = frame->saved_regs[ALPHA_RA_REGNUM];
1054 alpha_frame_locals_address (struct frame_info *fi)
1056 return (fi->frame - fi->extra_info->localoff);
1060 alpha_frame_args_address (struct frame_info *fi)
1062 return (fi->frame - (ALPHA_NUM_ARG_REGS * 8));
1065 /* ALPHA stack frames are almost impenetrable. When execution stops,
1066 we basically have to look at symbol information for the function
1067 that we stopped in, which tells us *which* register (if any) is
1068 the base of the frame pointer, and what offset from that register
1069 the frame itself is at.
1071 This presents a problem when trying to examine a stack in memory
1072 (that isn't executing at the moment), using the "frame" command. We
1073 don't have a PC, nor do we have any registers except SP.
1075 This routine takes two arguments, SP and PC, and tries to make the
1076 cached frames look as if these two arguments defined a frame on the
1077 cache. This allows the rest of info frame to extract the important
1078 arguments without difficulty. */
1081 alpha_setup_arbitrary_frame (int argc, CORE_ADDR *argv)
1084 error ("ALPHA frame specifications require two arguments: sp and pc");
1086 return create_new_frame (argv[0], argv[1]);
1089 /* The alpha passes the first six arguments in the registers, the rest on
1090 the stack. The register arguments are eventually transferred to the
1091 argument transfer area immediately below the stack by the called function
1092 anyway. So we `push' at least six arguments on the stack, `reload' the
1093 argument registers and then adjust the stack pointer to point past the
1094 sixth argument. This algorithm simplifies the passing of a large struct
1095 which extends from the registers to the stack.
1096 If the called function is returning a structure, the address of the
1097 structure to be returned is passed as a hidden first argument. */
1100 alpha_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
1101 int struct_return, CORE_ADDR struct_addr)
1104 int accumulate_size = struct_return ? 8 : 0;
1105 int arg_regs_size = ALPHA_NUM_ARG_REGS * 8;
1112 struct alpha_arg *alpha_args =
1113 (struct alpha_arg *) alloca (nargs * sizeof (struct alpha_arg));
1114 register struct alpha_arg *m_arg;
1115 char raw_buffer[sizeof (CORE_ADDR)];
1116 int required_arg_regs;
1118 for (i = 0, m_arg = alpha_args; i < nargs; i++, m_arg++)
1120 struct value *arg = args[i];
1121 struct type *arg_type = check_typedef (VALUE_TYPE (arg));
1122 /* Cast argument to long if necessary as the compiler does it too. */
1123 switch (TYPE_CODE (arg_type))
1126 case TYPE_CODE_BOOL:
1127 case TYPE_CODE_CHAR:
1128 case TYPE_CODE_RANGE:
1129 case TYPE_CODE_ENUM:
1130 if (TYPE_LENGTH (arg_type) < TYPE_LENGTH (builtin_type_long))
1132 arg_type = builtin_type_long;
1133 arg = value_cast (arg_type, arg);
1139 m_arg->len = TYPE_LENGTH (arg_type);
1140 m_arg->offset = accumulate_size;
1141 accumulate_size = (accumulate_size + m_arg->len + 7) & ~7;
1142 m_arg->contents = VALUE_CONTENTS (arg);
1145 /* Determine required argument register loads, loading an argument register
1146 is expensive as it uses three ptrace calls. */
1147 required_arg_regs = accumulate_size / 8;
1148 if (required_arg_regs > ALPHA_NUM_ARG_REGS)
1149 required_arg_regs = ALPHA_NUM_ARG_REGS;
1151 /* Make room for the arguments on the stack. */
1152 if (accumulate_size < arg_regs_size)
1153 accumulate_size = arg_regs_size;
1154 sp -= accumulate_size;
1156 /* Keep sp aligned to a multiple of 16 as the compiler does it too. */
1159 /* `Push' arguments on the stack. */
1160 for (i = nargs; m_arg--, --i >= 0;)
1161 write_memory (sp + m_arg->offset, m_arg->contents, m_arg->len);
1164 store_address (raw_buffer, sizeof (CORE_ADDR), struct_addr);
1165 write_memory (sp, raw_buffer, sizeof (CORE_ADDR));
1168 /* Load the argument registers. */
1169 for (i = 0; i < required_arg_regs; i++)
1173 val = read_memory_integer (sp + i * 8, 8);
1174 write_register (ALPHA_A0_REGNUM + i, val);
1175 write_register (ALPHA_FPA0_REGNUM + i, val);
1178 return sp + arg_regs_size;
1182 alpha_push_dummy_frame (void)
1185 struct linked_proc_info *link;
1186 alpha_extra_func_info_t proc_desc;
1187 CORE_ADDR sp = read_register (SP_REGNUM);
1188 CORE_ADDR save_address;
1189 char raw_buffer[ALPHA_MAX_REGISTER_RAW_SIZE];
1192 link = (struct linked_proc_info *) xmalloc (sizeof (struct linked_proc_info));
1193 link->next = linked_proc_desc_table;
1194 linked_proc_desc_table = link;
1196 proc_desc = &link->info;
1199 * The registers we must save are all those not preserved across
1201 * In addition, we must save the PC and RA.
1203 * Dummy frame layout:
1213 * Parameter build area
1217 /* MASK(i,j) == (1<<i) + (1<<(i+1)) + ... + (1<<j)). Assume i<=j<31. */
1218 #define MASK(i,j) ((((LONGEST)1 << ((j)+1)) - 1) ^ (((LONGEST)1 << (i)) - 1))
1219 #define GEN_REG_SAVE_MASK (MASK(0,8) | MASK(16,29))
1220 #define GEN_REG_SAVE_COUNT 24
1221 #define FLOAT_REG_SAVE_MASK (MASK(0,1) | MASK(10,30))
1222 #define FLOAT_REG_SAVE_COUNT 23
1223 /* The special register is the PC as we have no bit for it in the save masks.
1224 alpha_frame_saved_pc knows where the pc is saved in a dummy frame. */
1225 #define SPECIAL_REG_SAVE_COUNT 1
1227 PROC_REG_MASK (proc_desc) = GEN_REG_SAVE_MASK;
1228 PROC_FREG_MASK (proc_desc) = FLOAT_REG_SAVE_MASK;
1229 /* PROC_REG_OFFSET is the offset from the dummy frame to the saved RA,
1230 but keep SP aligned to a multiple of 16. */
1231 PROC_REG_OFFSET (proc_desc) =
1232 -((8 * (SPECIAL_REG_SAVE_COUNT
1233 + GEN_REG_SAVE_COUNT
1234 + FLOAT_REG_SAVE_COUNT)
1236 PROC_FREG_OFFSET (proc_desc) =
1237 PROC_REG_OFFSET (proc_desc) + 8 * GEN_REG_SAVE_COUNT;
1239 /* Save general registers.
1240 The return address register is the first saved register, all other
1241 registers follow in ascending order.
1242 The PC is saved immediately below the SP. */
1243 save_address = sp + PROC_REG_OFFSET (proc_desc);
1244 store_address (raw_buffer, 8, read_register (ALPHA_RA_REGNUM));
1245 write_memory (save_address, raw_buffer, 8);
1247 mask = PROC_REG_MASK (proc_desc) & 0xffffffffL;
1248 for (ireg = 0; mask; ireg++, mask >>= 1)
1251 if (ireg == ALPHA_RA_REGNUM)
1253 store_address (raw_buffer, 8, read_register (ireg));
1254 write_memory (save_address, raw_buffer, 8);
1258 store_address (raw_buffer, 8, read_register (PC_REGNUM));
1259 write_memory (sp - 8, raw_buffer, 8);
1261 /* Save floating point registers. */
1262 save_address = sp + PROC_FREG_OFFSET (proc_desc);
1263 mask = PROC_FREG_MASK (proc_desc) & 0xffffffffL;
1264 for (ireg = 0; mask; ireg++, mask >>= 1)
1267 store_address (raw_buffer, 8, read_register (ireg + FP0_REGNUM));
1268 write_memory (save_address, raw_buffer, 8);
1272 /* Set and save the frame address for the dummy.
1273 This is tricky. The only registers that are suitable for a frame save
1274 are those that are preserved across procedure calls (s0-s6). But if
1275 a read system call is interrupted and then a dummy call is made
1276 (see testsuite/gdb.t17/interrupt.exp) the dummy call hangs till the read
1277 is satisfied. Then it returns with the s0-s6 registers set to the values
1278 on entry to the read system call and our dummy frame pointer would be
1279 destroyed. So we save the dummy frame in the proc_desc and handle the
1280 retrieval of the frame pointer of a dummy specifically. The frame register
1281 is set to the virtual frame (pseudo) register, it's value will always
1282 be read as zero and will help us to catch any errors in the dummy frame
1284 PROC_DUMMY_FRAME (proc_desc) = sp;
1285 PROC_FRAME_REG (proc_desc) = FP_REGNUM;
1286 PROC_FRAME_OFFSET (proc_desc) = 0;
1287 sp += PROC_REG_OFFSET (proc_desc);
1288 write_register (SP_REGNUM, sp);
1290 PROC_LOW_ADDR (proc_desc) = CALL_DUMMY_ADDRESS ();
1291 PROC_HIGH_ADDR (proc_desc) = PROC_LOW_ADDR (proc_desc) + 4;
1293 SET_PROC_DESC_IS_DUMMY (proc_desc);
1294 PROC_PC_REG (proc_desc) = ALPHA_RA_REGNUM;
1298 alpha_pop_frame (void)
1300 register int regnum;
1301 struct frame_info *frame = get_current_frame ();
1302 CORE_ADDR new_sp = frame->frame;
1304 alpha_extra_func_info_t proc_desc = frame->extra_info->proc_desc;
1306 /* we need proc_desc to know how to restore the registers;
1307 if it is NULL, construct (a temporary) one */
1308 if (proc_desc == NULL)
1309 proc_desc = find_proc_desc (frame->pc, frame->next);
1311 /* Question: should we copy this proc_desc and save it in
1312 frame->proc_desc? If we do, who will free it?
1313 For now, we don't save a copy... */
1315 write_register (PC_REGNUM, FRAME_SAVED_PC (frame));
1316 if (frame->saved_regs == NULL)
1317 alpha_find_saved_regs (frame);
1320 for (regnum = 32; --regnum >= 0;)
1321 if (PROC_REG_MASK (proc_desc) & (1 << regnum))
1322 write_register (regnum,
1323 read_memory_integer (frame->saved_regs[regnum],
1325 for (regnum = 32; --regnum >= 0;)
1326 if (PROC_FREG_MASK (proc_desc) & (1 << regnum))
1327 write_register (regnum + FP0_REGNUM,
1328 read_memory_integer (frame->saved_regs[regnum + FP0_REGNUM], 8));
1330 write_register (SP_REGNUM, new_sp);
1331 flush_cached_frames ();
1333 if (proc_desc && (PROC_DESC_IS_DUMMY (proc_desc)
1334 || alpha_proc_desc_is_dyn_sigtramp (proc_desc)))
1336 struct linked_proc_info *pi_ptr, *prev_ptr;
1338 for (pi_ptr = linked_proc_desc_table, prev_ptr = NULL;
1340 prev_ptr = pi_ptr, pi_ptr = pi_ptr->next)
1342 if (&pi_ptr->info == proc_desc)
1347 error ("Can't locate dummy extra frame info\n");
1349 if (prev_ptr != NULL)
1350 prev_ptr->next = pi_ptr->next;
1352 linked_proc_desc_table = pi_ptr->next;
1358 /* To skip prologues, I use this predicate. Returns either PC itself
1359 if the code at PC does not look like a function prologue; otherwise
1360 returns an address that (if we're lucky) follows the prologue. If
1361 LENIENT, then we must skip everything which is involved in setting
1362 up the frame (it's OK to skip more, just so long as we don't skip
1363 anything which might clobber the registers which are being saved.
1364 Currently we must not skip more on the alpha, but we might need the
1365 lenient stuff some day. */
1368 alpha_skip_prologue_internal (CORE_ADDR pc, int lenient)
1372 CORE_ADDR post_prologue_pc;
1375 /* Silently return the unaltered pc upon memory errors.
1376 This could happen on OSF/1 if decode_line_1 tries to skip the
1377 prologue for quickstarted shared library functions when the
1378 shared library is not yet mapped in.
1379 Reading target memory is slow over serial lines, so we perform
1380 this check only if the target has shared libraries (which all
1381 Alpha targets do). */
1382 if (target_read_memory (pc, buf, 4))
1385 /* See if we can determine the end of the prologue via the symbol table.
1386 If so, then return either PC, or the PC after the prologue, whichever
1389 post_prologue_pc = after_prologue (pc, NULL);
1391 if (post_prologue_pc != 0)
1392 return max (pc, post_prologue_pc);
1394 /* Can't determine prologue from the symbol table, need to examine
1397 /* Skip the typical prologue instructions. These are the stack adjustment
1398 instruction and the instructions that save registers on the stack
1399 or in the gcc frame. */
1400 for (offset = 0; offset < 100; offset += 4)
1404 status = read_memory_nobpt (pc + offset, buf, 4);
1406 memory_error (status, pc + offset);
1407 inst = extract_unsigned_integer (buf, 4);
1409 /* The alpha has no delay slots. But let's keep the lenient stuff,
1410 we might need it for something else in the future. */
1414 if ((inst & 0xffff0000) == 0x27bb0000) /* ldah $gp,n($t12) */
1416 if ((inst & 0xffff0000) == 0x23bd0000) /* lda $gp,n($gp) */
1418 if ((inst & 0xffff0000) == 0x23de0000) /* lda $sp,n($sp) */
1420 if ((inst & 0xffe01fff) == 0x43c0153e) /* subq $sp,n,$sp */
1423 if ((inst & 0xfc1f0000) == 0xb41e0000
1424 && (inst & 0xffff0000) != 0xb7fe0000)
1425 continue; /* stq reg,n($sp) */
1427 if ((inst & 0xfc1f0000) == 0x9c1e0000
1428 && (inst & 0xffff0000) != 0x9ffe0000)
1429 continue; /* stt reg,n($sp) */
1431 if (inst == 0x47de040f) /* bis sp,sp,fp */
1440 alpha_skip_prologue (CORE_ADDR addr)
1442 return (alpha_skip_prologue_internal (addr, 0));
1446 /* Is address PC in the prologue (loosely defined) for function at
1450 alpha_in_lenient_prologue (CORE_ADDR startaddr, CORE_ADDR pc)
1452 CORE_ADDR end_prologue = alpha_skip_prologue_internal (startaddr, 1);
1453 return pc >= startaddr && pc < end_prologue;
1457 /* The alpha needs a conversion between register and memory format if
1458 the register is a floating point register and
1459 memory format is float, as the register format must be double
1461 memory format is an integer with 4 bytes or less, as the representation
1462 of integers in floating point registers is different. */
1464 alpha_register_convert_to_virtual (int regnum, struct type *valtype,
1465 char *raw_buffer, char *virtual_buffer)
1467 if (TYPE_LENGTH (valtype) >= REGISTER_RAW_SIZE (regnum))
1469 memcpy (virtual_buffer, raw_buffer, REGISTER_VIRTUAL_SIZE (regnum));
1473 if (TYPE_CODE (valtype) == TYPE_CODE_FLT)
1475 double d = extract_floating (raw_buffer, REGISTER_RAW_SIZE (regnum));
1476 store_floating (virtual_buffer, TYPE_LENGTH (valtype), d);
1478 else if (TYPE_CODE (valtype) == TYPE_CODE_INT && TYPE_LENGTH (valtype) <= 4)
1481 l = extract_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (regnum));
1482 l = ((l >> 32) & 0xc0000000) | ((l >> 29) & 0x3fffffff);
1483 store_unsigned_integer (virtual_buffer, TYPE_LENGTH (valtype), l);
1486 error ("Cannot retrieve value from floating point register");
1490 alpha_register_convert_to_raw (struct type *valtype, int regnum,
1491 char *virtual_buffer, char *raw_buffer)
1493 if (TYPE_LENGTH (valtype) >= REGISTER_RAW_SIZE (regnum))
1495 memcpy (raw_buffer, virtual_buffer, REGISTER_RAW_SIZE (regnum));
1499 if (TYPE_CODE (valtype) == TYPE_CODE_FLT)
1501 double d = extract_floating (virtual_buffer, TYPE_LENGTH (valtype));
1502 store_floating (raw_buffer, REGISTER_RAW_SIZE (regnum), d);
1504 else if (TYPE_CODE (valtype) == TYPE_CODE_INT && TYPE_LENGTH (valtype) <= 4)
1507 if (TYPE_UNSIGNED (valtype))
1508 l = extract_unsigned_integer (virtual_buffer, TYPE_LENGTH (valtype));
1510 l = extract_signed_integer (virtual_buffer, TYPE_LENGTH (valtype));
1511 l = ((l & 0xc0000000) << 32) | ((l & 0x3fffffff) << 29);
1512 store_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (regnum), l);
1515 error ("Cannot store value in floating point register");
1518 static const unsigned char *
1519 alpha_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
1521 static const unsigned char alpha_breakpoint[] =
1522 { 0x80, 0, 0, 0 }; /* call_pal bpt */
1524 *lenptr = sizeof(alpha_breakpoint);
1525 return (alpha_breakpoint);
1528 /* Given a return value in `regbuf' with a type `valtype',
1529 extract and copy its value into `valbuf'. */
1532 alpha_extract_return_value (struct type *valtype,
1533 char regbuf[REGISTER_BYTES], char *valbuf)
1535 if (TYPE_CODE (valtype) == TYPE_CODE_FLT)
1536 alpha_register_convert_to_virtual (FP0_REGNUM, valtype,
1537 regbuf + REGISTER_BYTE (FP0_REGNUM),
1540 memcpy (valbuf, regbuf + REGISTER_BYTE (ALPHA_V0_REGNUM),
1541 TYPE_LENGTH (valtype));
1544 /* Given a return value in `regbuf' with a type `valtype',
1545 write its value into the appropriate register. */
1548 alpha_store_return_value (struct type *valtype, char *valbuf)
1550 char raw_buffer[ALPHA_MAX_REGISTER_RAW_SIZE];
1551 int regnum = ALPHA_V0_REGNUM;
1552 int length = TYPE_LENGTH (valtype);
1554 if (TYPE_CODE (valtype) == TYPE_CODE_FLT)
1556 regnum = FP0_REGNUM;
1557 length = REGISTER_RAW_SIZE (regnum);
1558 alpha_register_convert_to_raw (valtype, regnum, valbuf, raw_buffer);
1561 memcpy (raw_buffer, valbuf, length);
1563 write_register_bytes (REGISTER_BYTE (regnum), raw_buffer, length);
1566 /* Just like reinit_frame_cache, but with the right arguments to be
1567 callable as an sfunc. */
1570 reinit_frame_cache_sfunc (char *args, int from_tty, struct cmd_list_element *c)
1572 reinit_frame_cache ();
1575 /* This is the definition of CALL_DUMMY_ADDRESS. It's a heuristic that is used
1576 to find a convenient place in the text segment to stick a breakpoint to
1577 detect the completion of a target function call (ala call_function_by_hand).
1581 alpha_call_dummy_address (void)
1584 struct minimal_symbol *sym;
1586 entry = entry_point_address ();
1591 sym = lookup_minimal_symbol ("_Prelude", NULL, symfile_objfile);
1593 if (!sym || MSYMBOL_TYPE (sym) != mst_text)
1596 return SYMBOL_VALUE_ADDRESS (sym) + 4;
1600 alpha_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
1601 struct value **args, struct type *type, int gcc_p)
1603 CORE_ADDR bp_address = CALL_DUMMY_ADDRESS ();
1605 if (bp_address == 0)
1606 error ("no place to put call");
1607 write_register (ALPHA_RA_REGNUM, bp_address);
1608 write_register (ALPHA_T12_REGNUM, fun);
1611 /* On the Alpha, the call dummy code is nevery copied to user space
1612 (see alpha_fix_call_dummy() above). The contents of this do not
1614 LONGEST alpha_call_dummy_words[] = { 0 };
1617 alpha_use_struct_convention (int gcc_p, struct type *type)
1619 /* Structures are returned by ref in extra arg0. */
1624 alpha_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
1626 /* Store the address of the place in which to copy the structure the
1627 subroutine will return. Handled by alpha_push_arguments. */
1631 alpha_extract_struct_value_address (char *regbuf)
1633 return (extract_address (regbuf + REGISTER_BYTE (ALPHA_V0_REGNUM),
1634 REGISTER_RAW_SIZE (ALPHA_V0_REGNUM)));
1637 /* Figure out where the longjmp will land.
1638 We expect the first arg to be a pointer to the jmp_buf structure from
1639 which we extract the PC (JB_PC) that we will land at. The PC is copied
1640 into the "pc". This routine returns true on success. */
1643 alpha_get_longjmp_target (CORE_ADDR *pc)
1645 struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
1647 char raw_buffer[ALPHA_MAX_REGISTER_RAW_SIZE];
1649 jb_addr = read_register (ALPHA_A0_REGNUM);
1651 if (target_read_memory (jb_addr + (tdep->jb_pc * tdep->jb_elt_size),
1652 raw_buffer, tdep->jb_elt_size))
1655 *pc = extract_address (raw_buffer, tdep->jb_elt_size);
1659 /* alpha_software_single_step() is called just before we want to resume
1660 the inferior, if we want to single-step it but there is no hardware
1661 or kernel single-step support (NetBSD on Alpha, for example). We find
1662 the target of the coming instruction and breakpoint it.
1664 single_step is also called just after the inferior stops. If we had
1665 set up a simulated single-step, we undo our damage. */
1668 alpha_next_pc (CORE_ADDR pc)
1675 insn = read_memory_unsigned_integer (pc, sizeof (insn));
1677 /* Opcode is top 6 bits. */
1678 op = (insn >> 26) & 0x3f;
1682 /* Jump format: target PC is:
1684 return (read_register ((insn >> 16) & 0x1f) & ~3);
1687 if ((op & 0x30) == 0x30)
1689 /* Branch format: target PC is:
1690 (new PC) + (4 * sext(displacement)) */
1691 if (op == 0x30 || /* BR */
1692 op == 0x34) /* BSR */
1695 offset = (insn & 0x001fffff);
1696 if (offset & 0x00100000)
1697 offset |= 0xffe00000;
1699 return (pc + 4 + offset);
1702 /* Need to determine if branch is taken; read RA. */
1703 rav = (LONGEST) read_register ((insn >> 21) & 0x1f);
1706 case 0x38: /* BLBC */
1710 case 0x3c: /* BLBS */
1714 case 0x39: /* BEQ */
1718 case 0x3d: /* BNE */
1722 case 0x3a: /* BLT */
1726 case 0x3b: /* BLE */
1730 case 0x3f: /* BGT */
1734 case 0x3e: /* BGE */
1741 /* Not a branch or branch not taken; target PC is:
1747 alpha_software_single_step (enum target_signal sig, int insert_breakpoints_p)
1749 static CORE_ADDR next_pc;
1750 typedef char binsn_quantum[BREAKPOINT_MAX];
1751 static binsn_quantum break_mem;
1754 if (insert_breakpoints_p)
1757 next_pc = alpha_next_pc (pc);
1759 target_insert_breakpoint (next_pc, break_mem);
1763 target_remove_breakpoint (next_pc, break_mem);
1769 /* This table matches the indices assigned to enum alpha_abi. Keep
1771 static const char * const alpha_abi_names[] =
1782 process_note_abi_tag_sections (bfd *abfd, asection *sect, void *obj)
1784 enum alpha_abi *os_ident_ptr = obj;
1786 unsigned int sectsize;
1788 name = bfd_get_section_name (abfd, sect);
1789 sectsize = bfd_section_size (abfd, sect);
1791 if (strcmp (name, ".note.ABI-tag") == 0 && sectsize > 0)
1793 unsigned int name_length, data_length, note_type;
1796 /* If the section is larger than this, it's probably not what we are
1801 note = alloca (sectsize);
1803 bfd_get_section_contents (abfd, sect, note,
1804 (file_ptr) 0, (bfd_size_type) sectsize);
1806 name_length = bfd_h_get_32 (abfd, note);
1807 data_length = bfd_h_get_32 (abfd, note + 4);
1808 note_type = bfd_h_get_32 (abfd, note + 8);
1810 if (name_length == 4 && data_length == 16 && note_type == 1
1811 && strcmp (note + 12, "GNU") == 0)
1813 int os_number = bfd_h_get_32 (abfd, note + 16);
1815 /* The case numbers are from abi-tags in glibc. */
1819 *os_ident_ptr = ALPHA_ABI_LINUX;
1824 (__FILE__, __LINE__,
1825 "process_note_abi_sections: Hurd objects not supported");
1830 (__FILE__, __LINE__,
1831 "process_note_abi_sections: Solaris objects not supported");
1836 (__FILE__, __LINE__,
1837 "process_note_abi_sections: unknown OS number %d",
1843 /* NetBSD uses a similar trick. */
1844 else if (strcmp (name, ".note.netbsd.ident") == 0 && sectsize > 0)
1846 unsigned int name_length, desc_length, note_type;
1849 /* If the section is larger than this, it's probably not what we are
1854 note = alloca (sectsize);
1856 bfd_get_section_contents (abfd, sect, note,
1857 (file_ptr) 0, (bfd_size_type) sectsize);
1859 name_length = bfd_h_get_32 (abfd, note);
1860 desc_length = bfd_h_get_32 (abfd, note + 4);
1861 note_type = bfd_h_get_32 (abfd, note + 8);
1863 if (name_length == 7 && desc_length == 4 && note_type == 1
1864 && strcmp (note + 12, "NetBSD") == 0)
1865 /* XXX Should we check the version here?
1866 Probably not necessary yet. */
1867 *os_ident_ptr = ALPHA_ABI_NETBSD;
1872 get_elfosabi (bfd *abfd)
1875 enum alpha_abi alpha_abi = ALPHA_ABI_UNKNOWN;
1877 elfosabi = elf_elfheader (abfd)->e_ident[EI_OSABI];
1879 /* When elfosabi is 0 (ELFOSABI_NONE), this is supposed to indicate
1880 what we're on a SYSV system. However, GNU/Linux uses a note section
1881 to record OS/ABI info, but leaves e_ident[EI_OSABI] zero. So we
1882 have to check the note sections too. */
1885 bfd_map_over_sections (abfd,
1886 process_note_abi_tag_sections,
1890 if (alpha_abi != ALPHA_ABI_UNKNOWN)
1896 /* Leave it as unknown. */
1899 case ELFOSABI_NETBSD:
1900 return ALPHA_ABI_NETBSD;
1902 case ELFOSABI_FREEBSD:
1903 return ALPHA_ABI_FREEBSD;
1905 case ELFOSABI_LINUX:
1906 return ALPHA_ABI_LINUX;
1909 return ALPHA_ABI_UNKNOWN;
1912 struct alpha_abi_handler
1914 struct alpha_abi_handler *next;
1916 void (*init_abi)(struct gdbarch_info, struct gdbarch *);
1919 struct alpha_abi_handler *alpha_abi_handler_list = NULL;
1922 alpha_gdbarch_register_os_abi (enum alpha_abi abi,
1923 void (*init_abi)(struct gdbarch_info,
1926 struct alpha_abi_handler **handler_p;
1928 for (handler_p = &alpha_abi_handler_list; *handler_p != NULL;
1929 handler_p = &(*handler_p)->next)
1931 if ((*handler_p)->abi == abi)
1934 (__FILE__, __LINE__,
1935 "alpha_gdbarch_register_os_abi: A handler for this ABI variant "
1936 "(%d) has already been registered", (int) abi);
1937 /* If user wants to continue, override previous definition. */
1938 (*handler_p)->init_abi = init_abi;
1944 = (struct alpha_abi_handler *) xmalloc (sizeof (struct alpha_abi_handler));
1945 (*handler_p)->next = NULL;
1946 (*handler_p)->abi = abi;
1947 (*handler_p)->init_abi = init_abi;
1950 /* Initialize the current architecture based on INFO. If possible, re-use an
1951 architecture from ARCHES, which is a list of architectures already created
1952 during this debugging session.
1954 Called e.g. at program startup, when reading a core file, and when reading
1957 static struct gdbarch *
1958 alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1960 struct gdbarch_tdep *tdep;
1961 struct gdbarch *gdbarch;
1962 enum alpha_abi alpha_abi = ALPHA_ABI_UNKNOWN;
1963 struct alpha_abi_handler *abi_handler;
1965 /* Try to determine the ABI of the object we are loading. */
1967 if (info.abfd != NULL)
1969 switch (bfd_get_flavour (info.abfd))
1971 case bfd_target_elf_flavour:
1972 alpha_abi = get_elfosabi (info.abfd);
1975 case bfd_target_ecoff_flavour:
1976 /* Assume it's OSF/1. */
1977 alpha_abi = ALPHA_ABI_OSF1;
1981 /* Not sure what to do here, leave the ABI as unknown. */
1986 /* Find a candidate among extant architectures. */
1987 for (arches = gdbarch_list_lookup_by_info (arches, &info);
1989 arches = gdbarch_list_lookup_by_info (arches->next, &info))
1991 /* Make sure the ABI selection matches. */
1992 tdep = gdbarch_tdep (arches->gdbarch);
1993 if (tdep && tdep->alpha_abi == alpha_abi)
1994 return arches->gdbarch;
1997 tdep = xmalloc (sizeof (struct gdbarch_tdep));
1998 gdbarch = gdbarch_alloc (&info, tdep);
2000 tdep->alpha_abi = alpha_abi;
2001 if (alpha_abi < ALPHA_ABI_INVALID)
2002 tdep->abi_name = alpha_abi_names[alpha_abi];
2005 internal_error (__FILE__, __LINE__, "Invalid setting of alpha_abi %d",
2007 tdep->abi_name = "<invalid>";
2010 /* Lowest text address. This is used by heuristic_proc_start() to
2011 decide when to stop looking. */
2012 tdep->vm_min_address = (CORE_ADDR) 0x120000000;
2014 tdep->dynamic_sigtramp_offset = NULL;
2015 tdep->skip_sigtramp_frame = NULL;
2016 tdep->sigcontext_addr = NULL;
2018 tdep->jb_pc = -1; /* longjmp support not enabled by default */
2021 set_gdbarch_short_bit (gdbarch, 16);
2022 set_gdbarch_int_bit (gdbarch, 32);
2023 set_gdbarch_long_bit (gdbarch, 64);
2024 set_gdbarch_long_long_bit (gdbarch, 64);
2025 set_gdbarch_float_bit (gdbarch, 32);
2026 set_gdbarch_double_bit (gdbarch, 64);
2027 set_gdbarch_long_double_bit (gdbarch, 64);
2028 set_gdbarch_ptr_bit (gdbarch, 64);
2031 set_gdbarch_num_regs (gdbarch, ALPHA_NUM_REGS);
2032 set_gdbarch_sp_regnum (gdbarch, ALPHA_SP_REGNUM);
2033 set_gdbarch_fp_regnum (gdbarch, ALPHA_FP_REGNUM);
2034 set_gdbarch_pc_regnum (gdbarch, ALPHA_PC_REGNUM);
2035 set_gdbarch_fp0_regnum (gdbarch, ALPHA_FP0_REGNUM);
2037 set_gdbarch_register_name (gdbarch, alpha_register_name);
2038 set_gdbarch_register_size (gdbarch, ALPHA_REGISTER_SIZE);
2039 set_gdbarch_register_bytes (gdbarch, ALPHA_REGISTER_BYTES);
2040 set_gdbarch_register_byte (gdbarch, alpha_register_byte);
2041 set_gdbarch_register_raw_size (gdbarch, alpha_register_raw_size);
2042 set_gdbarch_max_register_raw_size (gdbarch, ALPHA_MAX_REGISTER_RAW_SIZE);
2043 set_gdbarch_register_virtual_size (gdbarch, alpha_register_virtual_size);
2044 set_gdbarch_max_register_virtual_size (gdbarch,
2045 ALPHA_MAX_REGISTER_VIRTUAL_SIZE);
2046 set_gdbarch_register_virtual_type (gdbarch, alpha_register_virtual_type);
2048 set_gdbarch_cannot_fetch_register (gdbarch, alpha_cannot_fetch_register);
2049 set_gdbarch_cannot_store_register (gdbarch, alpha_cannot_store_register);
2051 set_gdbarch_register_convertible (gdbarch, alpha_register_convertible);
2052 set_gdbarch_register_convert_to_virtual (gdbarch,
2053 alpha_register_convert_to_virtual);
2054 set_gdbarch_register_convert_to_raw (gdbarch, alpha_register_convert_to_raw);
2056 set_gdbarch_skip_prologue (gdbarch, alpha_skip_prologue);
2058 set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
2059 set_gdbarch_frameless_function_invocation (gdbarch,
2060 generic_frameless_function_invocation_not);
2062 set_gdbarch_saved_pc_after_call (gdbarch, alpha_saved_pc_after_call);
2064 set_gdbarch_frame_chain (gdbarch, alpha_frame_chain);
2065 set_gdbarch_frame_chain_valid (gdbarch, func_frame_chain_valid);
2066 set_gdbarch_frame_saved_pc (gdbarch, alpha_frame_saved_pc);
2068 set_gdbarch_frame_init_saved_regs (gdbarch, alpha_frame_init_saved_regs);
2069 set_gdbarch_get_saved_register (gdbarch, alpha_get_saved_register);
2071 set_gdbarch_use_struct_convention (gdbarch, alpha_use_struct_convention);
2072 set_gdbarch_extract_return_value (gdbarch, alpha_extract_return_value);
2074 set_gdbarch_store_struct_return (gdbarch, alpha_store_struct_return);
2075 set_gdbarch_store_return_value (gdbarch, alpha_store_return_value);
2076 set_gdbarch_extract_struct_value_address (gdbarch,
2077 alpha_extract_struct_value_address);
2079 /* Settings for calling functions in the inferior. */
2080 set_gdbarch_use_generic_dummy_frames (gdbarch, 0);
2081 set_gdbarch_call_dummy_length (gdbarch, 0);
2082 set_gdbarch_push_arguments (gdbarch, alpha_push_arguments);
2083 set_gdbarch_pop_frame (gdbarch, alpha_pop_frame);
2085 /* On the Alpha, the call dummy code is never copied to user space,
2086 stopping the user call is achieved via a bp_call_dummy breakpoint.
2087 But we need a fake CALL_DUMMY definition to enable the proper
2088 call_function_by_hand and to avoid zero length array warnings. */
2089 set_gdbarch_call_dummy_p (gdbarch, 1);
2090 set_gdbarch_call_dummy_words (gdbarch, alpha_call_dummy_words);
2091 set_gdbarch_sizeof_call_dummy_words (gdbarch, 0);
2092 set_gdbarch_frame_args_address (gdbarch, alpha_frame_args_address);
2093 set_gdbarch_frame_locals_address (gdbarch, alpha_frame_locals_address);
2094 set_gdbarch_init_extra_frame_info (gdbarch, alpha_init_extra_frame_info);
2096 /* Alpha OSF/1 inhibits execution of code on the stack. But there is
2097 no need for a dummy on the Alpha. PUSH_ARGUMENTS takes care of all
2098 argument handling and bp_call_dummy takes care of stopping the dummy. */
2099 set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT);
2100 set_gdbarch_call_dummy_address (gdbarch, alpha_call_dummy_address);
2101 set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
2102 set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
2103 set_gdbarch_call_dummy_start_offset (gdbarch, 0);
2104 set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_at_entry_point);
2105 set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
2106 set_gdbarch_push_dummy_frame (gdbarch, alpha_push_dummy_frame);
2107 set_gdbarch_fix_call_dummy (gdbarch, alpha_fix_call_dummy);
2108 set_gdbarch_init_frame_pc (gdbarch, init_frame_pc_noop);
2109 set_gdbarch_init_frame_pc_first (gdbarch, alpha_init_frame_pc_first);
2111 set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
2112 set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
2114 /* Floats are always passed as doubles. */
2115 set_gdbarch_coerce_float_to_double (gdbarch,
2116 standard_coerce_float_to_double);
2118 set_gdbarch_breakpoint_from_pc (gdbarch, alpha_breakpoint_from_pc);
2119 set_gdbarch_decr_pc_after_break (gdbarch, 4);
2121 set_gdbarch_function_start_offset (gdbarch, 0);
2122 set_gdbarch_frame_args_skip (gdbarch, 0);
2124 /* Hook in ABI-specific overrides, if they have been registered. */
2125 if (alpha_abi == ALPHA_ABI_UNKNOWN)
2127 /* Don't complain about not knowing the ABI variant if we don't
2128 have an inferior. */
2131 (gdb_stderr, "GDB doesn't recognize the ABI of the inferior. "
2132 "Attempting to continue with the default Alpha settings");
2136 for (abi_handler = alpha_abi_handler_list; abi_handler != NULL;
2137 abi_handler = abi_handler->next)
2138 if (abi_handler->abi == alpha_abi)
2142 abi_handler->init_abi (info, gdbarch);
2145 /* We assume that if GDB_MULTI_ARCH is less than
2146 GDB_MULTI_ARCH_TM that an ABI variant can be supported by
2147 overriding definitions in this file. */
2148 if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
2151 "A handler for the ABI variant \"%s\" is not built into this "
2152 "configuration of GDB. "
2153 "Attempting to continue with the default Alpha settings",
2154 alpha_abi_names[alpha_abi]);
2158 /* Now that we have tuned the configuration, set a few final things
2159 based on what the OS ABI has told us. */
2161 if (tdep->jb_pc >= 0)
2162 set_gdbarch_get_longjmp_target (gdbarch, alpha_get_longjmp_target);
2168 alpha_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
2170 struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
2175 if (tdep->abi_name != NULL)
2176 fprintf_unfiltered (file, "alpha_dump_tdep: ABI = %s\n", tdep->abi_name);
2178 internal_error (__FILE__, __LINE__,
2179 "alpha_dump_tdep: illegal setting of tdep->alpha_abi (%d)",
2180 (int) tdep->alpha_abi);
2182 fprintf_unfiltered (file,
2183 "alpha_dump_tdep: vm_min_address = 0x%lx\n",
2184 (long) tdep->vm_min_address);
2186 fprintf_unfiltered (file,
2187 "alpha_dump_tdep: jb_pc = %d\n",
2189 fprintf_unfiltered (file,
2190 "alpha_dump_tdep: jb_elt_size = %ld\n",
2191 (long) tdep->jb_elt_size);
2195 _initialize_alpha_tdep (void)
2197 struct cmd_list_element *c;
2199 gdbarch_register (bfd_arch_alpha, alpha_gdbarch_init, alpha_dump_tdep);
2201 tm_print_insn = print_insn_alpha;
2203 /* Let the user set the fence post for heuristic_proc_start. */
2205 /* We really would like to have both "0" and "unlimited" work, but
2206 command.c doesn't deal with that. So make it a var_zinteger
2207 because the user can always use "999999" or some such for unlimited. */
2208 c = add_set_cmd ("heuristic-fence-post", class_support, var_zinteger,
2209 (char *) &heuristic_fence_post,
2211 Set the distance searched for the start of a function.\n\
2212 If you are debugging a stripped executable, GDB needs to search through the\n\
2213 program for the start of a function. This command sets the distance of the\n\
2214 search. The only need to set it is when debugging a stripped executable.",
2216 /* We need to throw away the frame cache when we set this, since it
2217 might change our ability to get backtraces. */
2218 set_cmd_sfunc (c, reinit_frame_cache_sfunc);
2219 add_show_from_set (c, &showlist);