]>
Commit | Line | Data |
---|---|---|
08c815c2 PA |
1 | #!/bin/sh |
2 | ||
1d506c26 | 3 | # Copyright (C) 2023-2024 Free Software Foundation, Inc. |
08c815c2 PA |
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 | # Used to generate linux-defaults.xml.in, like so: | |
21 | # $ ./update-linux-defaults.sh ~/strace.git | |
22 | ||
23 | if [ $# -lt 1 ]; then | |
24 | echo "dir argument needed" | |
25 | exit 1 | |
26 | fi | |
27 | ||
28 | d="$1" | |
29 | shift | |
30 | ||
31 | if [ ! -d "$d" ]; then | |
32 | echo "cannot find $d" | |
33 | exit 1 | |
34 | fi | |
35 | ||
36 | pre () | |
37 | { | |
38 | year=$(date +%Y) | |
39 | ||
40 | cat <<EOF | |
41 | <?xml version="1.0"?> | |
42 | <!-- Copyright (C) 2009-$year Free Software Foundation, Inc. | |
43 | ||
44 | Copying and distribution of this file, with or without modification, | |
45 | are permitted in any medium without royalty provided the copyright | |
46 | notice and this notice are preserved. --> | |
47 | ||
48 | <!-- This file was generated using the sources from strace. --> | |
49 | EOF | |
50 | ||
51 | echo '<syscalls_defaults>' | |
52 | } | |
53 | ||
54 | ||
55 | post () | |
56 | { | |
57 | echo '</syscalls_defaults>' | |
58 | } | |
59 | ||
60 | generate () | |
61 | { | |
62 | pre | |
63 | ||
64 | grep -rn -E "T[A-Z][,|]" "$d/src/linux/" \ | |
65 | | sed -e 's/\(T[A-Z][,|].*\)/\x03&/' -e 's/.*\x03//' \ | |
66 | -e 's/,[ \t]*SEN[ \t]*(/, SEN(/g' \ | |
67 | | grep ", SEN(" \ | |
68 | | sed -e 's/\(.*\"\).*/\1/g' \ | |
69 | -e 's/#64\"/\"/g' \ | |
70 | | awk '{print $3 " " $1}' \ | |
71 | | sort -u \ | |
72 | | sed -e 's/|/,/g' \ | |
73 | -e 's/TD,/descriptor,/g' \ | |
74 | -e 's/TF,/file,/g' \ | |
75 | -e 's/TI,/ipc,/g' \ | |
76 | -e 's/TM,/memory,/g' \ | |
77 | -e 's/TN,/network,/g' \ | |
78 | -e 's/TP,/process,/g' \ | |
79 | -e 's/TS,/signal,/g' \ | |
80 | -e 's/[A-Z]\+,//g' \ | |
81 | | grep -v '" $' \ | |
82 | | sed 's/,$//g' \ | |
83 | | awk "{printf \" <syscall name=%s groups=\\\"%s\\\"/>\n\", \$1, \$2}" | |
84 | ||
85 | post | |
86 | } | |
87 | ||
88 | f=linux-defaults.xml.in | |
89 | ||
90 | echo "Generating $f" | |
91 | generate > "$f" |