gas: correct sb_add_char() 2nd parameter type
[binutils-gdb.git] / gdb / syscalls / update-linux.sh
blobe2af1a75cb59464b4015116fa6bef1b117f5e665
1 #!/bin/sh
3 # Copyright (C) 2022-2024 Free Software Foundation, Inc.
5 # This file is part of GDB.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 # Used to generate .xml.in files, like so:
22 # ./update-linux.sh amd64-linux.xml.in
23 # ./update-linux.sh i386-linux.xml.in -m32
26 if [ $# -lt 1 ]; then
27 echo "file argument needed"
28 exit 1
31 f="$1"
32 shift
34 if [ ! -f "$f" ]; then
35 echo "cannot find $f"
36 exit 1
39 year=$(date +%Y)
42 cat <<EOF
43 <?xml version="1.0"?>
44 <!-- Copyright (C) 2009-$year Free Software Foundation, Inc.
46 Copying and distribution of this file, with or without modification,
47 are permitted in any medium without royalty provided the copyright
48 notice and this notice are preserved. -->
50 <!DOCTYPE feature SYSTEM "gdb-syscalls.dtd">
52 <!-- This file was generated using the following file:
54 <sys/syscall.h>
56 The file mentioned above belongs to the Linux Kernel. -->
59 EOF
61 echo '<syscalls_info>'
63 echo '#include <sys/syscall.h>' \
64 | gcc -E - -dD "$@" \
65 | grep -E '#define __NR_' \
66 | while read -r line; do
67 name=$(echo "$line" | awk '{print $2}' | sed 's/^__NR_//')
68 nr=$(echo "$line" | awk '{print $3}')
69 echo " <syscall name=\"$name\" number=\"$nr\"/>"
70 done
72 echo '</syscalls_info>'
73 ) > "$f"