Add tests for PR ld/16452 and PR ld/16457
[platform/upstream/binutils.git] / gdb / alpha-osf1-tdep.c
1 /* Target-dependent code for OSF/1 on Alpha.
2    Copyright (C) 2002-2014 Free Software Foundation, Inc.
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 3 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, see <http://www.gnu.org/licenses/>.  */
18
19 #include "defs.h"
20 #include "frame.h"
21 #include "gdbcore.h"
22 #include "value.h"
23 #include "osabi.h"
24 #include "objfiles.h"
25
26 #include "alpha-tdep.h"
27
28 static int
29 alpha_osf1_pc_in_sigtramp (struct gdbarch *gdbarch,
30                            CORE_ADDR pc, const char *func_name)
31 {
32   return (func_name != NULL && strcmp ("__sigtramp", func_name) == 0);
33 }
34
35 static CORE_ADDR
36 alpha_osf1_sigcontext_addr (struct frame_info *this_frame)
37 {
38   struct gdbarch *gdbarch = get_frame_arch (this_frame);
39   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
40   struct frame_info *next_frame = get_next_frame (this_frame);
41   struct frame_id next_id = null_frame_id;
42   
43   if (next_frame != NULL)
44     next_id = get_frame_id (next_frame);
45
46   return (read_memory_integer (next_id.stack_addr, 8, byte_order));
47 }
48
49 static void
50 alpha_osf1_init_abi (struct gdbarch_info info,
51                      struct gdbarch *gdbarch)
52 {
53   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
54
55   /* Hook into the MDEBUG frame unwinder.  */
56   alpha_mdebug_init_abi (info, gdbarch);
57
58   /* The next/step support via procfs on OSF1 is broken when running
59      on multi-processor machines.  We need to use software single
60      stepping instead.  */
61   set_gdbarch_software_single_step (gdbarch, alpha_software_single_step);
62
63   tdep->sigcontext_addr = alpha_osf1_sigcontext_addr;
64   tdep->pc_in_sigtramp = alpha_osf1_pc_in_sigtramp;
65
66   tdep->jb_pc = 2;
67   tdep->jb_elt_size = 8;
68 }
69
70 /* Provide a prototype to silence -Wmissing-prototypes.  */
71 extern initialize_file_ftype _initialize_alpha_osf1_tdep;
72
73 void
74 _initialize_alpha_osf1_tdep (void)
75 {
76   gdbarch_register_osabi (bfd_arch_alpha, 0, GDB_OSABI_OSF1,
77                           alpha_osf1_init_abi);
78 }