* alpha-tdep.c (alpha_gdbarch_init): Use set_gdbarch_print_insn ...
[deliverable/binutils-gdb.git] / gdb / alpha-osf1-tdep.c
CommitLineData
36a6271d 1/* Target-dependent code for OSF/1 on Alpha.
4be87837 2 Copyright 2002, 2003 Free Software Foundation, Inc.
36a6271d
JT
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21#include "defs.h"
22#include "frame.h"
5868c862 23#include "gdbcore.h"
36a6271d 24#include "value.h"
4be87837 25#include "osabi.h"
4c2e2391 26#include "gdb_string.h"
36a6271d
JT
27
28#include "alpha-tdep.h"
29
30/* Under OSF/1, the __sigtramp routine is frameless and has a frame
31 size of zero, but we are able to backtrace through it. */
32static CORE_ADDR
33alpha_osf1_skip_sigtramp_frame (struct frame_info *frame, CORE_ADDR pc)
34{
35 char *name;
36
37 find_pc_partial_function (pc, &name, (CORE_ADDR *) NULL, (CORE_ADDR *) NULL);
38 if (PC_IN_SIGTRAMP (pc, name))
39 return frame->frame;
40 return 0;
41}
42
6c72f9f9
JT
43static int
44alpha_osf1_pc_in_sigtramp (CORE_ADDR pc, char *func_name)
45{
bde58177 46 return (func_name != NULL && strcmp ("__sigtramp", func_name) == 0);
6c72f9f9
JT
47}
48
5868c862
JT
49static CORE_ADDR
50alpha_osf1_sigcontext_addr (struct frame_info *frame)
51{
52 return (read_memory_integer (frame->next ? frame->next->frame
53 : frame->frame, 8));
54}
55
d2427a71
RH
56/* This is the definition of CALL_DUMMY_ADDRESS. It's a heuristic that is used
57 to find a convenient place in the text segment to stick a breakpoint to
58 detect the completion of a target function call (ala call_function_by_hand).
59 */
60
61static CORE_ADDR
62alpha_call_dummy_address (void)
63{
64 CORE_ADDR entry;
65 struct minimal_symbol *sym;
66
67 entry = entry_point_address ();
68
69 if (entry != 0)
70 return entry;
71
72 sym = lookup_minimal_symbol ("_Prelude", NULL, symfile_objfile);
73
74 if (!sym || MSYMBOL_TYPE (sym) != mst_text)
75 return 0;
76 else
77 return SYMBOL_VALUE_ADDRESS (sym) + 4;
78}
79
36a6271d
JT
80static void
81alpha_osf1_init_abi (struct gdbarch_info info,
82 struct gdbarch *gdbarch)
83{
84 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
85
6c72f9f9 86 set_gdbarch_pc_in_sigtramp (gdbarch, alpha_osf1_pc_in_sigtramp);
c8edd8b4
JB
87 /* The next/step support via procfs on OSF1 is broken when running
88 on multi-processor machines. We need to use software single stepping
89 instead. */
90 set_gdbarch_software_single_step (gdbarch, alpha_software_single_step);
6c72f9f9 91
d2427a71
RH
92 /* Alpha OSF/1 inhibits execution of code on the stack. But there is
93 no need for a dummy on the Alpha. PUSH_ARGUMENTS takes care of all
94 argument handling and bp_call_dummy takes care of stopping the dummy. */
95 set_gdbarch_call_dummy_address (gdbarch, alpha_call_dummy_address);
96
36a6271d 97 tdep->skip_sigtramp_frame = alpha_osf1_skip_sigtramp_frame;
5868c862 98 tdep->sigcontext_addr = alpha_osf1_sigcontext_addr;
accc6d1f
JT
99
100 tdep->jb_pc = 2;
101 tdep->jb_elt_size = 8;
36a6271d
JT
102}
103
104void
105_initialize_alpha_osf1_tdep (void)
106{
05816f70
MK
107 gdbarch_register_osabi (bfd_arch_alpha, 0, GDB_OSABI_OSF1,
108 alpha_osf1_init_abi);
36a6271d 109}
This page took 0.106205 seconds and 4 git commands to generate.