diff options
author | Tom de Vries <tdevries@suse.de> | 2024-11-26 09:49:29 +0100 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2024-11-26 09:49:29 +0100 |
commit | 9d62135dcb384ef60a044cc0af71ba90f4c85a96 (patch) | |
tree | 0112e3ecd4050ab1b9d20a186af2b086e05d76a9 | |
parent | [gdb/syscalls] Restructure update-linux-from-src.sh (diff) | |
download | binutils-gdb-9d62135dcb384ef60a044cc0af71ba90f4c85a96.tar.gz binutils-gdb-9d62135dcb384ef60a044cc0af71ba90f4c85a96.tar.bz2 binutils-gdb-9d62135dcb384ef60a044cc0af71ba90f4c85a96.zip |
[gdb/syscalls] Use update-linux-from-src.sh for arm-linux
I tried to use arm-linux.py to regenerate arm-linux.xml.in, but it didn't work.
Fix this by:
- adding handling of arm-linux.xml.in in update-linux-from-src.sh,
- regenerating arm-linux.xml.in using update-linux-from-src.sh and linux 6.11
sources,
- regenerating arm-linux.xml using make, and
- removing arm-linux.py.
This changes the name "oldolduname" into "olduname".
Tested on arm-linux. Verified with shellcheck.
-rw-r--r-- | gdb/syscalls/arm-linux.py | 63 | ||||
-rw-r--r-- | gdb/syscalls/arm-linux.xml | 94 | ||||
-rw-r--r-- | gdb/syscalls/arm-linux.xml.in | 95 | ||||
-rwxr-xr-x | gdb/syscalls/update-linux-from-src.sh | 68 |
4 files changed, 235 insertions, 85 deletions
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( - """\ -<?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. This file is offered as-is, - without any warranty. --> - -<!DOCTYPE feature SYSTEM "gdb-syscalls.dtd"> - -<!-- This file was generated using the following file: - - %s - - The file mentioned above belongs to the Linux Kernel. - Some small hand-edits were made. --> - -<syscalls_info>""" - % (time.strftime("%Y"), infname) -) - - -def record(name, number, comment=None): - # nm = 'name="%s"' % name - # s = ' <syscall %-30s number="%d"/>' % (nm, number) - s = ' <syscall name="%s" number="%d"/>' % (name, number) - if comment: - s += " <!-- %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("</syscalls_info>") 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. --> -<!-- This file was generated using the following file: + notice and this notice are preserved. --> +<!-- This file was generated using the following files: - linux/arch/arm/include/uapi/asm/unistd.h + arch/arm/tools/syscall.tbl + arch/arm/include/uapi/asm/unistd.h - The file mentioned above belongs to the Linux Kernel. - Some small hand-edits were made. --> + The files mentioned above belong to the Linux Kernel. --> <syscalls_info> <syscall name="restart_syscall" number="0"/> <syscall name="exit" number="1" groups="process"/> @@ -72,7 +71,7 @@ <syscall name="mpx" number="56"/> <!-- removed --> <syscall name="setpgid" number="57"/> <syscall name="ulimit" number="58"/> <!-- removed --> - <syscall name="oldolduname" number="59"/> <!-- removed --> + <syscall name="olduname" number="59"/> <!-- removed --> <syscall name="umask" number="60"/> <syscall name="chroot" number="61" groups="file"/> <syscall name="ustat" number="62"/> @@ -387,9 +386,90 @@ <syscall name="process_vm_writev" number="377"/> <syscall name="kcmp" number="378"/> <syscall name="finit_module" number="379" groups="descriptor"/> + <syscall name="sched_setattr" number="380"/> + <syscall name="sched_getattr" number="381"/> + <syscall name="renameat2" number="382" groups="descriptor,file"/> + <syscall name="seccomp" number="383"/> + <syscall name="getrandom" number="384"/> + <syscall name="memfd_create" number="385" groups="descriptor"/> + <syscall name="bpf" number="386" groups="descriptor"/> + <syscall name="execveat" number="387" groups="descriptor,file,process"/> + <syscall name="userfaultfd" number="388" groups="descriptor"/> + <syscall name="membarrier" number="389"/> + <syscall name="mlock2" number="390" groups="memory"/> + <syscall name="copy_file_range" number="391" groups="descriptor"/> + <syscall name="preadv2" number="392" groups="descriptor"/> + <syscall name="pwritev2" number="393" groups="descriptor"/> + <syscall name="pkey_mprotect" number="394" groups="memory"/> + <syscall name="pkey_alloc" number="395"/> + <syscall name="pkey_free" number="396"/> + <syscall name="statx" number="397" groups="descriptor,file"/> + <syscall name="rseq" number="398"/> + <syscall name="io_pgetevents" number="399"/> + <syscall name="migrate_pages" number="400" groups="memory"/> + <syscall name="kexec_file_load" number="401" groups="descriptor"/> + <syscall name="clock_gettime64" number="403"/> + <syscall name="clock_settime64" number="404"/> + <syscall name="clock_adjtime64" number="405"/> + <syscall name="clock_getres_time64" number="406"/> + <syscall name="clock_nanosleep_time64" number="407"/> + <syscall name="timer_gettime64" number="408"/> + <syscall name="timer_settime64" number="409"/> + <syscall name="timerfd_gettime64" number="410" groups="descriptor"/> + <syscall name="timerfd_settime64" number="411" groups="descriptor"/> + <syscall name="utimensat_time64" number="412" groups="descriptor,file"/> + <syscall name="pselect6_time64" number="413" groups="descriptor"/> + <syscall name="ppoll_time64" number="414" groups="descriptor"/> + <syscall name="io_pgetevents_time64" number="416"/> + <syscall name="recvmmsg_time64" number="417" groups="network"/> + <syscall name="mq_timedsend_time64" number="418" groups="descriptor"/> + <syscall name="mq_timedreceive_time64" number="419" groups="descriptor"/> + <syscall name="semtimedop_time64" number="420" groups="ipc"/> + <syscall name="rt_sigtimedwait_time64" number="421" groups="signal"/> + <syscall name="futex_time64" number="422"/> + <syscall name="sched_rr_get_interval_time64" number="423"/> + <syscall name="pidfd_send_signal" number="424" groups="descriptor,signal,process"/> + <syscall name="io_uring_setup" number="425" groups="descriptor"/> + <syscall name="io_uring_enter" number="426" groups="descriptor,signal"/> + <syscall name="io_uring_register" number="427" groups="descriptor,memory"/> + <syscall name="open_tree" number="428" groups="descriptor,file"/> + <syscall name="move_mount" number="429" groups="descriptor,file"/> + <syscall name="fsopen" number="430" groups="descriptor"/> + <syscall name="fsconfig" number="431" groups="descriptor,file"/> + <syscall name="fsmount" number="432" groups="descriptor"/> + <syscall name="fspick" number="433" groups="descriptor,file"/> + <syscall name="pidfd_open" number="434" groups="descriptor"/> + <syscall name="clone3" number="435" groups="process"/> + <syscall name="close_range" number="436"/> + <syscall name="openat2" number="437" groups="descriptor,file"/> + <syscall name="pidfd_getfd" number="438" groups="descriptor"/> + <syscall name="faccessat2" number="439" groups="descriptor,file"/> + <syscall name="process_madvise" number="440" groups="descriptor"/> + <syscall name="epoll_pwait2" number="441" groups="descriptor"/> + <syscall name="mount_setattr" number="442" groups="descriptor,file"/> + <syscall name="quotactl_fd" number="443" groups="descriptor"/> + <syscall name="landlock_create_ruleset" number="444" groups="descriptor"/> + <syscall name="landlock_add_rule" number="445" groups="descriptor"/> + <syscall name="landlock_restrict_self" number="446" groups="descriptor"/> + <syscall name="process_mrelease" number="448" groups="descriptor"/> + <syscall name="futex_waitv" number="449"/> + <syscall name="set_mempolicy_home_node" number="450" groups="memory"/> + <syscall name="cachestat" number="451" groups="descriptor"/> + <syscall name="fchmodat2" number="452" groups="descriptor,file"/> + <syscall name="map_shadow_stack" number="453" groups="memory"/> + <syscall name="futex_wake" number="454"/> + <syscall name="futex_wait" number="455"/> + <syscall name="futex_requeue" number="456"/> + <syscall name="statmount" number="457"/> + <syscall name="listmount" number="458"/> + <syscall name="lsm_get_self_attr" number="459"/> + <syscall name="lsm_set_self_attr" number="460"/> + <syscall name="lsm_list_modules" number="461"/> + <syscall name="mseal" number="462"/> <syscall name="ARM_breakpoint" number="983041"/> <syscall name="ARM_cacheflush" number="983042"/> <syscall name="ARM_usr26" number="983043"/> <syscall name="ARM_usr32" number="983044"/> <syscall name="ARM_set_tls" number="983045"/> + <syscall name="ARM_get_tls" number="983046"/> </syscalls_info> 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. --> <!DOCTYPE feature SYSTEM "gdb-syscalls.dtd"> -<!-- This file was generated using the following file: +<!-- This file was generated using the following files: - linux/arch/arm/include/uapi/asm/unistd.h + arch/arm/tools/syscall.tbl + arch/arm/include/uapi/asm/unistd.h + + The files mentioned above belong to the Linux Kernel. --> - The file mentioned above belongs to the Linux Kernel. - Some small hand-edits were made. --> <syscalls_info> <syscall name="restart_syscall" number="0"/> @@ -75,7 +75,7 @@ <syscall name="mpx" number="56"/> <!-- removed --> <syscall name="setpgid" number="57"/> <syscall name="ulimit" number="58"/> <!-- removed --> - <syscall name="oldolduname" number="59"/> <!-- removed --> + <syscall name="olduname" number="59"/> <!-- removed --> <syscall name="umask" number="60"/> <syscall name="chroot" number="61"/> <syscall name="ustat" number="62"/> @@ -390,9 +390,90 @@ <syscall name="process_vm_writev" number="377"/> <syscall name="kcmp" number="378"/> <syscall name="finit_module" number="379"/> + <syscall name="sched_setattr" number="380"/> + <syscall name="sched_getattr" number="381"/> + <syscall name="renameat2" number="382"/> + <syscall name="seccomp" number="383"/> + <syscall name="getrandom" number="384"/> + <syscall name="memfd_create" number="385"/> + <syscall name="bpf" number="386"/> + <syscall name="execveat" number="387"/> + <syscall name="userfaultfd" number="388"/> + <syscall name="membarrier" number="389"/> + <syscall name="mlock2" number="390"/> + <syscall name="copy_file_range" number="391"/> + <syscall name="preadv2" number="392"/> + <syscall name="pwritev2" number="393"/> + <syscall name="pkey_mprotect" number="394"/> + <syscall name="pkey_alloc" number="395"/> + <syscall name="pkey_free" number="396"/> + <syscall name="statx" number="397"/> + <syscall name="rseq" number="398"/> + <syscall name="io_pgetevents" number="399"/> + <syscall name="migrate_pages" number="400"/> + <syscall name="kexec_file_load" number="401"/> + <syscall name="clock_gettime64" number="403"/> + <syscall name="clock_settime64" number="404"/> + <syscall name="clock_adjtime64" number="405"/> + <syscall name="clock_getres_time64" number="406"/> + <syscall name="clock_nanosleep_time64" number="407"/> + <syscall name="timer_gettime64" number="408"/> + <syscall name="timer_settime64" number="409"/> + <syscall name="timerfd_gettime64" number="410"/> + <syscall name="timerfd_settime64" number="411"/> + <syscall name="utimensat_time64" number="412"/> + <syscall name="pselect6_time64" number="413"/> + <syscall name="ppoll_time64" number="414"/> + <syscall name="io_pgetevents_time64" number="416"/> + <syscall name="recvmmsg_time64" number="417"/> + <syscall name="mq_timedsend_time64" number="418"/> + <syscall name="mq_timedreceive_time64" number="419"/> + <syscall name="semtimedop_time64" number="420"/> + <syscall name="rt_sigtimedwait_time64" number="421"/> + <syscall name="futex_time64" number="422"/> + <syscall name="sched_rr_get_interval_time64" number="423"/> + <syscall name="pidfd_send_signal" number="424"/> + <syscall name="io_uring_setup" number="425"/> + <syscall name="io_uring_enter" number="426"/> + <syscall name="io_uring_register" number="427"/> + <syscall name="open_tree" number="428"/> + <syscall name="move_mount" number="429"/> + <syscall name="fsopen" number="430"/> + <syscall name="fsconfig" number="431"/> + <syscall name="fsmount" number="432"/> + <syscall name="fspick" number="433"/> + <syscall name="pidfd_open" number="434"/> + <syscall name="clone3" number="435"/> + <syscall name="close_range" number="436"/> + <syscall name="openat2" number="437"/> + <syscall name="pidfd_getfd" number="438"/> + <syscall name="faccessat2" number="439"/> + <syscall name="process_madvise" number="440"/> + <syscall name="epoll_pwait2" number="441"/> + <syscall name="mount_setattr" number="442"/> + <syscall name="quotactl_fd" number="443"/> + <syscall name="landlock_create_ruleset" number="444"/> + <syscall name="landlock_add_rule" number="445"/> + <syscall name="landlock_restrict_self" number="446"/> + <syscall name="process_mrelease" number="448"/> + <syscall name="futex_waitv" number="449"/> + <syscall name="set_mempolicy_home_node" number="450"/> + <syscall name="cachestat" number="451"/> + <syscall name="fchmodat2" number="452"/> + <syscall name="map_shadow_stack" number="453"/> + <syscall name="futex_wake" number="454"/> + <syscall name="futex_wait" number="455"/> + <syscall name="futex_requeue" number="456"/> + <syscall name="statmount" number="457"/> + <syscall name="listmount" number="458"/> + <syscall name="lsm_get_self_attr" number="459"/> + <syscall name="lsm_set_self_attr" number="460"/> + <syscall name="lsm_list_modules" number="461"/> + <syscall name="mseal" number="462"/> <syscall name="ARM_breakpoint" number="983041"/> <syscall name="ARM_cacheflush" number="983042"/> <syscall name="ARM_usr26" number="983043"/> <syscall name="ARM_usr32" number="983044"/> <syscall name="ARM_set_tls" number="983045"/> + <syscall name="ARM_get_tls" number="983046"/> </syscalls_info> 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 () <!DOCTYPE feature SYSTEM "gdb-syscalls.dtd"> -<!-- This file was generated using the following file: +<!-- This file was generated using the following $file_files: - $f +$files - The file mentioned above belongs to the Linux Kernel. --> + 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 " <syscall name=\"$_name\" number=\"$_num\"/>" + if [ "$_abi" = "removed" ] && [ "${name_exists[$_name]}" = 1 ]; then + _name=old$_name + fi + + echo -n " <syscall name=\"$_name\" number=\"$_num\"/>" + + if [ "$_abi" = "removed" ]; then + echo " <!-- removed -->" + 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 () |