3 # Copyright 1998 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 2 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, write to the Free Software
19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 # Usage: merge-syscalls syscall.tab [HEADER-FILE ...]
24 # This will scan every HEADER-FILE
25 # (default is /usr/include/sys/syscall.h)
26 # for #define SYS_xxx directives,
27 # recursively scanning #included files.
29 # Then it updates "syscall.tab", which is a file that has a
30 # C fragment to initialize a table of known syscall names.
31 # Any syscalls already in "syscall.tab" will be kept.
33 # In principle, you don't need to run this unless you're
34 # porting gdb to a new host that uses procfs.c.
36 # FIXME: perhaps use gcc -E -dM instead.
37 # FIXME: perhaps track which hosts have which syscalls.
41 WS
=`printf "[\t ]*" 2>/dev/null || echo '[ ]*'`
52 echo >&2 "scanning $1..."
54 /^#${WS}define${WS}SYS_[_a-zA-Z0-9]${WS}/ {
55 s/^${WS}#${WS}define${WS}\(SYS_[_a-zA-Z0-9]*\)${WS}.*/\1/
58 /${WS}syscall_table${WS}\[SYS_[_a-zA-Z0-9]*\]/ {
59 s/^.*${WS}syscall_table${WS}\[\(SYS_[_a-zA-Z0-9]*\)\].*/\1/
66 /^${WS}#${WS}include${WS}</{
67 s/^${WS}#${WS}include${WS}<\([^>]*\)>.*/\1/
72 for dir in /usr/include; do
73 if [ -f "$dir/$inc" ]; then
85 set -- /usr
/include
/sys
/syscall.h
92 echo "/* This file is semi-automatically updated by `basename $0` */"
94 tail=`echo "$sys" | sed 's/^SYS_//'`
95 echo "#if defined ($sys)"
96 echo " syscall_table[$sys] = "\""$tail"\"";"
101 if cmp -s $DEST tmp$$
; then
102 echo "$DEST unchanged"
106 echo "creating new $DEST..."
107 if [ -f $DEST ]; then
108 mv $DEST $DEST.orig ||
exit 1
109 echo " (original moved to $DEST.orig)"
This page took 0.031415 seconds and 4 git commands to generate.