forked from Imagelibrary/binutils-gdb
[gdb/tdep] Improve gdb/syscalls/update-linux.sh
Fix two things in update-linux.sh: - remove use of unnecessary tmp file - inline gen-header.py into update-linux.sh Tested on x86_64-linux.
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
# Copyright (C) 2013-2022 Free Software Foundation, Inc.
|
||||
|
||||
# Copying and distribution of this file, with or without modification,
|
||||
# are permitted in any medium without royalty provided the copyright
|
||||
# notice and this notice are preserved. This file is offered as-is,
|
||||
# without any warranty.
|
||||
|
||||
import sys
|
||||
import time
|
||||
|
||||
infname = sys.argv[1]
|
||||
|
||||
print(
|
||||
"""\
|
||||
<?xml version="1.0"?>
|
||||
<!-- Copyright (C) 2009-%s Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. -->
|
||||
|
||||
<!DOCTYPE feature SYSTEM "gdb-syscalls.dtd">
|
||||
|
||||
<!-- This file was generated using the following file:
|
||||
|
||||
%s
|
||||
|
||||
The file mentioned above belongs to the Linux Kernel. -->
|
||||
|
||||
"""
|
||||
% (time.strftime("%Y"), infname)
|
||||
)
|
||||
@@ -36,25 +36,38 @@ if [ ! -f "$f" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
(
|
||||
python gen-header.py "<sys/syscall.h>"
|
||||
year=$(date +%Y)
|
||||
|
||||
tmp=$(mktemp)
|
||||
(
|
||||
cat <<EOF
|
||||
<?xml version="1.0"?>
|
||||
<!-- Copyright (C) 2009-$year Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. -->
|
||||
|
||||
<!DOCTYPE feature SYSTEM "gdb-syscalls.dtd">
|
||||
|
||||
<!-- This file was generated using the following file:
|
||||
|
||||
<sys/syscall.h>
|
||||
|
||||
The file mentioned above belongs to the Linux Kernel. -->
|
||||
|
||||
|
||||
EOF
|
||||
|
||||
echo '<syscalls_info>'
|
||||
|
||||
echo '#include <sys/syscall.h>' \
|
||||
| gcc -E - -dD "$@" \
|
||||
| grep -E '#define __NR_' \
|
||||
> "$tmp"
|
||||
|
||||
echo '<syscalls_info>'
|
||||
|
||||
while read -r line; do
|
||||
| while read -r line; do
|
||||
name=$(echo "$line" | awk '{print $2}' | sed 's/^__NR_//')
|
||||
nr=$(echo "$line" | awk '{print $3}')
|
||||
echo " <syscall name=\"$name\" number=\"$nr\"/>"
|
||||
done < "$tmp"
|
||||
done
|
||||
|
||||
echo '</syscalls_info>'
|
||||
|
||||
rm -f "$tmp"
|
||||
) > "$f"
|
||||
|
||||
Reference in New Issue
Block a user