]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/syscalls/update-linux-defaults.sh
Fix typo in tui-data.h
[thirdparty/binutils-gdb.git] / gdb / syscalls / update-linux-defaults.sh
CommitLineData
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
23if [ $# -lt 1 ]; then
24 echo "dir argument needed"
25 exit 1
26fi
27
28d="$1"
29shift
30
31if [ ! -d "$d" ]; then
32 echo "cannot find $d"
33 exit 1
34fi
35
36pre ()
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. -->
49EOF
50
51 echo '<syscalls_defaults>'
52}
53
54
55post ()
56{
57 echo '</syscalls_defaults>'
58}
59
60generate ()
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
88f=linux-defaults.xml.in
89
90echo "Generating $f"
91generate > "$f"