From 4498ef4f8b61f396472a12aea3aa84985714b7b3 Mon Sep 17 00:00:00 2001 From: Kamil Rytarowski Date: Wed, 29 Apr 2020 01:46:41 +0200 Subject: [PATCH] Add definitions of system calls to catch in native NetBSD targets All platforms on NetBSD use a shared system call table, so use a single XML file to describe the system calls available on each NetBSD platform. gdb/ChangeLog: * syscalls/update-netbsd.sh: New file. * syscalls/netbsd.xml: Regenerate. * data-directory/Makefile.in: Register `netbsd.xml' in `SYSCALLS_FILES' --- gdb/ChangeLog | 7 + gdb/data-directory/Makefile.in | 2 +- gdb/syscalls/netbsd.xml | 461 +++++++++++++++++++++++++++++++++ gdb/syscalls/update-netbsd.sh | 78 ++++++ 4 files changed, 547 insertions(+), 1 deletion(-) create mode 100644 gdb/syscalls/netbsd.xml create mode 100755 gdb/syscalls/update-netbsd.sh diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 81983103ac2..3313f156c94 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2020-04-28 Kamil Rytarowski + + * syscalls/update-netbsd.sh: New file. + * syscalls/netbsd.xml: Regenerate. + * data-directory/Makefile.in: Register `netbsd.xml' in + `SYSCALLS_FILES'. + 2020-04-28 Simon Marchi * syscalls/update-freebsd.sh: Add double quotes. diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in index 68b794a353d..3f0c729404b 100644 --- a/gdb/data-directory/Makefile.in +++ b/gdb/data-directory/Makefile.in @@ -63,7 +63,7 @@ GEN_SYSCALLS_FILES = \ sparc-linux.xml \ sparc64-linux.xml -SYSCALLS_FILES = gdb-syscalls.dtd freebsd.xml $(GEN_SYSCALLS_FILES) +SYSCALLS_FILES = gdb-syscalls.dtd freebsd.xml netbsd.xml $(GEN_SYSCALLS_FILES) PYTHON_DIR = python PYTHON_INSTALL_DIR = $(DESTDIR)$(GDB_DATADIR)/$(PYTHON_DIR) diff --git a/gdb/syscalls/netbsd.xml b/gdb/syscalls/netbsd.xml new file mode 100644 index 00000000000..06a9702659f --- /dev/null +++ b/gdb/syscalls/netbsd.xml @@ -0,0 +1,461 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gdb/syscalls/update-netbsd.sh b/gdb/syscalls/update-netbsd.sh new file mode 100755 index 00000000000..9ea7b57857b --- /dev/null +++ b/gdb/syscalls/update-netbsd.sh @@ -0,0 +1,78 @@ +#! /bin/sh + +# Copyright (C) 2020 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-netbsd.sh +# Update the netbsd.xml file. +# +# NetBSD uses the same list of system calls on all architectures. +# The list is defined in the sys/kern/syscalls.master file in the +# NetBSD source tree. This file is used as an input to generate +# several files that are also stored in NetBSD'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 > netbsd.xml.tmp < + + + + + + + + +EOF + +awk ' +/MAXSYSCALL/ || /_SYS_SYSCALL_H_/ || /MAXSYSARGS/ || /syscall/ || /NSYSENT/ { + next +} +/^#define/ { + sub(/^SYS_/,"",$2); + printf " \n" +} +/\/\* [0-9]* is obsolete [a-z_]* \*\// { + printf " \n", $5, $2 +} +/\/\* [0-9]* is netbsd[0-9]* [a-z_]* \*\// { + printf " \n", $4, $5, $2, $5 +}' "$1" >> netbsd.xml.tmp + +cat >> netbsd.xml.tmp < +EOF + +../../move-if-change netbsd.xml.tmp netbsd.xml -- 2.30.2