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 struct frame_extra_info
83 alpha_extra_func_info_t proc_desc
;
88 /* FIXME: Some of this code should perhaps be merged with mips-tdep.c. */
90 /* Prototypes for local functions. */
92 static void alpha_find_saved_regs (struct frame_info
*);
94 static alpha_extra_func_info_t
push_sigtramp_desc (CORE_ADDR low_addr
);
96 static CORE_ADDR
read_next_frame_reg (struct frame_info
*, int);
98 static CORE_ADDR
heuristic_proc_start (CORE_ADDR
);
100 static alpha_extra_func_info_t
heuristic_proc_desc (CORE_ADDR
,
102 struct frame_info
*);
104 static alpha_extra_func_info_t
find_proc_desc (CORE_ADDR
,
105 struct frame_info
*);
108 static int alpha_in_lenient_prologue (CORE_ADDR
, CORE_ADDR
);
111 static void reinit_frame_cache_sfunc (char *, int, struct cmd_list_element
*);
113 static CORE_ADDR
after_prologue (CORE_ADDR pc
,
114 alpha_extra_func_info_t proc_desc
);
116 static int alpha_in_prologue (CORE_ADDR pc
,
117 alpha_extra_func_info_t proc_desc
);
119 static int alpha_about_to_return (CORE_ADDR pc
);
121 void _initialize_alpha_tdep (void);
123 /* Heuristic_proc_start may hunt through the text section for a long
124 time across a 2400 baud serial line. Allows the user to limit this
126 static unsigned int heuristic_fence_post
= 0;
128 /* Layout of a stack frame on the alpha:
131 pdr members: | 7th ... nth arg, |
132 | `pushed' by caller. |
134 ----------------|-------------------------------|<-- old_sp == vfp
137 | |localoff | Copies of 1st .. 6th |
138 | | | | | argument if necessary. |
140 | | | --- |-------------------------------|<-- FRAME_LOCALS_ADDRESS
142 | | | | Locals and temporaries. |
144 | | | |-------------------------------|
146 |-fregoffset | Saved float registers. |
152 | | -------|-------------------------------|
154 | | | Saved registers. |
161 | ----------|-------------------------------|
163 frameoffset | Argument build area, gets |
164 | | 7th ... nth arg for any |
165 | | called procedure. |
167 -------------|-------------------------------|<-- 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_frame_past_sigtramp_frame (struct frame_info
*frame
, CORE_ADDR pc
)
201 struct gdbarch_tdep
*tdep
= gdbarch_tdep (current_gdbarch
);
203 if (tdep
->skip_sigtramp_frame
!= NULL
)
204 return (tdep
->skip_sigtramp_frame (frame
, pc
));
210 alpha_dynamic_sigtramp_offset (CORE_ADDR pc
)
212 struct gdbarch_tdep
*tdep
= gdbarch_tdep (current_gdbarch
);
214 /* Must be provided by OS/ABI variant code if supported. */
215 if (tdep
->dynamic_sigtramp_offset
!= NULL
)
216 return (tdep
->dynamic_sigtramp_offset (pc
));
221 #define ALPHA_PROC_SIGTRAMP_MAGIC 0x0e0f0f0f
223 /* Return TRUE if the procedure descriptor PROC is a procedure
224 descriptor that refers to a dynamically generated signal
225 trampoline routine. */
227 alpha_proc_desc_is_dyn_sigtramp (struct alpha_extra_func_info
*proc
)
229 struct gdbarch_tdep
*tdep
= gdbarch_tdep (current_gdbarch
);
231 if (tdep
->dynamic_sigtramp_offset
!= NULL
)
232 return (proc
->pdr
.isym
== ALPHA_PROC_SIGTRAMP_MAGIC
);
238 alpha_set_proc_desc_is_dyn_sigtramp (struct alpha_extra_func_info
*proc
)
240 struct gdbarch_tdep
*tdep
= gdbarch_tdep (current_gdbarch
);
242 if (tdep
->dynamic_sigtramp_offset
!= NULL
)
243 proc
->pdr
.isym
= ALPHA_PROC_SIGTRAMP_MAGIC
;
246 /* Dynamically create a signal-handler caller procedure descriptor for
247 the signal-handler return code starting at address LOW_ADDR. The
248 descriptor is added to the linked_proc_desc_table. */
250 static alpha_extra_func_info_t
251 push_sigtramp_desc (CORE_ADDR low_addr
)
253 struct linked_proc_info
*link
;
254 alpha_extra_func_info_t proc_desc
;
256 link
= (struct linked_proc_info
*)
257 xmalloc (sizeof (struct linked_proc_info
));
258 link
->next
= linked_proc_desc_table
;
259 linked_proc_desc_table
= link
;
261 proc_desc
= &link
->info
;
263 proc_desc
->numargs
= 0;
264 PROC_LOW_ADDR (proc_desc
) = low_addr
;
265 PROC_HIGH_ADDR (proc_desc
) = low_addr
+ 3 * 4;
266 PROC_DUMMY_FRAME (proc_desc
) = 0;
267 PROC_FRAME_OFFSET (proc_desc
) = 0x298; /* sizeof(struct sigcontext_struct) */
268 PROC_FRAME_REG (proc_desc
) = SP_REGNUM
;
269 PROC_REG_MASK (proc_desc
) = 0xffff;
270 PROC_FREG_MASK (proc_desc
) = 0xffff;
271 PROC_PC_REG (proc_desc
) = 26;
272 PROC_LOCALOFF (proc_desc
) = 0;
273 alpha_set_proc_desc_is_dyn_sigtramp (proc_desc
);
279 alpha_register_name (int regno
)
281 static char *register_names
[] =
283 "v0", "t0", "t1", "t2", "t3", "t4", "t5", "t6",
284 "t7", "s0", "s1", "s2", "s3", "s4", "s5", "fp",
285 "a0", "a1", "a2", "a3", "a4", "a5", "t8", "t9",
286 "t10", "t11", "ra", "t12", "at", "gp", "sp", "zero",
287 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
288 "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
289 "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
290 "f24", "f25", "f26", "f27", "f28", "f29", "f30", "fpcr",
296 if (regno
>= (sizeof(register_names
) / sizeof(*register_names
)))
298 return (register_names
[regno
]);
302 alpha_cannot_fetch_register (int regno
)
304 return (regno
== FP_REGNUM
|| regno
== ALPHA_ZERO_REGNUM
);
308 alpha_cannot_store_register (int regno
)
310 return (regno
== FP_REGNUM
|| regno
== ALPHA_ZERO_REGNUM
);
314 alpha_register_convertible (int regno
)
316 return (regno
>= FP0_REGNUM
&& regno
<= FP0_REGNUM
+ 31);
320 alpha_register_virtual_type (int regno
)
322 return ((regno
>= FP0_REGNUM
&& regno
< (FP0_REGNUM
+31))
323 ? builtin_type_double
: builtin_type_long
);
327 alpha_register_byte (int regno
)
333 alpha_register_raw_size (int regno
)
339 alpha_register_virtual_size (int regno
)
345 /* Guaranteed to set frame->saved_regs to some values (it never leaves it
349 alpha_find_saved_regs (struct frame_info
*frame
)
352 CORE_ADDR reg_position
;
354 alpha_extra_func_info_t proc_desc
;
357 frame_saved_regs_zalloc (frame
);
359 /* If it is the frame for __sigtramp, the saved registers are located
360 in a sigcontext structure somewhere on the stack. __sigtramp
361 passes a pointer to the sigcontext structure on the stack.
362 If the stack layout for __sigtramp changes, or if sigcontext offsets
363 change, we might have to update this code. */
364 #ifndef SIGFRAME_PC_OFF
365 #define SIGFRAME_PC_OFF (2 * 8)
366 #define SIGFRAME_REGSAVE_OFF (4 * 8)
367 #define SIGFRAME_FPREGSAVE_OFF (SIGFRAME_REGSAVE_OFF + 32 * 8 + 8)
369 if (frame
->signal_handler_caller
)
371 CORE_ADDR sigcontext_addr
;
373 sigcontext_addr
= SIGCONTEXT_ADDR (frame
);
374 for (ireg
= 0; ireg
< 32; ireg
++)
376 reg_position
= sigcontext_addr
+ SIGFRAME_REGSAVE_OFF
+ ireg
* 8;
377 frame
->saved_regs
[ireg
] = reg_position
;
379 for (ireg
= 0; ireg
< 32; ireg
++)
381 reg_position
= sigcontext_addr
+ SIGFRAME_FPREGSAVE_OFF
+ ireg
* 8;
382 frame
->saved_regs
[FP0_REGNUM
+ ireg
] = reg_position
;
384 frame
->saved_regs
[PC_REGNUM
] = sigcontext_addr
+ SIGFRAME_PC_OFF
;
388 proc_desc
= frame
->extra_info
->proc_desc
;
389 if (proc_desc
== NULL
)
390 /* I'm not sure how/whether this can happen. Normally when we can't
391 find a proc_desc, we "synthesize" one using heuristic_proc_desc
392 and set the saved_regs right away. */
395 /* Fill in the offsets for the registers which gen_mask says
398 reg_position
= frame
->frame
+ PROC_REG_OFFSET (proc_desc
);
399 mask
= PROC_REG_MASK (proc_desc
);
401 returnreg
= PROC_PC_REG (proc_desc
);
403 /* Note that RA is always saved first, regardless of its actual
405 if (mask
& (1 << returnreg
))
407 frame
->saved_regs
[returnreg
] = reg_position
;
409 mask
&= ~(1 << returnreg
); /* Clear bit for RA so we
410 don't save again later. */
413 for (ireg
= 0; ireg
<= 31; ++ireg
)
414 if (mask
& (1 << ireg
))
416 frame
->saved_regs
[ireg
] = reg_position
;
420 /* Fill in the offsets for the registers which float_mask says
423 reg_position
= frame
->frame
+ PROC_FREG_OFFSET (proc_desc
);
424 mask
= PROC_FREG_MASK (proc_desc
);
426 for (ireg
= 0; ireg
<= 31; ++ireg
)
427 if (mask
& (1 << ireg
))
429 frame
->saved_regs
[FP0_REGNUM
+ ireg
] = reg_position
;
433 frame
->saved_regs
[PC_REGNUM
] = frame
->saved_regs
[returnreg
];
437 alpha_frame_init_saved_regs (struct frame_info
*fi
)
439 if (fi
->saved_regs
== NULL
)
440 alpha_find_saved_regs (fi
);
441 fi
->saved_regs
[SP_REGNUM
] = fi
->frame
;
445 alpha_init_frame_pc_first (int fromleaf
, struct frame_info
*prev
)
447 prev
->pc
= (fromleaf
? SAVED_PC_AFTER_CALL (prev
->next
) :
448 prev
->next
? FRAME_SAVED_PC (prev
->next
) : read_pc ());
452 read_next_frame_reg (struct frame_info
*fi
, int regno
)
454 for (; fi
; fi
= fi
->next
)
456 /* We have to get the saved sp from the sigcontext
457 if it is a signal handler frame. */
458 if (regno
== SP_REGNUM
&& !fi
->signal_handler_caller
)
462 if (fi
->saved_regs
== NULL
)
463 alpha_find_saved_regs (fi
);
464 if (fi
->saved_regs
[regno
])
465 return read_memory_integer (fi
->saved_regs
[regno
], 8);
468 return read_register (regno
);
472 alpha_frame_saved_pc (struct frame_info
*frame
)
474 alpha_extra_func_info_t proc_desc
= frame
->extra_info
->proc_desc
;
475 /* We have to get the saved pc from the sigcontext
476 if it is a signal handler frame. */
477 int pcreg
= frame
->signal_handler_caller
? PC_REGNUM
478 : frame
->extra_info
->pc_reg
;
480 if (proc_desc
&& PROC_DESC_IS_DUMMY (proc_desc
))
481 return read_memory_integer (frame
->frame
- 8, 8);
483 return read_next_frame_reg (frame
, pcreg
);
487 alpha_get_saved_register (char *raw_buffer
,
490 struct frame_info
*frame
,
492 enum lval_type
*lval
)
496 if (!target_has_registers
)
497 error ("No registers.");
499 /* Normal systems don't optimize out things with register numbers. */
500 if (optimized
!= NULL
)
502 addr
= find_saved_register (frame
, regnum
);
507 if (regnum
== SP_REGNUM
)
509 if (raw_buffer
!= NULL
)
511 /* Put it back in target format. */
512 store_address (raw_buffer
, REGISTER_RAW_SIZE (regnum
),
519 if (raw_buffer
!= NULL
)
520 target_read_memory (addr
, raw_buffer
, REGISTER_RAW_SIZE (regnum
));
525 *lval
= lval_register
;
526 addr
= REGISTER_BYTE (regnum
);
527 if (raw_buffer
!= NULL
)
528 read_register_gen (regnum
, raw_buffer
);
535 alpha_saved_pc_after_call (struct frame_info
*frame
)
537 CORE_ADDR pc
= frame
->pc
;
539 alpha_extra_func_info_t proc_desc
;
542 /* Skip over shared library trampoline if necessary. */
543 tmp
= SKIP_TRAMPOLINE_CODE (pc
);
547 proc_desc
= find_proc_desc (pc
, frame
->next
);
548 pcreg
= proc_desc
? PROC_PC_REG (proc_desc
) : ALPHA_RA_REGNUM
;
550 if (frame
->signal_handler_caller
)
551 return alpha_frame_saved_pc (frame
);
553 return read_register (pcreg
);
557 static struct alpha_extra_func_info temp_proc_desc
;
558 static CORE_ADDR temp_saved_regs
[ALPHA_NUM_REGS
];
560 /* Nonzero if instruction at PC is a return instruction. "ret
561 $zero,($ra),1" on alpha. */
564 alpha_about_to_return (CORE_ADDR pc
)
566 return read_memory_integer (pc
, 4) == 0x6bfa8001;
571 /* This fencepost looks highly suspicious to me. Removing it also
572 seems suspicious as it could affect remote debugging across serial
576 heuristic_proc_start (CORE_ADDR pc
)
578 struct gdbarch_tdep
*tdep
= gdbarch_tdep (current_gdbarch
);
579 CORE_ADDR start_pc
= pc
;
580 CORE_ADDR fence
= start_pc
- heuristic_fence_post
;
585 if (heuristic_fence_post
== UINT_MAX
586 || fence
< tdep
->vm_min_address
)
587 fence
= tdep
->vm_min_address
;
589 /* search back for previous return */
590 for (start_pc
-= 4;; start_pc
-= 4)
591 if (start_pc
< fence
)
593 /* It's not clear to me why we reach this point when
594 stop_soon_quietly, but with this test, at least we
595 don't print out warnings for every child forked (eg, on
596 decstation). 22apr93 rich@cygnus.com. */
597 if (!stop_soon_quietly
)
599 static int blurb_printed
= 0;
601 if (fence
== tdep
->vm_min_address
)
602 warning ("Hit beginning of text section without finding");
604 warning ("Hit heuristic-fence-post without finding");
606 warning ("enclosing function for address 0x%s", paddr_nz (pc
));
610 This warning occurs if you are debugging a function without any symbols\n\
611 (for example, in a stripped executable). In that case, you may wish to\n\
612 increase the size of the search with the `set heuristic-fence-post' command.\n\
614 Otherwise, you told GDB there was a function where there isn't one, or\n\
615 (more likely) you have encountered a bug in GDB.\n");
622 else if (alpha_about_to_return (start_pc
))
625 start_pc
+= 4; /* skip return */
629 static alpha_extra_func_info_t
630 heuristic_proc_desc (CORE_ADDR start_pc
, CORE_ADDR limit_pc
,
631 struct frame_info
*next_frame
)
633 CORE_ADDR sp
= read_next_frame_reg (next_frame
, SP_REGNUM
);
636 int has_frame_reg
= 0;
637 unsigned long reg_mask
= 0;
642 memset (&temp_proc_desc
, '\0', sizeof (temp_proc_desc
));
643 memset (&temp_saved_regs
, '\0', SIZEOF_FRAME_SAVED_REGS
);
644 PROC_LOW_ADDR (&temp_proc_desc
) = start_pc
;
646 if (start_pc
+ 200 < limit_pc
)
647 limit_pc
= start_pc
+ 200;
649 for (cur_pc
= start_pc
; cur_pc
< limit_pc
; cur_pc
+= 4)
655 status
= read_memory_nobpt (cur_pc
, buf
, 4);
657 memory_error (status
, cur_pc
);
658 word
= extract_unsigned_integer (buf
, 4);
660 if ((word
& 0xffff0000) == 0x23de0000) /* lda $sp,n($sp) */
663 frame_size
+= (-word
) & 0xffff;
665 /* Exit loop if a positive stack adjustment is found, which
666 usually means that the stack cleanup code in the function
667 epilogue is reached. */
670 else if ((word
& 0xfc1f0000) == 0xb41e0000 /* stq reg,n($sp) */
671 && (word
& 0xffff0000) != 0xb7fe0000) /* reg != $zero */
673 int reg
= (word
& 0x03e00000) >> 21;
674 reg_mask
|= 1 << reg
;
675 temp_saved_regs
[reg
] = sp
+ (short) word
;
677 /* Starting with OSF/1-3.2C, the system libraries are shipped
678 without local symbols, but they still contain procedure
679 descriptors without a symbol reference. GDB is currently
680 unable to find these procedure descriptors and uses
681 heuristic_proc_desc instead.
682 As some low level compiler support routines (__div*, __add*)
683 use a non-standard return address register, we have to
684 add some heuristics to determine the return address register,
685 or stepping over these routines will fail.
686 Usually the return address register is the first register
687 saved on the stack, but assembler optimization might
688 rearrange the register saves.
689 So we recognize only a few registers (t7, t9, ra) within
690 the procedure prologue as valid return address registers.
691 If we encounter a return instruction, we extract the
692 the return address register from it.
694 FIXME: Rewriting GDB to access the procedure descriptors,
695 e.g. via the minimal symbol table, might obviate this hack. */
697 && cur_pc
< (start_pc
+ 80)
698 && (reg
== ALPHA_T7_REGNUM
|| reg
== ALPHA_T9_REGNUM
699 || reg
== ALPHA_RA_REGNUM
))
702 else if ((word
& 0xffe0ffff) == 0x6be08001) /* ret zero,reg,1 */
703 pcreg
= (word
>> 16) & 0x1f;
704 else if (word
== 0x47de040f) /* bis sp,sp fp */
709 /* If we haven't found a valid return address register yet,
710 keep searching in the procedure prologue. */
711 while (cur_pc
< (limit_pc
+ 80) && cur_pc
< (start_pc
+ 80))
716 if (read_memory_nobpt (cur_pc
, buf
, 4))
719 word
= extract_unsigned_integer (buf
, 4);
721 if ((word
& 0xfc1f0000) == 0xb41e0000 /* stq reg,n($sp) */
722 && (word
& 0xffff0000) != 0xb7fe0000) /* reg != $zero */
724 int reg
= (word
& 0x03e00000) >> 21;
725 if (reg
== ALPHA_T7_REGNUM
|| reg
== ALPHA_T9_REGNUM
726 || reg
== ALPHA_RA_REGNUM
)
732 else if ((word
& 0xffe0ffff) == 0x6be08001) /* ret zero,reg,1 */
734 pcreg
= (word
>> 16) & 0x1f;
741 PROC_FRAME_REG (&temp_proc_desc
) = ALPHA_GCC_FP_REGNUM
;
743 PROC_FRAME_REG (&temp_proc_desc
) = SP_REGNUM
;
744 PROC_FRAME_OFFSET (&temp_proc_desc
) = frame_size
;
745 PROC_REG_MASK (&temp_proc_desc
) = reg_mask
;
746 PROC_PC_REG (&temp_proc_desc
) = (pcreg
== -1) ? ALPHA_RA_REGNUM
: pcreg
;
747 PROC_LOCALOFF (&temp_proc_desc
) = 0; /* XXX - bogus */
748 return &temp_proc_desc
;
751 /* This returns the PC of the first inst after the prologue. If we can't
752 find the prologue, then return 0. */
755 after_prologue (CORE_ADDR pc
, alpha_extra_func_info_t proc_desc
)
757 struct symtab_and_line sal
;
758 CORE_ADDR func_addr
, func_end
;
761 proc_desc
= find_proc_desc (pc
, NULL
);
765 if (alpha_proc_desc_is_dyn_sigtramp (proc_desc
))
766 return PROC_LOW_ADDR (proc_desc
); /* "prologue" is in kernel */
768 /* If function is frameless, then we need to do it the hard way. I
769 strongly suspect that frameless always means prologueless... */
770 if (PROC_FRAME_REG (proc_desc
) == SP_REGNUM
771 && PROC_FRAME_OFFSET (proc_desc
) == 0)
775 if (!find_pc_partial_function (pc
, NULL
, &func_addr
, &func_end
))
776 return 0; /* Unknown */
778 sal
= find_pc_line (func_addr
, 0);
780 if (sal
.end
< func_end
)
783 /* The line after the prologue is after the end of the function. In this
784 case, tell the caller to find the prologue the hard way. */
789 /* Return non-zero if we *might* be in a function prologue. Return zero if we
790 are definitively *not* in a function prologue. */
793 alpha_in_prologue (CORE_ADDR pc
, alpha_extra_func_info_t proc_desc
)
795 CORE_ADDR after_prologue_pc
;
797 after_prologue_pc
= after_prologue (pc
, proc_desc
);
799 if (after_prologue_pc
== 0
800 || pc
< after_prologue_pc
)
806 static alpha_extra_func_info_t
807 find_proc_desc (CORE_ADDR pc
, struct frame_info
*next_frame
)
809 alpha_extra_func_info_t proc_desc
;
814 /* Try to get the proc_desc from the linked call dummy proc_descs
815 if the pc is in the call dummy.
816 This is hairy. In the case of nested dummy calls we have to find the
817 right proc_desc, but we might not yet know the frame for the dummy
818 as it will be contained in the proc_desc we are searching for.
819 So we have to find the proc_desc whose frame is closest to the current
822 if (PC_IN_CALL_DUMMY (pc
, 0, 0))
824 struct linked_proc_info
*link
;
825 CORE_ADDR sp
= read_next_frame_reg (next_frame
, SP_REGNUM
);
826 alpha_extra_func_info_t found_proc_desc
= NULL
;
827 long min_distance
= LONG_MAX
;
829 for (link
= linked_proc_desc_table
; link
; link
= link
->next
)
831 long distance
= (CORE_ADDR
) PROC_DUMMY_FRAME (&link
->info
) - sp
;
832 if (distance
> 0 && distance
< min_distance
)
834 min_distance
= distance
;
835 found_proc_desc
= &link
->info
;
838 if (found_proc_desc
!= NULL
)
839 return found_proc_desc
;
842 b
= block_for_pc (pc
);
844 find_pc_partial_function (pc
, NULL
, &startaddr
, NULL
);
849 if (startaddr
> BLOCK_START (b
))
850 /* This is the "pathological" case referred to in a comment in
851 print_frame_info. It might be better to move this check into
855 sym
= lookup_symbol (MIPS_EFI_SYMBOL_NAME
, b
, LABEL_NAMESPACE
,
859 /* If we never found a PDR for this function in symbol reading, then
860 examine prologues to find the information. */
861 if (sym
&& ((mips_extra_func_info_t
) SYMBOL_VALUE (sym
))->pdr
.framereg
== -1)
866 /* IF this is the topmost frame AND
867 * (this proc does not have debugging information OR
868 * the PC is in the procedure prologue)
869 * THEN create a "heuristic" proc_desc (by analyzing
870 * the actual code) to replace the "official" proc_desc.
872 proc_desc
= (alpha_extra_func_info_t
) SYMBOL_VALUE (sym
);
873 if (next_frame
== NULL
)
875 if (PROC_DESC_IS_DUMMY (proc_desc
) || alpha_in_prologue (pc
, proc_desc
))
877 alpha_extra_func_info_t found_heuristic
=
878 heuristic_proc_desc (PROC_LOW_ADDR (proc_desc
),
882 PROC_LOCALOFF (found_heuristic
) =
883 PROC_LOCALOFF (proc_desc
);
884 PROC_PC_REG (found_heuristic
) = PROC_PC_REG (proc_desc
);
885 proc_desc
= found_heuristic
;
894 /* Is linked_proc_desc_table really necessary? It only seems to be used
895 by procedure call dummys. However, the procedures being called ought
896 to have their own proc_descs, and even if they don't,
897 heuristic_proc_desc knows how to create them! */
899 register struct linked_proc_info
*link
;
900 for (link
= linked_proc_desc_table
; link
; link
= link
->next
)
901 if (PROC_LOW_ADDR (&link
->info
) <= pc
902 && PROC_HIGH_ADDR (&link
->info
) > pc
)
905 /* If PC is inside a dynamically generated sigtramp handler,
906 create and push a procedure descriptor for that code: */
907 offset
= alpha_dynamic_sigtramp_offset (pc
);
909 return push_sigtramp_desc (pc
- offset
);
911 /* If heuristic_fence_post is non-zero, determine the procedure
912 start address by examining the instructions.
913 This allows us to find the start address of static functions which
914 have no symbolic information, as startaddr would have been set to
915 the preceding global function start address by the
916 find_pc_partial_function call above. */
917 if (startaddr
== 0 || heuristic_fence_post
!= 0)
918 startaddr
= heuristic_proc_start (pc
);
921 heuristic_proc_desc (startaddr
, pc
, next_frame
);
926 alpha_extra_func_info_t cached_proc_desc
;
929 alpha_frame_chain (struct frame_info
*frame
)
931 alpha_extra_func_info_t proc_desc
;
932 CORE_ADDR saved_pc
= FRAME_SAVED_PC (frame
);
934 if (saved_pc
== 0 || inside_entry_file (saved_pc
))
937 proc_desc
= find_proc_desc (saved_pc
, frame
);
941 cached_proc_desc
= proc_desc
;
943 /* Fetch the frame pointer for a dummy frame from the procedure
945 if (PROC_DESC_IS_DUMMY (proc_desc
))
946 return (CORE_ADDR
) PROC_DUMMY_FRAME (proc_desc
);
948 /* If no frame pointer and frame size is zero, we must be at end
949 of stack (or otherwise hosed). If we don't check frame size,
950 we loop forever if we see a zero size frame. */
951 if (PROC_FRAME_REG (proc_desc
) == SP_REGNUM
952 && PROC_FRAME_OFFSET (proc_desc
) == 0
953 /* The previous frame from a sigtramp frame might be frameless
954 and have frame size zero. */
955 && !frame
->signal_handler_caller
)
956 return alpha_frame_past_sigtramp_frame (frame
, saved_pc
);
958 return read_next_frame_reg (frame
, PROC_FRAME_REG (proc_desc
))
959 + PROC_FRAME_OFFSET (proc_desc
);
963 alpha_print_extra_frame_info (struct frame_info
*fi
)
967 && fi
->extra_info
->proc_desc
968 && fi
->extra_info
->proc_desc
->pdr
.framereg
< NUM_REGS
)
969 printf_filtered (" frame pointer is at %s+%s\n",
970 REGISTER_NAME (fi
->extra_info
->proc_desc
->pdr
.framereg
),
971 paddr_d (fi
->extra_info
->proc_desc
->pdr
.frameoffset
));
975 alpha_init_extra_frame_info (int fromleaf
, struct frame_info
*frame
)
977 /* Use proc_desc calculated in frame_chain */
978 alpha_extra_func_info_t proc_desc
=
979 frame
->next
? cached_proc_desc
: find_proc_desc (frame
->pc
, frame
->next
);
981 frame
->extra_info
= (struct frame_extra_info
*)
982 frame_obstack_alloc (sizeof (struct frame_extra_info
));
984 frame
->saved_regs
= NULL
;
985 frame
->extra_info
->localoff
= 0;
986 frame
->extra_info
->pc_reg
= ALPHA_RA_REGNUM
;
987 frame
->extra_info
->proc_desc
= proc_desc
== &temp_proc_desc
? 0 : proc_desc
;
990 /* Get the locals offset and the saved pc register from the
991 procedure descriptor, they are valid even if we are in the
992 middle of the prologue. */
993 frame
->extra_info
->localoff
= PROC_LOCALOFF (proc_desc
);
994 frame
->extra_info
->pc_reg
= PROC_PC_REG (proc_desc
);
996 /* Fixup frame-pointer - only needed for top frame */
998 /* Fetch the frame pointer for a dummy frame from the procedure
1000 if (PROC_DESC_IS_DUMMY (proc_desc
))
1001 frame
->frame
= (CORE_ADDR
) PROC_DUMMY_FRAME (proc_desc
);
1003 /* This may not be quite right, if proc has a real frame register.
1004 Get the value of the frame relative sp, procedure might have been
1005 interrupted by a signal at it's very start. */
1006 else if (frame
->pc
== PROC_LOW_ADDR (proc_desc
)
1007 && !alpha_proc_desc_is_dyn_sigtramp (proc_desc
))
1008 frame
->frame
= read_next_frame_reg (frame
->next
, SP_REGNUM
);
1010 frame
->frame
= read_next_frame_reg (frame
->next
, PROC_FRAME_REG (proc_desc
))
1011 + PROC_FRAME_OFFSET (proc_desc
);
1013 if (proc_desc
== &temp_proc_desc
)
1017 /* Do not set the saved registers for a sigtramp frame,
1018 alpha_find_saved_registers will do that for us.
1019 We can't use frame->signal_handler_caller, it is not yet set. */
1020 find_pc_partial_function (frame
->pc
, &name
,
1021 (CORE_ADDR
*) NULL
, (CORE_ADDR
*) NULL
);
1022 if (!PC_IN_SIGTRAMP (frame
->pc
, name
))
1024 frame
->saved_regs
= (CORE_ADDR
*)
1025 frame_obstack_alloc (SIZEOF_FRAME_SAVED_REGS
);
1026 memcpy (frame
->saved_regs
, temp_saved_regs
,
1027 SIZEOF_FRAME_SAVED_REGS
);
1028 frame
->saved_regs
[PC_REGNUM
]
1029 = frame
->saved_regs
[ALPHA_RA_REGNUM
];
1036 alpha_frame_locals_address (struct frame_info
*fi
)
1038 return (fi
->frame
- fi
->extra_info
->localoff
);
1042 alpha_frame_args_address (struct frame_info
*fi
)
1044 return (fi
->frame
- (ALPHA_NUM_ARG_REGS
* 8));
1047 /* ALPHA stack frames are almost impenetrable. When execution stops,
1048 we basically have to look at symbol information for the function
1049 that we stopped in, which tells us *which* register (if any) is
1050 the base of the frame pointer, and what offset from that register
1051 the frame itself is at.
1053 This presents a problem when trying to examine a stack in memory
1054 (that isn't executing at the moment), using the "frame" command. We
1055 don't have a PC, nor do we have any registers except SP.
1057 This routine takes two arguments, SP and PC, and tries to make the
1058 cached frames look as if these two arguments defined a frame on the
1059 cache. This allows the rest of info frame to extract the important
1060 arguments without difficulty. */
1063 alpha_setup_arbitrary_frame (int argc
, CORE_ADDR
*argv
)
1066 error ("ALPHA frame specifications require two arguments: sp and pc");
1068 return create_new_frame (argv
[0], argv
[1]);
1071 /* The alpha passes the first six arguments in the registers, the rest on
1072 the stack. The register arguments are eventually transferred to the
1073 argument transfer area immediately below the stack by the called function
1074 anyway. So we `push' at least six arguments on the stack, `reload' the
1075 argument registers and then adjust the stack pointer to point past the
1076 sixth argument. This algorithm simplifies the passing of a large struct
1077 which extends from the registers to the stack.
1078 If the called function is returning a structure, the address of the
1079 structure to be returned is passed as a hidden first argument. */
1082 alpha_push_arguments (int nargs
, struct value
**args
, CORE_ADDR sp
,
1083 int struct_return
, CORE_ADDR struct_addr
)
1086 int accumulate_size
= struct_return
? 8 : 0;
1087 int arg_regs_size
= ALPHA_NUM_ARG_REGS
* 8;
1094 struct alpha_arg
*alpha_args
=
1095 (struct alpha_arg
*) alloca (nargs
* sizeof (struct alpha_arg
));
1096 register struct alpha_arg
*m_arg
;
1097 char raw_buffer
[sizeof (CORE_ADDR
)];
1098 int required_arg_regs
;
1100 for (i
= 0, m_arg
= alpha_args
; i
< nargs
; i
++, m_arg
++)
1102 struct value
*arg
= args
[i
];
1103 struct type
*arg_type
= check_typedef (VALUE_TYPE (arg
));
1104 /* Cast argument to long if necessary as the compiler does it too. */
1105 switch (TYPE_CODE (arg_type
))
1108 case TYPE_CODE_BOOL
:
1109 case TYPE_CODE_CHAR
:
1110 case TYPE_CODE_RANGE
:
1111 case TYPE_CODE_ENUM
:
1112 if (TYPE_LENGTH (arg_type
) < TYPE_LENGTH (builtin_type_long
))
1114 arg_type
= builtin_type_long
;
1115 arg
= value_cast (arg_type
, arg
);
1121 m_arg
->len
= TYPE_LENGTH (arg_type
);
1122 m_arg
->offset
= accumulate_size
;
1123 accumulate_size
= (accumulate_size
+ m_arg
->len
+ 7) & ~7;
1124 m_arg
->contents
= VALUE_CONTENTS (arg
);
1127 /* Determine required argument register loads, loading an argument register
1128 is expensive as it uses three ptrace calls. */
1129 required_arg_regs
= accumulate_size
/ 8;
1130 if (required_arg_regs
> ALPHA_NUM_ARG_REGS
)
1131 required_arg_regs
= ALPHA_NUM_ARG_REGS
;
1133 /* Make room for the arguments on the stack. */
1134 if (accumulate_size
< arg_regs_size
)
1135 accumulate_size
= arg_regs_size
;
1136 sp
-= accumulate_size
;
1138 /* Keep sp aligned to a multiple of 16 as the compiler does it too. */
1141 /* `Push' arguments on the stack. */
1142 for (i
= nargs
; m_arg
--, --i
>= 0;)
1143 write_memory (sp
+ m_arg
->offset
, m_arg
->contents
, m_arg
->len
);
1146 store_address (raw_buffer
, sizeof (CORE_ADDR
), struct_addr
);
1147 write_memory (sp
, raw_buffer
, sizeof (CORE_ADDR
));
1150 /* Load the argument registers. */
1151 for (i
= 0; i
< required_arg_regs
; i
++)
1155 val
= read_memory_integer (sp
+ i
* 8, 8);
1156 write_register (ALPHA_A0_REGNUM
+ i
, val
);
1157 write_register (ALPHA_FPA0_REGNUM
+ i
, val
);
1160 return sp
+ arg_regs_size
;
1164 alpha_push_dummy_frame (void)
1167 struct linked_proc_info
*link
;
1168 alpha_extra_func_info_t proc_desc
;
1169 CORE_ADDR sp
= read_register (SP_REGNUM
);
1170 CORE_ADDR save_address
;
1171 char raw_buffer
[ALPHA_MAX_REGISTER_RAW_SIZE
];
1174 link
= (struct linked_proc_info
*) xmalloc (sizeof (struct linked_proc_info
));
1175 link
->next
= linked_proc_desc_table
;
1176 linked_proc_desc_table
= link
;
1178 proc_desc
= &link
->info
;
1181 * The registers we must save are all those not preserved across
1183 * In addition, we must save the PC and RA.
1185 * Dummy frame layout:
1195 * Parameter build area
1199 /* MASK(i,j) == (1<<i) + (1<<(i+1)) + ... + (1<<j)). Assume i<=j<31. */
1200 #define MASK(i,j) ((((LONGEST)1 << ((j)+1)) - 1) ^ (((LONGEST)1 << (i)) - 1))
1201 #define GEN_REG_SAVE_MASK (MASK(0,8) | MASK(16,29))
1202 #define GEN_REG_SAVE_COUNT 24
1203 #define FLOAT_REG_SAVE_MASK (MASK(0,1) | MASK(10,30))
1204 #define FLOAT_REG_SAVE_COUNT 23
1205 /* The special register is the PC as we have no bit for it in the save masks.
1206 alpha_frame_saved_pc knows where the pc is saved in a dummy frame. */
1207 #define SPECIAL_REG_SAVE_COUNT 1
1209 PROC_REG_MASK (proc_desc
) = GEN_REG_SAVE_MASK
;
1210 PROC_FREG_MASK (proc_desc
) = FLOAT_REG_SAVE_MASK
;
1211 /* PROC_REG_OFFSET is the offset from the dummy frame to the saved RA,
1212 but keep SP aligned to a multiple of 16. */
1213 PROC_REG_OFFSET (proc_desc
) =
1214 -((8 * (SPECIAL_REG_SAVE_COUNT
1215 + GEN_REG_SAVE_COUNT
1216 + FLOAT_REG_SAVE_COUNT
)
1218 PROC_FREG_OFFSET (proc_desc
) =
1219 PROC_REG_OFFSET (proc_desc
) + 8 * GEN_REG_SAVE_COUNT
;
1221 /* Save general registers.
1222 The return address register is the first saved register, all other
1223 registers follow in ascending order.
1224 The PC is saved immediately below the SP. */
1225 save_address
= sp
+ PROC_REG_OFFSET (proc_desc
);
1226 store_address (raw_buffer
, 8, read_register (ALPHA_RA_REGNUM
));
1227 write_memory (save_address
, raw_buffer
, 8);
1229 mask
= PROC_REG_MASK (proc_desc
) & 0xffffffffL
;
1230 for (ireg
= 0; mask
; ireg
++, mask
>>= 1)
1233 if (ireg
== ALPHA_RA_REGNUM
)
1235 store_address (raw_buffer
, 8, read_register (ireg
));
1236 write_memory (save_address
, raw_buffer
, 8);
1240 store_address (raw_buffer
, 8, read_register (PC_REGNUM
));
1241 write_memory (sp
- 8, raw_buffer
, 8);
1243 /* Save floating point registers. */
1244 save_address
= sp
+ PROC_FREG_OFFSET (proc_desc
);
1245 mask
= PROC_FREG_MASK (proc_desc
) & 0xffffffffL
;
1246 for (ireg
= 0; mask
; ireg
++, mask
>>= 1)
1249 store_address (raw_buffer
, 8, read_register (ireg
+ FP0_REGNUM
));
1250 write_memory (save_address
, raw_buffer
, 8);
1254 /* Set and save the frame address for the dummy.
1255 This is tricky. The only registers that are suitable for a frame save
1256 are those that are preserved across procedure calls (s0-s6). But if
1257 a read system call is interrupted and then a dummy call is made
1258 (see testsuite/gdb.t17/interrupt.exp) the dummy call hangs till the read
1259 is satisfied. Then it returns with the s0-s6 registers set to the values
1260 on entry to the read system call and our dummy frame pointer would be
1261 destroyed. So we save the dummy frame in the proc_desc and handle the
1262 retrieval of the frame pointer of a dummy specifically. The frame register
1263 is set to the virtual frame (pseudo) register, it's value will always
1264 be read as zero and will help us to catch any errors in the dummy frame
1266 PROC_DUMMY_FRAME (proc_desc
) = sp
;
1267 PROC_FRAME_REG (proc_desc
) = FP_REGNUM
;
1268 PROC_FRAME_OFFSET (proc_desc
) = 0;
1269 sp
+= PROC_REG_OFFSET (proc_desc
);
1270 write_register (SP_REGNUM
, sp
);
1272 PROC_LOW_ADDR (proc_desc
) = CALL_DUMMY_ADDRESS ();
1273 PROC_HIGH_ADDR (proc_desc
) = PROC_LOW_ADDR (proc_desc
) + 4;
1275 SET_PROC_DESC_IS_DUMMY (proc_desc
);
1276 PROC_PC_REG (proc_desc
) = ALPHA_RA_REGNUM
;
1280 alpha_pop_frame (void)
1282 register int regnum
;
1283 struct frame_info
*frame
= get_current_frame ();
1284 CORE_ADDR new_sp
= frame
->frame
;
1286 alpha_extra_func_info_t proc_desc
= frame
->extra_info
->proc_desc
;
1288 /* we need proc_desc to know how to restore the registers;
1289 if it is NULL, construct (a temporary) one */
1290 if (proc_desc
== NULL
)
1291 proc_desc
= find_proc_desc (frame
->pc
, frame
->next
);
1293 /* Question: should we copy this proc_desc and save it in
1294 frame->proc_desc? If we do, who will free it?
1295 For now, we don't save a copy... */
1297 write_register (PC_REGNUM
, FRAME_SAVED_PC (frame
));
1298 if (frame
->saved_regs
== NULL
)
1299 alpha_find_saved_regs (frame
);
1302 for (regnum
= 32; --regnum
>= 0;)
1303 if (PROC_REG_MASK (proc_desc
) & (1 << regnum
))
1304 write_register (regnum
,
1305 read_memory_integer (frame
->saved_regs
[regnum
],
1307 for (regnum
= 32; --regnum
>= 0;)
1308 if (PROC_FREG_MASK (proc_desc
) & (1 << regnum
))
1309 write_register (regnum
+ FP0_REGNUM
,
1310 read_memory_integer (frame
->saved_regs
[regnum
+ FP0_REGNUM
], 8));
1312 write_register (SP_REGNUM
, new_sp
);
1313 flush_cached_frames ();
1315 if (proc_desc
&& (PROC_DESC_IS_DUMMY (proc_desc
)
1316 || alpha_proc_desc_is_dyn_sigtramp (proc_desc
)))
1318 struct linked_proc_info
*pi_ptr
, *prev_ptr
;
1320 for (pi_ptr
= linked_proc_desc_table
, prev_ptr
= NULL
;
1322 prev_ptr
= pi_ptr
, pi_ptr
= pi_ptr
->next
)
1324 if (&pi_ptr
->info
== proc_desc
)
1329 error ("Can't locate dummy extra frame info\n");
1331 if (prev_ptr
!= NULL
)
1332 prev_ptr
->next
= pi_ptr
->next
;
1334 linked_proc_desc_table
= pi_ptr
->next
;
1340 /* To skip prologues, I use this predicate. Returns either PC itself
1341 if the code at PC does not look like a function prologue; otherwise
1342 returns an address that (if we're lucky) follows the prologue. If
1343 LENIENT, then we must skip everything which is involved in setting
1344 up the frame (it's OK to skip more, just so long as we don't skip
1345 anything which might clobber the registers which are being saved.
1346 Currently we must not skip more on the alpha, but we might need the
1347 lenient stuff some day. */
1350 alpha_skip_prologue_internal (CORE_ADDR pc
, int lenient
)
1354 CORE_ADDR post_prologue_pc
;
1357 #ifdef GDB_TARGET_HAS_SHARED_LIBS
1358 /* Silently return the unaltered pc upon memory errors.
1359 This could happen on OSF/1 if decode_line_1 tries to skip the
1360 prologue for quickstarted shared library functions when the
1361 shared library is not yet mapped in.
1362 Reading target memory is slow over serial lines, so we perform
1363 this check only if the target has shared libraries. */
1364 if (target_read_memory (pc
, buf
, 4))
1368 /* See if we can determine the end of the prologue via the symbol table.
1369 If so, then return either PC, or the PC after the prologue, whichever
1372 post_prologue_pc
= after_prologue (pc
, NULL
);
1374 if (post_prologue_pc
!= 0)
1375 return max (pc
, post_prologue_pc
);
1377 /* Can't determine prologue from the symbol table, need to examine
1380 /* Skip the typical prologue instructions. These are the stack adjustment
1381 instruction and the instructions that save registers on the stack
1382 or in the gcc frame. */
1383 for (offset
= 0; offset
< 100; offset
+= 4)
1387 status
= read_memory_nobpt (pc
+ offset
, buf
, 4);
1389 memory_error (status
, pc
+ offset
);
1390 inst
= extract_unsigned_integer (buf
, 4);
1392 /* The alpha has no delay slots. But let's keep the lenient stuff,
1393 we might need it for something else in the future. */
1397 if ((inst
& 0xffff0000) == 0x27bb0000) /* ldah $gp,n($t12) */
1399 if ((inst
& 0xffff0000) == 0x23bd0000) /* lda $gp,n($gp) */
1401 if ((inst
& 0xffff0000) == 0x23de0000) /* lda $sp,n($sp) */
1403 if ((inst
& 0xffe01fff) == 0x43c0153e) /* subq $sp,n,$sp */
1406 if ((inst
& 0xfc1f0000) == 0xb41e0000
1407 && (inst
& 0xffff0000) != 0xb7fe0000)
1408 continue; /* stq reg,n($sp) */
1410 if ((inst
& 0xfc1f0000) == 0x9c1e0000
1411 && (inst
& 0xffff0000) != 0x9ffe0000)
1412 continue; /* stt reg,n($sp) */
1414 if (inst
== 0x47de040f) /* bis sp,sp,fp */
1423 alpha_skip_prologue (CORE_ADDR addr
)
1425 return (alpha_skip_prologue_internal (addr
, 0));
1429 /* Is address PC in the prologue (loosely defined) for function at
1433 alpha_in_lenient_prologue (CORE_ADDR startaddr
, CORE_ADDR pc
)
1435 CORE_ADDR end_prologue
= alpha_skip_prologue_internal (startaddr
, 1);
1436 return pc
>= startaddr
&& pc
< end_prologue
;
1440 /* The alpha needs a conversion between register and memory format if
1441 the register is a floating point register and
1442 memory format is float, as the register format must be double
1444 memory format is an integer with 4 bytes or less, as the representation
1445 of integers in floating point registers is different. */
1447 alpha_register_convert_to_virtual (int regnum
, struct type
*valtype
,
1448 char *raw_buffer
, char *virtual_buffer
)
1450 if (TYPE_LENGTH (valtype
) >= REGISTER_RAW_SIZE (regnum
))
1452 memcpy (virtual_buffer
, raw_buffer
, REGISTER_VIRTUAL_SIZE (regnum
));
1456 if (TYPE_CODE (valtype
) == TYPE_CODE_FLT
)
1458 double d
= extract_floating (raw_buffer
, REGISTER_RAW_SIZE (regnum
));
1459 store_floating (virtual_buffer
, TYPE_LENGTH (valtype
), d
);
1461 else if (TYPE_CODE (valtype
) == TYPE_CODE_INT
&& TYPE_LENGTH (valtype
) <= 4)
1464 l
= extract_unsigned_integer (raw_buffer
, REGISTER_RAW_SIZE (regnum
));
1465 l
= ((l
>> 32) & 0xc0000000) | ((l
>> 29) & 0x3fffffff);
1466 store_unsigned_integer (virtual_buffer
, TYPE_LENGTH (valtype
), l
);
1469 error ("Cannot retrieve value from floating point register");
1473 alpha_register_convert_to_raw (struct type
*valtype
, int regnum
,
1474 char *virtual_buffer
, char *raw_buffer
)
1476 if (TYPE_LENGTH (valtype
) >= REGISTER_RAW_SIZE (regnum
))
1478 memcpy (raw_buffer
, virtual_buffer
, REGISTER_RAW_SIZE (regnum
));
1482 if (TYPE_CODE (valtype
) == TYPE_CODE_FLT
)
1484 double d
= extract_floating (virtual_buffer
, TYPE_LENGTH (valtype
));
1485 store_floating (raw_buffer
, REGISTER_RAW_SIZE (regnum
), d
);
1487 else if (TYPE_CODE (valtype
) == TYPE_CODE_INT
&& TYPE_LENGTH (valtype
) <= 4)
1490 if (TYPE_UNSIGNED (valtype
))
1491 l
= extract_unsigned_integer (virtual_buffer
, TYPE_LENGTH (valtype
));
1493 l
= extract_signed_integer (virtual_buffer
, TYPE_LENGTH (valtype
));
1494 l
= ((l
& 0xc0000000) << 32) | ((l
& 0x3fffffff) << 29);
1495 store_unsigned_integer (raw_buffer
, REGISTER_RAW_SIZE (regnum
), l
);
1498 error ("Cannot store value in floating point register");
1501 static const unsigned char *
1502 alpha_breakpoint_from_pc (CORE_ADDR
*pcptr
, int *lenptr
)
1504 static const unsigned char alpha_breakpoint
[] =
1505 { 0x80, 0, 0, 0 }; /* call_pal bpt */
1507 *lenptr
= sizeof(alpha_breakpoint
);
1508 return (alpha_breakpoint
);
1511 /* Given a return value in `regbuf' with a type `valtype',
1512 extract and copy its value into `valbuf'. */
1515 alpha_extract_return_value (struct type
*valtype
,
1516 char regbuf
[REGISTER_BYTES
], char *valbuf
)
1518 if (TYPE_CODE (valtype
) == TYPE_CODE_FLT
)
1519 alpha_register_convert_to_virtual (FP0_REGNUM
, valtype
,
1520 regbuf
+ REGISTER_BYTE (FP0_REGNUM
),
1523 memcpy (valbuf
, regbuf
+ REGISTER_BYTE (ALPHA_V0_REGNUM
),
1524 TYPE_LENGTH (valtype
));
1527 /* Given a return value in `regbuf' with a type `valtype',
1528 write its value into the appropriate register. */
1531 alpha_store_return_value (struct type
*valtype
, char *valbuf
)
1533 char raw_buffer
[ALPHA_MAX_REGISTER_RAW_SIZE
];
1534 int regnum
= ALPHA_V0_REGNUM
;
1535 int length
= TYPE_LENGTH (valtype
);
1537 if (TYPE_CODE (valtype
) == TYPE_CODE_FLT
)
1539 regnum
= FP0_REGNUM
;
1540 length
= REGISTER_RAW_SIZE (regnum
);
1541 alpha_register_convert_to_raw (valtype
, regnum
, valbuf
, raw_buffer
);
1544 memcpy (raw_buffer
, valbuf
, length
);
1546 write_register_bytes (REGISTER_BYTE (regnum
), raw_buffer
, length
);
1549 /* Just like reinit_frame_cache, but with the right arguments to be
1550 callable as an sfunc. */
1553 reinit_frame_cache_sfunc (char *args
, int from_tty
, struct cmd_list_element
*c
)
1555 reinit_frame_cache ();
1558 /* This is the definition of CALL_DUMMY_ADDRESS. It's a heuristic that is used
1559 to find a convenient place in the text segment to stick a breakpoint to
1560 detect the completion of a target function call (ala call_function_by_hand).
1564 alpha_call_dummy_address (void)
1567 struct minimal_symbol
*sym
;
1569 entry
= entry_point_address ();
1574 sym
= lookup_minimal_symbol ("_Prelude", NULL
, symfile_objfile
);
1576 if (!sym
|| MSYMBOL_TYPE (sym
) != mst_text
)
1579 return SYMBOL_VALUE_ADDRESS (sym
) + 4;
1583 alpha_fix_call_dummy (char *dummy
, CORE_ADDR pc
, CORE_ADDR fun
, int nargs
,
1584 struct value
**args
, struct type
*type
, int gcc_p
)
1586 CORE_ADDR bp_address
= CALL_DUMMY_ADDRESS ();
1588 if (bp_address
== 0)
1589 error ("no place to put call");
1590 write_register (ALPHA_RA_REGNUM
, bp_address
);
1591 write_register (ALPHA_T12_REGNUM
, fun
);
1594 /* On the Alpha, the call dummy code is nevery copied to user space
1595 (see alpha_fix_call_dummy() above). The contents of this do not
1597 LONGEST alpha_call_dummy_words
[] = { 0 };
1600 alpha_use_struct_convention (int gcc_p
, struct type
*type
)
1602 /* Structures are returned by ref in extra arg0. */
1607 alpha_store_struct_return (CORE_ADDR addr
, CORE_ADDR sp
)
1609 /* Store the address of the place in which to copy the structure the
1610 subroutine will return. Handled by alpha_push_arguments. */
1614 alpha_extract_struct_value_address (char *regbuf
)
1616 return (extract_address (regbuf
+ REGISTER_BYTE (ALPHA_V0_REGNUM
),
1617 REGISTER_RAW_SIZE (ALPHA_V0_REGNUM
)));
1620 /* alpha_software_single_step() is called just before we want to resume
1621 the inferior, if we want to single-step it but there is no hardware
1622 or kernel single-step support (NetBSD on Alpha, for example). We find
1623 the target of the coming instruction and breakpoint it.
1625 single_step is also called just after the inferior stops. If we had
1626 set up a simulated single-step, we undo our damage. */
1629 alpha_next_pc (CORE_ADDR pc
)
1636 insn
= read_memory_unsigned_integer (pc
, sizeof (insn
));
1638 /* Opcode is top 6 bits. */
1639 op
= (insn
>> 26) & 0x3f;
1643 /* Jump format: target PC is:
1645 return (read_register ((insn
>> 16) & 0x1f) & ~3);
1648 if ((op
& 0x30) == 0x30)
1650 /* Branch format: target PC is:
1651 (new PC) + (4 * sext(displacement)) */
1652 if (op
== 0x30 || /* BR */
1653 op
== 0x34) /* BSR */
1656 offset
= (insn
& 0x001fffff);
1657 if (offset
& 0x00100000)
1658 offset
|= 0xffe00000;
1660 return (pc
+ 4 + offset
);
1663 /* Need to determine if branch is taken; read RA. */
1664 rav
= (LONGEST
) read_register ((insn
>> 21) & 0x1f);
1667 case 0x38: /* BLBC */
1671 case 0x3c: /* BLBS */
1675 case 0x39: /* BEQ */
1679 case 0x3d: /* BNE */
1683 case 0x3a: /* BLT */
1687 case 0x3b: /* BLE */
1691 case 0x3f: /* BGT */
1695 case 0x3e: /* BGE */
1702 /* Not a branch or branch not taken; target PC is:
1708 alpha_software_single_step (enum target_signal sig
, int insert_breakpoints_p
)
1710 static CORE_ADDR next_pc
;
1711 typedef char binsn_quantum
[BREAKPOINT_MAX
];
1712 static binsn_quantum break_mem
;
1715 if (insert_breakpoints_p
)
1718 next_pc
= alpha_next_pc (pc
);
1720 target_insert_breakpoint (next_pc
, break_mem
);
1724 target_remove_breakpoint (next_pc
, break_mem
);
1730 /* This table matches the indices assigned to enum alpha_abi. Keep
1732 static const char * const alpha_abi_names
[] =
1743 process_note_abi_tag_sections (bfd
*abfd
, asection
*sect
, void *obj
)
1745 enum alpha_abi
*os_ident_ptr
= obj
;
1747 unsigned int sectsize
;
1749 name
= bfd_get_section_name (abfd
, sect
);
1750 sectsize
= bfd_section_size (abfd
, sect
);
1752 if (strcmp (name
, ".note.ABI-tag") == 0 && sectsize
> 0)
1754 unsigned int name_length
, data_length
, note_type
;
1757 /* If the section is larger than this, it's probably not what we are
1762 note
= alloca (sectsize
);
1764 bfd_get_section_contents (abfd
, sect
, note
,
1765 (file_ptr
) 0, (bfd_size_type
) sectsize
);
1767 name_length
= bfd_h_get_32 (abfd
, note
);
1768 data_length
= bfd_h_get_32 (abfd
, note
+ 4);
1769 note_type
= bfd_h_get_32 (abfd
, note
+ 8);
1771 if (name_length
== 4 && data_length
== 16 && note_type
== 1
1772 && strcmp (note
+ 12, "GNU") == 0)
1774 int os_number
= bfd_h_get_32 (abfd
, note
+ 16);
1776 /* The case numbers are from abi-tags in glibc. */
1780 *os_ident_ptr
= ALPHA_ABI_LINUX
;
1785 (__FILE__
, __LINE__
,
1786 "process_note_abi_sections: Hurd objects not supported");
1791 (__FILE__
, __LINE__
,
1792 "process_note_abi_sections: Solaris objects not supported");
1797 (__FILE__
, __LINE__
,
1798 "process_note_abi_sections: unknown OS number %d",
1804 /* NetBSD uses a similar trick. */
1805 else if (strcmp (name
, ".note.netbsd.ident") == 0 && sectsize
> 0)
1807 unsigned int name_length
, desc_length
, note_type
;
1810 /* If the section is larger than this, it's probably not what we are
1815 note
= alloca (sectsize
);
1817 bfd_get_section_contents (abfd
, sect
, note
,
1818 (file_ptr
) 0, (bfd_size_type
) sectsize
);
1820 name_length
= bfd_h_get_32 (abfd
, note
);
1821 desc_length
= bfd_h_get_32 (abfd
, note
+ 4);
1822 note_type
= bfd_h_get_32 (abfd
, note
+ 8);
1824 if (name_length
== 7 && desc_length
== 4 && note_type
== 1
1825 && strcmp (note
+ 12, "NetBSD") == 0)
1826 /* XXX Should we check the version here?
1827 Probably not necessary yet. */
1828 *os_ident_ptr
= ALPHA_ABI_NETBSD
;
1833 get_elfosabi (bfd
*abfd
)
1836 enum alpha_abi alpha_abi
= ALPHA_ABI_UNKNOWN
;
1838 elfosabi
= elf_elfheader (abfd
)->e_ident
[EI_OSABI
];
1840 /* When elfosabi is 0 (ELFOSABI_NONE), this is supposed to indicate
1841 what we're on a SYSV system. However, GNU/Linux uses a note section
1842 to record OS/ABI info, but leaves e_ident[EI_OSABI] zero. So we
1843 have to check the note sections too. */
1846 bfd_map_over_sections (abfd
,
1847 process_note_abi_tag_sections
,
1851 if (alpha_abi
!= ALPHA_ABI_UNKNOWN
)
1857 /* Leave it as unknown. */
1860 case ELFOSABI_NETBSD
:
1861 return ALPHA_ABI_NETBSD
;
1863 case ELFOSABI_FREEBSD
:
1864 return ALPHA_ABI_FREEBSD
;
1866 case ELFOSABI_LINUX
:
1867 return ALPHA_ABI_LINUX
;
1870 return ALPHA_ABI_UNKNOWN
;
1873 struct alpha_abi_handler
1875 struct alpha_abi_handler
*next
;
1877 void (*init_abi
)(struct gdbarch_info
, struct gdbarch
*);
1880 struct alpha_abi_handler
*alpha_abi_handler_list
= NULL
;
1883 alpha_gdbarch_register_os_abi (enum alpha_abi abi
,
1884 void (*init_abi
)(struct gdbarch_info
,
1887 struct alpha_abi_handler
**handler_p
;
1889 for (handler_p
= &alpha_abi_handler_list
; *handler_p
!= NULL
;
1890 handler_p
= &(*handler_p
)->next
)
1892 if ((*handler_p
)->abi
== abi
)
1895 (__FILE__
, __LINE__
,
1896 "alpha_gdbarch_register_os_abi: A handler for this ABI variant "
1897 "(%d) has already been registered", (int) abi
);
1898 /* If user wants to continue, override previous definition. */
1899 (*handler_p
)->init_abi
= init_abi
;
1905 = (struct alpha_abi_handler
*) xmalloc (sizeof (struct alpha_abi_handler
));
1906 (*handler_p
)->next
= NULL
;
1907 (*handler_p
)->abi
= abi
;
1908 (*handler_p
)->init_abi
= init_abi
;
1911 /* Initialize the current architecture based on INFO. If possible, re-use an
1912 architecture from ARCHES, which is a list of architectures already created
1913 during this debugging session.
1915 Called e.g. at program startup, when reading a core file, and when reading
1918 static struct gdbarch
*
1919 alpha_gdbarch_init (struct gdbarch_info info
, struct gdbarch_list
*arches
)
1921 struct gdbarch_tdep
*tdep
;
1922 struct gdbarch
*gdbarch
;
1923 enum alpha_abi alpha_abi
= ALPHA_ABI_UNKNOWN
;
1924 struct alpha_abi_handler
*abi_handler
;
1926 /* Try to determine the ABI of the object we are loading. */
1928 if (info
.abfd
!= NULL
)
1930 switch (bfd_get_flavour (info
.abfd
))
1932 case bfd_target_elf_flavour
:
1933 alpha_abi
= get_elfosabi (info
.abfd
);
1936 case bfd_target_ecoff_flavour
:
1937 /* Assume it's OSF/1. */
1938 alpha_abi
= ALPHA_ABI_OSF1
;
1942 /* Not sure what to do here, leave the ABI as unknown. */
1947 /* Find a candidate among extant architectures. */
1948 for (arches
= gdbarch_list_lookup_by_info (arches
, &info
);
1950 arches
= gdbarch_list_lookup_by_info (arches
->next
, &info
))
1952 /* Make sure the ABI selection matches. */
1953 tdep
= gdbarch_tdep (arches
->gdbarch
);
1954 if (tdep
&& tdep
->alpha_abi
== alpha_abi
)
1955 return arches
->gdbarch
;
1958 tdep
= xmalloc (sizeof (struct gdbarch_tdep
));
1959 gdbarch
= gdbarch_alloc (&info
, tdep
);
1961 tdep
->alpha_abi
= alpha_abi
;
1962 if (alpha_abi
< ALPHA_ABI_INVALID
)
1963 tdep
->abi_name
= alpha_abi_names
[alpha_abi
];
1966 internal_error (__FILE__
, __LINE__
, "Invalid setting of alpha_abi %d",
1968 tdep
->abi_name
= "<invalid>";
1971 /* Lowest text address. This is used by heuristic_proc_start() to
1972 decide when to stop looking. */
1973 tdep
->vm_min_address
= (CORE_ADDR
) 0x120000000;
1975 tdep
->dynamic_sigtramp_offset
= NULL
;
1976 tdep
->skip_sigtramp_frame
= NULL
;
1979 set_gdbarch_short_bit (gdbarch
, 16);
1980 set_gdbarch_int_bit (gdbarch
, 32);
1981 set_gdbarch_long_bit (gdbarch
, 64);
1982 set_gdbarch_long_long_bit (gdbarch
, 64);
1983 set_gdbarch_float_bit (gdbarch
, 32);
1984 set_gdbarch_double_bit (gdbarch
, 64);
1985 set_gdbarch_long_double_bit (gdbarch
, 64);
1986 set_gdbarch_ptr_bit (gdbarch
, 64);
1989 set_gdbarch_num_regs (gdbarch
, ALPHA_NUM_REGS
);
1990 set_gdbarch_sp_regnum (gdbarch
, ALPHA_SP_REGNUM
);
1991 set_gdbarch_fp_regnum (gdbarch
, ALPHA_FP_REGNUM
);
1992 set_gdbarch_pc_regnum (gdbarch
, ALPHA_PC_REGNUM
);
1993 set_gdbarch_fp0_regnum (gdbarch
, ALPHA_FP0_REGNUM
);
1995 set_gdbarch_register_name (gdbarch
, alpha_register_name
);
1996 set_gdbarch_register_size (gdbarch
, ALPHA_REGISTER_SIZE
);
1997 set_gdbarch_register_bytes (gdbarch
, ALPHA_REGISTER_BYTES
);
1998 set_gdbarch_register_byte (gdbarch
, alpha_register_byte
);
1999 set_gdbarch_register_raw_size (gdbarch
, alpha_register_raw_size
);
2000 set_gdbarch_max_register_raw_size (gdbarch
, ALPHA_MAX_REGISTER_RAW_SIZE
);
2001 set_gdbarch_register_virtual_size (gdbarch
, alpha_register_virtual_size
);
2002 set_gdbarch_max_register_virtual_size (gdbarch
,
2003 ALPHA_MAX_REGISTER_VIRTUAL_SIZE
);
2004 set_gdbarch_register_virtual_type (gdbarch
, alpha_register_virtual_type
);
2006 set_gdbarch_cannot_fetch_register (gdbarch
, alpha_cannot_fetch_register
);
2007 set_gdbarch_cannot_store_register (gdbarch
, alpha_cannot_store_register
);
2009 set_gdbarch_register_convertible (gdbarch
, alpha_register_convertible
);
2010 set_gdbarch_register_convert_to_virtual (gdbarch
,
2011 alpha_register_convert_to_virtual
);
2012 set_gdbarch_register_convert_to_raw (gdbarch
, alpha_register_convert_to_raw
);
2014 set_gdbarch_skip_prologue (gdbarch
, alpha_skip_prologue
);
2016 set_gdbarch_frame_num_args (gdbarch
, frame_num_args_unknown
);
2017 set_gdbarch_frameless_function_invocation (gdbarch
,
2018 generic_frameless_function_invocation_not
);
2020 set_gdbarch_saved_pc_after_call (gdbarch
, alpha_saved_pc_after_call
);
2022 set_gdbarch_frame_chain (gdbarch
, alpha_frame_chain
);
2023 set_gdbarch_frame_chain_valid (gdbarch
, func_frame_chain_valid
);
2024 set_gdbarch_frame_saved_pc (gdbarch
, alpha_frame_saved_pc
);
2026 set_gdbarch_frame_init_saved_regs (gdbarch
, alpha_frame_init_saved_regs
);
2027 set_gdbarch_get_saved_register (gdbarch
, alpha_get_saved_register
);
2029 set_gdbarch_use_struct_convention (gdbarch
, alpha_use_struct_convention
);
2030 set_gdbarch_extract_return_value (gdbarch
, alpha_extract_return_value
);
2032 set_gdbarch_store_struct_return (gdbarch
, alpha_store_struct_return
);
2033 set_gdbarch_store_return_value (gdbarch
, alpha_store_return_value
);
2034 set_gdbarch_extract_struct_value_address (gdbarch
,
2035 alpha_extract_struct_value_address
);
2037 /* Settings for calling functions in the inferior. */
2038 set_gdbarch_use_generic_dummy_frames (gdbarch
, 0);
2039 set_gdbarch_call_dummy_length (gdbarch
, 0);
2040 set_gdbarch_push_arguments (gdbarch
, alpha_push_arguments
);
2041 set_gdbarch_pop_frame (gdbarch
, alpha_pop_frame
);
2043 /* On the Alpha, the call dummy code is never copied to user space,
2044 stopping the user call is achieved via a bp_call_dummy breakpoint.
2045 But we need a fake CALL_DUMMY definition to enable the proper
2046 call_function_by_hand and to avoid zero length array warnings. */
2047 set_gdbarch_call_dummy_p (gdbarch
, 1);
2048 set_gdbarch_call_dummy_words (gdbarch
, alpha_call_dummy_words
);
2049 set_gdbarch_sizeof_call_dummy_words (gdbarch
, 0);
2050 set_gdbarch_frame_args_address (gdbarch
, alpha_frame_args_address
);
2051 set_gdbarch_frame_locals_address (gdbarch
, alpha_frame_locals_address
);
2052 set_gdbarch_init_extra_frame_info (gdbarch
, alpha_init_extra_frame_info
);
2054 /* Alpha OSF/1 inhibits execution of code on the stack. But there is
2055 no need for a dummy on the Alpha. PUSH_ARGUMENTS takes care of all
2056 argument handling and bp_call_dummy takes care of stopping the dummy. */
2057 set_gdbarch_call_dummy_location (gdbarch
, AT_ENTRY_POINT
);
2058 set_gdbarch_call_dummy_address (gdbarch
, alpha_call_dummy_address
);
2059 set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch
, 1);
2060 set_gdbarch_call_dummy_breakpoint_offset (gdbarch
, 0);
2061 set_gdbarch_call_dummy_start_offset (gdbarch
, 0);
2062 set_gdbarch_pc_in_call_dummy (gdbarch
, pc_in_call_dummy_at_entry_point
);
2063 set_gdbarch_call_dummy_stack_adjust_p (gdbarch
, 0);
2064 set_gdbarch_push_dummy_frame (gdbarch
, alpha_push_dummy_frame
);
2065 set_gdbarch_fix_call_dummy (gdbarch
, alpha_fix_call_dummy
);
2066 set_gdbarch_init_frame_pc (gdbarch
, init_frame_pc_noop
);
2067 set_gdbarch_init_frame_pc_first (gdbarch
, alpha_init_frame_pc_first
);
2069 set_gdbarch_inner_than (gdbarch
, core_addr_lessthan
);
2070 set_gdbarch_skip_trampoline_code (gdbarch
, find_solib_trampoline_target
);
2072 /* Floats are always passed as doubles. */
2073 set_gdbarch_coerce_float_to_double (gdbarch
,
2074 standard_coerce_float_to_double
);
2076 set_gdbarch_breakpoint_from_pc (gdbarch
, alpha_breakpoint_from_pc
);
2077 set_gdbarch_decr_pc_after_break (gdbarch
, 4);
2079 set_gdbarch_function_start_offset (gdbarch
, 0);
2080 set_gdbarch_frame_args_skip (gdbarch
, 0);
2082 /* Hook in ABI-specific overrides, if they have been registered. */
2083 if (alpha_abi
== ALPHA_ABI_UNKNOWN
)
2085 /* Don't complain about not knowing the ABI variant if we don't
2086 have an inferior. */
2089 (gdb_stderr
, "GDB doesn't recognize the ABI of the inferior. "
2090 "Attempting to continue with the default Alpha settings");
2094 for (abi_handler
= alpha_abi_handler_list
; abi_handler
!= NULL
;
2095 abi_handler
= abi_handler
->next
)
2096 if (abi_handler
->abi
== alpha_abi
)
2100 abi_handler
->init_abi (info
, gdbarch
);
2103 /* We assume that if GDB_MULTI_ARCH is less than
2104 GDB_MULTI_ARCH_TM that an ABI variant can be supported by
2105 overriding definitions in this file. */
2106 if (GDB_MULTI_ARCH
> GDB_MULTI_ARCH_PARTIAL
)
2109 "A handler for the ABI variant \"%s\" is not built into this "
2110 "configuration of GDB. "
2111 "Attempting to continue with the default Alpha settings",
2112 alpha_abi_names
[alpha_abi
]);
2120 alpha_dump_tdep (struct gdbarch
*current_gdbarch
, struct ui_file
*file
)
2122 struct gdbarch_tdep
*tdep
= gdbarch_tdep (current_gdbarch
);
2127 if (tdep
->abi_name
!= NULL
)
2128 fprintf_unfiltered (file
, "alpha_dump_tdep: ABI = %s\n", tdep
->abi_name
);
2130 internal_error (__FILE__
, __LINE__
,
2131 "alpha_dump_tdep: illegal setting of tdep->alpha_abi (%d)",
2132 (int) tdep
->alpha_abi
);
2134 fprintf_unfiltered (file
,
2135 "alpha_dump_tdep: vm_min_address = 0x%lx\n",
2136 (long) tdep
->vm_min_address
);
2140 _initialize_alpha_tdep (void)
2142 struct cmd_list_element
*c
;
2144 gdbarch_register (bfd_arch_alpha
, alpha_gdbarch_init
, alpha_dump_tdep
);
2146 tm_print_insn
= print_insn_alpha
;
2148 /* Let the user set the fence post for heuristic_proc_start. */
2150 /* We really would like to have both "0" and "unlimited" work, but
2151 command.c doesn't deal with that. So make it a var_zinteger
2152 because the user can always use "999999" or some such for unlimited. */
2153 c
= add_set_cmd ("heuristic-fence-post", class_support
, var_zinteger
,
2154 (char *) &heuristic_fence_post
,
2156 Set the distance searched for the start of a function.\n\
2157 If you are debugging a stripped executable, GDB needs to search through the\n\
2158 program for the start of a function. This command sets the distance of the\n\
2159 search. The only need to set it is when debugging a stripped executable.",
2161 /* We need to throw away the frame cache when we set this, since it
2162 might change our ability to get backtraces. */
2163 set_cmd_sfunc (c
, reinit_frame_cache_sfunc
);
2164 add_show_from_set (c
, &showlist
);