[PATCH v5 4/5] Include group information to xml syscall files.
Doug Evans
dje@google.com
Tue May 17 17:28:00 GMT 2016
Gabriel Krisman Bertazi writes:
> We maintain linux-defaults.xml.in, a template file to hold generic group
> information. It is used by the XSL script that parses the architecture
> specific files to generate the final xml files, which are actually
> installed and loaded by GDB. The script is not run during the normal
> build process, only when building in maintainer mode.
>
> gdb/
>
> * data-directory/Makefile.in: Generate syscall xml when building
> in maintainer mode.
> * configure.ac: Include dependency for xsltproc when building
> in maintainer-mode.
> * syscalls/apply-defaults.xsl: New file.
> * syscalls/linux-defaults.xml.in: New file.
> * syscalls/aarch64-linux.xml: Rename to aarch64-linux.xml.in.
> * syscalls/amd64-linux.xml: Rename to amd64-linux.xml.in.
> * syscalls/arm-linux.xml: Rename to arm-linux.xml.in.
> * syscalls/bfin-linux.xml: Rename to bfin-linux.xml.in.
> * syscalls/i386-linux.xml: Rename to i386-linux.xml.in.
> * syscalls/mips-n32-linux.xml: Rename to mips-n32-linux.xml.in.
> * syscalls/mips-n64-linux.xml: Rename to mips-n64-linux.xml.in.
> * syscalls/mips-o32-linux.xml: Rename to mips-o32-linux.xml.in.
> * syscalls/ppc-linux.xml: Rename to ppc-linux.xml.in.
> * syscalls/ppc64-linux.xml: Rename to ppc64-linux.xml.in.
> * syscalls/s390-linux.xml: Rename to s390-linux.xml.in.
> * syscalls/s390x-linux.xml: Rename to s390x-linux.xml.in.
> * syscalls/sparc-linux.xml: Rename to sparc-linux.xml.in.
> * syscalls/sparc64-linux.xml: Rename to sparc64-linux.xml.in.
>...
>
> diff --git a/gdb/configure.ac b/gdb/configure.ac
> index d1930f9..b6529aa 100644
> --- a/gdb/configure.ac
> +++ b/gdb/configure.ac
> @@ -2338,6 +2338,16 @@ if test "${nativefile}" != ""; then
> fi
> AC_SUBST(GDB_NM_FILE)
>
> +dnl Add dependency for xsltproc if building with maintainer-mode
enabled.
> +if test "x$USE_MAINTAINER_MODE" = xyes; then
> + AC_PATH_PROGS(XSLTPROC, xsltproc, missing)
> + if test "${XSLTPROC}" = missing; then
> + AC_ERROR(unable to find xsltproc. maintainer-mode requires
xsltproc.)
> + fi
> +fi
> +AC_SUBST(XSLTPROC)
I wonder if we document maintainer-mode prerequisites anywhere.
> +
> +
> AC_LINK_FILES($files, $links)
>
> dnl Check for exe extension set on certain hosts (e.g. Win32)
> diff --git a/gdb/data-directory/Makefile.in
b/gdb/data-directory/Makefile.in
> index c05f379..9be925a 100644
> --- a/gdb/data-directory/Makefile.in
> +++ b/gdb/data-directory/Makefile.in
> @@ -22,6 +22,7 @@ PYTHON_SRCDIR = $(srcdir)/../python/lib
> GUILE_SRCDIR = $(srcdir)/../guile/lib
> SYSTEM_GDBINIT_SRCDIR = $(srcdir)/../system-gdbinit
> VPATH =
$(srcdir):$(SYSCALLS_SRCDIR):$(PYTHON_SRCDIR):$(GUILE_SRCDIR):$(SYSTEM_GDBINIT_SRCDIR)
> +XSLTPROC = @XSLTPROC@
>
> top_srcdir = @top_srcdir@
> top_builddir = @top_builddir@
> @@ -162,6 +163,9 @@ FLAGS_TO_PASS = \
> .PHONY: all
> all: stamp-syscalls stamp-python stamp-guile stamp-system-gdbinit
>
> +@MAINTAINER_MODE_TRUE@%.xml: %.xml.in apply-defaults.xsl
linux-defaults.xml.in
> +@MAINTAINER_MODE_TRUE@ $(XSLTPROC) -o $(SYSCALLS_SRCDIR)/$@
$(SYSCALLS_SRCDIR)/apply-defaults.xsl $<;\
> +
> # For portability's sake, we need to handle systems that don't have
> # symbolic links.
> stamp-syscalls: Makefile $(SYSCALLS_FILES)
> diff --git a/gdb/syscalls/aarch64-linux.xml
b/gdb/syscalls/aarch64-linux.xml.in
> similarity index 100%
> rename from gdb/syscalls/aarch64-linux.xml
> rename to gdb/syscalls/aarch64-linux.xml.in
> diff --git a/gdb/syscalls/amd64-linux.xml
b/gdb/syscalls/amd64-linux.xml.in
> similarity index 100%
> rename from gdb/syscalls/amd64-linux.xml
> rename to gdb/syscalls/amd64-linux.xml.in
> diff --git a/gdb/syscalls/apply-defaults.xsl
b/gdb/syscalls/apply-defaults.xsl
> new file mode 100644
> index 0000000..6363fc4
> --- /dev/null
> +++ b/gdb/syscalls/apply-defaults.xsl
> @@ -0,0 +1,27 @@
> +<!-- Copyright (C) 2016 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. -->
> +
> +<xsl:stylesheet version="1.0"
> + xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> + <xsl:output method="xml" doctype-system="gdb-syscalls.dtd"/>
> +
> + <xsl:template match="node()|@*" name="identity">
> + <xsl:copy>
> + <xsl:apply-templates select="node()|@*"/>
> + </xsl:copy>
> + </xsl:template>
> +
> + <xsl:template match="/syscalls_info/syscall">
> + <xsl:copy>
> + <xsl:apply-templates select="@*|node()"/>
> + <xsl:variable name="syscall"><xsl:value-of
select="@name"/></xsl:variable>
> + <xsl:for-each
select="document('linux-defaults.xml.in')/syscalls_defaults/child::*[@name=$syscall]">
> + <xsl:attribute name="groups"><xsl:value-of
select="@groups"/></xsl:attribute>
> + </xsl:for-each>
> + </xsl:copy>
> + </xsl:template>
> +
> +</xsl:stylesheet>
At the moment all group information comes from the defaults (I think).
I'm assuming all one has to do for special cases is add the group(s)
directly to the foo-xml.in file and that will work. Right?
IWBN to have some examples so people don't work from a default modus
operandi
of adding everything to linux-defaults.xml.in.
btw, why is linux-defaults.xml.in a ".in" file?
I'd expect it to just be linux-defaults.xml.
> diff --git a/gdb/syscalls/arm-linux.xml b/gdb/syscalls/arm-linux.xml.in
> similarity index 100%
> rename from gdb/syscalls/arm-linux.xml
> rename to gdb/syscalls/arm-linux.xml.in
> diff --git a/gdb/syscalls/bfin-linux.xml b/gdb/syscalls/bfin-linux.xml.in
> similarity index 100%
> rename from gdb/syscalls/bfin-linux.xml
> rename to gdb/syscalls/bfin-linux.xml.in
> diff --git a/gdb/syscalls/i386-linux.xml b/gdb/syscalls/i386-linux.xml.in
> similarity index 100%
> rename from gdb/syscalls/i386-linux.xml
> rename to gdb/syscalls/i386-linux.xml.in
> diff --git a/gdb/syscalls/linux-defaults.xml.in
b/gdb/syscalls/linux-defaults.xml.in
> new file mode 100644
> index 0000000..1c4e187
> --- /dev/null
> +++ b/gdb/syscalls/linux-defaults.xml.in
> @@ -0,0 +1,243 @@
> +<?xml version="1.0"?>
> +<!-- Copyright (C) 2009-2016 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. -->
> +
> +<!-- The group field information was based on strace. -->
> +
> +<syscalls_defaults>
> + <syscall name="read" groups="descriptor"/>
> + <syscall name="write" groups="descriptor"/>
> + <syscall name="open" groups="descriptor,file"/>
> + <syscall name="close" groups="descriptor"/>
> + <syscall name="stat" groups="file"/>
> + <syscall name="fstat" groups="descriptor"/>
> + <syscall name="lstat" groups="file"/>
> + <syscall name="poll" groups="descriptor"/>
> + <syscall name="lseek" groups="descriptor"/>
> + <syscall name="mmap" groups="descriptor,memory"/>
> + <syscall name="mprotect" groups="memory"/>
> + <syscall name="munmap" groups="memory"/>
> + <syscall name="brk" groups="memory"/>
> + <syscall name="rt_sigaction" groups="signal"/>
> + <syscall name="rt_sigprocmask" groups="signal"/>
> + <syscall name="rt_sigreturn" groups="signal"/>
> + <syscall name="ioctl" groups="descriptor"/>
> + <syscall name="pread64" groups="descriptor"/>
> + <syscall name="pwrite64" groups="descriptor"/>
> + <syscall name="readv" groups="descriptor"/>
> + <syscall name="writev" groups="descriptor"/>
> + <syscall name="access" groups="file"/>
> + <syscall name="pipe" groups="descriptor"/>
> + <syscall name="select" groups="descriptor"/>
> + <syscall name="mremap" groups="memory"/>
> + <syscall name="msync" groups="memory"/>
> + <syscall name="mincore" groups="memory"/>
> + <syscall name="madvise" groups="memory"/>
> + <syscall name="shmget" groups="ipc"/>
> + <syscall name="shmat" groups="ipc,memory"/>
> + <syscall name="shmctl" groups="ipc"/>
> + <syscall name="dup" groups="descriptor"/>
> + <syscall name="dup2" groups="descriptor"/>
> + <syscall name="pause" groups="signal"/>
> + <syscall name="sendfile" groups="descriptor,network"/>
> + <syscall name="socket" groups="network"/>
> + <syscall name="connect" groups="network"/>
> + <syscall name="accept" groups="network"/>
> + <syscall name="sendto" groups="network"/>
> + <syscall name="recvfrom" groups="network"/>
> + <syscall name="sendmsg" groups="network"/>
> + <syscall name="recvmsg" groups="network"/>
> + <syscall name="shutdown" groups="network"/>
> + <syscall name="bind" groups="network"/>
> + <syscall name="listen" groups="network"/>
> + <syscall name="getsockname" groups="network"/>
> + <syscall name="getpeername" groups="network"/>
> + <syscall name="socketpair" groups="network"/>
> + <syscall name="setsockopt" groups="network"/>
> + <syscall name="getsockopt" groups="network"/>
> + <syscall name="clone" groups="process"/>
> + <syscall name="fork" groups="process"/>
> + <syscall name="vfork" groups="process"/>
> + <syscall name="execve" groups="file,process"/>
> + <syscall name="execv" groups="file,process"/>
> + <syscall name="exit" groups="process"/>
> + <syscall name="wait4" groups="process"/>
> + <syscall name="kill" groups="signal"/>
> + <syscall name="semget" groups="ipc"/>
> + <syscall name="semop" groups="ipc"/>
> + <syscall name="semctl" groups="ipc"/>
> + <syscall name="shmdt" groups="ipc,memory"/>
> + <syscall name="msgget" groups="ipc"/>
> + <syscall name="msgsnd" groups="ipc"/>
> + <syscall name="msgrcv" groups="ipc"/>
> + <syscall name="msgctl" groups="ipc"/>
> + <syscall name="fcntl" groups="descriptor"/>
> + <syscall name="flock" groups="descriptor"/>
> + <syscall name="fsync" groups="descriptor"/>
> + <syscall name="fdatasync" groups="descriptor"/>
> + <syscall name="truncate" groups="file"/>
> + <syscall name="ftruncate" groups="descriptor"/>
> + <syscall name="getdents" groups="descriptor"/>
> + <syscall name="getcwd" groups="file"/>
> + <syscall name="chdir" groups="file"/>
> + <syscall name="fchdir" groups="descriptor"/>
> + <syscall name="rename" groups="file"/>
> + <syscall name="mkdir" groups="file"/>
> + <syscall name="rmdir" groups="file"/>
> + <syscall name="creat" groups="descriptor,file"/>
> + <syscall name="link" groups="file"/>
> + <syscall name="unlink" groups="file"/>
> + <syscall name="symlink" groups="file"/>
> + <syscall name="readlink" groups="file"/>
> + <syscall name="chmod" groups="file"/>
> + <syscall name="fchmod" groups="descriptor"/>
> + <syscall name="chown" groups="file"/>
> + <syscall name="fchown" groups="descriptor"/>
> + <syscall name="lchown" groups="file"/>
> + <syscall name="rt_sigpending" groups="signal"/>
> + <syscall name="rt_sigtimedwait" groups="signal"/>
> + <syscall name="rt_sigqueueinfo" groups="signal"/>
> + <syscall name="rt_sigsuspend" groups="signal"/>
> + <syscall name="sigaltstack" groups="signal"/>
> + <syscall name="utime" groups="file"/>
> + <syscall name="mknod" groups="file"/>
> + <syscall name="uselib" groups="file"/>
> + <syscall name="statfs" groups="file"/>
> + <syscall name="fstatfs" groups="descriptor"/>
> + <syscall name="mlock" groups="memory"/>
> + <syscall name="munlock" groups="memory"/>
> + <syscall name="mlockall" groups="memory"/>
> + <syscall name="munlockall" groups="memory"/>
> + <syscall name="pivot_root" groups="file"/>
> + <syscall name="arch_prctl" groups="process"/>
> + <syscall name="chroot" groups="file"/>
> + <syscall name="acct" groups="file"/>
> + <syscall name="mount" groups="file"/>
> + <syscall name="umount" groups="file"/>
> + <syscall name="umount2" groups="file"/>
> + <syscall name="swapon" groups="file"/>
> + <syscall name="swapoff" groups="file"/>
> + <syscall name="quotactl" groups="file"/>
> + <syscall name="readahead" groups="descriptor"/>
> + <syscall name="setxattr" groups="file"/>
> + <syscall name="lsetxattr" groups="file"/>
> + <syscall name="fsetxattr" groups="descriptor"/>
> + <syscall name="getxattr" groups="file"/>
> + <syscall name="lgetxattr" groups="file"/>
> + <syscall name="fgetxattr" groups="descriptor"/>
> + <syscall name="listxattr" groups="file"/>
> + <syscall name="llistxattr" groups="file"/>
> + <syscall name="flistxattr" groups="descriptor"/>
> + <syscall name="removexattr" groups="file"/>
> + <syscall name="lremovexattr" groups="file"/>
> + <syscall name="fremovexattr" groups="descriptor"/>
> + <syscall name="tkill" groups="signal"/>
> + <syscall name="epoll_create" groups="descriptor"/>
> + <syscall name="remap_file_pages" groups="memory"/>
> + <syscall name="getdents64" groups="descriptor"/>
> + <syscall name="semtimedop" groups="ipc"/>
> + <syscall name="fadvise64" groups="descriptor"/>
> + <syscall name="exit_group" groups="process"/>
> + <syscall name="epoll_wait" groups="descriptor"/>
> + <syscall name="epoll_ctl" groups="descriptor"/>
> + <syscall name="tgkill" groups="signal"/>
> + <syscall name="utimes" groups="file"/>
> + <syscall name="mbind" groups="memory"/>
> + <syscall name="set_mempolicy" groups="memory"/>
> + <syscall name="get_mempolicy" groups="memory"/>
> + <syscall name="waitid" groups="process"/>
> + <syscall name="inotify_init" groups="descriptor"/>
> + <syscall name="inotify_add_watch" groups="descriptor"/>
> + <syscall name="inotify_rm_watch" groups="descriptor"/>
> + <syscall name="migrate_pages" groups="memory"/>
> + <syscall name="openat" groups="descriptor,file"/>
> + <syscall name="mkdirat" groups="descriptor,file"/>
> + <syscall name="mknodat" groups="descriptor,file"/>
> + <syscall name="fchownat" groups="descriptor,file"/>
> + <syscall name="futimesat" groups="descriptor,file"/>
> + <syscall name="newfstatat" groups="descriptor,file"/>
> + <syscall name="unlinkat" groups="descriptor,file"/>
> + <syscall name="renameat" groups="descriptor,file"/>
> + <syscall name="linkat" groups="descriptor,file"/>
> + <syscall name="symlinkat" groups="descriptor,file"/>
> + <syscall name="readlinkat" groups="descriptor,file"/>
> + <syscall name="fchmodat" groups="descriptor,file"/>
> + <syscall name="faccessat" groups="descriptor,file"/>
> + <syscall name="pselect6" groups="descriptor"/>
> + <syscall name="ppoll" groups="descriptor"/>
> + <syscall name="unshare" groups="process"/>
> + <syscall name="splice" groups="descriptor"/>
> + <syscall name="tee" groups="descriptor"/>
> + <syscall name="sync_file_range" groups="descriptor"/>
> + <syscall name="vmsplice" groups="descriptor"/>
> + <syscall name="move_pages" groups="memory"/>
> + <syscall name="utimensat" groups="descriptor,file"/>
> + <syscall name="epoll_pwait" groups="descriptor"/>
> + <syscall name="signalfd" groups="descriptor,signal"/>
> + <syscall name="timerfd_create" groups="descriptor"/>
> + <syscall name="eventfd" groups="descriptor"/>
> + <syscall name="fallocate" groups="descriptor"/>
> + <syscall name="timerfd_settime" groups="descriptor"/>
> + <syscall name="timerfd_gettime" groups="descriptor"/>
> + <syscall name="accept4" groups="network"/>
> + <syscall name="signalfd4" groups="descriptor,signal"/>
> + <syscall name="eventfd2" groups="descriptor"/>
> + <syscall name="epoll_create1" groups="descriptor"/>
> + <syscall name="dup3" groups="descriptor"/>
> + <syscall name="pipe2" groups="descriptor"/>
> + <syscall name="inotify_init1" groups="descriptor"/>
> + <syscall name="preadv" groups="descriptor"/>
> + <syscall name="pwritev" groups="descriptor"/>
> + <syscall name="send" groups="network"/>
> + <syscall name="recv" groups="network"/>
> + <syscall name="statfs64" groups="file"/>
> + <syscall name="fstatfs64" groups="descriptor"/>
> + <syscall name="sendfile64" groups="descriptor,network"/>
> + <syscall name="rt_tgsigqueueinfo" groups="process,signal"/>
> + <syscall name="perf_event_open" groups="descriptor"/>
> + <syscall name="recvmmsg" groups="network"/>
> + <syscall name="fanotify_init" groups="descriptor"/>
> + <syscall name="fanotify_mark" groups="descriptor,file"/>
> + <syscall name="fchown32" groups="descriptor"/>
> + <syscall name="chown32" groups="file"/>
> + <syscall name="fcntl64" groups="descriptor"/>
> + <syscall name="mmap2" groups="descriptor,memory"/>
> + <syscall name="truncate64" groups="file"/>
> + <syscall name="ftruncate64" groups="descriptor"/>
> + <syscall name="stat64" groups="file"/>
> + <syscall name="lstat64" groups="file"/>
> + <syscall name="fstat64" groups="descriptor"/>
> + <syscall name="lchown32" groups="file"/>
> + <syscall name="name_to_handle_at" groups="descriptor,file"/>
> + <syscall name="open_by_handle_at" groups="descriptor"/>
> + <syscall name="_llseek" groups="descriptor"/>
> + <syscall name="syncfs" groups="descriptor"/>
> + <syscall name="sendmmsg" groups="network"/>
> + <syscall name="setns" groups="descriptor"/>
> + <syscall name="finit_module" groups="descriptor"/>
> + <syscall name="oldstat" groups="file"/>
> + <syscall name="sigaction" groups="signal"/>
> + <syscall name="sigreturn" groups="signal"/>
> + <syscall name="sigsuspend" groups="signal"/>
> + <syscall name="sigpending" groups="signal"/>
> + <syscall name="sigprocmask" groups="signal"/>
> + <syscall name="ipc" groups="ipc"/>
> + <syscall name="readdir" groups="descriptor"/>
> + <syscall name="socketcall" groups="descriptor"/>
> + <syscall name="break" groups="memory"/>
> + <syscall name="oldfstat" groups="descriptor"/>
> + <syscall name="signal" groups="signal"/>
> + <syscall name="sgetmask" groups="signal"/>
> + <syscall name="ssetmask" groups="signal"/>
> + <syscall name="oldlstat" groups="file"/>
> + <syscall name="waitpid" groups="process"/>
> + <syscall name="pread" groups="descriptor"/>
> + <syscall name="pwrite" groups="descriptor"/>
> + <syscall name="fadvise64_64" groups="descriptor"/>
> + <syscall name="fstatat64" groups="descriptor,file"/>
> + <syscall name="_newselect" groups="descriptor"/>
> + <syscall name="timerfd" groups="descriptor"/>
> +</syscalls_defaults>
> diff --git a/gdb/syscalls/mips-n32-linux.xml
b/gdb/syscalls/mips-n32-linux.xml.in
> similarity index 100%
> rename from gdb/syscalls/mips-n32-linux.xml
> rename to gdb/syscalls/mips-n32-linux.xml.in
> diff --git a/gdb/syscalls/mips-n64-linux.xml
b/gdb/syscalls/mips-n64-linux.xml.in
> similarity index 100%
> rename from gdb/syscalls/mips-n64-linux.xml
> rename to gdb/syscalls/mips-n64-linux.xml.in
> diff --git a/gdb/syscalls/mips-o32-linux.xml
b/gdb/syscalls/mips-o32-linux.xml.in
> similarity index 100%
> rename from gdb/syscalls/mips-o32-linux.xml
> rename to gdb/syscalls/mips-o32-linux.xml.in
> diff --git a/gdb/syscalls/ppc-linux.xml b/gdb/syscalls/ppc-linux.xml.in
> similarity index 100%
> rename from gdb/syscalls/ppc-linux.xml
> rename to gdb/syscalls/ppc-linux.xml.in
> diff --git a/gdb/syscalls/ppc64-linux.xml
b/gdb/syscalls/ppc64-linux.xml.in
> similarity index 100%
> rename from gdb/syscalls/ppc64-linux.xml
> rename to gdb/syscalls/ppc64-linux.xml.in
> diff --git a/gdb/syscalls/s390-linux.xml b/gdb/syscalls/s390-linux.xml.in
> similarity index 100%
> rename from gdb/syscalls/s390-linux.xml
> rename to gdb/syscalls/s390-linux.xml.in
> diff --git a/gdb/syscalls/s390x-linux.xml
b/gdb/syscalls/s390x-linux.xml.in
> similarity index 100%
> rename from gdb/syscalls/s390x-linux.xml
> rename to gdb/syscalls/s390x-linux.xml.in
> diff --git a/gdb/syscalls/sparc-linux.xml
b/gdb/syscalls/sparc-linux.xml.in
> similarity index 100%
> rename from gdb/syscalls/sparc-linux.xml
> rename to gdb/syscalls/sparc-linux.xml.in
> diff --git a/gdb/syscalls/sparc64-linux.xml
b/gdb/syscalls/sparc64-linux.xml.in
> similarity index 100%
> rename from gdb/syscalls/sparc64-linux.xml
> rename to gdb/syscalls/sparc64-linux.xml.in
> --
> 2.4.3
>
More information about the Gdb-patches
mailing list