GDB (API)
/home/stan/gdb/src/gdb/alpha-osf1-tdep.c
Go to the documentation of this file.
00001 /* Target-dependent code for OSF/1 on Alpha.
00002    Copyright (C) 2002-2013 Free Software Foundation, Inc.
00003 
00004    This file is part of GDB.
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 3 of the License, or
00009    (at your option) any later version.
00010 
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00018 
00019 #include "defs.h"
00020 #include "frame.h"
00021 #include "gdbcore.h"
00022 #include "value.h"
00023 #include "osabi.h"
00024 #include "gdb_string.h"
00025 #include "objfiles.h"
00026 
00027 #include "alpha-tdep.h"
00028 
00029 static int
00030 alpha_osf1_pc_in_sigtramp (struct gdbarch *gdbarch,
00031                            CORE_ADDR pc, const char *func_name)
00032 {
00033   return (func_name != NULL && strcmp ("__sigtramp", func_name) == 0);
00034 }
00035 
00036 static CORE_ADDR
00037 alpha_osf1_sigcontext_addr (struct frame_info *this_frame)
00038 {
00039   struct gdbarch *gdbarch = get_frame_arch (this_frame);
00040   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
00041   struct frame_info *next_frame = get_next_frame (this_frame);
00042   struct frame_id next_id = null_frame_id;
00043   
00044   if (next_frame != NULL)
00045     next_id = get_frame_id (next_frame);
00046 
00047   return (read_memory_integer (next_id.stack_addr, 8, byte_order));
00048 }
00049 
00050 static void
00051 alpha_osf1_init_abi (struct gdbarch_info info,
00052                      struct gdbarch *gdbarch)
00053 {
00054   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
00055 
00056   /* Hook into the MDEBUG frame unwinder.  */
00057   alpha_mdebug_init_abi (info, gdbarch);
00058 
00059   /* The next/step support via procfs on OSF1 is broken when running
00060      on multi-processor machines.  We need to use software single
00061      stepping instead.  */
00062   set_gdbarch_software_single_step (gdbarch, alpha_software_single_step);
00063 
00064   tdep->sigcontext_addr = alpha_osf1_sigcontext_addr;
00065   tdep->pc_in_sigtramp = alpha_osf1_pc_in_sigtramp;
00066 
00067   tdep->jb_pc = 2;
00068   tdep->jb_elt_size = 8;
00069 }
00070 
00071 /* Provide a prototype to silence -Wmissing-prototypes.  */
00072 extern initialize_file_ftype _initialize_alpha_osf1_tdep;
00073 
00074 void
00075 _initialize_alpha_osf1_tdep (void)
00076 {
00077   gdbarch_register_osabi (bfd_arch_alpha, 0, GDB_OSABI_OSF1,
00078                           alpha_osf1_init_abi);
00079 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines