Files
binutils-gdb/gdb/features/riscv/rebuild-csr-xml.sh
Nelson Chu 453c733fcf RISC-V: Update the rebuild-csr-xml.sh.
We add new arguments defined and aborted verisons for DECLARE_CSR to
support privileged versions controling in binutils.  Therefore, the
rebuild-csr-xml.sh should be updated, too.

	gdb/
	* features/riscv/rebuild-csr-xml.sh: Updated.
2020-06-12 09:44:02 +08:00

38 lines
990 B
Bash
Executable File

#! /bin/bash
RISCV_OPC_FILE=$1
RISCV_FEATURE_DIR=$2
function gen_csr_xml ()
{
bitsize=$1
cat <<EOF
<?xml version="1.0"?>
<!-- Copyright (C) 2018-2020 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. -->
<!DOCTYPE feature SYSTEM "gdb-target.dtd">
<feature name="org.gnu.gdb.riscv.csr">
EOF
if [ "$bitsize" = "64" ]; then
grep "^DECLARE_CSR(" ${RISCV_OPC_FILE} \
| sed /CSR_CLASS_.*_32/d \
| sed -e "s!DECLARE_CSR(\(.*\), .*, .*, .*, .*! <reg name=\"\1\" bitsize=\"$bitsize\"/>!"
echo "</feature>"
else
grep "^DECLARE_CSR(" ${RISCV_OPC_FILE} \
| sed -e "s!DECLARE_CSR(\(.*\), .*, .*, .*, .*! <reg name=\"\1\" bitsize=\"$bitsize\"/>!"
echo "</feature>"
fi
}
gen_csr_xml 32 > ${RISCV_FEATURE_DIR}/32bit-csr.xml
gen_csr_xml 64 > ${RISCV_FEATURE_DIR}/64bit-csr.xml