diff --git a/gdb/syscalls/arm-linux.py b/gdb/syscalls/arm-linux.py deleted file mode 100644 index a3f64d0a825..00000000000 --- a/gdb/syscalls/arm-linux.py +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright (C) 2013-2024 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 re -import sys -import time - -infname = sys.argv[1] -inf = file(infname) - -print( - """\ - - - - - - - -""" - % (time.strftime("%Y"), infname) -) - - -def record(name, number, comment=None): - # nm = 'name="%s"' % name - # s = ' ' % (nm, number) - s = ' ' % (name, number) - if comment: - s += " " % comment - print(s) - - -for line in inf: - m = re.match(r"^#define __NR_(\w+)\s+\(__NR_SYSCALL_BASE\+\s*(\d+)\)", line) - if m: - record(m.group(1), int(m.group(2))) - continue - - m = re.match(r"^\s+/\* (\d+) was sys_(\w+) \*/$", line) - if m: - record(m.group(2), int(m.group(1)), "removed") - - m = re.match(r"^#define __ARM_NR_(\w+)\s+\(__ARM_NR_BASE\+\s*(\d+)\)", line) - if m: - record("ARM_" + m.group(1), 0x0F0000 + int(m.group(2))) - continue - -print("") diff --git a/gdb/syscalls/arm-linux.xml b/gdb/syscalls/arm-linux.xml index 72a64566133..8493057e691 100644 --- a/gdb/syscalls/arm-linux.xml +++ b/gdb/syscalls/arm-linux.xml @@ -4,14 +4,13 @@ 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. --> - + + The files mentioned above belong to the Linux Kernel. --> @@ -72,7 +71,7 @@ - + @@ -387,9 +386,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gdb/syscalls/arm-linux.xml.in b/gdb/syscalls/arm-linux.xml.in index ca8e2441aab..42cb51601bc 100644 --- a/gdb/syscalls/arm-linux.xml.in +++ b/gdb/syscalls/arm-linux.xml.in @@ -3,17 +3,17 @@ 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. --> + notice and this notice are preserved. --> - - The file mentioned above belongs to the Linux Kernel. - Some small hand-edits were made. --> @@ -75,7 +75,7 @@ - + @@ -390,9 +390,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gdb/syscalls/update-linux-from-src.sh b/gdb/syscalls/update-linux-from-src.sh index a4a1bc21195..d07cbbd9b44 100755 --- a/gdb/syscalls/update-linux-from-src.sh +++ b/gdb/syscalls/update-linux-from-src.sh @@ -42,6 +42,21 @@ pre () f="$1" local start_date start_date="$2" + local h + h="$3" + + local prefix + prefix=" " + + if [ "$h" != "" ]; then + file_files="files" + belong_belongs="belong" + files=$(echo -e "$prefix$f\n$prefix$h") + else + file_files="file" + belong_belongs="belongs" + files="$prefix$f" + fi local year year=$(date +%Y) @@ -56,11 +71,11 @@ pre () - + The $file_files mentioned above $belong_belongs to the Linux Kernel. --> EOF @@ -84,23 +99,43 @@ one () start_date="$3" local offset offset="$4" + local h + h="$5" tmp=$(mktemp) trap 'rm -f $tmp' EXIT - pre "$f" "$start_date" + pre "$f" "$start_date" "$h" # Print out num, abi, name. grep -v "^#" "$d/$f" \ | awk '{print $1, $2, $3}' \ > "$tmp" + local decimal + decimal="[0-9][0-9]*" + # Print out num, "removed", name. + grep -E "^# $decimal was sys_*" "$d/$f" \ + | awk '{print $2, "removed", gensub("^sys_", "", 1, $4)}' \ + >> "$tmp" + + case $h in + arch/arm/include/uapi/asm/unistd.h) + grep '#define __ARM_NR_[a-z].*__ARM_NR_BASE\+' "$d/$h" \ + | sed 's/#define //;s/__ARM_NR_BASE+//;s/[()]//g;s/__ARM_NR_/ARM_/' \ + | awk '{print $2 + 0x0f0000, "private", $1}' \ + >> "$tmp" + ;; + esac + local nums declare -a nums local abis declare -a abis local names declare -a names + local name_exists + declare -A name_exists local i i=0 @@ -136,6 +171,10 @@ one () abis[i]="$_abi" names[i]="$_name" + if [ "$_abi" != "removed" ]; then + name_exists[$_name]=1 + fi + i=$((i + 1)) done < <(sort -V "$tmp") @@ -147,7 +186,17 @@ one () _abi=${abis[$i]} _num=$((${nums[$i]} + offset)) - echo " " + if [ "$_abi" = "removed" ] && [ "${name_exists[$_name]}" = 1 ]; then + _name=old$_name + fi + + echo -n " " + + if [ "$_abi" = "removed" ]; then + echo " " + else + echo + fi done post @@ -162,6 +211,8 @@ regen () start_date=2009 local offset offset=0 + local h + h= local t local abi @@ -227,8 +278,9 @@ regen () return ;; arm-linux.xml.in) - echo "Skipping $f, use arm-linux.py instead" - return + t="arch/arm/tools/syscall.tbl" + h="arch/arm/include/uapi/asm/unistd.h" + abi="common eabi oabi removed private" ;; loongarch-linux.xml.in) echo "Skipping $f, no syscall.tbl" @@ -244,7 +296,7 @@ regen () esac echo "Generating $f" - one "$t" "$abi" "$start_date" "$offset" > "$f" + one "$t" "$abi" "$start_date" "$offset" "$h" > "$f" } main ()