OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [gdb/] [arm-wince-tdep.c] - Blame information for rev 157

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
/* Target-dependent code for Windows CE running on ARM processors,
2
   for GDB.
3
 
4
   Copyright (C) 2007, 2008 Free Software Foundation, Inc.
5
 
6
   This file is part of GDB.
7
 
8
   This program is free software; you can redistribute it and/or modify
9
   it under the terms of the GNU General Public License as published by
10
   the Free Software Foundation; either version 3 of the License, or
11
   (at your option) any later version.
12
 
13
   This program is distributed in the hope that it will be useful,
14
   but WITHOUT ANY WARRANTY; without even the implied warranty of
15
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
   GNU General Public License for more details.
17
 
18
   You should have received a copy of the GNU General Public License
19
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
20
 
21
#include "defs.h"
22
#include "osabi.h"
23
#include "gdbcore.h"
24
#include "target.h"
25
#include "solib.h"
26
#include "solib-target.h"
27
 
28
#include "gdb_string.h"
29
 
30
#include "arm-tdep.h"
31
 
32
static const char arm_wince_le_breakpoint[] = { 0x10, 0x00, 0x00, 0xe6 };
33
static const char arm_wince_thumb_le_breakpoint[] = { 0xfe, 0xdf };
34
 
35
/* Description of the longjmp buffer.  */
36
#define ARM_WINCE_JB_ELEMENT_SIZE       INT_REGISTER_SIZE
37
#define ARM_WINCE_JB_PC                 10
38
 
39
static CORE_ADDR
40
arm_pe_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
41
{
42
  ULONGEST indirect;
43
  struct minimal_symbol *indsym;
44
  char *symname;
45
  CORE_ADDR next_pc;
46
 
47
  /* The format of an ARM DLL trampoline is:
48
       ldr  ip, [pc]
49
       ldr  pc, [ip]
50
       .dw __imp_<func>  */
51
 
52
  if (pc == 0
53
      || read_memory_unsigned_integer (pc + 0, 4) != 0xe59fc000
54
      || read_memory_unsigned_integer (pc + 4, 4) != 0xe59cf000)
55
    return 0;
56
 
57
  indirect = read_memory_unsigned_integer (pc + 8, 4);
58
  if (indirect == 0)
59
    return 0;
60
 
61
  indsym = lookup_minimal_symbol_by_pc (indirect);
62
  if (indsym == NULL)
63
    return 0;
64
 
65
  symname = SYMBOL_LINKAGE_NAME (indsym);
66
  if (symname == NULL || strncmp (symname, "__imp_", 6) != 0)
67
    return 0;
68
 
69
  next_pc = read_memory_unsigned_integer (indirect, 4);
70
  if (next_pc != 0)
71
    return next_pc;
72
 
73
  /* Check with the default arm gdbarch_skip_trampoline.  */
74
  return arm_skip_stub (frame, pc);
75
}
76
 
77
static void
78
arm_wince_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
79
{
80
  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
81
 
82
  tdep->arm_breakpoint = arm_wince_le_breakpoint;
83
  tdep->arm_breakpoint_size = sizeof (arm_wince_le_breakpoint);
84
  tdep->thumb_breakpoint = arm_wince_thumb_le_breakpoint;
85
  tdep->thumb_breakpoint_size = sizeof (arm_wince_thumb_le_breakpoint);
86
  tdep->struct_return = pcc_struct_return;
87
 
88
  tdep->fp_model = ARM_FLOAT_SOFT_VFP;
89
 
90
  tdep->jb_pc = ARM_WINCE_JB_PC;
91
  tdep->jb_elt_size = ARM_WINCE_JB_ELEMENT_SIZE;
92
 
93
  /* On ARM WinCE char defaults to signed.  */
94
  set_gdbarch_char_signed (gdbarch, 1);
95
 
96
  /* Shared library handling.  */
97
  set_solib_ops (gdbarch, &solib_target_so_ops);
98
  set_gdbarch_skip_trampoline_code (gdbarch, arm_pe_skip_trampoline_code);
99
 
100
  /* Single stepping.  */
101
  set_gdbarch_software_single_step (gdbarch, arm_software_single_step);
102
}
103
 
104
static enum gdb_osabi
105
arm_wince_osabi_sniffer (bfd *abfd)
106
{
107
  const char *target_name = bfd_get_target (abfd);
108
 
109
  if (strcmp (target_name, "pei-arm-wince-little") == 0)
110
    return GDB_OSABI_WINCE;
111
 
112
  return GDB_OSABI_UNKNOWN;
113
}
114
 
115
/* Provide a prototype to silence -Wmissing-prototypes.  */
116
void _initialize_arm_wince_tdep (void);
117
 
118
void
119
_initialize_arm_wince_tdep (void)
120
{
121
  gdbarch_register_osabi_sniffer (bfd_arch_arm, bfd_target_coff_flavour,
122
                                  arm_wince_osabi_sniffer);
123
 
124
  gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_WINCE,
125
                          arm_wince_init_abi);
126
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.