* emultempl/elf32.em (gld${EMULATION_NAME}_get_script): Add combreloc
[deliverable/binutils-gdb.git] / gdb / hppa-hpux-tdep.c
CommitLineData
273f8429
JB
1/* Target-dependent code for HPUX running on PA-RISC, for GDB.
2 Copyright 2002 Free Software Foundation, Inc.
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
18Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
19
20#include "defs.h"
21#include "arch-utils.h"
60e1ff27 22#include "gdbcore.h"
273f8429
JB
23#include "osabi.h"
24
25/* Forward declarations. */
26extern void _initialize_hppa_hpux_tdep (void);
27extern initialize_file_ftype _initialize_hppa_hpux_tdep;
28
60e1ff27
JB
29/* FIXME: brobecker 2002-12-25. The following functions will eventually
30 become static, after the multiarching conversion is done. */
31int hppa_hpux_pc_in_sigtramp (CORE_ADDR pc, char *name);
32void hppa_hpux_frame_saved_pc_in_sigtramp (struct frame_info *fi,
33 CORE_ADDR *tmp);
34void hppa_hpux_frame_base_before_sigtramp (struct frame_info *fi,
35 CORE_ADDR *tmp);
36void hppa_hpux_frame_find_saved_regs_in_sigtramp
37 (struct frame_info *fi, struct frame_saved_regs *fsr);
38
39int
40hppa_hpux_pc_in_sigtramp (CORE_ADDR pc, char *name)
41{
42 /* Actually, for a PA running HPUX the kernel calls the signal handler
43 without an intermediate trampoline. Luckily the kernel always sets
44 the return pointer for the signal handler to point to _sigreturn. */
45 return (name && (strcmp ("_sigreturn", name) == 0));
46}
47
48/* For hppa_hpux_frame_saved_pc_in_sigtramp,
49 hppa_hpux_frame_base_before_sigtramp and
50 hppa_hpux_frame_find_saved_regs_in_sigtramp:
51
52 The signal context structure pointer is always saved at the base
53 of the frame which "calls" the signal handler. We only want to find
54 the hardware save state structure, which lives 10 32bit words into
55 sigcontext structure.
56
57 Within the hardware save state structure, registers are found in the
58 same order as the register numbers in GDB.
59
60 At one time we peeked at %r31 rather than the PC queues to determine
61 what instruction took the fault. This was done on purpose, but I don't
62 remember why. Looking at the PC queues is really the right way, and
63 I don't remember why that didn't work when this code was originally
64 written. */
65
66void
67hppa_hpux_frame_saved_pc_in_sigtramp (struct frame_info *fi, CORE_ADDR *tmp)
68{
69 *tmp = read_memory_integer (fi->frame + (43 * 4), 4);
70}
71
72void
73hppa_hpux_frame_base_before_sigtramp (struct frame_info *fi,
74 CORE_ADDR *tmp)
75{
76 *tmp = read_memory_integer (fi->frame + (40 * 4), 4);
77}
78
79void
80hppa_hpux_frame_find_saved_regs_in_sigtramp (struct frame_info *fi,
81 struct frame_saved_regs *fsr)
82{
83 int i;
84 const CORE_ADDR tmp = (fi)->frame + (10 * 4);
85
86 for (i = 0; i < NUM_REGS; i++)
87 {
88 if (i == SP_REGNUM)
89 (fsr)->regs[SP_REGNUM] = read_memory_integer (tmp + SP_REGNUM * 4, 4);
90 else
91 (fsr)->regs[i] = tmp + i * 4;
92 }
93}
94
95
273f8429
JB
96static void
97hppa_hpux_som_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
98{
99}
100
101static void
102hppa_hpux_elf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
103{
104}
105
106void
107_initialize_hppa_hpux_tdep (void)
108{
05816f70 109 gdbarch_register_osabi (bfd_arch_hppa, 0, GDB_OSABI_HPUX_SOM,
273f8429 110 hppa_hpux_som_init_abi);
05816f70 111 gdbarch_register_osabi (bfd_arch_hppa, 0, GDB_OSABI_HPUX_ELF,
273f8429
JB
112 hppa_hpux_elf_init_abi);
113}
This page took 0.046728 seconds and 4 git commands to generate.