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_frame_args_address_ftype alpha_frame_args_address
;
63 static gdbarch_frame_locals_address_ftype alpha_frame_locals_address
;
65 static gdbarch_skip_prologue_ftype alpha_skip_prologue
;
66 static gdbarch_get_saved_register_ftype alpha_get_saved_register
;
67 static gdbarch_saved_pc_after_call_ftype alpha_saved_pc_after_call
;
68 static gdbarch_frame_chain_ftype alpha_frame_chain
;
69 static gdbarch_frame_saved_pc_ftype alpha_frame_saved_pc
;
70 static gdbarch_frame_init_saved_regs_ftype alpha_frame_init_saved_regs
;
72 static gdbarch_push_arguments_ftype alpha_push_arguments
;
73 static gdbarch_push_dummy_frame_ftype alpha_push_dummy_frame
;
74 static gdbarch_pop_frame_ftype alpha_pop_frame
;
75 static gdbarch_fix_call_dummy_ftype alpha_fix_call_dummy
;
76 static gdbarch_init_frame_pc_first_ftype alpha_init_frame_pc_first
;
77 static gdbarch_init_extra_frame_info_ftype alpha_init_extra_frame_info
;
79 struct frame_extra_info
81 alpha_extra_func_info_t proc_desc
;
86 /* FIXME: Some of this code should perhaps be merged with mips-tdep.c. */
88 /* Prototypes for local functions. */
90 static void alpha_find_saved_regs (struct frame_info
*);
92 static alpha_extra_func_info_t
push_sigtramp_desc (CORE_ADDR low_addr
);
94 static CORE_ADDR
read_next_frame_reg (struct frame_info
*, int);
96 static CORE_ADDR
heuristic_proc_start (CORE_ADDR
);
98 static alpha_extra_func_info_t
heuristic_proc_desc (CORE_ADDR
,
100 struct frame_info
*);
102 static alpha_extra_func_info_t
find_proc_desc (CORE_ADDR
,
103 struct frame_info
*);
106 static int alpha_in_lenient_prologue (CORE_ADDR
, CORE_ADDR
);
109 static void reinit_frame_cache_sfunc (char *, int, struct cmd_list_element
*);
111 static CORE_ADDR
after_prologue (CORE_ADDR pc
,
112 alpha_extra_func_info_t proc_desc
);
114 static int alpha_in_prologue (CORE_ADDR pc
,
115 alpha_extra_func_info_t proc_desc
);
117 static int alpha_about_to_return (CORE_ADDR pc
);
119 void _initialize_alpha_tdep (void);
121 /* Heuristic_proc_start may hunt through the text section for a long
122 time across a 2400 baud serial line. Allows the user to limit this
124 static unsigned int heuristic_fence_post
= 0;
126 /* Layout of a stack frame on the alpha:
129 pdr members: | 7th ... nth arg, |
130 | `pushed' by caller. |
132 ----------------|-------------------------------|<-- old_sp == vfp
135 | |localoff | Copies of 1st .. 6th |
136 | | | | | argument if necessary. |
138 | | | --- |-------------------------------|<-- FRAME_LOCALS_ADDRESS
140 | | | | Locals and temporaries. |
142 | | | |-------------------------------|
144 |-fregoffset | Saved float registers. |
150 | | -------|-------------------------------|
152 | | | Saved registers. |
159 | ----------|-------------------------------|
161 frameoffset | Argument build area, gets |
162 | | 7th ... nth arg for any |
163 | | called procedure. |
165 -------------|-------------------------------|<-- sp
172 #define PROC_LOW_ADDR(proc) ((proc)->pdr.adr) /* least address */
173 /* These next two fields are kind of being hijacked. I wonder if
174 iline is too small for the values it needs to hold, if GDB is
175 running on a 32-bit host. */
176 #define PROC_HIGH_ADDR(proc) ((proc)->pdr.iline) /* upper address bound */
177 #define PROC_DUMMY_FRAME(proc) ((proc)->pdr.cbLineOffset) /*CALL_DUMMY frame */
178 #define PROC_FRAME_OFFSET(proc) ((proc)->pdr.frameoffset)
179 #define PROC_FRAME_REG(proc) ((proc)->pdr.framereg)
180 #define PROC_REG_MASK(proc) ((proc)->pdr.regmask)
181 #define PROC_FREG_MASK(proc) ((proc)->pdr.fregmask)
182 #define PROC_REG_OFFSET(proc) ((proc)->pdr.regoffset)
183 #define PROC_FREG_OFFSET(proc) ((proc)->pdr.fregoffset)
184 #define PROC_PC_REG(proc) ((proc)->pdr.pcreg)
185 #define PROC_LOCALOFF(proc) ((proc)->pdr.localoff)
186 #define PROC_SYMBOL(proc) (*(struct symbol**)&(proc)->pdr.isym)
187 #define _PROC_MAGIC_ 0x0F0F0F0F
188 #define PROC_DESC_IS_DUMMY(proc) ((proc)->pdr.isym == _PROC_MAGIC_)
189 #define SET_PROC_DESC_IS_DUMMY(proc) ((proc)->pdr.isym = _PROC_MAGIC_)
191 struct linked_proc_info
193 struct alpha_extra_func_info info
;
194 struct linked_proc_info
*next
;
196 *linked_proc_desc_table
= NULL
;
199 alpha_osf_in_sigtramp (CORE_ADDR pc
, char *func_name
)
201 return (func_name
!= NULL
&& STREQ ("__sigtramp", func_name
));
204 /* Under OSF/1, the __sigtramp routine is frameless and has a frame
205 size of zero, but we are able to backtrace through it. */
207 alpha_osf_skip_sigtramp_frame (struct frame_info
*frame
, CORE_ADDR pc
)
210 find_pc_partial_function (pc
, &name
, (CORE_ADDR
*) NULL
, (CORE_ADDR
*) NULL
);
211 if (PC_IN_SIGTRAMP (pc
, name
))
218 /* Dynamically create a signal-handler caller procedure descriptor for
219 the signal-handler return code starting at address LOW_ADDR. The
220 descriptor is added to the linked_proc_desc_table. */
222 static alpha_extra_func_info_t
223 push_sigtramp_desc (CORE_ADDR low_addr
)
225 struct linked_proc_info
*link
;
226 alpha_extra_func_info_t proc_desc
;
228 link
= (struct linked_proc_info
*)
229 xmalloc (sizeof (struct linked_proc_info
));
230 link
->next
= linked_proc_desc_table
;
231 linked_proc_desc_table
= link
;
233 proc_desc
= &link
->info
;
235 proc_desc
->numargs
= 0;
236 PROC_LOW_ADDR (proc_desc
) = low_addr
;
237 PROC_HIGH_ADDR (proc_desc
) = low_addr
+ 3 * 4;
238 PROC_DUMMY_FRAME (proc_desc
) = 0;
239 PROC_FRAME_OFFSET (proc_desc
) = 0x298; /* sizeof(struct sigcontext_struct) */
240 PROC_FRAME_REG (proc_desc
) = SP_REGNUM
;
241 PROC_REG_MASK (proc_desc
) = 0xffff;
242 PROC_FREG_MASK (proc_desc
) = 0xffff;
243 PROC_PC_REG (proc_desc
) = 26;
244 PROC_LOCALOFF (proc_desc
) = 0;
245 SET_PROC_DESC_IS_DYN_SIGTRAMP (proc_desc
);
251 alpha_register_name (int regno
)
253 static char *register_names
[] =
255 "v0", "t0", "t1", "t2", "t3", "t4", "t5", "t6",
256 "t7", "s0", "s1", "s2", "s3", "s4", "s5", "fp",
257 "a0", "a1", "a2", "a3", "a4", "a5", "t8", "t9",
258 "t10", "t11", "ra", "t12", "at", "gp", "sp", "zero",
259 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
260 "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
261 "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
262 "f24", "f25", "f26", "f27", "f28", "f29", "f30", "fpcr",
268 if (regno
>= (sizeof(register_names
) / sizeof(*register_names
)))
270 return (register_names
[regno
]);
274 alpha_cannot_fetch_register (int regno
)
276 return (regno
== FP_REGNUM
|| regno
== ALPHA_ZERO_REGNUM
);
280 alpha_cannot_store_register (int regno
)
282 return (regno
== FP_REGNUM
|| regno
== ALPHA_ZERO_REGNUM
);
286 alpha_register_convertible (int regno
)
288 return (regno
>= FP0_REGNUM
&& regno
<= FP0_REGNUM
+ 31);
292 alpha_register_virtual_type (int regno
)
294 return ((regno
>= FP0_REGNUM
&& regno
< (FP0_REGNUM
+31))
295 ? builtin_type_double
: builtin_type_long
);
299 alpha_register_byte (int regno
)
305 alpha_register_raw_size (int regno
)
311 alpha_register_virtual_size (int regno
)
317 /* Guaranteed to set frame->saved_regs to some values (it never leaves it
321 alpha_find_saved_regs (struct frame_info
*frame
)
324 CORE_ADDR reg_position
;
326 alpha_extra_func_info_t proc_desc
;
329 frame_saved_regs_zalloc (frame
);
331 /* If it is the frame for __sigtramp, the saved registers are located
332 in a sigcontext structure somewhere on the stack. __sigtramp
333 passes a pointer to the sigcontext structure on the stack.
334 If the stack layout for __sigtramp changes, or if sigcontext offsets
335 change, we might have to update this code. */
336 #ifndef SIGFRAME_PC_OFF
337 #define SIGFRAME_PC_OFF (2 * 8)
338 #define SIGFRAME_REGSAVE_OFF (4 * 8)
339 #define SIGFRAME_FPREGSAVE_OFF (SIGFRAME_REGSAVE_OFF + 32 * 8 + 8)
341 if (frame
->signal_handler_caller
)
343 CORE_ADDR sigcontext_addr
;
345 sigcontext_addr
= SIGCONTEXT_ADDR (frame
);
346 for (ireg
= 0; ireg
< 32; ireg
++)
348 reg_position
= sigcontext_addr
+ SIGFRAME_REGSAVE_OFF
+ ireg
* 8;
349 frame
->saved_regs
[ireg
] = reg_position
;
351 for (ireg
= 0; ireg
< 32; ireg
++)
353 reg_position
= sigcontext_addr
+ SIGFRAME_FPREGSAVE_OFF
+ ireg
* 8;
354 frame
->saved_regs
[FP0_REGNUM
+ ireg
] = reg_position
;
356 frame
->saved_regs
[PC_REGNUM
] = sigcontext_addr
+ SIGFRAME_PC_OFF
;
360 proc_desc
= frame
->extra_info
->proc_desc
;
361 if (proc_desc
== NULL
)
362 /* I'm not sure how/whether this can happen. Normally when we can't
363 find a proc_desc, we "synthesize" one using heuristic_proc_desc
364 and set the saved_regs right away. */
367 /* Fill in the offsets for the registers which gen_mask says
370 reg_position
= frame
->frame
+ PROC_REG_OFFSET (proc_desc
);
371 mask
= PROC_REG_MASK (proc_desc
);
373 returnreg
= PROC_PC_REG (proc_desc
);
375 /* Note that RA is always saved first, regardless of its actual
377 if (mask
& (1 << returnreg
))
379 frame
->saved_regs
[returnreg
] = reg_position
;
381 mask
&= ~(1 << returnreg
); /* Clear bit for RA so we
382 don't save again later. */
385 for (ireg
= 0; ireg
<= 31; ++ireg
)
386 if (mask
& (1 << ireg
))
388 frame
->saved_regs
[ireg
] = reg_position
;
392 /* Fill in the offsets for the registers which float_mask says
395 reg_position
= frame
->frame
+ PROC_FREG_OFFSET (proc_desc
);
396 mask
= PROC_FREG_MASK (proc_desc
);
398 for (ireg
= 0; ireg
<= 31; ++ireg
)
399 if (mask
& (1 << ireg
))
401 frame
->saved_regs
[FP0_REGNUM
+ ireg
] = reg_position
;
405 frame
->saved_regs
[PC_REGNUM
] = frame
->saved_regs
[returnreg
];
409 alpha_frame_init_saved_regs (struct frame_info
*fi
)
411 if (fi
->saved_regs
== NULL
)
412 alpha_find_saved_regs (fi
);
413 fi
->saved_regs
[SP_REGNUM
] = fi
->frame
;
417 alpha_init_frame_pc_first (int fromleaf
, struct frame_info
*prev
)
419 prev
->pc
= (fromleaf
? SAVED_PC_AFTER_CALL (prev
->next
) :
420 prev
->next
? FRAME_SAVED_PC (prev
->next
) : read_pc ());
424 read_next_frame_reg (struct frame_info
*fi
, int regno
)
426 for (; fi
; fi
= fi
->next
)
428 /* We have to get the saved sp from the sigcontext
429 if it is a signal handler frame. */
430 if (regno
== SP_REGNUM
&& !fi
->signal_handler_caller
)
434 if (fi
->saved_regs
== NULL
)
435 alpha_find_saved_regs (fi
);
436 if (fi
->saved_regs
[regno
])
437 return read_memory_integer (fi
->saved_regs
[regno
], 8);
440 return read_register (regno
);
444 alpha_frame_saved_pc (struct frame_info
*frame
)
446 alpha_extra_func_info_t proc_desc
= frame
->extra_info
->proc_desc
;
447 /* We have to get the saved pc from the sigcontext
448 if it is a signal handler frame. */
449 int pcreg
= frame
->signal_handler_caller
? PC_REGNUM
450 : frame
->extra_info
->pc_reg
;
452 if (proc_desc
&& PROC_DESC_IS_DUMMY (proc_desc
))
453 return read_memory_integer (frame
->frame
- 8, 8);
455 return read_next_frame_reg (frame
, pcreg
);
459 alpha_get_saved_register (char *raw_buffer
,
462 struct frame_info
*frame
,
464 enum lval_type
*lval
)
468 if (!target_has_registers
)
469 error ("No registers.");
471 /* Normal systems don't optimize out things with register numbers. */
472 if (optimized
!= NULL
)
474 addr
= find_saved_register (frame
, regnum
);
479 if (regnum
== SP_REGNUM
)
481 if (raw_buffer
!= NULL
)
483 /* Put it back in target format. */
484 store_address (raw_buffer
, REGISTER_RAW_SIZE (regnum
),
491 if (raw_buffer
!= NULL
)
492 target_read_memory (addr
, raw_buffer
, REGISTER_RAW_SIZE (regnum
));
497 *lval
= lval_register
;
498 addr
= REGISTER_BYTE (regnum
);
499 if (raw_buffer
!= NULL
)
500 read_register_gen (regnum
, raw_buffer
);
507 alpha_saved_pc_after_call (struct frame_info
*frame
)
509 CORE_ADDR pc
= frame
->pc
;
511 alpha_extra_func_info_t proc_desc
;
514 /* Skip over shared library trampoline if necessary. */
515 tmp
= SKIP_TRAMPOLINE_CODE (pc
);
519 proc_desc
= find_proc_desc (pc
, frame
->next
);
520 pcreg
= proc_desc
? PROC_PC_REG (proc_desc
) : ALPHA_RA_REGNUM
;
522 if (frame
->signal_handler_caller
)
523 return alpha_frame_saved_pc (frame
);
525 return read_register (pcreg
);
529 static struct alpha_extra_func_info temp_proc_desc
;
530 static CORE_ADDR temp_saved_regs
[ALPHA_NUM_REGS
];
532 /* Nonzero if instruction at PC is a return instruction. "ret
533 $zero,($ra),1" on alpha. */
536 alpha_about_to_return (CORE_ADDR pc
)
538 return read_memory_integer (pc
, 4) == 0x6bfa8001;
543 /* This fencepost looks highly suspicious to me. Removing it also
544 seems suspicious as it could affect remote debugging across serial
548 heuristic_proc_start (CORE_ADDR pc
)
550 struct gdbarch_tdep
*tdep
= gdbarch_tdep (current_gdbarch
);
551 CORE_ADDR start_pc
= pc
;
552 CORE_ADDR fence
= start_pc
- heuristic_fence_post
;
557 if (heuristic_fence_post
== UINT_MAX
558 || fence
< tdep
->vm_min_address
)
559 fence
= tdep
->vm_min_address
;
561 /* search back for previous return */
562 for (start_pc
-= 4;; start_pc
-= 4)
563 if (start_pc
< fence
)
565 /* It's not clear to me why we reach this point when
566 stop_soon_quietly, but with this test, at least we
567 don't print out warnings for every child forked (eg, on
568 decstation). 22apr93 rich@cygnus.com. */
569 if (!stop_soon_quietly
)
571 static int blurb_printed
= 0;
573 if (fence
== tdep
->vm_min_address
)
574 warning ("Hit beginning of text section without finding");
576 warning ("Hit heuristic-fence-post without finding");
578 warning ("enclosing function for address 0x%s", paddr_nz (pc
));
582 This warning occurs if you are debugging a function without any symbols\n\
583 (for example, in a stripped executable). In that case, you may wish to\n\
584 increase the size of the search with the `set heuristic-fence-post' command.\n\
586 Otherwise, you told GDB there was a function where there isn't one, or\n\
587 (more likely) you have encountered a bug in GDB.\n");
594 else if (alpha_about_to_return (start_pc
))
597 start_pc
+= 4; /* skip return */
601 static alpha_extra_func_info_t
602 heuristic_proc_desc (CORE_ADDR start_pc
, CORE_ADDR limit_pc
,
603 struct frame_info
*next_frame
)
605 CORE_ADDR sp
= read_next_frame_reg (next_frame
, SP_REGNUM
);
608 int has_frame_reg
= 0;
609 unsigned long reg_mask
= 0;
614 memset (&temp_proc_desc
, '\0', sizeof (temp_proc_desc
));
615 memset (&temp_saved_regs
, '\0', SIZEOF_FRAME_SAVED_REGS
);
616 PROC_LOW_ADDR (&temp_proc_desc
) = start_pc
;
618 if (start_pc
+ 200 < limit_pc
)
619 limit_pc
= start_pc
+ 200;
621 for (cur_pc
= start_pc
; cur_pc
< limit_pc
; cur_pc
+= 4)
627 status
= read_memory_nobpt (cur_pc
, buf
, 4);
629 memory_error (status
, cur_pc
);
630 word
= extract_unsigned_integer (buf
, 4);
632 if ((word
& 0xffff0000) == 0x23de0000) /* lda $sp,n($sp) */
635 frame_size
+= (-word
) & 0xffff;
637 /* Exit loop if a positive stack adjustment is found, which
638 usually means that the stack cleanup code in the function
639 epilogue is reached. */
642 else if ((word
& 0xfc1f0000) == 0xb41e0000 /* stq reg,n($sp) */
643 && (word
& 0xffff0000) != 0xb7fe0000) /* reg != $zero */
645 int reg
= (word
& 0x03e00000) >> 21;
646 reg_mask
|= 1 << reg
;
647 temp_saved_regs
[reg
] = sp
+ (short) word
;
649 /* Starting with OSF/1-3.2C, the system libraries are shipped
650 without local symbols, but they still contain procedure
651 descriptors without a symbol reference. GDB is currently
652 unable to find these procedure descriptors and uses
653 heuristic_proc_desc instead.
654 As some low level compiler support routines (__div*, __add*)
655 use a non-standard return address register, we have to
656 add some heuristics to determine the return address register,
657 or stepping over these routines will fail.
658 Usually the return address register is the first register
659 saved on the stack, but assembler optimization might
660 rearrange the register saves.
661 So we recognize only a few registers (t7, t9, ra) within
662 the procedure prologue as valid return address registers.
663 If we encounter a return instruction, we extract the
664 the return address register from it.
666 FIXME: Rewriting GDB to access the procedure descriptors,
667 e.g. via the minimal symbol table, might obviate this hack. */
669 && cur_pc
< (start_pc
+ 80)
670 && (reg
== ALPHA_T7_REGNUM
|| reg
== ALPHA_T9_REGNUM
671 || reg
== ALPHA_RA_REGNUM
))
674 else if ((word
& 0xffe0ffff) == 0x6be08001) /* ret zero,reg,1 */
675 pcreg
= (word
>> 16) & 0x1f;
676 else if (word
== 0x47de040f) /* bis sp,sp fp */
681 /* If we haven't found a valid return address register yet,
682 keep searching in the procedure prologue. */
683 while (cur_pc
< (limit_pc
+ 80) && cur_pc
< (start_pc
+ 80))
688 if (read_memory_nobpt (cur_pc
, buf
, 4))
691 word
= extract_unsigned_integer (buf
, 4);
693 if ((word
& 0xfc1f0000) == 0xb41e0000 /* stq reg,n($sp) */
694 && (word
& 0xffff0000) != 0xb7fe0000) /* reg != $zero */
696 int reg
= (word
& 0x03e00000) >> 21;
697 if (reg
== ALPHA_T7_REGNUM
|| reg
== ALPHA_T9_REGNUM
698 || reg
== ALPHA_RA_REGNUM
)
704 else if ((word
& 0xffe0ffff) == 0x6be08001) /* ret zero,reg,1 */
706 pcreg
= (word
>> 16) & 0x1f;
713 PROC_FRAME_REG (&temp_proc_desc
) = ALPHA_GCC_FP_REGNUM
;
715 PROC_FRAME_REG (&temp_proc_desc
) = SP_REGNUM
;
716 PROC_FRAME_OFFSET (&temp_proc_desc
) = frame_size
;
717 PROC_REG_MASK (&temp_proc_desc
) = reg_mask
;
718 PROC_PC_REG (&temp_proc_desc
) = (pcreg
== -1) ? ALPHA_RA_REGNUM
: pcreg
;
719 PROC_LOCALOFF (&temp_proc_desc
) = 0; /* XXX - bogus */
720 return &temp_proc_desc
;
723 /* This returns the PC of the first inst after the prologue. If we can't
724 find the prologue, then return 0. */
727 after_prologue (CORE_ADDR pc
, alpha_extra_func_info_t proc_desc
)
729 struct symtab_and_line sal
;
730 CORE_ADDR func_addr
, func_end
;
733 proc_desc
= find_proc_desc (pc
, NULL
);
737 if (PROC_DESC_IS_DYN_SIGTRAMP (proc_desc
))
738 return PROC_LOW_ADDR (proc_desc
); /* "prologue" is in kernel */
740 /* If function is frameless, then we need to do it the hard way. I
741 strongly suspect that frameless always means prologueless... */
742 if (PROC_FRAME_REG (proc_desc
) == SP_REGNUM
743 && PROC_FRAME_OFFSET (proc_desc
) == 0)
747 if (!find_pc_partial_function (pc
, NULL
, &func_addr
, &func_end
))
748 return 0; /* Unknown */
750 sal
= find_pc_line (func_addr
, 0);
752 if (sal
.end
< func_end
)
755 /* The line after the prologue is after the end of the function. In this
756 case, tell the caller to find the prologue the hard way. */
761 /* Return non-zero if we *might* be in a function prologue. Return zero if we
762 are definitively *not* in a function prologue. */
765 alpha_in_prologue (CORE_ADDR pc
, alpha_extra_func_info_t proc_desc
)
767 CORE_ADDR after_prologue_pc
;
769 after_prologue_pc
= after_prologue (pc
, proc_desc
);
771 if (after_prologue_pc
== 0
772 || pc
< after_prologue_pc
)
778 static alpha_extra_func_info_t
779 find_proc_desc (CORE_ADDR pc
, struct frame_info
*next_frame
)
781 alpha_extra_func_info_t proc_desc
;
786 /* Try to get the proc_desc from the linked call dummy proc_descs
787 if the pc is in the call dummy.
788 This is hairy. In the case of nested dummy calls we have to find the
789 right proc_desc, but we might not yet know the frame for the dummy
790 as it will be contained in the proc_desc we are searching for.
791 So we have to find the proc_desc whose frame is closest to the current
794 if (PC_IN_CALL_DUMMY (pc
, 0, 0))
796 struct linked_proc_info
*link
;
797 CORE_ADDR sp
= read_next_frame_reg (next_frame
, SP_REGNUM
);
798 alpha_extra_func_info_t found_proc_desc
= NULL
;
799 long min_distance
= LONG_MAX
;
801 for (link
= linked_proc_desc_table
; link
; link
= link
->next
)
803 long distance
= (CORE_ADDR
) PROC_DUMMY_FRAME (&link
->info
) - sp
;
804 if (distance
> 0 && distance
< min_distance
)
806 min_distance
= distance
;
807 found_proc_desc
= &link
->info
;
810 if (found_proc_desc
!= NULL
)
811 return found_proc_desc
;
814 b
= block_for_pc (pc
);
816 find_pc_partial_function (pc
, NULL
, &startaddr
, NULL
);
821 if (startaddr
> BLOCK_START (b
))
822 /* This is the "pathological" case referred to in a comment in
823 print_frame_info. It might be better to move this check into
827 sym
= lookup_symbol (MIPS_EFI_SYMBOL_NAME
, b
, LABEL_NAMESPACE
,
831 /* If we never found a PDR for this function in symbol reading, then
832 examine prologues to find the information. */
833 if (sym
&& ((mips_extra_func_info_t
) SYMBOL_VALUE (sym
))->pdr
.framereg
== -1)
838 /* IF this is the topmost frame AND
839 * (this proc does not have debugging information OR
840 * the PC is in the procedure prologue)
841 * THEN create a "heuristic" proc_desc (by analyzing
842 * the actual code) to replace the "official" proc_desc.
844 proc_desc
= (alpha_extra_func_info_t
) SYMBOL_VALUE (sym
);
845 if (next_frame
== NULL
)
847 if (PROC_DESC_IS_DUMMY (proc_desc
) || alpha_in_prologue (pc
, proc_desc
))
849 alpha_extra_func_info_t found_heuristic
=
850 heuristic_proc_desc (PROC_LOW_ADDR (proc_desc
),
854 PROC_LOCALOFF (found_heuristic
) =
855 PROC_LOCALOFF (proc_desc
);
856 PROC_PC_REG (found_heuristic
) = PROC_PC_REG (proc_desc
);
857 proc_desc
= found_heuristic
;
866 /* Is linked_proc_desc_table really necessary? It only seems to be used
867 by procedure call dummys. However, the procedures being called ought
868 to have their own proc_descs, and even if they don't,
869 heuristic_proc_desc knows how to create them! */
871 register struct linked_proc_info
*link
;
872 for (link
= linked_proc_desc_table
; link
; link
= link
->next
)
873 if (PROC_LOW_ADDR (&link
->info
) <= pc
874 && PROC_HIGH_ADDR (&link
->info
) > pc
)
877 /* If PC is inside a dynamically generated sigtramp handler,
878 create and push a procedure descriptor for that code: */
879 offset
= DYNAMIC_SIGTRAMP_OFFSET (pc
);
881 return push_sigtramp_desc (pc
- offset
);
883 /* If heuristic_fence_post is non-zero, determine the procedure
884 start address by examining the instructions.
885 This allows us to find the start address of static functions which
886 have no symbolic information, as startaddr would have been set to
887 the preceding global function start address by the
888 find_pc_partial_function call above. */
889 if (startaddr
== 0 || heuristic_fence_post
!= 0)
890 startaddr
= heuristic_proc_start (pc
);
893 heuristic_proc_desc (startaddr
, pc
, next_frame
);
898 alpha_extra_func_info_t cached_proc_desc
;
901 alpha_frame_chain (struct frame_info
*frame
)
903 alpha_extra_func_info_t proc_desc
;
904 CORE_ADDR saved_pc
= FRAME_SAVED_PC (frame
);
906 if (saved_pc
== 0 || inside_entry_file (saved_pc
))
909 proc_desc
= find_proc_desc (saved_pc
, frame
);
913 cached_proc_desc
= proc_desc
;
915 /* Fetch the frame pointer for a dummy frame from the procedure
917 if (PROC_DESC_IS_DUMMY (proc_desc
))
918 return (CORE_ADDR
) PROC_DUMMY_FRAME (proc_desc
);
920 /* If no frame pointer and frame size is zero, we must be at end
921 of stack (or otherwise hosed). If we don't check frame size,
922 we loop forever if we see a zero size frame. */
923 if (PROC_FRAME_REG (proc_desc
) == SP_REGNUM
924 && PROC_FRAME_OFFSET (proc_desc
) == 0
925 /* The previous frame from a sigtramp frame might be frameless
926 and have frame size zero. */
927 && !frame
->signal_handler_caller
)
928 return FRAME_PAST_SIGTRAMP_FRAME (frame
, saved_pc
);
930 return read_next_frame_reg (frame
, PROC_FRAME_REG (proc_desc
))
931 + PROC_FRAME_OFFSET (proc_desc
);
935 alpha_print_extra_frame_info (struct frame_info
*fi
)
939 && fi
->extra_info
->proc_desc
940 && fi
->extra_info
->proc_desc
->pdr
.framereg
< NUM_REGS
)
941 printf_filtered (" frame pointer is at %s+%s\n",
942 REGISTER_NAME (fi
->extra_info
->proc_desc
->pdr
.framereg
),
943 paddr_d (fi
->extra_info
->proc_desc
->pdr
.frameoffset
));
947 alpha_init_extra_frame_info (int fromleaf
, struct frame_info
*frame
)
949 /* Use proc_desc calculated in frame_chain */
950 alpha_extra_func_info_t proc_desc
=
951 frame
->next
? cached_proc_desc
: find_proc_desc (frame
->pc
, frame
->next
);
953 frame
->extra_info
= (struct frame_extra_info
*)
954 frame_obstack_alloc (sizeof (struct frame_extra_info
));
956 frame
->saved_regs
= NULL
;
957 frame
->extra_info
->localoff
= 0;
958 frame
->extra_info
->pc_reg
= ALPHA_RA_REGNUM
;
959 frame
->extra_info
->proc_desc
= proc_desc
== &temp_proc_desc
? 0 : proc_desc
;
962 /* Get the locals offset and the saved pc register from the
963 procedure descriptor, they are valid even if we are in the
964 middle of the prologue. */
965 frame
->extra_info
->localoff
= PROC_LOCALOFF (proc_desc
);
966 frame
->extra_info
->pc_reg
= PROC_PC_REG (proc_desc
);
968 /* Fixup frame-pointer - only needed for top frame */
970 /* Fetch the frame pointer for a dummy frame from the procedure
972 if (PROC_DESC_IS_DUMMY (proc_desc
))
973 frame
->frame
= (CORE_ADDR
) PROC_DUMMY_FRAME (proc_desc
);
975 /* This may not be quite right, if proc has a real frame register.
976 Get the value of the frame relative sp, procedure might have been
977 interrupted by a signal at it's very start. */
978 else if (frame
->pc
== PROC_LOW_ADDR (proc_desc
)
979 && !PROC_DESC_IS_DYN_SIGTRAMP (proc_desc
))
980 frame
->frame
= read_next_frame_reg (frame
->next
, SP_REGNUM
);
982 frame
->frame
= read_next_frame_reg (frame
->next
, PROC_FRAME_REG (proc_desc
))
983 + PROC_FRAME_OFFSET (proc_desc
);
985 if (proc_desc
== &temp_proc_desc
)
989 /* Do not set the saved registers for a sigtramp frame,
990 alpha_find_saved_registers will do that for us.
991 We can't use frame->signal_handler_caller, it is not yet set. */
992 find_pc_partial_function (frame
->pc
, &name
,
993 (CORE_ADDR
*) NULL
, (CORE_ADDR
*) NULL
);
994 if (!PC_IN_SIGTRAMP (frame
->pc
, name
))
996 frame
->saved_regs
= (CORE_ADDR
*)
997 frame_obstack_alloc (SIZEOF_FRAME_SAVED_REGS
);
998 memcpy (frame
->saved_regs
, temp_saved_regs
,
999 SIZEOF_FRAME_SAVED_REGS
);
1000 frame
->saved_regs
[PC_REGNUM
]
1001 = frame
->saved_regs
[ALPHA_RA_REGNUM
];
1008 alpha_frame_locals_address (struct frame_info
*fi
)
1010 return (fi
->frame
- fi
->extra_info
->localoff
);
1014 alpha_frame_args_address (struct frame_info
*fi
)
1016 return (fi
->frame
- (ALPHA_NUM_ARG_REGS
* 8));
1019 /* ALPHA stack frames are almost impenetrable. When execution stops,
1020 we basically have to look at symbol information for the function
1021 that we stopped in, which tells us *which* register (if any) is
1022 the base of the frame pointer, and what offset from that register
1023 the frame itself is at.
1025 This presents a problem when trying to examine a stack in memory
1026 (that isn't executing at the moment), using the "frame" command. We
1027 don't have a PC, nor do we have any registers except SP.
1029 This routine takes two arguments, SP and PC, and tries to make the
1030 cached frames look as if these two arguments defined a frame on the
1031 cache. This allows the rest of info frame to extract the important
1032 arguments without difficulty. */
1035 alpha_setup_arbitrary_frame (int argc
, CORE_ADDR
*argv
)
1038 error ("ALPHA frame specifications require two arguments: sp and pc");
1040 return create_new_frame (argv
[0], argv
[1]);
1043 /* The alpha passes the first six arguments in the registers, the rest on
1044 the stack. The register arguments are eventually transferred to the
1045 argument transfer area immediately below the stack by the called function
1046 anyway. So we `push' at least six arguments on the stack, `reload' the
1047 argument registers and then adjust the stack pointer to point past the
1048 sixth argument. This algorithm simplifies the passing of a large struct
1049 which extends from the registers to the stack.
1050 If the called function is returning a structure, the address of the
1051 structure to be returned is passed as a hidden first argument. */
1054 alpha_push_arguments (int nargs
, struct value
**args
, CORE_ADDR sp
,
1055 int struct_return
, CORE_ADDR struct_addr
)
1058 int accumulate_size
= struct_return
? 8 : 0;
1059 int arg_regs_size
= ALPHA_NUM_ARG_REGS
* 8;
1066 struct alpha_arg
*alpha_args
=
1067 (struct alpha_arg
*) alloca (nargs
* sizeof (struct alpha_arg
));
1068 register struct alpha_arg
*m_arg
;
1069 char raw_buffer
[sizeof (CORE_ADDR
)];
1070 int required_arg_regs
;
1072 for (i
= 0, m_arg
= alpha_args
; i
< nargs
; i
++, m_arg
++)
1074 struct value
*arg
= args
[i
];
1075 struct type
*arg_type
= check_typedef (VALUE_TYPE (arg
));
1076 /* Cast argument to long if necessary as the compiler does it too. */
1077 switch (TYPE_CODE (arg_type
))
1080 case TYPE_CODE_BOOL
:
1081 case TYPE_CODE_CHAR
:
1082 case TYPE_CODE_RANGE
:
1083 case TYPE_CODE_ENUM
:
1084 if (TYPE_LENGTH (arg_type
) < TYPE_LENGTH (builtin_type_long
))
1086 arg_type
= builtin_type_long
;
1087 arg
= value_cast (arg_type
, arg
);
1093 m_arg
->len
= TYPE_LENGTH (arg_type
);
1094 m_arg
->offset
= accumulate_size
;
1095 accumulate_size
= (accumulate_size
+ m_arg
->len
+ 7) & ~7;
1096 m_arg
->contents
= VALUE_CONTENTS (arg
);
1099 /* Determine required argument register loads, loading an argument register
1100 is expensive as it uses three ptrace calls. */
1101 required_arg_regs
= accumulate_size
/ 8;
1102 if (required_arg_regs
> ALPHA_NUM_ARG_REGS
)
1103 required_arg_regs
= ALPHA_NUM_ARG_REGS
;
1105 /* Make room for the arguments on the stack. */
1106 if (accumulate_size
< arg_regs_size
)
1107 accumulate_size
= arg_regs_size
;
1108 sp
-= accumulate_size
;
1110 /* Keep sp aligned to a multiple of 16 as the compiler does it too. */
1113 /* `Push' arguments on the stack. */
1114 for (i
= nargs
; m_arg
--, --i
>= 0;)
1115 write_memory (sp
+ m_arg
->offset
, m_arg
->contents
, m_arg
->len
);
1118 store_address (raw_buffer
, sizeof (CORE_ADDR
), struct_addr
);
1119 write_memory (sp
, raw_buffer
, sizeof (CORE_ADDR
));
1122 /* Load the argument registers. */
1123 for (i
= 0; i
< required_arg_regs
; i
++)
1127 val
= read_memory_integer (sp
+ i
* 8, 8);
1128 write_register (ALPHA_A0_REGNUM
+ i
, val
);
1129 write_register (ALPHA_FPA0_REGNUM
+ i
, val
);
1132 return sp
+ arg_regs_size
;
1136 alpha_push_dummy_frame (void)
1139 struct linked_proc_info
*link
;
1140 alpha_extra_func_info_t proc_desc
;
1141 CORE_ADDR sp
= read_register (SP_REGNUM
);
1142 CORE_ADDR save_address
;
1143 char raw_buffer
[ALPHA_MAX_REGISTER_RAW_SIZE
];
1146 link
= (struct linked_proc_info
*) xmalloc (sizeof (struct linked_proc_info
));
1147 link
->next
= linked_proc_desc_table
;
1148 linked_proc_desc_table
= link
;
1150 proc_desc
= &link
->info
;
1153 * The registers we must save are all those not preserved across
1155 * In addition, we must save the PC and RA.
1157 * Dummy frame layout:
1167 * Parameter build area
1171 /* MASK(i,j) == (1<<i) + (1<<(i+1)) + ... + (1<<j)). Assume i<=j<31. */
1172 #define MASK(i,j) ((((LONGEST)1 << ((j)+1)) - 1) ^ (((LONGEST)1 << (i)) - 1))
1173 #define GEN_REG_SAVE_MASK (MASK(0,8) | MASK(16,29))
1174 #define GEN_REG_SAVE_COUNT 24
1175 #define FLOAT_REG_SAVE_MASK (MASK(0,1) | MASK(10,30))
1176 #define FLOAT_REG_SAVE_COUNT 23
1177 /* The special register is the PC as we have no bit for it in the save masks.
1178 alpha_frame_saved_pc knows where the pc is saved in a dummy frame. */
1179 #define SPECIAL_REG_SAVE_COUNT 1
1181 PROC_REG_MASK (proc_desc
) = GEN_REG_SAVE_MASK
;
1182 PROC_FREG_MASK (proc_desc
) = FLOAT_REG_SAVE_MASK
;
1183 /* PROC_REG_OFFSET is the offset from the dummy frame to the saved RA,
1184 but keep SP aligned to a multiple of 16. */
1185 PROC_REG_OFFSET (proc_desc
) =
1186 -((8 * (SPECIAL_REG_SAVE_COUNT
1187 + GEN_REG_SAVE_COUNT
1188 + FLOAT_REG_SAVE_COUNT
)
1190 PROC_FREG_OFFSET (proc_desc
) =
1191 PROC_REG_OFFSET (proc_desc
) + 8 * GEN_REG_SAVE_COUNT
;
1193 /* Save general registers.
1194 The return address register is the first saved register, all other
1195 registers follow in ascending order.
1196 The PC is saved immediately below the SP. */
1197 save_address
= sp
+ PROC_REG_OFFSET (proc_desc
);
1198 store_address (raw_buffer
, 8, read_register (ALPHA_RA_REGNUM
));
1199 write_memory (save_address
, raw_buffer
, 8);
1201 mask
= PROC_REG_MASK (proc_desc
) & 0xffffffffL
;
1202 for (ireg
= 0; mask
; ireg
++, mask
>>= 1)
1205 if (ireg
== ALPHA_RA_REGNUM
)
1207 store_address (raw_buffer
, 8, read_register (ireg
));
1208 write_memory (save_address
, raw_buffer
, 8);
1212 store_address (raw_buffer
, 8, read_register (PC_REGNUM
));
1213 write_memory (sp
- 8, raw_buffer
, 8);
1215 /* Save floating point registers. */
1216 save_address
= sp
+ PROC_FREG_OFFSET (proc_desc
);
1217 mask
= PROC_FREG_MASK (proc_desc
) & 0xffffffffL
;
1218 for (ireg
= 0; mask
; ireg
++, mask
>>= 1)
1221 store_address (raw_buffer
, 8, read_register (ireg
+ FP0_REGNUM
));
1222 write_memory (save_address
, raw_buffer
, 8);
1226 /* Set and save the frame address for the dummy.
1227 This is tricky. The only registers that are suitable for a frame save
1228 are those that are preserved across procedure calls (s0-s6). But if
1229 a read system call is interrupted and then a dummy call is made
1230 (see testsuite/gdb.t17/interrupt.exp) the dummy call hangs till the read
1231 is satisfied. Then it returns with the s0-s6 registers set to the values
1232 on entry to the read system call and our dummy frame pointer would be
1233 destroyed. So we save the dummy frame in the proc_desc and handle the
1234 retrieval of the frame pointer of a dummy specifically. The frame register
1235 is set to the virtual frame (pseudo) register, it's value will always
1236 be read as zero and will help us to catch any errors in the dummy frame
1238 PROC_DUMMY_FRAME (proc_desc
) = sp
;
1239 PROC_FRAME_REG (proc_desc
) = FP_REGNUM
;
1240 PROC_FRAME_OFFSET (proc_desc
) = 0;
1241 sp
+= PROC_REG_OFFSET (proc_desc
);
1242 write_register (SP_REGNUM
, sp
);
1244 PROC_LOW_ADDR (proc_desc
) = CALL_DUMMY_ADDRESS ();
1245 PROC_HIGH_ADDR (proc_desc
) = PROC_LOW_ADDR (proc_desc
) + 4;
1247 SET_PROC_DESC_IS_DUMMY (proc_desc
);
1248 PROC_PC_REG (proc_desc
) = ALPHA_RA_REGNUM
;
1252 alpha_pop_frame (void)
1254 register int regnum
;
1255 struct frame_info
*frame
= get_current_frame ();
1256 CORE_ADDR new_sp
= frame
->frame
;
1258 alpha_extra_func_info_t proc_desc
= frame
->extra_info
->proc_desc
;
1260 /* we need proc_desc to know how to restore the registers;
1261 if it is NULL, construct (a temporary) one */
1262 if (proc_desc
== NULL
)
1263 proc_desc
= find_proc_desc (frame
->pc
, frame
->next
);
1265 /* Question: should we copy this proc_desc and save it in
1266 frame->proc_desc? If we do, who will free it?
1267 For now, we don't save a copy... */
1269 write_register (PC_REGNUM
, FRAME_SAVED_PC (frame
));
1270 if (frame
->saved_regs
== NULL
)
1271 alpha_find_saved_regs (frame
);
1274 for (regnum
= 32; --regnum
>= 0;)
1275 if (PROC_REG_MASK (proc_desc
) & (1 << regnum
))
1276 write_register (regnum
,
1277 read_memory_integer (frame
->saved_regs
[regnum
],
1279 for (regnum
= 32; --regnum
>= 0;)
1280 if (PROC_FREG_MASK (proc_desc
) & (1 << regnum
))
1281 write_register (regnum
+ FP0_REGNUM
,
1282 read_memory_integer (frame
->saved_regs
[regnum
+ FP0_REGNUM
], 8));
1284 write_register (SP_REGNUM
, new_sp
);
1285 flush_cached_frames ();
1287 if (proc_desc
&& (PROC_DESC_IS_DUMMY (proc_desc
)
1288 || PROC_DESC_IS_DYN_SIGTRAMP (proc_desc
)))
1290 struct linked_proc_info
*pi_ptr
, *prev_ptr
;
1292 for (pi_ptr
= linked_proc_desc_table
, prev_ptr
= NULL
;
1294 prev_ptr
= pi_ptr
, pi_ptr
= pi_ptr
->next
)
1296 if (&pi_ptr
->info
== proc_desc
)
1301 error ("Can't locate dummy extra frame info\n");
1303 if (prev_ptr
!= NULL
)
1304 prev_ptr
->next
= pi_ptr
->next
;
1306 linked_proc_desc_table
= pi_ptr
->next
;
1312 /* To skip prologues, I use this predicate. Returns either PC itself
1313 if the code at PC does not look like a function prologue; otherwise
1314 returns an address that (if we're lucky) follows the prologue. If
1315 LENIENT, then we must skip everything which is involved in setting
1316 up the frame (it's OK to skip more, just so long as we don't skip
1317 anything which might clobber the registers which are being saved.
1318 Currently we must not skip more on the alpha, but we might need the
1319 lenient stuff some day. */
1322 alpha_skip_prologue_internal (CORE_ADDR pc
, int lenient
)
1326 CORE_ADDR post_prologue_pc
;
1329 #ifdef GDB_TARGET_HAS_SHARED_LIBS
1330 /* Silently return the unaltered pc upon memory errors.
1331 This could happen on OSF/1 if decode_line_1 tries to skip the
1332 prologue for quickstarted shared library functions when the
1333 shared library is not yet mapped in.
1334 Reading target memory is slow over serial lines, so we perform
1335 this check only if the target has shared libraries. */
1336 if (target_read_memory (pc
, buf
, 4))
1340 /* See if we can determine the end of the prologue via the symbol table.
1341 If so, then return either PC, or the PC after the prologue, whichever
1344 post_prologue_pc
= after_prologue (pc
, NULL
);
1346 if (post_prologue_pc
!= 0)
1347 return max (pc
, post_prologue_pc
);
1349 /* Can't determine prologue from the symbol table, need to examine
1352 /* Skip the typical prologue instructions. These are the stack adjustment
1353 instruction and the instructions that save registers on the stack
1354 or in the gcc frame. */
1355 for (offset
= 0; offset
< 100; offset
+= 4)
1359 status
= read_memory_nobpt (pc
+ offset
, buf
, 4);
1361 memory_error (status
, pc
+ offset
);
1362 inst
= extract_unsigned_integer (buf
, 4);
1364 /* The alpha has no delay slots. But let's keep the lenient stuff,
1365 we might need it for something else in the future. */
1369 if ((inst
& 0xffff0000) == 0x27bb0000) /* ldah $gp,n($t12) */
1371 if ((inst
& 0xffff0000) == 0x23bd0000) /* lda $gp,n($gp) */
1373 if ((inst
& 0xffff0000) == 0x23de0000) /* lda $sp,n($sp) */
1375 if ((inst
& 0xffe01fff) == 0x43c0153e) /* subq $sp,n,$sp */
1378 if ((inst
& 0xfc1f0000) == 0xb41e0000
1379 && (inst
& 0xffff0000) != 0xb7fe0000)
1380 continue; /* stq reg,n($sp) */
1382 if ((inst
& 0xfc1f0000) == 0x9c1e0000
1383 && (inst
& 0xffff0000) != 0x9ffe0000)
1384 continue; /* stt reg,n($sp) */
1386 if (inst
== 0x47de040f) /* bis sp,sp,fp */
1395 alpha_skip_prologue (CORE_ADDR addr
)
1397 return (alpha_skip_prologue_internal (addr
, 0));
1401 /* Is address PC in the prologue (loosely defined) for function at
1405 alpha_in_lenient_prologue (CORE_ADDR startaddr
, CORE_ADDR pc
)
1407 CORE_ADDR end_prologue
= alpha_skip_prologue_internal (startaddr
, 1);
1408 return pc
>= startaddr
&& pc
< end_prologue
;
1412 /* The alpha needs a conversion between register and memory format if
1413 the register is a floating point register and
1414 memory format is float, as the register format must be double
1416 memory format is an integer with 4 bytes or less, as the representation
1417 of integers in floating point registers is different. */
1419 alpha_register_convert_to_virtual (int regnum
, struct type
*valtype
,
1420 char *raw_buffer
, char *virtual_buffer
)
1422 if (TYPE_LENGTH (valtype
) >= REGISTER_RAW_SIZE (regnum
))
1424 memcpy (virtual_buffer
, raw_buffer
, REGISTER_VIRTUAL_SIZE (regnum
));
1428 if (TYPE_CODE (valtype
) == TYPE_CODE_FLT
)
1430 double d
= extract_floating (raw_buffer
, REGISTER_RAW_SIZE (regnum
));
1431 store_floating (virtual_buffer
, TYPE_LENGTH (valtype
), d
);
1433 else if (TYPE_CODE (valtype
) == TYPE_CODE_INT
&& TYPE_LENGTH (valtype
) <= 4)
1436 l
= extract_unsigned_integer (raw_buffer
, REGISTER_RAW_SIZE (regnum
));
1437 l
= ((l
>> 32) & 0xc0000000) | ((l
>> 29) & 0x3fffffff);
1438 store_unsigned_integer (virtual_buffer
, TYPE_LENGTH (valtype
), l
);
1441 error ("Cannot retrieve value from floating point register");
1445 alpha_register_convert_to_raw (struct type
*valtype
, int regnum
,
1446 char *virtual_buffer
, char *raw_buffer
)
1448 if (TYPE_LENGTH (valtype
) >= REGISTER_RAW_SIZE (regnum
))
1450 memcpy (raw_buffer
, virtual_buffer
, REGISTER_RAW_SIZE (regnum
));
1454 if (TYPE_CODE (valtype
) == TYPE_CODE_FLT
)
1456 double d
= extract_floating (virtual_buffer
, TYPE_LENGTH (valtype
));
1457 store_floating (raw_buffer
, REGISTER_RAW_SIZE (regnum
), d
);
1459 else if (TYPE_CODE (valtype
) == TYPE_CODE_INT
&& TYPE_LENGTH (valtype
) <= 4)
1462 if (TYPE_UNSIGNED (valtype
))
1463 l
= extract_unsigned_integer (virtual_buffer
, TYPE_LENGTH (valtype
));
1465 l
= extract_signed_integer (virtual_buffer
, TYPE_LENGTH (valtype
));
1466 l
= ((l
& 0xc0000000) << 32) | ((l
& 0x3fffffff) << 29);
1467 store_unsigned_integer (raw_buffer
, REGISTER_RAW_SIZE (regnum
), l
);
1470 error ("Cannot store value in floating point register");
1473 /* Given a return value in `regbuf' with a type `valtype',
1474 extract and copy its value into `valbuf'. */
1477 alpha_extract_return_value (struct type
*valtype
,
1478 char regbuf
[REGISTER_BYTES
], char *valbuf
)
1480 if (TYPE_CODE (valtype
) == TYPE_CODE_FLT
)
1481 alpha_register_convert_to_virtual (FP0_REGNUM
, valtype
,
1482 regbuf
+ REGISTER_BYTE (FP0_REGNUM
),
1485 memcpy (valbuf
, regbuf
+ REGISTER_BYTE (ALPHA_V0_REGNUM
),
1486 TYPE_LENGTH (valtype
));
1489 /* Given a return value in `regbuf' with a type `valtype',
1490 write its value into the appropriate register. */
1493 alpha_store_return_value (struct type
*valtype
, char *valbuf
)
1495 char raw_buffer
[ALPHA_MAX_REGISTER_RAW_SIZE
];
1496 int regnum
= ALPHA_V0_REGNUM
;
1497 int length
= TYPE_LENGTH (valtype
);
1499 if (TYPE_CODE (valtype
) == TYPE_CODE_FLT
)
1501 regnum
= FP0_REGNUM
;
1502 length
= REGISTER_RAW_SIZE (regnum
);
1503 alpha_register_convert_to_raw (valtype
, regnum
, valbuf
, raw_buffer
);
1506 memcpy (raw_buffer
, valbuf
, length
);
1508 write_register_bytes (REGISTER_BYTE (regnum
), raw_buffer
, length
);
1511 /* Just like reinit_frame_cache, but with the right arguments to be
1512 callable as an sfunc. */
1515 reinit_frame_cache_sfunc (char *args
, int from_tty
, struct cmd_list_element
*c
)
1517 reinit_frame_cache ();
1520 /* This is the definition of CALL_DUMMY_ADDRESS. It's a heuristic that is used
1521 to find a convenient place in the text segment to stick a breakpoint to
1522 detect the completion of a target function call (ala call_function_by_hand).
1526 alpha_call_dummy_address (void)
1529 struct minimal_symbol
*sym
;
1531 entry
= entry_point_address ();
1536 sym
= lookup_minimal_symbol ("_Prelude", NULL
, symfile_objfile
);
1538 if (!sym
|| MSYMBOL_TYPE (sym
) != mst_text
)
1541 return SYMBOL_VALUE_ADDRESS (sym
) + 4;
1545 alpha_fix_call_dummy (char *dummy
, CORE_ADDR pc
, CORE_ADDR fun
, int nargs
,
1546 struct value
**args
, struct type
*type
, int gcc_p
)
1548 CORE_ADDR bp_address
= CALL_DUMMY_ADDRESS ();
1550 if (bp_address
== 0)
1551 error ("no place to put call");
1552 write_register (ALPHA_RA_REGNUM
, bp_address
);
1553 write_register (ALPHA_T12_REGNUM
, fun
);
1556 /* On the Alpha, the call dummy code is nevery copied to user space
1557 (see alpha_fix_call_dummy() above). The contents of this do not
1559 LONGEST alpha_call_dummy_words
[] = { 0 };
1562 alpha_use_struct_convention (int gcc_p
, struct type
*type
)
1564 /* Structures are returned by ref in extra arg0. */
1569 alpha_store_struct_return (CORE_ADDR addr
, CORE_ADDR sp
)
1571 /* Store the address of the place in which to copy the structure the
1572 subroutine will return. Handled by alpha_push_arguments. */
1576 alpha_extract_struct_value_address (char *regbuf
)
1578 return (extract_address (regbuf
+ REGISTER_BYTE (ALPHA_V0_REGNUM
),
1579 REGISTER_RAW_SIZE (ALPHA_V0_REGNUM
)));
1582 /* alpha_software_single_step() is called just before we want to resume
1583 the inferior, if we want to single-step it but there is no hardware
1584 or kernel single-step support (NetBSD on Alpha, for example). We find
1585 the target of the coming instruction and breakpoint it.
1587 single_step is also called just after the inferior stops. If we had
1588 set up a simulated single-step, we undo our damage. */
1591 alpha_next_pc (CORE_ADDR pc
)
1598 insn
= read_memory_unsigned_integer (pc
, sizeof (insn
));
1600 /* Opcode is top 6 bits. */
1601 op
= (insn
>> 26) & 0x3f;
1605 /* Jump format: target PC is:
1607 return (read_register ((insn
>> 16) & 0x1f) & ~3);
1610 if ((op
& 0x30) == 0x30)
1612 /* Branch format: target PC is:
1613 (new PC) + (4 * sext(displacement)) */
1614 if (op
== 0x30 || /* BR */
1615 op
== 0x34) /* BSR */
1618 offset
= (insn
& 0x001fffff);
1619 if (offset
& 0x00100000)
1620 offset
|= 0xffe00000;
1622 return (pc
+ 4 + offset
);
1625 /* Need to determine if branch is taken; read RA. */
1626 rav
= (LONGEST
) read_register ((insn
>> 21) & 0x1f);
1629 case 0x38: /* BLBC */
1633 case 0x3c: /* BLBS */
1637 case 0x39: /* BEQ */
1641 case 0x3d: /* BNE */
1645 case 0x3a: /* BLT */
1649 case 0x3b: /* BLE */
1653 case 0x3f: /* BGT */
1657 case 0x3e: /* BGE */
1664 /* Not a branch or branch not taken; target PC is:
1670 alpha_software_single_step (enum target_signal sig
, int insert_breakpoints_p
)
1672 static CORE_ADDR next_pc
;
1673 typedef char binsn_quantum
[BREAKPOINT_MAX
];
1674 static binsn_quantum break_mem
;
1677 if (insert_breakpoints_p
)
1680 next_pc
= alpha_next_pc (pc
);
1682 target_insert_breakpoint (next_pc
, break_mem
);
1686 target_remove_breakpoint (next_pc
, break_mem
);
1692 /* This table matches the indices assigned to enum alpha_abi. Keep
1694 static const char * const alpha_abi_names
[] =
1705 process_note_abi_tag_sections (bfd
*abfd
, asection
*sect
, void *obj
)
1707 enum alpha_abi
*os_ident_ptr
= obj
;
1709 unsigned int sectsize
;
1711 name
= bfd_get_section_name (abfd
, sect
);
1712 sectsize
= bfd_section_size (abfd
, sect
);
1714 if (strcmp (name
, ".note.ABI-tag") == 0 && sectsize
> 0)
1716 unsigned int name_length
, data_length
, note_type
;
1719 /* If the section is larger than this, it's probably not what we are
1724 note
= alloca (sectsize
);
1726 bfd_get_section_contents (abfd
, sect
, note
,
1727 (file_ptr
) 0, (bfd_size_type
) sectsize
);
1729 name_length
= bfd_h_get_32 (abfd
, note
);
1730 data_length
= bfd_h_get_32 (abfd
, note
+ 4);
1731 note_type
= bfd_h_get_32 (abfd
, note
+ 8);
1733 if (name_length
== 4 && data_length
== 16 && note_type
== 1
1734 && strcmp (note
+ 12, "GNU") == 0)
1736 int os_number
= bfd_h_get_32 (abfd
, note
+ 16);
1738 /* The case numbers are from abi-tags in glibc. */
1742 *os_ident_ptr
= ALPHA_ABI_LINUX
;
1747 (__FILE__
, __LINE__
,
1748 "process_note_abi_sections: Hurd objects not supported");
1753 (__FILE__
, __LINE__
,
1754 "process_note_abi_sections: Solaris objects not supported");
1759 (__FILE__
, __LINE__
,
1760 "process_note_abi_sections: unknown OS number %d",
1766 /* NetBSD uses a similar trick. */
1767 else if (strcmp (name
, ".note.netbsd.ident") == 0 && sectsize
> 0)
1769 unsigned int name_length
, desc_length
, note_type
;
1772 /* If the section is larger than this, it's probably not what we are
1777 note
= alloca (sectsize
);
1779 bfd_get_section_contents (abfd
, sect
, note
,
1780 (file_ptr
) 0, (bfd_size_type
) sectsize
);
1782 name_length
= bfd_h_get_32 (abfd
, note
);
1783 desc_length
= bfd_h_get_32 (abfd
, note
+ 4);
1784 note_type
= bfd_h_get_32 (abfd
, note
+ 8);
1786 if (name_length
== 7 && desc_length
== 4 && note_type
== 1
1787 && strcmp (note
+ 12, "NetBSD") == 0)
1788 /* XXX Should we check the version here?
1789 Probably not necessary yet. */
1790 *os_ident_ptr
= ALPHA_ABI_NETBSD
;
1795 get_elfosabi (bfd
*abfd
)
1798 enum alpha_abi alpha_abi
= ALPHA_ABI_UNKNOWN
;
1800 elfosabi
= elf_elfheader (abfd
)->e_ident
[EI_OSABI
];
1802 /* When elfosabi is 0 (ELFOSABI_NONE), this is supposed to indicate
1803 what we're on a SYSV system. However, GNU/Linux uses a note section
1804 to record OS/ABI info, but leaves e_ident[EI_OSABI] zero. So we
1805 have to check the note sections too. */
1808 bfd_map_over_sections (abfd
,
1809 process_note_abi_tag_sections
,
1813 if (alpha_abi
!= ALPHA_ABI_UNKNOWN
)
1819 /* Leave it as unknown. */
1822 case ELFOSABI_NETBSD
:
1823 return ALPHA_ABI_NETBSD
;
1825 case ELFOSABI_FREEBSD
:
1826 return ALPHA_ABI_FREEBSD
;
1828 case ELFOSABI_LINUX
:
1829 return ALPHA_ABI_LINUX
;
1832 return ALPHA_ABI_UNKNOWN
;
1835 struct alpha_abi_handler
1837 struct alpha_abi_handler
*next
;
1839 void (*init_abi
)(struct gdbarch_info
, struct gdbarch
*);
1842 struct alpha_abi_handler
*alpha_abi_handler_list
= NULL
;
1845 alpha_gdbarch_register_os_abi (enum alpha_abi abi
,
1846 void (*init_abi
)(struct gdbarch_info
,
1849 struct alpha_abi_handler
**handler_p
;
1851 for (handler_p
= &alpha_abi_handler_list
; *handler_p
!= NULL
;
1852 handler_p
= &(*handler_p
)->next
)
1854 if ((*handler_p
)->abi
== abi
)
1857 (__FILE__
, __LINE__
,
1858 "alpha_gdbarch_register_os_abi: A handler for this ABI variant "
1859 "(%d) has already been registered", (int) abi
);
1860 /* If user wants to continue, override previous definition. */
1861 (*handler_p
)->init_abi
= init_abi
;
1867 = (struct alpha_abi_handler
*) xmalloc (sizeof (struct alpha_abi_handler
));
1868 (*handler_p
)->next
= NULL
;
1869 (*handler_p
)->abi
= abi
;
1870 (*handler_p
)->init_abi
= init_abi
;
1873 /* Initialize the current architecture based on INFO. If possible, re-use an
1874 architecture from ARCHES, which is a list of architectures already created
1875 during this debugging session.
1877 Called e.g. at program startup, when reading a core file, and when reading
1880 static struct gdbarch
*
1881 alpha_gdbarch_init (struct gdbarch_info info
, struct gdbarch_list
*arches
)
1883 struct gdbarch_tdep
*tdep
;
1884 struct gdbarch
*gdbarch
;
1885 enum alpha_abi alpha_abi
= ALPHA_ABI_UNKNOWN
;
1886 struct alpha_abi_handler
*abi_handler
;
1888 /* Try to determine the ABI of the object we are loading. */
1890 if (info
.abfd
!= NULL
)
1892 switch (bfd_get_flavour (info
.abfd
))
1894 case bfd_target_elf_flavour
:
1895 alpha_abi
= get_elfosabi (info
.abfd
);
1898 case bfd_target_ecoff_flavour
:
1899 /* Assume it's OSF/1. */
1900 alpha_abi
= ALPHA_ABI_OSF1
;
1904 /* Not sure what to do here, leave the ABI as unknown. */
1909 /* Find a candidate among extant architectures. */
1910 for (arches
= gdbarch_list_lookup_by_info (arches
, &info
);
1912 arches
= gdbarch_list_lookup_by_info (arches
->next
, &info
))
1914 /* Make sure the ABI selection matches. */
1915 tdep
= gdbarch_tdep (arches
->gdbarch
);
1916 if (tdep
&& tdep
->alpha_abi
== alpha_abi
)
1917 return arches
->gdbarch
;
1920 tdep
= xmalloc (sizeof (struct gdbarch_tdep
));
1921 gdbarch
= gdbarch_alloc (&info
, tdep
);
1923 tdep
->alpha_abi
= alpha_abi
;
1924 if (alpha_abi
< ALPHA_ABI_INVALID
)
1925 tdep
->abi_name
= alpha_abi_names
[alpha_abi
];
1928 internal_error (__FILE__
, __LINE__
, "Invalid setting of alpha_abi %d",
1930 tdep
->abi_name
= "<invalid>";
1933 /* Lowest text address. This is used by heuristic_proc_start() to
1934 decide when to stop looking. */
1935 tdep
->vm_min_address
= (CORE_ADDR
) 0x120000000;
1938 set_gdbarch_short_bit (gdbarch
, 16);
1939 set_gdbarch_int_bit (gdbarch
, 32);
1940 set_gdbarch_long_bit (gdbarch
, 64);
1941 set_gdbarch_long_long_bit (gdbarch
, 64);
1942 set_gdbarch_float_bit (gdbarch
, 32);
1943 set_gdbarch_double_bit (gdbarch
, 64);
1944 set_gdbarch_long_double_bit (gdbarch
, 64);
1945 set_gdbarch_ptr_bit (gdbarch
, 64);
1948 set_gdbarch_num_regs (gdbarch
, ALPHA_NUM_REGS
);
1949 set_gdbarch_sp_regnum (gdbarch
, ALPHA_SP_REGNUM
);
1950 set_gdbarch_fp_regnum (gdbarch
, ALPHA_FP_REGNUM
);
1951 set_gdbarch_pc_regnum (gdbarch
, ALPHA_PC_REGNUM
);
1952 set_gdbarch_fp0_regnum (gdbarch
, ALPHA_FP0_REGNUM
);
1954 set_gdbarch_register_name (gdbarch
, alpha_register_name
);
1955 set_gdbarch_register_size (gdbarch
, ALPHA_REGISTER_SIZE
);
1956 set_gdbarch_register_bytes (gdbarch
, ALPHA_REGISTER_BYTES
);
1957 set_gdbarch_register_byte (gdbarch
, alpha_register_byte
);
1958 set_gdbarch_register_raw_size (gdbarch
, alpha_register_raw_size
);
1959 set_gdbarch_max_register_raw_size (gdbarch
, ALPHA_MAX_REGISTER_RAW_SIZE
);
1960 set_gdbarch_register_virtual_size (gdbarch
, alpha_register_virtual_size
);
1961 set_gdbarch_max_register_virtual_size (gdbarch
,
1962 ALPHA_MAX_REGISTER_VIRTUAL_SIZE
);
1963 set_gdbarch_register_virtual_type (gdbarch
, alpha_register_virtual_type
);
1965 set_gdbarch_cannot_fetch_register (gdbarch
, alpha_cannot_fetch_register
);
1966 set_gdbarch_cannot_store_register (gdbarch
, alpha_cannot_store_register
);
1968 set_gdbarch_register_convertible (gdbarch
, alpha_register_convertible
);
1969 set_gdbarch_register_convert_to_virtual (gdbarch
,
1970 alpha_register_convert_to_virtual
);
1971 set_gdbarch_register_convert_to_raw (gdbarch
, alpha_register_convert_to_raw
);
1973 set_gdbarch_skip_prologue (gdbarch
, alpha_skip_prologue
);
1975 set_gdbarch_frame_num_args (gdbarch
, frame_num_args_unknown
);
1976 set_gdbarch_frameless_function_invocation (gdbarch
,
1977 generic_frameless_function_invocation_not
);
1979 set_gdbarch_saved_pc_after_call (gdbarch
, alpha_saved_pc_after_call
);
1981 set_gdbarch_frame_chain (gdbarch
, alpha_frame_chain
);
1982 set_gdbarch_frame_chain_valid (gdbarch
, func_frame_chain_valid
);
1983 set_gdbarch_frame_saved_pc (gdbarch
, alpha_frame_saved_pc
);
1985 set_gdbarch_frame_init_saved_regs (gdbarch
, alpha_frame_init_saved_regs
);
1986 set_gdbarch_get_saved_register (gdbarch
, alpha_get_saved_register
);
1988 set_gdbarch_use_struct_convention (gdbarch
, alpha_use_struct_convention
);
1989 set_gdbarch_extract_return_value (gdbarch
, alpha_extract_return_value
);
1991 set_gdbarch_store_struct_return (gdbarch
, alpha_store_struct_return
);
1992 set_gdbarch_store_return_value (gdbarch
, alpha_store_return_value
);
1993 set_gdbarch_extract_struct_value_address (gdbarch
,
1994 alpha_extract_struct_value_address
);
1996 /* Settings for calling functions in the inferior. */
1997 set_gdbarch_use_generic_dummy_frames (gdbarch
, 0);
1998 set_gdbarch_call_dummy_length (gdbarch
, 0);
1999 set_gdbarch_push_arguments (gdbarch
, alpha_push_arguments
);
2000 set_gdbarch_pop_frame (gdbarch
, alpha_pop_frame
);
2002 /* On the Alpha, the call dummy code is never copied to user space,
2003 stopping the user call is achieved via a bp_call_dummy breakpoint.
2004 But we need a fake CALL_DUMMY definition to enable the proper
2005 call_function_by_hand and to avoid zero length array warnings. */
2006 set_gdbarch_call_dummy_p (gdbarch
, 1);
2007 set_gdbarch_call_dummy_words (gdbarch
, alpha_call_dummy_words
);
2008 set_gdbarch_sizeof_call_dummy_words (gdbarch
, 0);
2009 set_gdbarch_frame_args_address (gdbarch
, alpha_frame_args_address
);
2010 set_gdbarch_frame_locals_address (gdbarch
, alpha_frame_locals_address
);
2011 set_gdbarch_init_extra_frame_info (gdbarch
, alpha_init_extra_frame_info
);
2013 /* Alpha OSF/1 inhibits execution of code on the stack. But there is
2014 no need for a dummy on the Alpha. PUSH_ARGUMENTS takes care of all
2015 argument handling and bp_call_dummy takes care of stopping the dummy. */
2016 set_gdbarch_call_dummy_location (gdbarch
, AT_ENTRY_POINT
);
2017 set_gdbarch_call_dummy_address (gdbarch
, alpha_call_dummy_address
);
2018 set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch
, 1);
2019 set_gdbarch_call_dummy_breakpoint_offset (gdbarch
, 0);
2020 set_gdbarch_call_dummy_start_offset (gdbarch
, 0);
2021 set_gdbarch_pc_in_call_dummy (gdbarch
, pc_in_call_dummy_at_entry_point
);
2022 set_gdbarch_call_dummy_stack_adjust_p (gdbarch
, 0);
2023 set_gdbarch_push_dummy_frame (gdbarch
, alpha_push_dummy_frame
);
2024 set_gdbarch_fix_call_dummy (gdbarch
, alpha_fix_call_dummy
);
2025 set_gdbarch_init_frame_pc (gdbarch
, init_frame_pc_noop
);
2026 set_gdbarch_init_frame_pc_first (gdbarch
, alpha_init_frame_pc_first
);
2028 set_gdbarch_inner_than (gdbarch
, core_addr_lessthan
);
2030 /* Floats are always passed as doubles. */
2031 set_gdbarch_coerce_float_to_double (gdbarch
,
2032 standard_coerce_float_to_double
);
2034 set_gdbarch_decr_pc_after_break (gdbarch
, 4);
2035 set_gdbarch_frame_args_skip (gdbarch
, 0);
2037 /* Hook in ABI-specific overrides, if they have been registered. */
2038 if (alpha_abi
== ALPHA_ABI_UNKNOWN
)
2040 /* Don't complain about not knowing the ABI variant if we don't
2041 have an inferior. */
2044 (gdb_stderr
, "GDB doesn't recognize the ABI of the inferior. "
2045 "Attempting to continue with the default Alpha settings");
2049 for (abi_handler
= alpha_abi_handler_list
; abi_handler
!= NULL
;
2050 abi_handler
= abi_handler
->next
)
2051 if (abi_handler
->abi
== alpha_abi
)
2055 abi_handler
->init_abi (info
, gdbarch
);
2058 /* We assume that if GDB_MULTI_ARCH is less than
2059 GDB_MULTI_ARCH_TM that an ABI variant can be supported by
2060 overriding definitions in this file. */
2061 if (GDB_MULTI_ARCH
> GDB_MULTI_ARCH_PARTIAL
)
2064 "A handler for the ABI variant \"%s\" is not built into this "
2065 "configuration of GDB. "
2066 "Attempting to continue with the default Alpha settings",
2067 alpha_abi_names
[alpha_abi
]);
2075 alpha_dump_tdep (struct gdbarch
*current_gdbarch
, struct ui_file
*file
)
2077 struct gdbarch_tdep
*tdep
= gdbarch_tdep (current_gdbarch
);
2082 if (tdep
->abi_name
!= NULL
)
2083 fprintf_unfiltered (file
, "alpha_dump_tdep: ABI = %s\n", tdep
->abi_name
);
2085 internal_error (__FILE__
, __LINE__
,
2086 "alpha_dump_tdep: illegal setting of tdep->alpha_abi (%d)",
2087 (int) tdep
->alpha_abi
);
2089 fprintf_unfiltered (file
,
2090 "alpha_dump_tdep: vm_min_address = 0x%lx\n",
2091 (long) tdep
->vm_min_address
);
2095 _initialize_alpha_tdep (void)
2097 struct cmd_list_element
*c
;
2099 gdbarch_register (bfd_arch_alpha
, alpha_gdbarch_init
, alpha_dump_tdep
);
2101 tm_print_insn
= print_insn_alpha
;
2103 /* Let the user set the fence post for heuristic_proc_start. */
2105 /* We really would like to have both "0" and "unlimited" work, but
2106 command.c doesn't deal with that. So make it a var_zinteger
2107 because the user can always use "999999" or some such for unlimited. */
2108 c
= add_set_cmd ("heuristic-fence-post", class_support
, var_zinteger
,
2109 (char *) &heuristic_fence_post
,
2111 Set the distance searched for the start of a function.\n\
2112 If you are debugging a stripped executable, GDB needs to search through the\n\
2113 program for the start of a function. This command sets the distance of the\n\
2114 search. The only need to set it is when debugging a stripped executable.",
2116 /* We need to throw away the frame cache when we set this, since it
2117 might change our ability to get backtraces. */
2118 set_cmd_sfunc (c
, reinit_frame_cache_sfunc
);
2119 add_show_from_set (c
, &showlist
);