3 # Copyright (C) 2020-2021 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 # Usage: update-netbsd.sh <path-to-syscall.h>
21 # Update the netbsd.xml file.
23 # NetBSD uses the same list of system calls on all architectures.
24 # The list is defined in the sys/kern/syscalls.master file in the
25 # NetBSD source tree. This file is used as an input to generate
26 # several files that are also stored in NetBSD's source tree. This
27 # script parses one of those generated files (sys/sys/syscall.h)
28 # rather than syscalls.master as syscall.h is easier to parse.
31 echo "Error: Path to syscall.h missing. Aborting."
32 echo "Usage: update-gnulib.sh <path-to-syscall.h>"
36 cat > netbsd.xml.tmp
<<EOF
37 <?xml version="1.0"?> <!-- THIS FILE IS GENERATED -*- buffer-read-only: t -*- -->
39 <!-- Copyright (C) 2020 Free Software Foundation, Inc.
41 Copying and distribution of this file, with or without modification,
42 are permitted in any medium without royalty provided the copyright
43 notice and this notice are preserved. -->
45 <!DOCTYPE feature SYSTEM "gdb-syscalls.dtd">
47 <!-- This file was generated using the following file:
49 /usr/src/sys/sys/syscall.h
51 The file mentioned above belongs to the NetBSD Kernel. -->
57 /MAXSYSCALL/ || /_SYS_SYSCALL_H_/ || /MAXSYSARGS/ || /syscall/ || /NSYSENT/ {
62 printf " <syscall name=\"%s\" number=\"%s\"", $2, $3
63 if (sub(/^netbsd[0-9]*_/,"",$2) != 0)
64 printf " alias=\"%s\"", $2
67 /\/\* [0-9]* is obsolete [a-z_]* \*\// {
68 printf " <syscall name=\"%s\" number=\"%s\"/>\n", $5, $2
70 /\/\* [0-9]* is netbsd[0-9]* [a-z_]* \*\// {
71 printf " <syscall name=\"%s_%s\" number=\"%s\" alias=\"%s\"/>\n", $4, $5, $2, $5
72 }' "$1" >> netbsd.xml.tmp
74 cat >> netbsd.xml.tmp
<<EOF
78 ..
/..
/move-if-change netbsd.xml.tmp netbsd.xml