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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [linux-tdep.c] - Blame information for rev 853

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
/* Target-dependent code for GNU/Linux, architecture independent.
2
 
3
   Copyright (C) 2009, 2010 Free Software Foundation, Inc.
4
 
5
   This file is part of GDB.
6
 
7
   This program is free software; you can redistribute it and/or modify
8
   it under the terms of the GNU General Public License as published by
9
   the Free Software Foundation; either version 3 of the License, or
10
   (at your option) any later version.
11
 
12
   This program is distributed in the hope that it will be useful,
13
   but WITHOUT ANY WARRANTY; without even the implied warranty of
14
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
   GNU General Public License for more details.
16
 
17
   You should have received a copy of the GNU General Public License
18
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
19
 
20
#include "defs.h"
21
#include "gdbtypes.h"
22
#include "linux-tdep.h"
23
#include "auxv.h"
24
#include "target.h"
25
#include "elf/common.h"
26
 
27
/* This function is suitable for architectures that don't
28
   extend/override the standard siginfo structure.  */
29
 
30
struct type *
31
linux_get_siginfo_type (struct gdbarch *gdbarch)
32
{
33
  struct type *int_type, *uint_type, *long_type, *void_ptr_type;
34
  struct type *uid_type, *pid_type;
35
  struct type *sigval_type, *clock_type;
36
  struct type *siginfo_type, *sifields_type;
37
  struct type *type;
38
 
39
  int_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
40
                                0, "int");
41
  uint_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
42
                                 1, "unsigned int");
43
  long_type = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch),
44
                                 0, "long");
45
  void_ptr_type = lookup_pointer_type (builtin_type (gdbarch)->builtin_void);
46
 
47
  /* sival_t */
48
  sigval_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION);
49
  TYPE_NAME (sigval_type) = xstrdup ("sigval_t");
50
  append_composite_type_field (sigval_type, "sival_int", int_type);
51
  append_composite_type_field (sigval_type, "sival_ptr", void_ptr_type);
52
 
53
  /* __pid_t */
54
  pid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, TYPE_LENGTH (int_type),
55
                        xstrdup ("__pid_t"));
56
  TYPE_TARGET_TYPE (pid_type) = int_type;
57
  TYPE_TARGET_STUB (pid_type) = 1;
58
 
59
  /* __uid_t */
60
  uid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, TYPE_LENGTH (uint_type),
61
                        xstrdup ("__uid_t"));
62
  TYPE_TARGET_TYPE (uid_type) = uint_type;
63
  TYPE_TARGET_STUB (uid_type) = 1;
64
 
65
  /* __clock_t */
66
  clock_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, TYPE_LENGTH (long_type),
67
                          xstrdup ("__clock_t"));
68
  TYPE_TARGET_TYPE (clock_type) = long_type;
69
  TYPE_TARGET_STUB (clock_type) = 1;
70
 
71
  /* _sifields */
72
  sifields_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION);
73
 
74
  {
75
    const int si_max_size = 128;
76
    int si_pad_size;
77
    int size_of_int = gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT;
78
 
79
    /* _pad */
80
    if (gdbarch_ptr_bit (gdbarch) == 64)
81
      si_pad_size = (si_max_size / size_of_int) - 4;
82
    else
83
      si_pad_size = (si_max_size / size_of_int) - 3;
84
    append_composite_type_field (sifields_type, "_pad",
85
                                 init_vector_type (int_type, si_pad_size));
86
  }
87
 
88
  /* _kill */
89
  type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
90
  append_composite_type_field (type, "si_pid", pid_type);
91
  append_composite_type_field (type, "si_uid", uid_type);
92
  append_composite_type_field (sifields_type, "_kill", type);
93
 
94
  /* _timer */
95
  type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
96
  append_composite_type_field (type, "si_tid", int_type);
97
  append_composite_type_field (type, "si_overrun", int_type);
98
  append_composite_type_field (type, "si_sigval", sigval_type);
99
  append_composite_type_field (sifields_type, "_timer", type);
100
 
101
  /* _rt */
102
  type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
103
  append_composite_type_field (type, "si_pid", pid_type);
104
  append_composite_type_field (type, "si_uid", uid_type);
105
  append_composite_type_field (type, "si_sigval", sigval_type);
106
  append_composite_type_field (sifields_type, "_rt", type);
107
 
108
  /* _sigchld */
109
  type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
110
  append_composite_type_field (type, "si_pid", pid_type);
111
  append_composite_type_field (type, "si_uid", uid_type);
112
  append_composite_type_field (type, "si_status", int_type);
113
  append_composite_type_field (type, "si_utime", clock_type);
114
  append_composite_type_field (type, "si_stime", clock_type);
115
  append_composite_type_field (sifields_type, "_sigchld", type);
116
 
117
  /* _sigfault */
118
  type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
119
  append_composite_type_field (type, "si_addr", void_ptr_type);
120
  append_composite_type_field (sifields_type, "_sigfault", type);
121
 
122
  /* _sigpoll */
123
  type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
124
  append_composite_type_field (type, "si_band", long_type);
125
  append_composite_type_field (type, "si_fd", int_type);
126
  append_composite_type_field (sifields_type, "_sigpoll", type);
127
 
128
  /* struct siginfo */
129
  siginfo_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
130
  TYPE_NAME (siginfo_type) = xstrdup ("siginfo");
131
  append_composite_type_field (siginfo_type, "si_signo", int_type);
132
  append_composite_type_field (siginfo_type, "si_errno", int_type);
133
  append_composite_type_field (siginfo_type, "si_code", int_type);
134
  append_composite_type_field_aligned (siginfo_type,
135
                                       "_sifields", sifields_type,
136
                                       TYPE_LENGTH (long_type));
137
 
138
  return siginfo_type;
139
}
140
 
141
int
142
linux_has_shared_address_space (void)
143
{
144
  /* Determine whether we are running on uClinux or normal Linux
145
     kernel.  */
146
  CORE_ADDR dummy;
147
  int target_is_uclinux;
148
 
149
  target_is_uclinux
150
    = (target_auxv_search (&current_target, AT_NULL, &dummy) > 0
151
       && target_auxv_search (&current_target, AT_PAGESZ, &dummy) == 0);
152
 
153
  return target_is_uclinux;
154
}

powered by: WebSVN 2.1.0

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