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