From patchwork Wed Oct 3 17:30:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Baldwin X-Patchwork-Id: 29631 Received: (qmail 3235 invoked by alias); 3 Oct 2018 17:30:52 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 124492 invoked by uid 89); 3 Oct 2018 17:30:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_HELO_PASS, SPF_SOFTFAIL autolearn=ham version=3.3.2 spammy=mount, 956, freebsd's, freebsds X-HELO: mail.baldwin.cx Received: from bigwig.baldwin.cx (HELO mail.baldwin.cx) (96.47.65.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 03 Oct 2018 17:30:31 +0000 Received: from ralph.baldwin.cx (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 6D74F10B4CE for ; Wed, 3 Oct 2018 13:30:13 -0400 (EDT) From: John Baldwin To: gdb-patches@sourceware.org Subject: [PATCH 2/2] Update the FreeBSD system call table to match FreeBSD 12.0. Date: Wed, 3 Oct 2018 10:30:05 -0700 Message-Id: <20181003173005.19581-3-jhb@FreeBSD.org> In-Reply-To: <20181003173005.19581-1-jhb@FreeBSD.org> References: <20181003173005.19581-1-jhb@FreeBSD.org> X-IsSubscribed: yes Add a script to generate the FreeBSD XML system call table from the sys/sys/syscall.h file in the kernel source tree. For ABI compatiblity system calls used by older binaries (such as freebsd11_kevent()), the original system call name is used as an alias. Run this script against the current syscall.h file in FreeBSD's head branch which is expected to be the file used in 12.0 (head is currently in code freeze as part of the 12.0 release process). gdb/ChangeLog: * syscalls/update-freebsd.sh: New file. * syscalls/freebsd.xml: Regenerate. --- gdb/ChangeLog | 5 ++ gdb/syscalls/freebsd.xml | 107 ++++++++++++++++++++++++++------- gdb/syscalls/update-freebsd.sh | 77 ++++++++++++++++++++++++ 3 files changed, 167 insertions(+), 22 deletions(-) create mode 100755 gdb/syscalls/update-freebsd.sh diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1f679b48ed..c359821fd2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2018-10-03 John Baldwin + + * syscalls/update-freebsd.sh: New file. + * syscalls/freebsd.xml: Regenerate. + 2018-10-03 John Baldwin * break-catch-syscall.c (catch_syscall_split_args): Update for diff --git a/gdb/syscalls/freebsd.xml b/gdb/syscalls/freebsd.xml index 810258a850..773e0be5f8 100644 --- a/gdb/syscalls/freebsd.xml +++ b/gdb/syscalls/freebsd.xml @@ -24,12 +24,14 @@ + - + + @@ -50,7 +52,7 @@ - + @@ -69,12 +71,16 @@ + + - + + + @@ -95,6 +101,8 @@ + + @@ -119,27 +127,42 @@ + + + + + + + - - - + + + + + + + - + + + + + @@ -147,15 +170,16 @@ - + - + + - + @@ -170,6 +194,7 @@ + @@ -180,18 +205,19 @@ - + - - - + + + + - + @@ -205,11 +231,17 @@ + + + + + + @@ -222,12 +254,15 @@ + + + @@ -246,14 +281,26 @@ - + + + + + + + + + + + + + @@ -265,10 +312,10 @@ - - - - + + + + @@ -304,6 +351,7 @@ + @@ -352,12 +400,12 @@ - + - + @@ -373,6 +421,7 @@ + @@ -407,4 +456,18 @@ + + + + + + + + + + + + + + diff --git a/gdb/syscalls/update-freebsd.sh b/gdb/syscalls/update-freebsd.sh new file mode 100755 index 0000000000..8699faa873 --- /dev/null +++ b/gdb/syscalls/update-freebsd.sh @@ -0,0 +1,77 @@ +#! /bin/sh + +# Copyright (C) 2011-2018 Free Software Foundation, Inc. +# +# This file is part of GDB. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Usage: update-freebsd.sh +# Update the freebsd.xml file. +# +# FreeBSD uses the same list of system calls on all architectures. +# The list is defined in the sys/kern/syscalls.master file in the +# FreeBSD source tree. This file is used as an input to generate +# several files that are also stored in FreeBSD's source tree. This +# script parses one of those generated files (sys/sys/syscall.h) +# rather than syscalls.master as syscall.h is easier to parse. + +if [ $# -ne 1 ]; then + echo "Error: Path to syscall.h missing. Aborting." + echo "Usage: update-gnulib.sh " + exit 1 +fi + +cat > freebsd.xml.tmp < + + + + + + + +EOF + +awk ' +/MAXSYSCALL/ { + next +} +/^#define/ { + sub(/^SYS_/,"",$2); + printf " \n" +} +/\/\* [0-9]* is obsolete [a-z_]* \*\// { + printf " \n", $5, $2 +} +/\/\* [0-9]* is freebsd[0-9]* [a-z_]* \*\// { + printf " \n", $4, $5, $2, $5 +}' $1 >> freebsd.xml.tmp + +cat >> freebsd.xml.tmp < +EOF + +../../move-if-change freebsd.xml.tmp freebsd.xml