From: Tom de Vries Date: Wed, 18 May 2022 09:56:32 +0000 (+0200) Subject: [gdb/tdep] Add gdb/syscalls/update-linux-from-src.sh X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=192257c998507f8a6ad9a85394b4fd4c627552cb;p=binutils-gdb.git [gdb/tdep] Add gdb/syscalls/update-linux-from-src.sh Add a new script gdb/syscalls/update-linux-from-src.sh, that can be used to generate *-linux.xml.in files from linux kernel sources, like so: ... $ ./update-linux-from-src.sh ~/upstream/linux-stable.git Skipping aarch64-linux.xml.in, no syscall.tbl Generating amd64-linux.xml.in Skipping arm-linux.xml.in, use arm-linux.py instead Skipping bfin-linux.xml.in, no longer supported Generating i386-linux.xml.in Generating mips-n32-linux.xml.in Generating mips-n64-linux.xml.in Generating mips-o32-linux.xml.in Generating ppc64-linux.xml.in Generating ppc-linux.xml.in Generating s390-linux.xml.in Generating s390x-linux.xml.in Generating sparc64-linux.xml.in Generating sparc-linux.xml.in ... Update *-linux.xml.in and *-linux.xml using linux kernel tag v5.18-rc6. --- diff --git a/gdb/syscalls/amd64-linux.xml b/gdb/syscalls/amd64-linux.xml index 231308b72b7..cf2b5c88d54 100644 --- a/gdb/syscalls/amd64-linux.xml +++ b/gdb/syscalls/amd64-linux.xml @@ -7,7 +7,7 @@ notice and this notice are preserved. --> diff --git a/gdb/syscalls/amd64-linux.xml.in b/gdb/syscalls/amd64-linux.xml.in index 404d445988e..e2c8450352f 100644 --- a/gdb/syscalls/amd64-linux.xml.in +++ b/gdb/syscalls/amd64-linux.xml.in @@ -9,7 +9,7 @@ diff --git a/gdb/syscalls/i386-linux.xml b/gdb/syscalls/i386-linux.xml index c4b28111388..cff0e04464a 100644 --- a/gdb/syscalls/i386-linux.xml +++ b/gdb/syscalls/i386-linux.xml @@ -7,7 +7,7 @@ notice and this notice are preserved. --> diff --git a/gdb/syscalls/i386-linux.xml.in b/gdb/syscalls/i386-linux.xml.in index 549b59565f3..3814acd5761 100644 --- a/gdb/syscalls/i386-linux.xml.in +++ b/gdb/syscalls/i386-linux.xml.in @@ -9,7 +9,7 @@ diff --git a/gdb/syscalls/mips-n32-linux.xml b/gdb/syscalls/mips-n32-linux.xml index d6cffc4e5aa..47a8204dfea 100644 --- a/gdb/syscalls/mips-n32-linux.xml +++ b/gdb/syscalls/mips-n32-linux.xml @@ -6,8 +6,8 @@ are permitted in any medium without royalty provided the copyright notice and this notice are preserved. --> @@ -188,7 +188,6 @@ - @@ -204,7 +203,6 @@ - @@ -313,4 +311,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gdb/syscalls/mips-n32-linux.xml.in b/gdb/syscalls/mips-n32-linux.xml.in index cbdf82e65a1..85528f296ee 100644 --- a/gdb/syscalls/mips-n32-linux.xml.in +++ b/gdb/syscalls/mips-n32-linux.xml.in @@ -8,11 +8,12 @@ + @@ -191,7 +192,6 @@ - @@ -207,7 +207,6 @@ - @@ -316,4 +315,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gdb/syscalls/mips-n64-linux.xml b/gdb/syscalls/mips-n64-linux.xml index c7507537118..d1c29840641 100644 --- a/gdb/syscalls/mips-n64-linux.xml +++ b/gdb/syscalls/mips-n64-linux.xml @@ -6,8 +6,8 @@ are permitted in any medium without royalty provided the copyright notice and this notice are preserved. --> @@ -306,4 +306,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gdb/syscalls/mips-n64-linux.xml.in b/gdb/syscalls/mips-n64-linux.xml.in index 28ac1509d6f..26e470e7ff0 100644 --- a/gdb/syscalls/mips-n64-linux.xml.in +++ b/gdb/syscalls/mips-n64-linux.xml.in @@ -8,11 +8,12 @@ + @@ -309,4 +310,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gdb/syscalls/mips-o32-linux.xml b/gdb/syscalls/mips-o32-linux.xml index 1e845d6a4d1..b7e7af3f362 100644 --- a/gdb/syscalls/mips-o32-linux.xml +++ b/gdb/syscalls/mips-o32-linux.xml @@ -6,8 +6,8 @@ are permitted in any medium without royalty provided the copyright notice and this notice are preserved. --> @@ -341,4 +341,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gdb/syscalls/mips-o32-linux.xml.in b/gdb/syscalls/mips-o32-linux.xml.in index 98ba0638b8a..c9368e9c5ae 100644 --- a/gdb/syscalls/mips-o32-linux.xml.in +++ b/gdb/syscalls/mips-o32-linux.xml.in @@ -8,11 +8,12 @@ + @@ -344,4 +345,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gdb/syscalls/ppc-linux.xml b/gdb/syscalls/ppc-linux.xml index 34ba8bd4e49..967a6cd3ea9 100644 --- a/gdb/syscalls/ppc-linux.xml +++ b/gdb/syscalls/ppc-linux.xml @@ -7,7 +7,7 @@ notice and this notice are preserved. --> @@ -439,4 +439,7 @@ + + + diff --git a/gdb/syscalls/ppc-linux.xml.in b/gdb/syscalls/ppc-linux.xml.in index 61c7c585453..f22f3570e7b 100644 --- a/gdb/syscalls/ppc-linux.xml.in +++ b/gdb/syscalls/ppc-linux.xml.in @@ -9,7 +9,7 @@ @@ -443,4 +443,7 @@ + + + diff --git a/gdb/syscalls/ppc64-linux.xml b/gdb/syscalls/ppc64-linux.xml index 838f73bc25e..8a3e8a2864f 100644 --- a/gdb/syscalls/ppc64-linux.xml +++ b/gdb/syscalls/ppc64-linux.xml @@ -7,7 +7,7 @@ notice and this notice are preserved. --> @@ -411,4 +411,7 @@ + + + diff --git a/gdb/syscalls/ppc64-linux.xml.in b/gdb/syscalls/ppc64-linux.xml.in index 4ed80e0a41b..056cd00e4ec 100644 --- a/gdb/syscalls/ppc64-linux.xml.in +++ b/gdb/syscalls/ppc64-linux.xml.in @@ -9,7 +9,7 @@ @@ -415,4 +415,7 @@ + + + diff --git a/gdb/syscalls/s390-linux.xml b/gdb/syscalls/s390-linux.xml index 12548d07583..550dda730b3 100644 --- a/gdb/syscalls/s390-linux.xml +++ b/gdb/syscalls/s390-linux.xml @@ -7,7 +7,7 @@ notice and this notice are preserved. --> @@ -316,6 +316,8 @@ + + @@ -361,4 +363,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gdb/syscalls/s390-linux.xml.in b/gdb/syscalls/s390-linux.xml.in index b0732b71048..ea2356461c9 100644 --- a/gdb/syscalls/s390-linux.xml.in +++ b/gdb/syscalls/s390-linux.xml.in @@ -9,10 +9,11 @@ + @@ -319,6 +320,8 @@ + + @@ -364,4 +367,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gdb/syscalls/s390x-linux.xml b/gdb/syscalls/s390x-linux.xml index 1738d4c5713..511129eb851 100644 --- a/gdb/syscalls/s390x-linux.xml +++ b/gdb/syscalls/s390x-linux.xml @@ -7,7 +7,7 @@ notice and this notice are preserved. --> @@ -283,6 +283,8 @@ + + @@ -328,4 +330,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gdb/syscalls/s390x-linux.xml.in b/gdb/syscalls/s390x-linux.xml.in index 858263068f9..4e3fd3ec42b 100644 --- a/gdb/syscalls/s390x-linux.xml.in +++ b/gdb/syscalls/s390x-linux.xml.in @@ -9,10 +9,11 @@ + @@ -286,6 +287,8 @@ + + @@ -331,4 +334,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gdb/syscalls/sparc-linux.xml b/gdb/syscalls/sparc-linux.xml index 25ceb37dc4f..5eaf7a0656c 100644 --- a/gdb/syscalls/sparc-linux.xml +++ b/gdb/syscalls/sparc-linux.xml @@ -6,8 +6,8 @@ are permitted in any medium without royalty provided the copyright notice and this notice are preserved. --> @@ -338,4 +338,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gdb/syscalls/sparc-linux.xml.in b/gdb/syscalls/sparc-linux.xml.in index 81afb6daa15..3d7053cf2a1 100644 --- a/gdb/syscalls/sparc-linux.xml.in +++ b/gdb/syscalls/sparc-linux.xml.in @@ -8,11 +8,12 @@ + @@ -27,7 +28,7 @@ - + @@ -341,4 +342,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gdb/syscalls/sparc64-linux.xml b/gdb/syscalls/sparc64-linux.xml index c2e9fadc1ab..66a9bbf72b4 100644 --- a/gdb/syscalls/sparc64-linux.xml +++ b/gdb/syscalls/sparc64-linux.xml @@ -6,8 +6,8 @@ are permitted in any medium without royalty provided the copyright notice and this notice are preserved. --> @@ -320,4 +320,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gdb/syscalls/sparc64-linux.xml.in b/gdb/syscalls/sparc64-linux.xml.in index 15bb84ab7e1..8b3f08df3f2 100644 --- a/gdb/syscalls/sparc64-linux.xml.in +++ b/gdb/syscalls/sparc64-linux.xml.in @@ -8,11 +8,12 @@ + @@ -27,7 +28,7 @@ - + @@ -323,4 +324,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gdb/syscalls/update-linux-from-src.sh b/gdb/syscalls/update-linux-from-src.sh new file mode 100755 index 00000000000..c85f9dfbe2f --- /dev/null +++ b/gdb/syscalls/update-linux-from-src.sh @@ -0,0 +1,169 @@ +#!/bin/sh + +# Copyright (C) 2022 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 +# the Free Software Foundation; either version 3 of the License, or +# (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 +# along with this program. If not, see . + +# Used to generate .xml.in files, like so: +# $ ./update-linux-from-src.sh ~/linux-stable.git + +if [ $# -lt 1 ]; then + echo "dir argument needed" + exit 1 +fi + +d="$1" +shift + +if [ ! -d "$d" ]; then + echo "cannot find $d" + exit 1 +fi + +pre () +{ + f="$1" + + year=$(date +%Y) + + cat < + + + + + + + +EOF + + echo '' +} + + +post () +{ + echo '' +} + +one () +{ + f="$1" + abi="$2" + start_date="$3" + offset="$4" + + pre "$f" "$start_date" + + grep -v "^#" "$d/$f" \ + | awk '{print $2, $3, $1}' \ + | grep -E "^$abi" \ + | grep -E -v " (reserved|unused)[0-9]+ " \ + | awk "{printf \" \n\", \$2, \$3 + $offset}" + + post +} + +for f in *.in; do + start_date=2009 + offset=0 + + case $f in + amd64-linux.xml.in) + t="arch/x86/entry/syscalls/syscall_64.tbl" + abi="(common|64)" + ;; + i386-linux.xml.in) + t="arch/x86/entry/syscalls/syscall_32.tbl" + abi=i386 + ;; + ppc64-linux.xml.in) + t="arch/powerpc/kernel/syscalls/syscall.tbl" + abi="(common|64|nospu)" + ;; + ppc-linux.xml.in) + t="arch/powerpc/kernel/syscalls/syscall.tbl" + abi="(common|32|nospu)" + ;; + s390-linux.xml.in) + t="arch/s390/kernel/syscalls/syscall.tbl" + abi="(common|32)" + ;; + s390x-linux.xml.in) + t="arch/s390/kernel/syscalls/syscall.tbl" + abi="(common|64)" + ;; + sparc64-linux.xml.in) + t="arch/sparc/kernel/syscalls/syscall.tbl" + abi="(common|64)" + start_date="2010" + ;; + sparc-linux.xml.in) + t="arch/sparc/kernel/syscalls/syscall.tbl" + abi="(common|32)" + start_date="2010" + ;; + mips-n32-linux.xml.in) + t="arch/mips/kernel/syscalls/syscall_n32.tbl" + abi="n32" + start_date="2011" + offset=6000 + ;; + mips-n64-linux.xml.in) + t="arch/mips/kernel/syscalls/syscall_n64.tbl" + abi="n64" + start_date="2011" + offset=5000 + ;; + mips-o32-linux.xml.in) + t="arch/mips/kernel/syscalls/syscall_o32.tbl" + abi="o32" + start_date="2011" + offset=4000 + ;; + bfin-linux.xml.in) + echo "Skipping $f, no longer supported" + continue + ;; + aarch64-linux.xml.in) + echo "Skipping $f, no syscall.tbl" + continue + ;; + arm-linux.xml.in) + echo "Skipping $f, use arm-linux.py instead" + continue + ;; + linux-defaults.xml.in) + continue + ;; + *) + echo "Don't know how to generate $f" + continue + ;; + esac + + echo "Generating $f" + one "$t" "$abi" "$start_date" "$offset" > "$f" + +done