]>
Commit | Line | Data |
---|---|---|
4498ef4f KR |
1 | #! /bin/sh |
2 | ||
1d506c26 | 3 | # Copyright (C) 2020-2024 Free Software Foundation, Inc. |
4498ef4f KR |
4 | # |
5 | # This file is part of GDB. | |
6 | # | |
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. | |
11 | # | |
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. | |
16 | # | |
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/>. | |
19 | ||
20 | # Usage: update-netbsd.sh <path-to-syscall.h> | |
21 | # Update the netbsd.xml file. | |
22 | # | |
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. | |
29 | ||
30 | if [ $# -ne 1 ]; then | |
31 | echo "Error: Path to syscall.h missing. Aborting." | |
fd34472c | 32 | echo "Usage: update-netbsd.sh <path-to-syscall.h>" |
4498ef4f KR |
33 | exit 1 |
34 | fi | |
35 | ||
36 | cat > netbsd.xml.tmp <<EOF | |
37 | <?xml version="1.0"?> <!-- THIS FILE IS GENERATED -*- buffer-read-only: t -*- --> | |
38 | <!-- vi:set ro: --> | |
1d506c26 | 39 | <!-- Copyright (C) 2020-2024 Free Software Foundation, Inc. |
4498ef4f KR |
40 | |
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. --> | |
44 | ||
45 | <!DOCTYPE feature SYSTEM "gdb-syscalls.dtd"> | |
46 | ||
47 | <!-- This file was generated using the following file: | |
48 | ||
49 | /usr/src/sys/sys/syscall.h | |
50 | ||
51 | The file mentioned above belongs to the NetBSD Kernel. --> | |
52 | ||
53 | <syscalls_info> | |
54 | EOF | |
55 | ||
56 | awk ' | |
57 | /MAXSYSCALL/ || /_SYS_SYSCALL_H_/ || /MAXSYSARGS/ || /syscall/ || /NSYSENT/ { | |
58 | next | |
59 | } | |
60 | /^#define/ { | |
61 | sub(/^SYS_/,"",$2); | |
62 | printf " <syscall name=\"%s\" number=\"%s\"", $2, $3 | |
63 | if (sub(/^netbsd[0-9]*_/,"",$2) != 0) | |
64 | printf " alias=\"%s\"", $2 | |
65 | printf "/>\n" | |
66 | } | |
67 | /\/\* [0-9]* is obsolete [a-z_]* \*\// { | |
68 | printf " <syscall name=\"%s\" number=\"%s\"/>\n", $5, $2 | |
69 | } | |
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 | |
73 | ||
74 | cat >> netbsd.xml.tmp <<EOF | |
75 | </syscalls_info> | |
76 | EOF | |
77 | ||
78 | ../../move-if-change netbsd.xml.tmp netbsd.xml |