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

Subversion Repositories or1k

[/] [or1k/] [tags/] [VER_5_3/] [gdb-5.3/] [gdb/] [regformats/] [regdat.sh] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1181 sfurman
#!/bin/sh -u
2
 
3
# Register protocol definitions for GDB, the GNU debugger.
4
# Copyright 2001, 2002 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 2 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, write to the Free Software
20
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21
 
22
move_if_change ()
23
{
24
    file=$1
25
    if test -r ${file} && cmp -s "${file}" new-"${file}"
26
    then
27
        echo "${file} unchanged." 1>&2
28
    else
29
        mv new-"${file}" "${file}"
30
        echo "${file} updated." 1>&2
31
    fi
32
}
33
 
34
# Format of the input files
35
read="type entry"
36
 
37
do_read ()
38
{
39
    type=""
40
    entry=""
41
    while read line
42
    do
43
        if test "${line}" = ""
44
        then
45
            continue
46
        elif test "${line}" = "#" -a "${comment}" = ""
47
        then
48
            continue
49
        elif expr "${line}" : "#" > /dev/null
50
        then
51
            comment="${comment}
52
${line}"
53
        else
54
 
55
            # The semantics of IFS varies between different SH's.  Some
56
            # treat ``::' as three fields while some treat it as just too.
57
            # Work around this by eliminating ``::'' ....
58
            line="`echo "${line}" | sed -e 's/::/: :/g' -e 's/::/: :/g'`"
59
 
60
            OFS="${IFS}" ; IFS="[:]"
61
            eval read ${read} <<EOF
62
${line}
63
EOF
64
            IFS="${OFS}"
65
 
66
            # .... and then going back through each field and strip out those
67
            # that ended up with just that space character.
68
            for r in ${read}
69
            do
70
                if eval test \"\${${r}}\" = \"\ \"
71
                then
72
                    eval ${r}=""
73
                fi
74
            done
75
 
76
            break
77
        fi
78
    done
79
    if [ -n "${type}" ]
80
    then
81
        true
82
    else
83
        false
84
    fi
85
}
86
 
87
if test ! -r $1; then
88
  echo "$0: Could not open $1." 1>&2
89
  exit 1
90
fi
91
 
92
copyright ()
93
{
94
cat <<EOF
95
/* *INDENT-OFF* */ /* THIS FILE IS GENERATED */
96
 
97
/* A register protocol for GDB, the GNU debugger.
98
   Copyright 2001, 2002 Free Software Foundation, Inc.
99
 
100
   This file is part of GDB.
101
 
102
   This program is free software; you can redistribute it and/or modify
103
   it under the terms of the GNU General Public License as published by
104
   the Free Software Foundation; either version 2 of the License, or
105
   (at your option) any later version.
106
 
107
   This program is distributed in the hope that it will be useful,
108
   but WITHOUT ANY WARRANTY; without even the implied warranty of
109
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
110
   GNU General Public License for more details.
111
 
112
   You should have received a copy of the GNU General Public License
113
   along with this program; if not, write to the Free Software
114
   Foundation, Inc., 59 Temple Place - Suite 330,
115
   Boston, MA 02111-1307, USA.  */
116
 
117
/* This file was created with the aid of \`\`regdat.sh'' and \`\`$1''.  */
118
 
119
EOF
120
}
121
 
122
 
123
exec > new-$2
124
copyright $1
125
echo '#include "regdef.h"'
126
echo '#include "regcache.h"'
127
echo
128
offset=0
129
i=0
130
name=x
131
expedite=x
132
exec < $1
133
while do_read
134
do
135
  if test "${type}" = "name"; then
136
    name="${entry}"
137
    echo "struct reg regs_${name}[] = {"
138
    continue
139
  elif test "${type}" = "expedite"; then
140
    expedite="${entry}"
141
    continue
142
  elif test "${name}" = x; then
143
    echo "$0: $1 does not specify \`\`name''." 1>&2
144
    exit 1
145
  else
146
    echo "  { \"${entry}\", ${offset}, ${type} },"
147
    offset=`expr ${offset} + ${type}`
148
    i=`expr $i + 1`
149
  fi
150
done
151
 
152
echo "};"
153
echo
154
echo "const char *expedite_regs_${name}[] = { \"`echo ${expedite} | sed 's/,/", "/g'`\", 0 };"
155
echo
156
 
157
cat <<EOF
158
void
159
init_registers ()
160
{
161
    set_register_cache (regs_${name},
162
                        sizeof (regs_${name}) / sizeof (regs_${name}[0]));
163
    gdbserver_expedite_regs = expedite_regs_${name};
164
}
165
EOF
166
 
167
# close things off
168
exec 1>&2
169
move_if_change $2

powered by: WebSVN 2.1.0

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