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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-6.8/] [gdb/] [regformats/] [regdat.sh] - Diff between revs 827 and 840

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 827 Rev 840
#!/bin/sh -u
#!/bin/sh -u
 
 
# Register protocol definitions for GDB, the GNU debugger.
# Register protocol definitions for GDB, the GNU debugger.
# Copyright 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
# Copyright 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
#
#
# This file is part of GDB.
# This file is part of GDB.
#
#
# This program is free software; you can redistribute it and/or modify
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
move_if_change ()
move_if_change ()
{
{
    file=$1
    file=$1
    if test -r ${file} && cmp -s "${file}" new-"${file}"
    if test -r ${file} && cmp -s "${file}" new-"${file}"
    then
    then
        echo "${file} unchanged." 1>&2
        echo "${file} unchanged." 1>&2
    else
    else
        mv new-"${file}" "${file}"
        mv new-"${file}" "${file}"
        echo "${file} updated." 1>&2
        echo "${file} updated." 1>&2
    fi
    fi
}
}
 
 
# Format of the input files
# Format of the input files
read="type entry"
read="type entry"
 
 
do_read ()
do_read ()
{
{
    type=""
    type=""
    entry=""
    entry=""
    while read line
    while read line
    do
    do
        if test "${line}" = ""
        if test "${line}" = ""
        then
        then
            continue
            continue
        elif test "${line}" = "#" -a "${comment}" = ""
        elif test "${line}" = "#" -a "${comment}" = ""
        then
        then
            continue
            continue
        elif expr "${line}" : "#" > /dev/null
        elif expr "${line}" : "#" > /dev/null
        then
        then
            comment="${comment}
            comment="${comment}
${line}"
${line}"
        else
        else
 
 
            # The semantics of IFS varies between different SH's.  Some
            # The semantics of IFS varies between different SH's.  Some
            # treat ``::' as three fields while some treat it as just too.
            # treat ``::' as three fields while some treat it as just too.
            # Work around this by eliminating ``::'' ....
            # Work around this by eliminating ``::'' ....
            line="`echo "${line}" | sed -e 's/::/: :/g' -e 's/::/: :/g'`"
            line="`echo "${line}" | sed -e 's/::/: :/g' -e 's/::/: :/g'`"
 
 
            OFS="${IFS}" ; IFS="[:]"
            OFS="${IFS}" ; IFS="[:]"
            eval read ${read} <<EOF
            eval read ${read} <<EOF
${line}
${line}
EOF
EOF
            IFS="${OFS}"
            IFS="${OFS}"
 
 
            # .... and then going back through each field and strip out those
            # .... and then going back through each field and strip out those
            # that ended up with just that space character.
            # that ended up with just that space character.
            for r in ${read}
            for r in ${read}
            do
            do
                if eval test \"\${${r}}\" = \"\ \"
                if eval test \"\${${r}}\" = \"\ \"
                then
                then
                    eval ${r}=""
                    eval ${r}=""
                fi
                fi
            done
            done
 
 
            break
            break
        fi
        fi
    done
    done
    if [ -n "${type}" ]
    if [ -n "${type}" ]
    then
    then
        true
        true
    else
    else
        false
        false
    fi
    fi
}
}
 
 
if test ! -r $1; then
if test ! -r $1; then
  echo "$0: Could not open $1." 1>&2
  echo "$0: Could not open $1." 1>&2
  exit 1
  exit 1
fi
fi
 
 
copyright ()
copyright ()
{
{
cat <<EOF
cat <<EOF
/* *INDENT-OFF* */ /* THIS FILE IS GENERATED */
/* *INDENT-OFF* */ /* THIS FILE IS GENERATED */
 
 
/* A register protocol for GDB, the GNU debugger.
/* A register protocol for GDB, the GNU debugger.
   Copyright 2001, 2002 Free Software Foundation, Inc.
   Copyright 2001, 2002 Free Software Foundation, Inc.
 
 
   This file is part of GDB.
   This file is part of GDB.
 
 
   This program is free software; you can redistribute it and/or modify
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
   (at your option) any later version.
 
 
   This program is distributed in the hope that it will be useful,
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   GNU General Public License for more details.
 
 
   You should have received a copy of the GNU General Public License
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330,
   Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.  */
   Boston, MA 02111-1307, USA.  */
 
 
/* This file was created with the aid of \`\`regdat.sh'' and \`\`$1''.  */
/* This file was created with the aid of \`\`regdat.sh'' and \`\`$1''.  */
 
 
EOF
EOF
}
}
 
 
 
 
exec > new-$2
exec > new-$2
copyright $1
copyright $1
echo '#include "regdef.h"'
echo '#include "regdef.h"'
echo '#include "regcache.h"'
echo '#include "regcache.h"'
echo
echo
offset=0
offset=0
i=0
i=0
name=x
name=x
expedite=x
expedite=x
exec < $1
exec < $1
while do_read
while do_read
do
do
  if test "${type}" = "name"; then
  if test "${type}" = "name"; then
    name="${entry}"
    name="${entry}"
    echo "struct reg regs_${name}[] = {"
    echo "struct reg regs_${name}[] = {"
    continue
    continue
  elif test "${type}" = "expedite"; then
  elif test "${type}" = "expedite"; then
    expedite="${entry}"
    expedite="${entry}"
    continue
    continue
  elif test "${name}" = x; then
  elif test "${name}" = x; then
    echo "$0: $1 does not specify \`\`name''." 1>&2
    echo "$0: $1 does not specify \`\`name''." 1>&2
    exit 1
    exit 1
  else
  else
    echo "  { \"${entry}\", ${offset}, ${type} },"
    echo "  { \"${entry}\", ${offset}, ${type} },"
    offset=`expr ${offset} + ${type}`
    offset=`expr ${offset} + ${type}`
    i=`expr $i + 1`
    i=`expr $i + 1`
  fi
  fi
done
done
 
 
echo "};"
echo "};"
echo
echo
echo "const char *expedite_regs_${name}[] = { \"`echo ${expedite} | sed 's/,/", "/g'`\", 0 };"
echo "const char *expedite_regs_${name}[] = { \"`echo ${expedite} | sed 's/,/", "/g'`\", 0 };"
echo
echo
 
 
cat <<EOF
cat <<EOF
void
void
init_registers ()
init_registers ()
{
{
    set_register_cache (regs_${name},
    set_register_cache (regs_${name},
                        sizeof (regs_${name}) / sizeof (regs_${name}[0]));
                        sizeof (regs_${name}) / sizeof (regs_${name}[0]));
    gdbserver_expedite_regs = expedite_regs_${name};
    gdbserver_expedite_regs = expedite_regs_${name};
}
}
EOF
EOF
 
 
# close things off
# close things off
exec 1>&2
exec 1>&2
move_if_change $2
move_if_change $2
 
 

powered by: WebSVN 2.1.0

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