* parse.c (write_dollar_variable): New function.
[deliverable/binutils-gdb.git] / gdb / alpha-tdep.c
CommitLineData
cef4c2e7 1/* Target-dependent code for the ALPHA architecture, for GDB, the GNU Debugger.
a1a0d974 2 Copyright 1993, 1994, 1995 Free Software Foundation, Inc.
cef4c2e7
PS
3
4This file is part of GDB.
5
6This program is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program; if not, write to the Free Software
6c9638b4 18Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
cef4c2e7
PS
19
20#include "defs.h"
21#include "frame.h"
22#include "inferior.h"
23#include "symtab.h"
24#include "value.h"
25#include "gdbcmd.h"
26#include "gdbcore.h"
27#include "dis-asm.h"
72bba93b
SG
28#include "symfile.h"
29#include "objfiles.h"
2b576293 30#include "gdb_string.h"
cef4c2e7
PS
31
32/* FIXME: Some of this code should perhaps be merged with mips-tdep.c. */
33
72bba93b
SG
34/* FIXME: Put this declaration in frame.h. */
35extern struct obstack frame_cache_obstack;
cef4c2e7
PS
36\f
37
38/* Forward declarations. */
39
669caa9c 40static CORE_ADDR read_next_frame_reg PARAMS ((struct frame_info *, int));
cef4c2e7 41
669caa9c 42static CORE_ADDR heuristic_proc_start PARAMS ((CORE_ADDR));
cef4c2e7 43
669caa9c
SS
44static alpha_extra_func_info_t heuristic_proc_desc PARAMS ((CORE_ADDR,
45 CORE_ADDR,
46 struct frame_info *));
cef4c2e7 47
e3be225e
SS
48static alpha_extra_func_info_t find_proc_desc PARAMS ((CORE_ADDR,
49 struct frame_info *));
cef4c2e7 50
e3be225e 51#if 0
669caa9c 52static int alpha_in_lenient_prologue PARAMS ((CORE_ADDR, CORE_ADDR));
e3be225e 53#endif
cef4c2e7 54
e3be225e
SS
55static void reinit_frame_cache_sfunc PARAMS ((char *, int,
56 struct cmd_list_element *));
cef4c2e7 57
72bba93b
SG
58static CORE_ADDR after_prologue PARAMS ((CORE_ADDR pc,
59 alpha_extra_func_info_t proc_desc));
60
61static int in_prologue PARAMS ((CORE_ADDR pc,
62 alpha_extra_func_info_t proc_desc));
63
cef4c2e7
PS
64/* Heuristic_proc_start may hunt through the text section for a long
65 time across a 2400 baud serial line. Allows the user to limit this
66 search. */
67static unsigned int heuristic_fence_post = 0;
68
69/* Layout of a stack frame on the alpha:
70
71 | |
72 pdr members: | 7th ... nth arg, |
73 | `pushed' by caller. |
74 | |
75----------------|-------------------------------|<-- old_sp == vfp
76 ^ ^ ^ ^ | |
77 | | | | | |
78 | |localoff | Copies of 1st .. 6th |
79 | | | | | argument if necessary. |
80 | | | v | |
3e6b0674
PS
81 | | | --- |-------------------------------|<-- FRAME_LOCALS_ADDRESS
82 | | | | |
cef4c2e7
PS
83 | | | | Locals and temporaries. |
84 | | | | |
85 | | | |-------------------------------|
86 | | | | |
87 |-fregoffset | Saved float registers. |
88 | | | | F9 |
89 | | | | . |
90 | | | | . |
91 | | | | F2 |
92 | | v | |
93 | | -------|-------------------------------|
94 | | | |
95 | | | Saved registers. |
96 | | | S6 |
97 |-regoffset | . |
98 | | | . |
99 | | | S0 |
100 | | | pdr.pcreg |
101 | v | |
102 | ----------|-------------------------------|
103 | | |
104 frameoffset | Argument build area, gets |
105 | | 7th ... nth arg for any |
106 | | called procedure. |
107 v | |
108 -------------|-------------------------------|<-- sp
109 | |
110*/
111
112#define PROC_LOW_ADDR(proc) ((proc)->pdr.adr) /* least address */
113#define PROC_HIGH_ADDR(proc) ((proc)->pdr.iline) /* upper address bound */
114#define PROC_DUMMY_FRAME(proc) ((proc)->pdr.iopt) /* frame for CALL_DUMMY */
115#define PROC_FRAME_OFFSET(proc) ((proc)->pdr.frameoffset)
116#define PROC_FRAME_REG(proc) ((proc)->pdr.framereg)
117#define PROC_REG_MASK(proc) ((proc)->pdr.regmask)
118#define PROC_FREG_MASK(proc) ((proc)->pdr.fregmask)
119#define PROC_REG_OFFSET(proc) ((proc)->pdr.regoffset)
120#define PROC_FREG_OFFSET(proc) ((proc)->pdr.fregoffset)
121#define PROC_PC_REG(proc) ((proc)->pdr.pcreg)
122#define PROC_LOCALOFF(proc) ((proc)->pdr.localoff)
123#define PROC_SYMBOL(proc) (*(struct symbol**)&(proc)->pdr.isym)
124#define _PROC_MAGIC_ 0x0F0F0F0F
125#define PROC_DESC_IS_DUMMY(proc) ((proc)->pdr.isym == _PROC_MAGIC_)
126#define SET_PROC_DESC_IS_DUMMY(proc) ((proc)->pdr.isym = _PROC_MAGIC_)
127
128struct linked_proc_info
129{
130 struct alpha_extra_func_info info;
131 struct linked_proc_info *next;
132} *linked_proc_desc_table = NULL;
133
134\f
72bba93b
SG
135/* Guaranteed to set fci->saved_regs to some values (it never leaves it
136 NULL). */
137
138void
669caa9c
SS
139alpha_find_saved_regs (frame)
140 struct frame_info *frame;
72bba93b
SG
141{
142 int ireg;
143 CORE_ADDR reg_position;
144 unsigned long mask;
145 alpha_extra_func_info_t proc_desc;
146 int returnreg;
147
669caa9c 148 frame->saved_regs = (struct frame_saved_regs *)
72bba93b 149 obstack_alloc (&frame_cache_obstack, sizeof(struct frame_saved_regs));
669caa9c 150 memset (frame->saved_regs, 0, sizeof (struct frame_saved_regs));
72bba93b 151
e4dbd248
PS
152 /* If it is the frame for __sigtramp, the saved registers are located
153 in a sigcontext structure somewhere on the stack. __sigtramp
154 passes a pointer to the sigcontext structure on the stack.
155 If the stack layout for __sigtramp changes, or if sigcontext offsets
156 change, we might have to update this code. */
157#ifndef SIGFRAME_PC_OFF
158#define SIGFRAME_PC_OFF (2 * 8)
159#define SIGFRAME_REGSAVE_OFF (4 * 8)
160#define SIGFRAME_FPREGSAVE_OFF (SIGFRAME_REGSAVE_OFF + 32 * 8 + 8)
161#endif
162 if (frame->signal_handler_caller)
163 {
164 CORE_ADDR sigcontext_pointer_addr;
165 CORE_ADDR sigcontext_addr;
166
167 if (frame->next)
168 sigcontext_pointer_addr = frame->next->frame;
169 else
170 sigcontext_pointer_addr = frame->frame;
171 sigcontext_addr = read_memory_integer(sigcontext_pointer_addr, 8);
172 for (ireg = 0; ireg < 32; ireg++)
173 {
174 reg_position = sigcontext_addr + SIGFRAME_REGSAVE_OFF + ireg * 8;
175 frame->saved_regs->regs[ireg] = reg_position;
176 }
177 for (ireg = 0; ireg < 32; ireg++)
178 {
179 reg_position = sigcontext_addr + SIGFRAME_FPREGSAVE_OFF + ireg * 8;
180 frame->saved_regs->regs[FP0_REGNUM + ireg] = reg_position;
181 }
182 frame->saved_regs->regs[PC_REGNUM] = sigcontext_addr + SIGFRAME_PC_OFF;
183 return;
184 }
185
669caa9c 186 proc_desc = frame->proc_desc;
72bba93b
SG
187 if (proc_desc == NULL)
188 /* I'm not sure how/whether this can happen. Normally when we can't
189 find a proc_desc, we "synthesize" one using heuristic_proc_desc
190 and set the saved_regs right away. */
191 return;
192
193 /* Fill in the offsets for the registers which gen_mask says
194 were saved. */
195
669caa9c 196 reg_position = frame->frame + PROC_REG_OFFSET (proc_desc);
72bba93b
SG
197 mask = PROC_REG_MASK (proc_desc);
198
199 returnreg = PROC_PC_REG (proc_desc);
200
e4dbd248 201 /* Note that RA is always saved first, regardless of its actual
72bba93b
SG
202 register number. */
203 if (mask & (1 << returnreg))
204 {
669caa9c 205 frame->saved_regs->regs[returnreg] = reg_position;
72bba93b
SG
206 reg_position += 8;
207 mask &= ~(1 << returnreg); /* Clear bit for RA so we
208 don't save again later. */
209 }
210
211 for (ireg = 0; ireg <= 31 ; ++ireg)
212 if (mask & (1 << ireg))
213 {
669caa9c 214 frame->saved_regs->regs[ireg] = reg_position;
72bba93b
SG
215 reg_position += 8;
216 }
217
218 /* Fill in the offsets for the registers which float_mask says
219 were saved. */
220
669caa9c 221 reg_position = frame->frame + PROC_FREG_OFFSET (proc_desc);
72bba93b
SG
222 mask = PROC_FREG_MASK (proc_desc);
223
224 for (ireg = 0; ireg <= 31 ; ++ireg)
225 if (mask & (1 << ireg))
226 {
669caa9c 227 frame->saved_regs->regs[FP0_REGNUM+ireg] = reg_position;
72bba93b
SG
228 reg_position += 8;
229 }
230
669caa9c 231 frame->saved_regs->regs[PC_REGNUM] = frame->saved_regs->regs[returnreg];
72bba93b 232}
cef4c2e7
PS
233
234static CORE_ADDR
235read_next_frame_reg(fi, regno)
669caa9c 236 struct frame_info *fi;
cef4c2e7
PS
237 int regno;
238{
cef4c2e7
PS
239 for (; fi; fi = fi->next)
240 {
e4dbd248
PS
241 /* We have to get the saved sp from the sigcontext
242 if it is a signal handler frame. */
243 if (regno == SP_REGNUM && !fi->signal_handler_caller)
cef4c2e7 244 return fi->frame;
72bba93b
SG
245 else
246 {
247 if (fi->saved_regs == NULL)
248 alpha_find_saved_regs (fi);
249 if (fi->saved_regs->regs[regno])
250 return read_memory_integer(fi->saved_regs->regs[regno], 8);
251 }
cef4c2e7
PS
252 }
253 return read_register(regno);
254}
255
256CORE_ADDR
257alpha_frame_saved_pc(frame)
669caa9c 258 struct frame_info *frame;
cef4c2e7
PS
259{
260 alpha_extra_func_info_t proc_desc = frame->proc_desc;
0434c1a0
PS
261 /* We have to get the saved pc from the sigcontext
262 if it is a signal handler frame. */
adbe434b 263 int pcreg = frame->signal_handler_caller ? PC_REGNUM : frame->pc_reg;
cef4c2e7
PS
264
265 if (proc_desc && PROC_DESC_IS_DUMMY(proc_desc))
266 return read_memory_integer(frame->frame - 8, 8);
267
268 return read_next_frame_reg(frame, pcreg);
269}
270
271CORE_ADDR
272alpha_saved_pc_after_call (frame)
669caa9c 273 struct frame_info *frame;
cef4c2e7 274{
adbe434b
PS
275 CORE_ADDR pc = frame->pc;
276 CORE_ADDR tmp;
277 alpha_extra_func_info_t proc_desc;
278 int pcreg;
279
280 /* Skip over shared library trampoline if necessary. */
281 tmp = SKIP_TRAMPOLINE_CODE (pc);
282 if (tmp != 0)
283 pc = tmp;
284
285 proc_desc = find_proc_desc (pc, frame->next);
286 pcreg = proc_desc ? PROC_PC_REG (proc_desc) : RA_REGNUM;
cef4c2e7
PS
287
288 return read_register (pcreg);
289}
290
291
292static struct alpha_extra_func_info temp_proc_desc;
293static struct frame_saved_regs temp_saved_regs;
294
295/* This fencepost looks highly suspicious to me. Removing it also
296 seems suspicious as it could affect remote debugging across serial
297 lines. */
298
299static CORE_ADDR
300heuristic_proc_start(pc)
301 CORE_ADDR pc;
302{
303 CORE_ADDR start_pc = pc;
304 CORE_ADDR fence = start_pc - heuristic_fence_post;
305
306 if (start_pc == 0) return 0;
307
308 if (heuristic_fence_post == UINT_MAX
309 || fence < VM_MIN_ADDRESS)
310 fence = VM_MIN_ADDRESS;
311
312 /* search back for previous return */
313 for (start_pc -= 4; ; start_pc -= 4)
314 if (start_pc < fence)
315 {
316 /* It's not clear to me why we reach this point when
317 stop_soon_quietly, but with this test, at least we
318 don't print out warnings for every child forked (eg, on
319 decstation). 22apr93 rich@cygnus.com. */
320 if (!stop_soon_quietly)
321 {
322 static int blurb_printed = 0;
323
324 if (fence == VM_MIN_ADDRESS)
325 warning("Hit beginning of text section without finding");
326 else
327 warning("Hit heuristic-fence-post without finding");
328
329 warning("enclosing function for address 0x%lx", pc);
330 if (!blurb_printed)
331 {
332 printf_filtered ("\
333This warning occurs if you are debugging a function without any symbols\n\
334(for example, in a stripped executable). In that case, you may wish to\n\
335increase the size of the search with the `set heuristic-fence-post' command.\n\
336\n\
337Otherwise, you told GDB there was a function where there isn't one, or\n\
338(more likely) you have encountered a bug in GDB.\n");
339 blurb_printed = 1;
340 }
341 }
342
343 return 0;
344 }
345 else if (ABOUT_TO_RETURN(start_pc))
346 break;
347
348 start_pc += 4; /* skip return */
349 return start_pc;
350}
351
352static alpha_extra_func_info_t
353heuristic_proc_desc(start_pc, limit_pc, next_frame)
354 CORE_ADDR start_pc, limit_pc;
669caa9c 355 struct frame_info *next_frame;
cef4c2e7 356{
2fe3b329 357 CORE_ADDR sp = read_next_frame_reg (next_frame, SP_REGNUM);
cef4c2e7
PS
358 CORE_ADDR cur_pc;
359 int frame_size;
360 int has_frame_reg = 0;
361 unsigned long reg_mask = 0;
362
363 if (start_pc == 0)
364 return NULL;
669caa9c
SS
365 memset (&temp_proc_desc, '\0', sizeof(temp_proc_desc));
366 memset (&temp_saved_regs, '\0', sizeof(struct frame_saved_regs));
367 PROC_LOW_ADDR (&temp_proc_desc) = start_pc;
cef4c2e7
PS
368
369 if (start_pc + 200 < limit_pc)
370 limit_pc = start_pc + 200;
371 frame_size = 0;
372 for (cur_pc = start_pc; cur_pc < limit_pc; cur_pc += 4)
373 {
374 char buf[4];
375 unsigned long word;
376 int status;
377
378 status = read_memory_nobpt (cur_pc, buf, 4);
379 if (status)
380 memory_error (status, cur_pc);
381 word = extract_unsigned_integer (buf, 4);
382
383 if ((word & 0xffff0000) == 0x23de0000) /* lda $sp,n($sp) */
384 frame_size += (-word) & 0xffff;
385 else if ((word & 0xfc1f0000) == 0xb41e0000 /* stq reg,n($sp) */
386 && (word & 0xffff0000) != 0xb7fe0000) /* reg != $zero */
387 {
388 int reg = (word & 0x03e00000) >> 21;
389 reg_mask |= 1 << reg;
390 temp_saved_regs.regs[reg] = sp + (short)word;
391 }
392 else if (word == 0x47de040f) /* bis sp,sp fp */
393 has_frame_reg = 1;
394 }
395 if (has_frame_reg)
396 PROC_FRAME_REG(&temp_proc_desc) = GCC_FP_REGNUM;
397 else
398 PROC_FRAME_REG(&temp_proc_desc) = SP_REGNUM;
399 PROC_FRAME_OFFSET(&temp_proc_desc) = frame_size;
400 PROC_REG_MASK(&temp_proc_desc) = reg_mask;
401 PROC_PC_REG(&temp_proc_desc) = RA_REGNUM;
72bba93b 402 PROC_LOCALOFF(&temp_proc_desc) = 0; /* XXX - bogus */
cef4c2e7
PS
403 return &temp_proc_desc;
404}
405
72bba93b
SG
406/* This returns the PC of the first inst after the prologue. If we can't
407 find the prologue, then return 0. */
408
409static CORE_ADDR
410after_prologue (pc, proc_desc)
411 CORE_ADDR pc;
412 alpha_extra_func_info_t proc_desc;
413{
72bba93b
SG
414 struct symtab_and_line sal;
415 CORE_ADDR func_addr, func_end;
416
417 if (!proc_desc)
418 proc_desc = find_proc_desc (pc, NULL);
419
420 if (proc_desc)
421 {
422 /* If function is frameless, then we need to do it the hard way. I
423 strongly suspect that frameless always means prologueless... */
424 if (PROC_FRAME_REG (proc_desc) == SP_REGNUM
425 && PROC_FRAME_OFFSET (proc_desc) == 0)
426 return 0;
427 }
428
429 if (!find_pc_partial_function (pc, NULL, &func_addr, &func_end))
430 return 0; /* Unknown */
431
432 sal = find_pc_line (func_addr, 0);
433
434 if (sal.end < func_end)
435 return sal.end;
436
437 /* The line after the prologue is after the end of the function. In this
438 case, tell the caller to find the prologue the hard way. */
439
440 return 0;
441}
442
443/* Return non-zero if we *might* be in a function prologue. Return zero if we
444 are definatly *not* in a function prologue. */
445
446static int
447in_prologue (pc, proc_desc)
448 CORE_ADDR pc;
449 alpha_extra_func_info_t proc_desc;
450{
451 CORE_ADDR after_prologue_pc;
452
453 after_prologue_pc = after_prologue (pc, proc_desc);
454
455 if (after_prologue_pc == 0
456 || pc < after_prologue_pc)
457 return 1;
458 else
459 return 0;
460}
461
cef4c2e7 462static alpha_extra_func_info_t
669caa9c 463find_proc_desc (pc, next_frame)
cef4c2e7 464 CORE_ADDR pc;
669caa9c 465 struct frame_info *next_frame;
cef4c2e7
PS
466{
467 alpha_extra_func_info_t proc_desc;
468 struct block *b;
469 struct symbol *sym;
470 CORE_ADDR startaddr;
471
472 /* Try to get the proc_desc from the linked call dummy proc_descs
473 if the pc is in the call dummy.
474 This is hairy. In the case of nested dummy calls we have to find the
475 right proc_desc, but we might not yet know the frame for the dummy
476 as it will be contained in the proc_desc we are searching for.
477 So we have to find the proc_desc whose frame is closest to the current
478 stack pointer. */
72bba93b 479
cef4c2e7
PS
480 if (PC_IN_CALL_DUMMY (pc, 0, 0))
481 {
482 struct linked_proc_info *link;
2fe3b329 483 CORE_ADDR sp = read_next_frame_reg (next_frame, SP_REGNUM);
cef4c2e7
PS
484 alpha_extra_func_info_t found_proc_desc = NULL;
485 long min_distance = LONG_MAX;
486
487 for (link = linked_proc_desc_table; link; link = link->next)
488 {
489 long distance = (CORE_ADDR) PROC_DUMMY_FRAME (&link->info) - sp;
490 if (distance > 0 && distance < min_distance)
491 {
492 min_distance = distance;
493 found_proc_desc = &link->info;
494 }
495 }
496 if (found_proc_desc != NULL)
497 return found_proc_desc;
498 }
499
500 b = block_for_pc(pc);
72bba93b 501
cef4c2e7
PS
502 find_pc_partial_function (pc, NULL, &startaddr, NULL);
503 if (b == NULL)
504 sym = NULL;
505 else
506 {
507 if (startaddr > BLOCK_START (b))
508 /* This is the "pathological" case referred to in a comment in
509 print_frame_info. It might be better to move this check into
510 symbol reading. */
511 sym = NULL;
512 else
513 sym = lookup_symbol (MIPS_EFI_SYMBOL_NAME, b, LABEL_NAMESPACE,
514 0, NULL);
515 }
516
4f69fe46
JK
517 /* If we never found a PDR for this function in symbol reading, then
518 examine prologues to find the information. */
519 if (sym && ((mips_extra_func_info_t) SYMBOL_VALUE (sym))->pdr.framereg == -1)
520 sym = NULL;
521
cef4c2e7
PS
522 if (sym)
523 {
72bba93b
SG
524 /* IF this is the topmost frame AND
525 * (this proc does not have debugging information OR
cef4c2e7
PS
526 * the PC is in the procedure prologue)
527 * THEN create a "heuristic" proc_desc (by analyzing
528 * the actual code) to replace the "official" proc_desc.
529 */
530 proc_desc = (alpha_extra_func_info_t)SYMBOL_VALUE(sym);
72bba93b
SG
531 if (next_frame == NULL)
532 {
533 if (PROC_DESC_IS_DUMMY (proc_desc) || in_prologue (pc, proc_desc))
534 {
cef4c2e7 535 alpha_extra_func_info_t found_heuristic =
72bba93b
SG
536 heuristic_proc_desc (PROC_LOW_ADDR (proc_desc),
537 pc, next_frame);
cef4c2e7 538 if (found_heuristic)
de7ad6d8
JK
539 {
540 PROC_LOCALOFF (found_heuristic) =
541 PROC_LOCALOFF (proc_desc);
adbe434b 542 PROC_PC_REG (found_heuristic) = PROC_PC_REG (proc_desc);
de7ad6d8
JK
543 proc_desc = found_heuristic;
544 }
72bba93b
SG
545 }
546 }
cef4c2e7
PS
547 }
548 else
549 {
72bba93b
SG
550 /* Is linked_proc_desc_table really necessary? It only seems to be used
551 by procedure call dummys. However, the procedures being called ought
552 to have their own proc_descs, and even if they don't,
553 heuristic_proc_desc knows how to create them! */
554
555 register struct linked_proc_info *link;
556 for (link = linked_proc_desc_table; link; link = link->next)
557 if (PROC_LOW_ADDR(&link->info) <= pc
558 && PROC_HIGH_ADDR(&link->info) > pc)
559 return &link->info;
560
cef4c2e7
PS
561 if (startaddr == 0)
562 startaddr = heuristic_proc_start (pc);
563
564 proc_desc =
565 heuristic_proc_desc (startaddr, pc, next_frame);
566 }
567 return proc_desc;
568}
569
570alpha_extra_func_info_t cached_proc_desc;
571
669caa9c 572CORE_ADDR
cef4c2e7 573alpha_frame_chain(frame)
669caa9c 574 struct frame_info *frame;
cef4c2e7
PS
575{
576 alpha_extra_func_info_t proc_desc;
577 CORE_ADDR saved_pc = FRAME_SAVED_PC(frame);
578
579 if (saved_pc == 0 || inside_entry_file (saved_pc))
580 return 0;
581
582 proc_desc = find_proc_desc(saved_pc, frame);
583 if (!proc_desc)
584 return 0;
585
586 cached_proc_desc = proc_desc;
587
588 /* Fetch the frame pointer for a dummy frame from the procedure
589 descriptor. */
590 if (PROC_DESC_IS_DUMMY(proc_desc))
669caa9c 591 return (CORE_ADDR) PROC_DUMMY_FRAME(proc_desc);
cef4c2e7
PS
592
593 /* If no frame pointer and frame size is zero, we must be at end
594 of stack (or otherwise hosed). If we don't check frame size,
595 we loop forever if we see a zero size frame. */
596 if (PROC_FRAME_REG (proc_desc) == SP_REGNUM
597 && PROC_FRAME_OFFSET (proc_desc) == 0
cef4c2e7
PS
598 /* The previous frame from a sigtramp frame might be frameless
599 and have frame size zero. */
600 && !frame->signal_handler_caller)
0434c1a0
PS
601 {
602 /* The alpha __sigtramp routine is frameless and has a frame size
603 of zero, but we are able to backtrace through it. */
604 char *name;
605 find_pc_partial_function (saved_pc, &name,
606 (CORE_ADDR *)NULL, (CORE_ADDR *)NULL);
607 if (IN_SIGTRAMP (saved_pc, name))
608 return frame->frame;
609 else
610 return 0;
611 }
cef4c2e7
PS
612 else
613 return read_next_frame_reg(frame, PROC_FRAME_REG(proc_desc))
0434c1a0 614 + PROC_FRAME_OFFSET(proc_desc);
cef4c2e7
PS
615}
616
617void
669caa9c
SS
618init_extra_frame_info (frame)
619 struct frame_info *frame;
cef4c2e7 620{
cef4c2e7
PS
621 /* Use proc_desc calculated in frame_chain */
622 alpha_extra_func_info_t proc_desc =
669caa9c 623 frame->next ? cached_proc_desc : find_proc_desc(frame->pc, frame->next);
cef4c2e7 624
669caa9c 625 frame->saved_regs = NULL;
adbe434b
PS
626 frame->localoff = 0;
627 frame->pc_reg = RA_REGNUM;
628 frame->proc_desc = proc_desc == &temp_proc_desc ? 0 : proc_desc;
cef4c2e7
PS
629 if (proc_desc)
630 {
adbe434b
PS
631 /* Get the locals offset and the saved pc register from the
632 procedure descriptor, they are valid even if we are in the
633 middle of the prologue. */
669caa9c 634 frame->localoff = PROC_LOCALOFF(proc_desc);
adbe434b 635 frame->pc_reg = PROC_PC_REG(proc_desc);
cef4c2e7 636
cef4c2e7 637 /* Fixup frame-pointer - only needed for top frame */
72bba93b 638
cef4c2e7
PS
639 /* Fetch the frame pointer for a dummy frame from the procedure
640 descriptor. */
641 if (PROC_DESC_IS_DUMMY(proc_desc))
669caa9c 642 frame->frame = (CORE_ADDR) PROC_DUMMY_FRAME(proc_desc);
72bba93b 643
cef4c2e7
PS
644 /* This may not be quite right, if proc has a real frame register.
645 Get the value of the frame relative sp, procedure might have been
646 interrupted by a signal at it's very start. */
669caa9c
SS
647 else if (frame->pc == PROC_LOW_ADDR (proc_desc) && !PROC_DESC_IS_DUMMY (proc_desc))
648 frame->frame = read_next_frame_reg (frame->next, SP_REGNUM);
cef4c2e7 649 else
669caa9c
SS
650 frame->frame = read_next_frame_reg (frame->next, PROC_FRAME_REG (proc_desc))
651 + PROC_FRAME_OFFSET (proc_desc);
cef4c2e7
PS
652
653 if (proc_desc == &temp_proc_desc)
cef4c2e7 654 {
669caa9c 655 frame->saved_regs = (struct frame_saved_regs*)
72bba93b
SG
656 obstack_alloc (&frame_cache_obstack,
657 sizeof (struct frame_saved_regs));
669caa9c
SS
658 *frame->saved_regs = temp_saved_regs;
659 frame->saved_regs->regs[PC_REGNUM] = frame->saved_regs->regs[RA_REGNUM];
cef4c2e7 660 }
cef4c2e7
PS
661 }
662}
663
664/* ALPHA stack frames are almost impenetrable. When execution stops,
665 we basically have to look at symbol information for the function
666 that we stopped in, which tells us *which* register (if any) is
667 the base of the frame pointer, and what offset from that register
668 the frame itself is at.
669
670 This presents a problem when trying to examine a stack in memory
671 (that isn't executing at the moment), using the "frame" command. We
672 don't have a PC, nor do we have any registers except SP.
673
674 This routine takes two arguments, SP and PC, and tries to make the
675 cached frames look as if these two arguments defined a frame on the
676 cache. This allows the rest of info frame to extract the important
677 arguments without difficulty. */
678
669caa9c 679struct frame_info *
cef4c2e7
PS
680setup_arbitrary_frame (argc, argv)
681 int argc;
669caa9c 682 CORE_ADDR *argv;
cef4c2e7
PS
683{
684 if (argc != 2)
685 error ("ALPHA frame specifications require two arguments: sp and pc");
686
687 return create_new_frame (argv[0], argv[1]);
688}
689
690/* The alpha passes the first six arguments in the registers, the rest on
691 the stack. The register arguments are eventually transferred to the
692 argument transfer area immediately below the stack by the called function
693 anyway. So we `push' at least six arguments on the stack, `reload' the
694 argument registers and then adjust the stack pointer to point past the
695 sixth argument. This algorithm simplifies the passing of a large struct
696 which extends from the registers to the stack.
697 If the called function is returning a structure, the address of the
698 structure to be returned is passed as a hidden first argument. */
699
cef4c2e7
PS
700CORE_ADDR
701alpha_push_arguments (nargs, args, sp, struct_return, struct_addr)
7810d333
JK
702 int nargs;
703 value_ptr *args;
704 CORE_ADDR sp;
705 int struct_return;
706 CORE_ADDR struct_addr;
cef4c2e7
PS
707{
708 register i;
709 int accumulate_size = struct_return ? 8 : 0;
3e6b0674 710 int arg_regs_size = ALPHA_NUM_ARG_REGS * 8;
cef4c2e7
PS
711 struct alpha_arg { char *contents; int len; int offset; };
712 struct alpha_arg *alpha_args =
713 (struct alpha_arg*)alloca (nargs * sizeof (struct alpha_arg));
714 register struct alpha_arg *m_arg;
715 char raw_buffer[sizeof (CORE_ADDR)];
716 int required_arg_regs;
717
718 for (i = 0, m_arg = alpha_args; i < nargs; i++, m_arg++)
719 {
5222ca60 720 value_ptr arg = args[i];
cef4c2e7 721 /* Cast argument to long if necessary as the compiler does it too. */
b3636ee5
JK
722 switch (TYPE_CODE (VALUE_TYPE (arg)))
723 {
724 case TYPE_CODE_INT:
725 case TYPE_CODE_BOOL:
726 case TYPE_CODE_CHAR:
727 case TYPE_CODE_RANGE:
728 case TYPE_CODE_ENUM:
729 if (TYPE_LENGTH (VALUE_TYPE (arg)) < TYPE_LENGTH (builtin_type_long))
730 arg = value_cast (builtin_type_long, arg);
731 break;
732 default:
733 break;
734 }
cef4c2e7
PS
735 m_arg->len = TYPE_LENGTH (VALUE_TYPE (arg));
736 m_arg->offset = accumulate_size;
737 accumulate_size = (accumulate_size + m_arg->len + 7) & ~7;
738 m_arg->contents = VALUE_CONTENTS(arg);
739 }
740
741 /* Determine required argument register loads, loading an argument register
742 is expensive as it uses three ptrace calls. */
743 required_arg_regs = accumulate_size / 8;
3e6b0674
PS
744 if (required_arg_regs > ALPHA_NUM_ARG_REGS)
745 required_arg_regs = ALPHA_NUM_ARG_REGS;
cef4c2e7
PS
746
747 /* Make room for the arguments on the stack. */
748 if (accumulate_size < arg_regs_size)
749 accumulate_size = arg_regs_size;
750 sp -= accumulate_size;
751
752 /* Keep sp aligned to a multiple of 16 as the compiler does it too. */
753 sp &= ~15;
754
755 /* `Push' arguments on the stack. */
756 for (i = nargs; m_arg--, --i >= 0; )
757 write_memory(sp + m_arg->offset, m_arg->contents, m_arg->len);
758 if (struct_return)
759 {
760 store_address (raw_buffer, sizeof (CORE_ADDR), struct_addr);
761 write_memory (sp, raw_buffer, sizeof (CORE_ADDR));
762 }
763
764 /* Load the argument registers. */
765 for (i = 0; i < required_arg_regs; i++)
766 {
767 LONGEST val;
768
769 val = read_memory_integer (sp + i * 8, 8);
770 write_register (A0_REGNUM + i, val);
771 write_register (FPA0_REGNUM + i, val);
772 }
773
774 return sp + arg_regs_size;
775}
776
777void
778alpha_push_dummy_frame()
779{
780 int ireg;
72bba93b
SG
781 struct linked_proc_info *link;
782 alpha_extra_func_info_t proc_desc;
cef4c2e7
PS
783 CORE_ADDR sp = read_register (SP_REGNUM);
784 CORE_ADDR save_address;
785 char raw_buffer[MAX_REGISTER_RAW_SIZE];
786 unsigned long mask;
787
72bba93b 788 link = (struct linked_proc_info *) xmalloc(sizeof (struct linked_proc_info));
cef4c2e7
PS
789 link->next = linked_proc_desc_table;
790 linked_proc_desc_table = link;
72bba93b
SG
791
792 proc_desc = &link->info;
cef4c2e7
PS
793
794 /*
795 * The registers we must save are all those not preserved across
796 * procedure calls.
797 * In addition, we must save the PC and RA.
798 *
799 * Dummy frame layout:
800 * (high memory)
801 * Saved PC
802 * Saved F30
803 * ...
804 * Saved F0
805 * Saved R29
806 * ...
807 * Saved R0
808 * Saved R26 (RA)
809 * Parameter build area
810 * (low memory)
811 */
812
813/* MASK(i,j) == (1<<i) + (1<<(i+1)) + ... + (1<<j)). Assume i<=j<31. */
814#define MASK(i,j) (((1L << ((j)+1)) - 1) ^ ((1L << (i)) - 1))
815#define GEN_REG_SAVE_MASK (MASK(0,8) | MASK(16,29))
816#define GEN_REG_SAVE_COUNT 24
817#define FLOAT_REG_SAVE_MASK (MASK(0,1) | MASK(10,30))
818#define FLOAT_REG_SAVE_COUNT 23
819 /* The special register is the PC as we have no bit for it in the save masks.
820 alpha_frame_saved_pc knows where the pc is saved in a dummy frame. */
821#define SPECIAL_REG_SAVE_COUNT 1
822
823 PROC_REG_MASK(proc_desc) = GEN_REG_SAVE_MASK;
824 PROC_FREG_MASK(proc_desc) = FLOAT_REG_SAVE_MASK;
825 /* PROC_REG_OFFSET is the offset from the dummy frame to the saved RA,
826 but keep SP aligned to a multiple of 16. */
827 PROC_REG_OFFSET(proc_desc) =
828 - ((8 * (SPECIAL_REG_SAVE_COUNT
829 + GEN_REG_SAVE_COUNT
830 + FLOAT_REG_SAVE_COUNT)
831 + 15) & ~15);
832 PROC_FREG_OFFSET(proc_desc) =
833 PROC_REG_OFFSET(proc_desc) + 8 * GEN_REG_SAVE_COUNT;
834
835 /* Save general registers.
836 The return address register is the first saved register, all other
837 registers follow in ascending order.
838 The PC is saved immediately below the SP. */
839 save_address = sp + PROC_REG_OFFSET(proc_desc);
840 store_address (raw_buffer, 8, read_register (RA_REGNUM));
841 write_memory (save_address, raw_buffer, 8);
842 save_address += 8;
843 mask = PROC_REG_MASK(proc_desc) & 0xffffffffL;
844 for (ireg = 0; mask; ireg++, mask >>= 1)
845 if (mask & 1)
846 {
847 if (ireg == RA_REGNUM)
848 continue;
849 store_address (raw_buffer, 8, read_register (ireg));
850 write_memory (save_address, raw_buffer, 8);
851 save_address += 8;
852 }
853
854 store_address (raw_buffer, 8, read_register (PC_REGNUM));
855 write_memory (sp - 8, raw_buffer, 8);
856
857 /* Save floating point registers. */
858 save_address = sp + PROC_FREG_OFFSET(proc_desc);
859 mask = PROC_FREG_MASK(proc_desc) & 0xffffffffL;
860 for (ireg = 0; mask; ireg++, mask >>= 1)
861 if (mask & 1)
862 {
863 store_address (raw_buffer, 8, read_register (ireg + FP0_REGNUM));
864 write_memory (save_address, raw_buffer, 8);
865 save_address += 8;
866 }
867
868 /* Set and save the frame address for the dummy.
869 This is tricky. The only registers that are suitable for a frame save
870 are those that are preserved across procedure calls (s0-s6). But if
871 a read system call is interrupted and then a dummy call is made
872 (see testsuite/gdb.t17/interrupt.exp) the dummy call hangs till the read
873 is satisfied. Then it returns with the s0-s6 registers set to the values
874 on entry to the read system call and our dummy frame pointer would be
875 destroyed. So we save the dummy frame in the proc_desc and handle the
876 retrieval of the frame pointer of a dummy specifically. The frame register
877 is set to the virtual frame (pseudo) register, it's value will always
878 be read as zero and will help us to catch any errors in the dummy frame
879 retrieval code. */
880 PROC_DUMMY_FRAME(proc_desc) = sp;
881 PROC_FRAME_REG(proc_desc) = FP_REGNUM;
882 PROC_FRAME_OFFSET(proc_desc) = 0;
883 sp += PROC_REG_OFFSET(proc_desc);
884 write_register (SP_REGNUM, sp);
885
72bba93b 886 PROC_LOW_ADDR(proc_desc) = CALL_DUMMY_ADDRESS ();
cef4c2e7
PS
887 PROC_HIGH_ADDR(proc_desc) = PROC_LOW_ADDR(proc_desc) + 4;
888
889 SET_PROC_DESC_IS_DUMMY(proc_desc);
890 PROC_PC_REG(proc_desc) = RA_REGNUM;
891}
892
893void
894alpha_pop_frame()
895{
896 register int regnum;
669caa9c 897 struct frame_info *frame = get_current_frame ();
cef4c2e7
PS
898 CORE_ADDR new_sp = frame->frame;
899
900 alpha_extra_func_info_t proc_desc = frame->proc_desc;
901
902 write_register (PC_REGNUM, FRAME_SAVED_PC(frame));
72bba93b
SG
903 if (frame->saved_regs == NULL)
904 alpha_find_saved_regs (frame);
cef4c2e7
PS
905 if (proc_desc)
906 {
907 for (regnum = 32; --regnum >= 0; )
908 if (PROC_REG_MASK(proc_desc) & (1 << regnum))
909 write_register (regnum,
910 read_memory_integer (frame->saved_regs->regs[regnum],
911 8));
912 for (regnum = 32; --regnum >= 0; )
913 if (PROC_FREG_MASK(proc_desc) & (1 << regnum))
914 write_register (regnum + FP0_REGNUM,
915 read_memory_integer (frame->saved_regs->regs[regnum + FP0_REGNUM], 8));
916 }
917 write_register (SP_REGNUM, new_sp);
918 flush_cached_frames ();
cef4c2e7
PS
919
920 if (proc_desc && PROC_DESC_IS_DUMMY(proc_desc))
921 {
922 struct linked_proc_info *pi_ptr, *prev_ptr;
923
924 for (pi_ptr = linked_proc_desc_table, prev_ptr = NULL;
925 pi_ptr != NULL;
926 prev_ptr = pi_ptr, pi_ptr = pi_ptr->next)
927 {
928 if (&pi_ptr->info == proc_desc)
929 break;
930 }
931
932 if (pi_ptr == NULL)
933 error ("Can't locate dummy extra frame info\n");
934
935 if (prev_ptr != NULL)
936 prev_ptr->next = pi_ptr->next;
937 else
938 linked_proc_desc_table = pi_ptr->next;
939
940 free (pi_ptr);
941 }
942}
943\f
944/* To skip prologues, I use this predicate. Returns either PC itself
945 if the code at PC does not look like a function prologue; otherwise
946 returns an address that (if we're lucky) follows the prologue. If
947 LENIENT, then we must skip everything which is involved in setting
948 up the frame (it's OK to skip more, just so long as we don't skip
949 anything which might clobber the registers which are being saved.
950 Currently we must not skip more on the alpha, but we might the lenient
951 stuff some day. */
952
953CORE_ADDR
954alpha_skip_prologue (pc, lenient)
955 CORE_ADDR pc;
956 int lenient;
957{
958 unsigned long inst;
959 int offset;
72bba93b 960 CORE_ADDR post_prologue_pc;
2fe3b329
PS
961 char buf[4];
962
963#ifdef GDB_TARGET_HAS_SHARED_LIBS
964 /* Silently return the unaltered pc upon memory errors.
965 This could happen on OSF/1 if decode_line_1 tries to skip the
966 prologue for quickstarted shared library functions when the
967 shared library is not yet mapped in.
968 Reading target memory is slow over serial lines, so we perform
969 this check only if the target has shared libraries. */
970 if (target_read_memory (pc, buf, 4))
971 return pc;
972#endif
72bba93b
SG
973
974 /* See if we can determine the end of the prologue via the symbol table.
975 If so, then return either PC, or the PC after the prologue, whichever
976 is greater. */
977
978 post_prologue_pc = after_prologue (pc, NULL);
979
980 if (post_prologue_pc != 0)
981 return max (pc, post_prologue_pc);
982
983 /* Can't determine prologue from the symbol table, need to examine
984 instructions. */
cef4c2e7
PS
985
986 /* Skip the typical prologue instructions. These are the stack adjustment
987 instruction and the instructions that save registers on the stack
988 or in the gcc frame. */
989 for (offset = 0; offset < 100; offset += 4)
990 {
cef4c2e7
PS
991 int status;
992
993 status = read_memory_nobpt (pc + offset, buf, 4);
994 if (status)
995 memory_error (status, pc + offset);
996 inst = extract_unsigned_integer (buf, 4);
997
998 /* The alpha has no delay slots. But let's keep the lenient stuff,
999 we might need it for something else in the future. */
1000 if (lenient && 0)
1001 continue;
1002
1003 if ((inst & 0xffff0000) == 0x27bb0000) /* ldah $gp,n($t12) */
1004 continue;
1005 if ((inst & 0xffff0000) == 0x23bd0000) /* lda $gp,n($gp) */
1006 continue;
1007 if ((inst & 0xffff0000) == 0x23de0000) /* lda $sp,n($sp) */
1008 continue;
1009 else if ((inst & 0xfc1f0000) == 0xb41e0000
1010 && (inst & 0xffff0000) != 0xb7fe0000)
1011 continue; /* stq reg,n($sp) */
1012 /* reg != $zero */
1013 else if ((inst & 0xfc1f0000) == 0x9c1e0000
1014 && (inst & 0xffff0000) != 0x9ffe0000)
1015 continue; /* stt reg,n($sp) */
1016 /* reg != $zero */
1017 else if (inst == 0x47de040f) /* bis sp,sp,fp */
1018 continue;
1019 else
1020 break;
1021 }
1022 return pc + offset;
1023}
1024
e3be225e 1025#if 0
cef4c2e7
PS
1026/* Is address PC in the prologue (loosely defined) for function at
1027 STARTADDR? */
1028
1029static int
1030alpha_in_lenient_prologue (startaddr, pc)
1031 CORE_ADDR startaddr;
1032 CORE_ADDR pc;
1033{
1034 CORE_ADDR end_prologue = alpha_skip_prologue (startaddr, 1);
1035 return pc >= startaddr && pc < end_prologue;
1036}
e3be225e 1037#endif
cef4c2e7 1038
ad09cb2b
PS
1039/* The alpha needs a conversion between register and memory format if
1040 the register is a floating point register and
1041 memory format is float, as the register format must be double
1042 or
1043 memory format is an integer with 4 bytes or less, as the representation
1044 of integers in floating point registers is different. */
1045void
1046alpha_register_convert_to_virtual (regnum, valtype, raw_buffer, virtual_buffer)
1047 int regnum;
1048 struct type *valtype;
1049 char *raw_buffer;
1050 char *virtual_buffer;
1051{
1052 if (TYPE_LENGTH (valtype) >= REGISTER_RAW_SIZE (regnum))
1053 {
1054 memcpy (virtual_buffer, raw_buffer, REGISTER_VIRTUAL_SIZE (regnum));
1055 return;
1056 }
1057
1058 if (TYPE_CODE (valtype) == TYPE_CODE_FLT)
1059 {
1060 double d = extract_floating (raw_buffer, REGISTER_RAW_SIZE (regnum));
1061 store_floating (virtual_buffer, TYPE_LENGTH (valtype), d);
1062 }
1063 else if (TYPE_CODE (valtype) == TYPE_CODE_INT && TYPE_LENGTH (valtype) <= 4)
1064 {
1065 unsigned LONGEST l;
1066 l = extract_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (regnum));
1067 l = ((l >> 32) & 0xc0000000) | ((l >> 29) & 0x3fffffff);
1068 store_unsigned_integer (virtual_buffer, TYPE_LENGTH (valtype), l);
1069 }
1070 else
1071 error ("Cannot retrieve value from floating point register");
1072}
1073
1074void
1075alpha_register_convert_to_raw (valtype, regnum, virtual_buffer, raw_buffer)
1076 struct type *valtype;
1077 int regnum;
1078 char *virtual_buffer;
1079 char *raw_buffer;
1080{
1081 if (TYPE_LENGTH (valtype) >= REGISTER_RAW_SIZE (regnum))
1082 {
1083 memcpy (raw_buffer, virtual_buffer, REGISTER_RAW_SIZE (regnum));
1084 return;
1085 }
1086
1087 if (TYPE_CODE (valtype) == TYPE_CODE_FLT)
1088 {
1089 double d = extract_floating (virtual_buffer, TYPE_LENGTH (valtype));
1090 store_floating (raw_buffer, REGISTER_RAW_SIZE (regnum), d);
1091 }
1092 else if (TYPE_CODE (valtype) == TYPE_CODE_INT && TYPE_LENGTH (valtype) <= 4)
1093 {
1094 unsigned LONGEST l;
1095 if (TYPE_UNSIGNED (valtype))
1096 l = extract_unsigned_integer (virtual_buffer, TYPE_LENGTH (valtype));
1097 else
1098 l = extract_signed_integer (virtual_buffer, TYPE_LENGTH (valtype));
1099 l = ((l & 0xc0000000) << 32) | ((l & 0x3fffffff) << 29);
1100 store_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (regnum), l);
1101 }
1102 else
1103 error ("Cannot store value in floating point register");
1104}
1105
cef4c2e7
PS
1106/* Given a return value in `regbuf' with a type `valtype',
1107 extract and copy its value into `valbuf'. */
669caa9c 1108
cef4c2e7
PS
1109void
1110alpha_extract_return_value (valtype, regbuf, valbuf)
1111 struct type *valtype;
1112 char regbuf[REGISTER_BYTES];
1113 char *valbuf;
1114{
92a6d600
PS
1115 if (TYPE_CODE (valtype) == TYPE_CODE_FLT)
1116 alpha_register_convert_to_virtual (FP0_REGNUM, valtype,
1117 regbuf + REGISTER_BYTE (FP0_REGNUM),
1118 valbuf);
1119 else
1120 memcpy (valbuf, regbuf + REGISTER_BYTE (V0_REGNUM), TYPE_LENGTH (valtype));
cef4c2e7
PS
1121}
1122
1123/* Given a return value in `regbuf' with a type `valtype',
7810d333 1124 write its value into the appropriate register. */
669caa9c 1125
cef4c2e7
PS
1126void
1127alpha_store_return_value (valtype, valbuf)
1128 struct type *valtype;
1129 char *valbuf;
1130{
cef4c2e7 1131 char raw_buffer[MAX_REGISTER_RAW_SIZE];
92a6d600
PS
1132 int regnum = V0_REGNUM;
1133 int length = TYPE_LENGTH (valtype);
cef4c2e7 1134
92a6d600
PS
1135 if (TYPE_CODE (valtype) == TYPE_CODE_FLT)
1136 {
1137 regnum = FP0_REGNUM;
1138 length = REGISTER_RAW_SIZE (regnum);
1139 alpha_register_convert_to_raw (valtype, regnum, valbuf, raw_buffer);
1140 }
1141 else
1142 memcpy (raw_buffer, valbuf, length);
cef4c2e7 1143
92a6d600 1144 write_register_bytes (REGISTER_BYTE (regnum), raw_buffer, length);
cef4c2e7
PS
1145}
1146
cef4c2e7
PS
1147/* Just like reinit_frame_cache, but with the right arguments to be
1148 callable as an sfunc. */
669caa9c 1149
cef4c2e7
PS
1150static void
1151reinit_frame_cache_sfunc (args, from_tty, c)
1152 char *args;
1153 int from_tty;
1154 struct cmd_list_element *c;
1155{
1156 reinit_frame_cache ();
1157}
1158
72bba93b
SG
1159/* This is the definition of CALL_DUMMY_ADDRESS. It's a heuristic that is used
1160 to find a convenient place in the text segment to stick a breakpoint to
1161 detect the completion of a target function call (ala call_function_by_hand).
1162 */
1163
1164CORE_ADDR
1165alpha_call_dummy_address ()
1166{
1167 CORE_ADDR entry;
1168 struct minimal_symbol *sym;
1169
1170 entry = entry_point_address ();
1171
1172 if (entry != 0)
1173 return entry;
1174
2d336b1b 1175 sym = lookup_minimal_symbol ("_Prelude", NULL, symfile_objfile);
72bba93b
SG
1176
1177 if (!sym || MSYMBOL_TYPE (sym) != mst_text)
1178 return 0;
1179 else
1180 return SYMBOL_VALUE_ADDRESS (sym) + 4;
1181}
1182
cef4c2e7
PS
1183void
1184_initialize_alpha_tdep ()
1185{
1186 struct cmd_list_element *c;
1187
18b46e7c
SS
1188 tm_print_insn = print_insn_alpha;
1189
cef4c2e7
PS
1190 /* Let the user set the fence post for heuristic_proc_start. */
1191
1192 /* We really would like to have both "0" and "unlimited" work, but
1193 command.c doesn't deal with that. So make it a var_zinteger
1194 because the user can always use "999999" or some such for unlimited. */
1195 c = add_set_cmd ("heuristic-fence-post", class_support, var_zinteger,
1196 (char *) &heuristic_fence_post,
1197 "\
1198Set the distance searched for the start of a function.\n\
1199If you are debugging a stripped executable, GDB needs to search through the\n\
1200program for the start of a function. This command sets the distance of the\n\
1201search. The only need to set it is when debugging a stripped executable.",
1202 &setlist);
1203 /* We need to throw away the frame cache when we set this, since it
1204 might change our ability to get backtraces. */
1205 c->function.sfunc = reinit_frame_cache_sfunc;
1206 add_show_from_set (c, &showlist);
1207}
This page took 0.165399 seconds and 4 git commands to generate.