From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 45BB23858D3C; Wed, 18 May 2022 09:56:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 45BB23858D3C Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/tdep] Add gdb/syscalls/update-linux-from-src.sh X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: e1e15284481896505eab0cbc556f2348ef8fffbf X-Git-Newrev: 192257c998507f8a6ad9a85394b4fd4c627552cb Message-Id: <20220518095636.45BB23858D3C@sourceware.org> Date: Wed, 18 May 2022 09:56:36 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 May 2022 09:56:36 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D192257c99850= 7f8a6ad9a85394b4fd4c627552cb commit 192257c998507f8a6ad9a85394b4fd4c627552cb Author: Tom de Vries Date: Wed May 18 11:56:32 2022 +0200 [gdb/tdep] Add gdb/syscalls/update-linux-from-src.sh =20 Add a new script gdb/syscalls/update-linux-from-src.sh, that can be use= d 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 ... =20 Update *-linux.xml.in and *-linux.xml using linux kernel tag v5.18-rc6. Diff: --- gdb/syscalls/amd64-linux.xml | 2 +- gdb/syscalls/amd64-linux.xml.in | 2 +- gdb/syscalls/i386-linux.xml | 2 +- gdb/syscalls/i386-linux.xml.in | 2 +- gdb/syscalls/mips-n32-linux.xml | 82 ++++++++++++++++- gdb/syscalls/mips-n32-linux.xml.in | 83 ++++++++++++++++- gdb/syscalls/mips-n64-linux.xml | 60 +++++++++++- gdb/syscalls/mips-n64-linux.xml.in | 61 +++++++++++- gdb/syscalls/mips-o32-linux.xml | 90 +++++++++++++++++- gdb/syscalls/mips-o32-linux.xml.in | 91 +++++++++++++++++- gdb/syscalls/ppc-linux.xml | 5 +- gdb/syscalls/ppc-linux.xml.in | 5 +- gdb/syscalls/ppc64-linux.xml | 5 +- gdb/syscalls/ppc64-linux.xml.in | 5 +- gdb/syscalls/s390-linux.xml | 72 ++++++++++++++- gdb/syscalls/s390-linux.xml.in | 73 ++++++++++++++- gdb/syscalls/s390x-linux.xml | 53 ++++++++++- gdb/syscalls/s390x-linux.xml.in | 54 ++++++++++- gdb/syscalls/sparc-linux.xml | 96 ++++++++++++++++++- gdb/syscalls/sparc-linux.xml.in | 99 +++++++++++++++++++- gdb/syscalls/sparc64-linux.xml | 77 +++++++++++++++- gdb/syscalls/sparc64-linux.xml.in | 80 +++++++++++++++- gdb/syscalls/update-linux-from-src.sh | 169 ++++++++++++++++++++++++++++++= ++++ 23 files changed, 1230 insertions(+), 38 deletions(-) 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 @@ =20 =20 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 @@ =20 =20 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-lin= ux.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 @@ =20 =20 + @@ -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-lin= ux.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 @@ =20 =20 + @@ -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-lin= ux.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 @@ =20 =20 + @@ -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 @@ =20 =20 @@ -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 @@ =20 =20 @@ -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 @@ =20 =20 + @@ -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 @@ =20 =20 + @@ -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 @@ =20 =20 + @@ -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 @@ =20 =20 + @@ -27,7 +28,7 @@ - + @@ -323,4 +324,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gdb/syscalls/update-linux-from-src.sh b/gdb/syscalls/update-li= nux-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=3D"$1" +shift + +if [ ! -d "$d" ]; then + echo "cannot find $d" + exit 1 +fi + +pre () +{ + f=3D"$1" + + year=3D$(date +%Y) + + cat < + + + + + + + +EOF + + echo '' +} + + +post () +{ + echo '' +} + +one () +{ + f=3D"$1" + abi=3D"$2" + start_date=3D"$3" + offset=3D"$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=3D2009 + offset=3D0 + + case $f in + amd64-linux.xml.in) + t=3D"arch/x86/entry/syscalls/syscall_64.tbl" + abi=3D"(common|64)" + ;; + i386-linux.xml.in) + t=3D"arch/x86/entry/syscalls/syscall_32.tbl" + abi=3Di386 + ;; + ppc64-linux.xml.in) + t=3D"arch/powerpc/kernel/syscalls/syscall.tbl" + abi=3D"(common|64|nospu)" + ;; + ppc-linux.xml.in) + t=3D"arch/powerpc/kernel/syscalls/syscall.tbl" + abi=3D"(common|32|nospu)" + ;; + s390-linux.xml.in) + t=3D"arch/s390/kernel/syscalls/syscall.tbl" + abi=3D"(common|32)" + ;; + s390x-linux.xml.in) + t=3D"arch/s390/kernel/syscalls/syscall.tbl" + abi=3D"(common|64)" + ;; + sparc64-linux.xml.in) + t=3D"arch/sparc/kernel/syscalls/syscall.tbl" + abi=3D"(common|64)" + start_date=3D"2010" + ;; + sparc-linux.xml.in) + t=3D"arch/sparc/kernel/syscalls/syscall.tbl" + abi=3D"(common|32)" + start_date=3D"2010" + ;; + mips-n32-linux.xml.in) + t=3D"arch/mips/kernel/syscalls/syscall_n32.tbl" + abi=3D"n32" + start_date=3D"2011" + offset=3D6000 + ;; + mips-n64-linux.xml.in) + t=3D"arch/mips/kernel/syscalls/syscall_n64.tbl" + abi=3D"n64" + start_date=3D"2011" + offset=3D5000 + ;; + mips-o32-linux.xml.in) + t=3D"arch/mips/kernel/syscalls/syscall_o32.tbl" + abi=3D"o32" + start_date=3D"2011" + offset=3D4000 + ;; + 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