2002-02-01 22:05:28 +00:00
|
|
|
#!/bin/sh -u
|
|
|
|
|
|
|
|
# Register protocol definitions for GDB, the GNU debugger.
|
2011-01-01 15:34:07 +00:00
|
|
|
# Copyright 2001, 2002, 2007, 2008, 2009, 2010, 2011
|
|
|
|
# Free Software Foundation, Inc.
|
2002-02-01 22:05:28 +00:00
|
|
|
#
|
|
|
|
# This file is part of GDB.
|
|
|
|
#
|
|
|
|
# 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
|
2007-08-23 18:19:51 +00:00
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
2002-02-01 22:05:28 +00:00
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2007-08-23 18:19:51 +00:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2002-02-01 22:05:28 +00:00
|
|
|
|
|
|
|
move_if_change ()
|
|
|
|
{
|
|
|
|
file=$1
|
|
|
|
if test -r ${file} && cmp -s "${file}" new-"${file}"
|
|
|
|
then
|
|
|
|
echo "${file} unchanged." 1>&2
|
|
|
|
else
|
|
|
|
mv new-"${file}" "${file}"
|
|
|
|
echo "${file} updated." 1>&2
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Format of the input files
|
|
|
|
read="type entry"
|
|
|
|
|
|
|
|
do_read ()
|
|
|
|
{
|
|
|
|
type=""
|
|
|
|
entry=""
|
|
|
|
while read line
|
|
|
|
do
|
|
|
|
if test "${line}" = ""
|
|
|
|
then
|
|
|
|
continue
|
|
|
|
elif test "${line}" = "#" -a "${comment}" = ""
|
|
|
|
then
|
|
|
|
continue
|
|
|
|
elif expr "${line}" : "#" > /dev/null
|
|
|
|
then
|
|
|
|
comment="${comment}
|
|
|
|
${line}"
|
|
|
|
else
|
|
|
|
|
|
|
|
# The semantics of IFS varies between different SH's. Some
|
|
|
|
# treat ``::' as three fields while some treat it as just too.
|
|
|
|
# Work around this by eliminating ``::'' ....
|
|
|
|
line="`echo "${line}" | sed -e 's/::/: :/g' -e 's/::/: :/g'`"
|
|
|
|
|
|
|
|
OFS="${IFS}" ; IFS="[:]"
|
|
|
|
eval read ${read} <<EOF
|
|
|
|
${line}
|
|
|
|
EOF
|
|
|
|
IFS="${OFS}"
|
|
|
|
|
|
|
|
# .... and then going back through each field and strip out those
|
|
|
|
# that ended up with just that space character.
|
|
|
|
for r in ${read}
|
|
|
|
do
|
|
|
|
if eval test \"\${${r}}\" = \"\ \"
|
|
|
|
then
|
|
|
|
eval ${r}=""
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ -n "${type}" ]
|
|
|
|
then
|
|
|
|
true
|
|
|
|
else
|
|
|
|
false
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
if test ! -r $1; then
|
|
|
|
echo "$0: Could not open $1." 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
copyright ()
|
|
|
|
{
|
|
|
|
cat <<EOF
|
|
|
|
/* *INDENT-OFF* */ /* THIS FILE IS GENERATED */
|
|
|
|
|
|
|
|
/* A register protocol for GDB, the GNU debugger.
|
|
|
|
Copyright 2001, 2002 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
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
|
2009-12-20 11:51:30 +00:00
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
2002-02-01 22:05:28 +00:00
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2009-12-20 11:51:30 +00:00
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
2002-02-01 22:05:28 +00:00
|
|
|
|
|
|
|
/* This file was created with the aid of \`\`regdat.sh'' and \`\`$1''. */
|
|
|
|
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
exec > new-$2
|
|
|
|
copyright $1
|
gdb/gdbserver/
* server.h (LONGEST): New.
(struct thread_info) <while_stepping>: New field.
(unpack_varlen_hex, xrealloc, pulongest, plongest, phex_nz):
Declare.
(initialize_tracepoint, handle_tracepoint_general_set)
(handle_tracepoint_query, tracepoint_finished_step)
(tracepoint_was_hit, release_while_stepping_state_list):
(current_traceframe): Declare.
* server.c (handle_general_set): Handle tracepoint packets.
(read_memory): New.
(write_memory): New.
(handle_search_memory_1): Use read_memory.
(handle_query): Report support for conditional tracepoints, trace
state variables, and tracepoint sources. Handle tracepoint
queries.
(main): Initialize the tracepoints module.
(process_serial_event): Handle traceframe reads/writes.
* linux-low.c (handle_tracepoints): New.
(linux_wait_1): Call it.
(linux_resume_one_lwp): Handle while-stepping.
(linux_supports_tracepoints, linux_read_pc, linux_write_pc): New.
(linux_target_ops): Install them.
* linux-low.h (struct linux_target_ops) <supports_tracepoints>:
New field.
* linux-x86-low.c (x86_supports_tracepoints): New.
(the_low_target). Install it.
* mem-break.h (delete_breakpoint): Declare.
* mem-break.c (delete_breakpoint): Make external.
* target.h (struct target_ops): Add `supports_tracepoints',
`read_pc', and `write_pc' fields.
(target_supports_tracepoints): Define.
* utils.c (xrealloc, decimal2str, pulongest, plongest, thirty_two)
(phex_nz): New.
* regcache.h (struct regcache) <registers_owned>: New field.
(init_register_cache, regcache_cpy): Declare.
(regcache_read_pc, regcache_write_pc): Declare.
(register_cache_size): Declare.
(supply_regblock): Declare.
* regcache.c (init_register_cache): New.
(new_register_cache): Use it.
(regcache_cpy): New.
(register_cache_size): New.
(supply_regblock): New.
(regcache_read_pc, regcache_write_pc): New.
* tracepoint.c: New.
* Makefile.in (OBS): Add tracepoint.o.
(tracepoint.o): New rule.
gdb/
* regformats/regdat.sh: Include server.h. Don't include
regcache.h.
2010-04-09 03:40:00 +00:00
|
|
|
echo '#include "server.h"'
|
2002-02-01 22:05:28 +00:00
|
|
|
echo '#include "regdef.h"'
|
|
|
|
echo
|
|
|
|
offset=0
|
|
|
|
i=0
|
|
|
|
name=x
|
2008-02-28 05:54:10 +00:00
|
|
|
xmltarget=x
|
2009-07-20 18:51:42 +00:00
|
|
|
xmlarch=x
|
|
|
|
xmlosabi=x
|
2002-02-01 22:05:28 +00:00
|
|
|
expedite=x
|
|
|
|
exec < $1
|
|
|
|
while do_read
|
|
|
|
do
|
|
|
|
if test "${type}" = "name"; then
|
|
|
|
name="${entry}"
|
|
|
|
echo "struct reg regs_${name}[] = {"
|
|
|
|
continue
|
2008-02-28 05:54:10 +00:00
|
|
|
elif test "${type}" = "xmltarget"; then
|
|
|
|
xmltarget="${entry}"
|
|
|
|
continue
|
|
|
|
elif test "${type}" = "xmlarch"; then
|
2009-07-20 18:51:42 +00:00
|
|
|
xmlarch="${entry}"
|
|
|
|
continue
|
|
|
|
elif test "${type}" = "osabi"; then
|
|
|
|
xmlosabi="${entry}"
|
2008-02-28 05:54:10 +00:00
|
|
|
continue
|
2002-02-01 22:05:28 +00:00
|
|
|
elif test "${type}" = "expedite"; then
|
|
|
|
expedite="${entry}"
|
|
|
|
continue
|
|
|
|
elif test "${name}" = x; then
|
|
|
|
echo "$0: $1 does not specify \`\`name''." 1>&2
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo " { \"${entry}\", ${offset}, ${type} },"
|
|
|
|
offset=`expr ${offset} + ${type}`
|
|
|
|
i=`expr $i + 1`
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "};"
|
|
|
|
echo
|
2002-02-04 22:45:49 +00:00
|
|
|
echo "const char *expedite_regs_${name}[] = { \"`echo ${expedite} | sed 's/,/", "/g'`\", 0 };"
|
2008-02-28 05:54:10 +00:00
|
|
|
if test "${xmltarget}" = x; then
|
2009-07-20 18:51:42 +00:00
|
|
|
if test "${xmlarch}" = x && test "${xmlosabi}" = x; then
|
|
|
|
echo "const char *xmltarget_${name} = 0;"
|
|
|
|
else
|
|
|
|
echo "const char *xmltarget_${name} = \"@<target>\\"
|
|
|
|
if test "${xmlarch}" != x; then
|
|
|
|
echo "<architecture>${xmlarch}</architecture>\\"
|
|
|
|
fi
|
|
|
|
if test "${xmlosabi}" != x; then
|
|
|
|
echo "<osabi>${xmlosabi}</osabi>\\"
|
|
|
|
fi
|
|
|
|
echo "</target>\";"
|
|
|
|
fi
|
2008-02-28 05:54:10 +00:00
|
|
|
else
|
|
|
|
echo "const char *xmltarget_${name} = \"${xmltarget}\";"
|
|
|
|
fi
|
2002-02-14 06:21:24 +00:00
|
|
|
echo
|
|
|
|
|
|
|
|
cat <<EOF
|
|
|
|
void
|
2008-02-27 03:27:40 +00:00
|
|
|
init_registers_${name} ()
|
2002-02-14 06:21:24 +00:00
|
|
|
{
|
|
|
|
set_register_cache (regs_${name},
|
|
|
|
sizeof (regs_${name}) / sizeof (regs_${name}[0]));
|
|
|
|
gdbserver_expedite_regs = expedite_regs_${name};
|
2008-02-28 05:54:10 +00:00
|
|
|
gdbserver_xmltarget = xmltarget_${name};
|
2002-02-14 06:21:24 +00:00
|
|
|
}
|
|
|
|
EOF
|
2002-02-01 22:05:28 +00:00
|
|
|
|
|
|
|
# close things off
|
|
|
|
exec 1>&2
|
|
|
|
move_if_change $2
|