* [PATCH 3/4] 'catch syscall' feature -- XML support part
@ 2008-11-04 4:32 Sérgio Durigan Júnior
2008-11-04 13:36 ` Mark Kettenis
` (2 more replies)
0 siblings, 3 replies; 18+ messages in thread
From: Sérgio Durigan Júnior @ 2008-11-04 4:32 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 778 bytes --]
This is the part which adds XML support for the "catch syscall" feature.
I decided to put the architecture's XML files here too, so that the
architecture-independent part does not grow too much.
Regards,
--
Sérgio Durigan Júnior
Linux on Power Toolchain - Software Engineer
Linux Technology Center - LTC
IBM Brazil
gdb/ChangeLog:
2008-11-04 Sergio Durigan Junior <sergiodj@linux.vnet.ibm.com>
* gdb-syscalls.dtd: New definition file for syscall's XML
support.
* i386-syscalls.xml: New file for i386 syscalls.
* ppc-syscalls.xml: New file for PPC syscalls.
* ppc64-syscalls.xml: New file for PPC64 syscalls.
* xml-syscall.c: New file containing functions for manipulating
syscall's XML files.
* xml-syscall.h: New file, exporting the functions above mentioned.
[-- Attachment #2: catch-syscall-xml-support.patch --]
[-- Type: text/x-patch, Size: 55536 bytes --]
diff --git a/gdb/syscalls/gdb-syscalls.dtd b/gdb/syscalls/gdb-syscalls.dtd
new file mode 100644
index 0000000..0d40ab4
--- /dev/null
+++ b/gdb/syscalls/gdb-syscalls.dtd
@@ -0,0 +1,21 @@
+<!-- Copyright (C) 2007, 2008 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 root element of a syscall info is <syscalls_info>. -->
+
+<!ELEMENT syscalls_info (syscall*)>
+
+<!-- Maybe the 'number' attribute will have to be changed from
+ ID to CDATA. -->
+<!ELEMENT syscall EMPTY>
+<!ATTLIST syscall
+ name CDATA #REQUIRED
+ number ID #REQUIRED>
+
+<!ELEMENT xi:include (EMPTY)>
+<!ATTLIST xi:include
+ xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude"
+ href CDATA #REQUIRED>
diff --git a/gdb/syscalls/i386-syscalls.xml b/gdb/syscalls/i386-syscalls.xml
new file mode 100644
index 0000000..8044c7b
--- /dev/null
+++ b/gdb/syscalls/i386-syscalls.xml
@@ -0,0 +1,337 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2007, 2008 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. -->
+
+<!DOCTYPE feature SYSTEM "gdb-syscalls.dtd">
+
+<syscalls_info>
+ <syscall name="restart_syscall" number="0"/>
+ <syscall name="exit" number="1"/>
+ <syscall name="fork" number="2"/>
+ <syscall name="read" number="3"/>
+ <syscall name="write" number="4"/>
+ <syscall name="open" number="5"/>
+ <syscall name="close" number="6"/>
+ <syscall name="waitpid" number="7"/>
+ <syscall name="creat" number="8"/>
+ <syscall name="link" number="9"/>
+ <syscall name="unlink" number="10"/>
+ <syscall name="execve" number="11"/>
+ <syscall name="chdir" number="12"/>
+ <syscall name="time" number="13"/>
+ <syscall name="mknod" number="14"/>
+ <syscall name="chmod" number="15"/>
+ <syscall name="lchown" number="16"/>
+ <syscall name="break" number="17"/>
+ <syscall name="oldstat" number="18"/>
+ <syscall name="lseek" number="19"/>
+ <syscall name="getpid" number="20"/>
+ <syscall name="mount" number="21"/>
+ <syscall name="umount" number="22"/>
+ <syscall name="setuid" number="23"/>
+ <syscall name="getuid" number="24"/>
+ <syscall name="stime" number="25"/>
+ <syscall name="ptrace" number="26"/>
+ <syscall name="alarm" number="27"/>
+ <syscall name="oldfstat" number="28"/>
+ <syscall name="pause" number="29"/>
+ <syscall name="utime" number="30"/>
+ <syscall name="stty" number="31"/>
+ <syscall name="gtty" number="32"/>
+ <syscall name="access" number="33"/>
+ <syscall name="nice" number="34"/>
+ <syscall name="ftime" number="35"/>
+ <syscall name="sync" number="36"/>
+ <syscall name="kill" number="37"/>
+ <syscall name="rename" number="38"/>
+ <syscall name="mkdir" number="39"/>
+ <syscall name="rmdir" number="40"/>
+ <syscall name="dup" number="41"/>
+ <syscall name="pipe" number="42"/>
+ <syscall name="times" number="43"/>
+ <syscall name="prof" number="44"/>
+ <syscall name="brk" number="45"/>
+ <syscall name="setgid" number="46"/>
+ <syscall name="getgid" number="47"/>
+ <syscall name="signal" number="48"/>
+ <syscall name="geteuid" number="49"/>
+ <syscall name="getegid" number="50"/>
+ <syscall name="acct" number="51"/>
+ <syscall name="umount2" number="52"/>
+ <syscall name="lock" number="53"/>
+ <syscall name="ioctl" number="54"/>
+ <syscall name="fcntl" number="55"/>
+ <syscall name="mpx" number="56"/>
+ <syscall name="setpgid" number="57"/>
+ <syscall name="ulimit" number="58"/>
+ <syscall name="oldolduname" number="59"/>
+ <syscall name="umask" number="60"/>
+ <syscall name="chroot" number="61"/>
+ <syscall name="ustat" number="62"/>
+ <syscall name="dup2" number="63"/>
+ <syscall name="getppid" number="64"/>
+ <syscall name="getpgrp" number="65"/>
+ <syscall name="setsid" number="66"/>
+ <syscall name="sigaction" number="67"/>
+ <syscall name="sgetmask" number="68"/>
+ <syscall name="ssetmask" number="69"/>
+ <syscall name="setreuid" number="70"/>
+ <syscall name="setregid" number="71"/>
+ <syscall name="sigsuspend" number="72"/>
+ <syscall name="sigpending" number="73"/>
+ <syscall name="sethostname" number="74"/>
+ <syscall name="setrlimit" number="75"/>
+ <syscall name="getrlimit" number="76"/>
+ <syscall name="getrusage" number="77"/>
+ <syscall name="gettimeofday" number="78"/>
+ <syscall name="settimeofday" number="79"/>
+ <syscall name="getgroups" number="80"/>
+ <syscall name="setgroups" number="81"/>
+ <syscall name="select" number="82"/>
+ <syscall name="symlink" number="83"/>
+ <syscall name="oldlstat" number="84"/>
+ <syscall name="readlink" number="85"/>
+ <syscall name="uselib" number="86"/>
+ <syscall name="swapon" number="87"/>
+ <syscall name="reboot" number="88"/>
+ <syscall name="readdir" number="89"/>
+ <syscall name="mmap" number="90"/>
+ <syscall name="munmap" number="91"/>
+ <syscall name="truncate" number="92"/>
+ <syscall name="ftruncate" number="93"/>
+ <syscall name="fchmod" number="94"/>
+ <syscall name="fchown" number="95"/>
+ <syscall name="getpriority" number="96"/>
+ <syscall name="setpriority" number="97"/>
+ <syscall name="profil" number="98"/>
+ <syscall name="statfs" number="99"/>
+ <syscall name="fstatfs" number="100"/>
+ <syscall name="ioperm" number="101"/>
+ <syscall name="socketcall" number="102"/>
+ <syscall name="syslog" number="103"/>
+ <syscall name="setitimer" number="104"/>
+ <syscall name="getitimer" number="105"/>
+ <syscall name="stat" number="106"/>
+ <syscall name="lstat" number="107"/>
+ <syscall name="fstat" number="108"/>
+ <syscall name="olduname" number="109"/>
+ <syscall name="iopl" number="110"/>
+ <syscall name="vhangup" number="111"/>
+ <syscall name="idle" number="112"/>
+ <syscall name="vm86old" number="113"/>
+ <syscall name="wait4" number="114"/>
+ <syscall name="swapoff" number="115"/>
+ <syscall name="sysinfo" number="116"/>
+ <syscall name="ipc" number="117"/>
+ <syscall name="fsync" number="118"/>
+ <syscall name="sigreturn" number="119"/>
+ <syscall name="clone" number="120"/>
+ <syscall name="setdomainname" number="121"/>
+ <syscall name="uname" number="122"/>
+ <syscall name="modify_ldt" number="123"/>
+ <syscall name="adjtimex" number="124"/>
+ <syscall name="mprotect" number="125"/>
+ <syscall name="sigprocmask" number="126"/>
+ <syscall name="create_module" number="127"/>
+ <syscall name="init_module" number="128"/>
+ <syscall name="delete_module" number="129"/>
+ <syscall name="get_kernel_syms" number="130"/>
+ <syscall name="quotactl" number="131"/>
+ <syscall name="getpgid" number="132"/>
+ <syscall name="fchdir" number="133"/>
+ <syscall name="bdflush" number="134"/>
+ <syscall name="sysfs" number="135"/>
+ <syscall name="personality" number="136"/>
+ <syscall name="afs_syscall" number="137"/>
+ <syscall name="setfsuid" number="138"/>
+ <syscall name="setfsgid" number="139"/>
+ <syscall name="_llseek" number="140"/>
+ <syscall name="getdents" number="141"/>
+ <syscall name="_newselect" number="142"/>
+ <syscall name="flock" number="143"/>
+ <syscall name="msync" number="144"/>
+ <syscall name="readv" number="145"/>
+ <syscall name="writev" number="146"/>
+ <syscall name="getsid" number="147"/>
+ <syscall name="fdatasync" number="148"/>
+ <syscall name="_sysctl" number="149"/>
+ <syscall name="mlock" number="150"/>
+ <syscall name="munlock" number="151"/>
+ <syscall name="mlockall" number="152"/>
+ <syscall name="munlockall" number="153"/>
+ <syscall name="sched_setparam" number="154"/>
+ <syscall name="sched_getparam" number="155"/>
+ <syscall name="sched_setscheduler" number="156"/>
+ <syscall name="sched_getscheduler" number="157"/>
+ <syscall name="sched_yield" number="158"/>
+ <syscall name="sched_get_priority_max" number="159"/>
+ <syscall name="sched_get_priority_min" number="160"/>
+ <syscall name="sched_rr_get_interval" number="161"/>
+ <syscall name="nanosleep" number="162"/>
+ <syscall name="mremap" number="163"/>
+ <syscall name="setresuid" number="164"/>
+ <syscall name="getresuid" number="165"/>
+ <syscall name="vm86" number="166"/>
+ <syscall name="query_module" number="167"/>
+ <syscall name="poll" number="168"/>
+ <syscall name="nfsservctl" number="169"/>
+ <syscall name="setresgid" number="170"/>
+ <syscall name="getresgid" number="171"/>
+ <syscall name="prctl" number="172"/>
+ <syscall name="rt_sigreturn" number="173"/>
+ <syscall name="rt_sigaction" number="174"/>
+ <syscall name="rt_sigprocmask" number="175"/>
+ <syscall name="rt_sigpending" number="176"/>
+ <syscall name="rt_sigtimedwait" number="177"/>
+ <syscall name="rt_sigqueueinfo" number="178"/>
+ <syscall name="rt_sigsuspend" number="179"/>
+ <syscall name="pread64" number="180"/>
+ <syscall name="pwrite64" number="181"/>
+ <syscall name="chown" number="182"/>
+ <syscall name="getcwd" number="183"/>
+ <syscall name="capget" number="184"/>
+ <syscall name="capset" number="185"/>
+ <syscall name="sigaltstack" number="186"/>
+ <syscall name="sendfile" number="187"/>
+ <syscall name="getpmsg" number="188"/>
+ <syscall name="putpmsg" number="189"/>
+ <syscall name="vfork" number="190"/>
+ <syscall name="ugetrlimit" number="191"/>
+ <syscall name="mmap2" number="192"/>
+ <syscall name="truncate64" number="193"/>
+ <syscall name="ftruncate64" number="194"/>
+ <syscall name="stat64" number="195"/>
+ <syscall name="lstat64" number="196"/>
+ <syscall name="fstat64" number="197"/>
+ <syscall name="lchown32" number="198"/>
+ <syscall name="getuid32" number="199"/>
+ <syscall name="getgid32" number="200"/>
+ <syscall name="geteuid32" number="201"/>
+ <syscall name="getegid32" number="202"/>
+ <syscall name="setreuid32" number="203"/>
+ <syscall name="setregid32" number="204"/>
+ <syscall name="getgroups32" number="205"/>
+ <syscall name="setgroups32" number="206"/>
+ <syscall name="fchown32" number="207"/>
+ <syscall name="setresuid32" number="208"/>
+ <syscall name="getresuid32" number="209"/>
+ <syscall name="setresgid32" number="210"/>
+ <syscall name="getresgid32" number="211"/>
+ <syscall name="chown32" number="212"/>
+ <syscall name="setuid32" number="213"/>
+ <syscall name="setgid32" number="214"/>
+ <syscall name="setfsuid32" number="215"/>
+ <syscall name="setfsgid32" number="216"/>
+ <syscall name="pivot_root" number="217"/>
+ <syscall name="mincore" number="218"/>
+ <syscall name="madvise" number="219"/>
+ <syscall name="madvise1" number="220"/>
+ <syscall name="getdents64" number="221"/>
+ <syscall name="fcntl64" number="222"/>
+ <syscall name="" number="223"/>
+ <syscall name="gettid" number="224"/>
+ <syscall name="readahead" number="225"/>
+ <syscall name="setxattr" number="226"/>
+ <syscall name="lsetxattr" number="227"/>
+ <syscall name="fsetxattr" number="228"/>
+ <syscall name="getxattr" number="229"/>
+ <syscall name="lgetxattr" number="230"/>
+ <syscall name="fgetxattr" number="231"/>
+ <syscall name="listxattr" number="232"/>
+ <syscall name="llistxattr" number="233"/>
+ <syscall name="flistxattr" number="234"/>
+ <syscall name="removexattr" number="235"/>
+ <syscall name="lremovexattr" number="236"/>
+ <syscall name="fremovexattr" number="237"/>
+ <syscall name="tkill" number="238"/>
+ <syscall name="sendfile64" number="239"/>
+ <syscall name="futex" number="240"/>
+ <syscall name="sched_setaffinity" number="241"/>
+ <syscall name="sched_getaffinity" number="242"/>
+ <syscall name="set_thread_area" number="243"/>
+ <syscall name="get_thread_area" number="244"/>
+ <syscall name="io_setup" number="245"/>
+ <syscall name="io_destroy" number="246"/>
+ <syscall name="io_getevents" number="247"/>
+ <syscall name="io_submit" number="248"/>
+ <syscall name="io_cancel" number="249"/>
+ <syscall name="fadvise64" number="250"/>
+ <syscall name="" number="251"/>
+ <syscall name="exit_group" number="252"/>
+ <syscall name="lookup_dcookie" number="253"/>
+ <syscall name="epoll_create" number="254"/>
+ <syscall name="epoll_ctl" number="255"/>
+ <syscall name="epoll_wait" number="256"/>
+ <syscall name="remap_file_pages" number="257"/>
+ <syscall name="set_tid_address" number="258"/>
+ <syscall name="timer_create" number="259"/>
+ <syscall name="timer_settime" number="260"/>
+ <syscall name="timer_gettime" number="261"/>
+ <syscall name="timer_getoverrun" number="262"/>
+ <syscall name="timer_delete" number="263"/>
+ <syscall name="clock_settime" number="264"/>
+ <syscall name="clock_gettime" number="265"/>
+ <syscall name="clock_getres" number="266"/>
+ <syscall name="clock_nanosleep" number="267"/>
+ <syscall name="statfs64" number="268"/>
+ <syscall name="fstatfs64" number="269"/>
+ <syscall name="tgkill" number="270"/>
+ <syscall name="utimes" number="271"/>
+ <syscall name="fadvise64_64" number="272"/>
+ <syscall name="vserver" number="273"/>
+ <syscall name="mbind" number="274"/>
+ <syscall name="get_mempolicy" number="275"/>
+ <syscall name="set_mempolicy" number="276"/>
+ <syscall name="mq_open" number="277"/>
+ <syscall name="mq_unlink" number="278"/>
+ <syscall name="mq_timedsend" number="279"/>
+ <syscall name="mq_timedreceive" number="280"/>
+ <syscall name="mq_notify" number="281"/>
+ <syscall name="mq_getsetattr" number="282"/>
+ <syscall name="kexec_load" number="283"/>
+ <syscall name="waitid" number="284"/>
+ <syscall name="" number="285"/>
+ <syscall name="add_key" number="286"/>
+ <syscall name="request_key" number="287"/>
+ <syscall name="keyctl" number="288"/>
+ <syscall name="ioprio_set" number="289"/>
+ <syscall name="ioprio_get" number="290"/>
+ <syscall name="inotify_init" number="291"/>
+ <syscall name="inotify_add_watch" number="292"/>
+ <syscall name="inotify_rm_watch" number="293"/>
+ <syscall name="migrate_pages" number="294"/>
+ <syscall name="openat" number="295"/>
+ <syscall name="mkdirat" number="296"/>
+ <syscall name="mknodat" number="297"/>
+ <syscall name="fchownat" number="298"/>
+ <syscall name="futimesat" number="299"/>
+ <syscall name="fstatat64" number="300"/>
+ <syscall name="unlinkat" number="301"/>
+ <syscall name="renameat" number="302"/>
+ <syscall name="linkat" number="303"/>
+ <syscall name="symlinkat" number="304"/>
+ <syscall name="readlinkat" number="305"/>
+ <syscall name="fchmodat" number="306"/>
+ <syscall name="faccessat" number="307"/>
+ <syscall name="pselect6" number="308"/>
+ <syscall name="ppoll" number="309"/>
+ <syscall name="unshare" number="310"/>
+ <syscall name="set_robust_list" number="311"/>
+ <syscall name="get_robust_list" number="312"/>
+ <syscall name="splice" number="313"/>
+ <syscall name="sync_file_range" number="314"/>
+ <syscall name="tee" number="315"/>
+ <syscall name="vmsplice" number="316"/>
+ <syscall name="move_pages" number="317"/>
+ <syscall name="getcpu" number="318"/>
+ <syscall name="epoll_pwait" number="319"/>
+ <syscall name="utimensat" number="320"/>
+ <syscall name="signalfd" number="321"/>
+ <syscall name="timerfd_create" number="322"/>
+ <syscall name="eventfd" number="323"/>
+ <syscall name="fallocate" number="324"/>
+ <syscall name="timerfd_settime" number="325"/>
+</syscalls_info>
diff --git a/gdb/syscalls/ppc-syscalls.xml b/gdb/syscalls/ppc-syscalls.xml
new file mode 100644
index 0000000..4ac794f
--- /dev/null
+++ b/gdb/syscalls/ppc-syscalls.xml
@@ -0,0 +1,312 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2007, 2008 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. -->
+
+<!DOCTYPE feature SYSTEM "gdb-syscalls.dtd">
+
+<syscalls_info>
+ <syscall name="restart_syscall" number="0"/>
+ <syscall name="exit" number="1"/>
+ <syscall name="fork" number="2"/>
+ <syscall name="read" number="3"/>
+ <syscall name="write" number="4"/>
+ <syscall name="open" number="5"/>
+ <syscall name="close" number="6"/>
+ <syscall name="waitpid" number="7"/>
+ <syscall name="creat" number="8"/>
+ <syscall name="link" number="9"/>
+ <syscall name="unlink" number="10"/>
+ <syscall name="execve" number="11"/>
+ <syscall name="chdir" number="12"/>
+ <syscall name="time" number="13"/>
+ <syscall name="mknod" number="14"/>
+ <syscall name="chmod" number="15"/>
+ <syscall name="lchown" number="16"/>
+ <syscall name="break" number="17"/>
+ <syscall name="oldstat" number="18"/>
+ <syscall name="lseek" number="19"/>
+ <syscall name="getpid" number="20"/>
+ <syscall name="mount" number="21"/>
+ <syscall name="umount" number="22"/>
+ <syscall name="setuid" number="23"/>
+ <syscall name="getuid" number="24"/>
+ <syscall name="stime" number="25"/>
+ <syscall name="ptrace" number="26"/>
+ <syscall name="alarm" number="27"/>
+ <syscall name="oldfstat" number="28"/>
+ <syscall name="pause" number="29"/>
+ <syscall name="utime" number="30"/>
+ <syscall name="stty" number="31"/>
+ <syscall name="gtty" number="32"/>
+ <syscall name="access" number="33"/>
+ <syscall name="nice" number="34"/>
+ <syscall name="ftime" number="35"/>
+ <syscall name="sync" number="36"/>
+ <syscall name="kill" number="37"/>
+ <syscall name="rename" number="38"/>
+ <syscall name="mkdir" number="39"/>
+ <syscall name="rmdir" number="40"/>
+ <syscall name="dup" number="41"/>
+ <syscall name="pipe" number="42"/>
+ <syscall name="times" number="43"/>
+ <syscall name="prof" number="44"/>
+ <syscall name="brk" number="45"/>
+ <syscall name="setgid" number="46"/>
+ <syscall name="getgid" number="47"/>
+ <syscall name="signal" number="48"/>
+ <syscall name="geteuid" number="49"/>
+ <syscall name="getegid" number="50"/>
+ <syscall name="acct" number="51"/>
+ <syscall name="umount2" number="52"/>
+ <syscall name="lock" number="53"/>
+ <syscall name="ioctl" number="54"/>
+ <syscall name="fcntl" number="55"/>
+ <syscall name="mpx" number="56"/>
+ <syscall name="setpgid" number="57"/>
+ <syscall name="ulimit" number="58"/>
+ <syscall name="oldolduname" number="59"/>
+ <syscall name="umask" number="60"/>
+ <syscall name="chroot" number="61"/>
+ <syscall name="ustat" number="62"/>
+ <syscall name="dup2" number="63"/>
+ <syscall name="getppid" number="64"/>
+ <syscall name="getpgrp" number="65"/>
+ <syscall name="setsid" number="66"/>
+ <syscall name="sigaction" number="67"/>
+ <syscall name="sgetmask" number="68"/>
+ <syscall name="ssetmask" number="69"/>
+ <syscall name="setreuid" number="70"/>
+ <syscall name="setregid" number="71"/>
+ <syscall name="sigsuspend" number="72"/>
+ <syscall name="sigpending" number="73"/>
+ <syscall name="sethostname" number="74"/>
+ <syscall name="setrlimit" number="75"/>
+ <syscall name="getrlimit" number="76"/>
+ <syscall name="getrusage" number="77"/>
+ <syscall name="gettimeofday" number="78"/>
+ <syscall name="settimeofday" number="79"/>
+ <syscall name="getgroups" number="80"/>
+ <syscall name="setgroups" number="81"/>
+ <syscall name="select" number="82"/>
+ <syscall name="symlink" number="83"/>
+ <syscall name="oldlstat" number="84"/>
+ <syscall name="readlink" number="85"/>
+ <syscall name="uselib" number="86"/>
+ <syscall name="swapon" number="87"/>
+ <syscall name="reboot" number="88"/>
+ <syscall name="readdir" number="89"/>
+ <syscall name="mmap" number="90"/>
+ <syscall name="munmap" number="91"/>
+ <syscall name="truncate" number="92"/>
+ <syscall name="ftruncate" number="93"/>
+ <syscall name="fchmod" number="94"/>
+ <syscall name="fchown" number="95"/>
+ <syscall name="getpriority" number="96"/>
+ <syscall name="setpriority" number="97"/>
+ <syscall name="profil" number="98"/>
+ <syscall name="statfs" number="99"/>
+ <syscall name="fstatfs" number="100"/>
+ <syscall name="ioperm" number="101"/>
+ <syscall name="socketcall" number="102"/>
+ <syscall name="syslog" number="103"/>
+ <syscall name="setitimer" number="104"/>
+ <syscall name="getitimer" number="105"/>
+ <syscall name="stat" number="106"/>
+ <syscall name="lstat" number="107"/>
+ <syscall name="fstat" number="108"/>
+ <syscall name="olduname" number="109"/>
+ <syscall name="iopl" number="110"/>
+ <syscall name="vhangup" number="111"/>
+ <syscall name="idle" number="112"/>
+ <syscall name="vm86" number="113"/>
+ <syscall name="wait4" number="114"/>
+ <syscall name="swapoff" number="115"/>
+ <syscall name="sysinfo" number="116"/>
+ <syscall name="ipc" number="117"/>
+ <syscall name="fsync" number="118"/>
+ <syscall name="sigreturn" number="119"/>
+ <syscall name="clone" number="120"/>
+ <syscall name="setdomainname" number="121"/>
+ <syscall name="uname" number="122"/>
+ <syscall name="modify_ldt" number="123"/>
+ <syscall name="adjtimex" number="124"/>
+ <syscall name="mprotect" number="125"/>
+ <syscall name="sigprocmask" number="126"/>
+ <syscall name="create_module" number="127"/>
+ <syscall name="init_module" number="128"/>
+ <syscall name="delete_module" number="129"/>
+ <syscall name="get_kernel_syms" number="130"/>
+ <syscall name="quotactl" number="131"/>
+ <syscall name="getpgid" number="132"/>
+ <syscall name="fchdir" number="133"/>
+ <syscall name="bdflush" number="134"/>
+ <syscall name="sysfs" number="135"/>
+ <syscall name="personality" number="136"/>
+ <syscall name="afs_syscall" number="137"/>
+ <syscall name="setfsuid" number="138"/>
+ <syscall name="setfsgid" number="139"/>
+ <syscall name="_llseek" number="140"/>
+ <syscall name="getdents" number="141"/>
+ <syscall name="_newselect" number="142"/>
+ <syscall name="flock" number="143"/>
+ <syscall name="msync" number="144"/>
+ <syscall name="readv" number="145"/>
+ <syscall name="writev" number="146"/>
+ <syscall name="getsid" number="147"/>
+ <syscall name="fdatasync" number="148"/>
+ <syscall name="_sysctl" number="149"/>
+ <syscall name="mlock" number="150"/>
+ <syscall name="munlock" number="151"/>
+ <syscall name="mlockall" number="152"/>
+ <syscall name="munlockall" number="153"/>
+ <syscall name="sched_setparam" number="154"/>
+ <syscall name="sched_getparam" number="155"/>
+ <syscall name="sched_setscheduler" number="156"/>
+ <syscall name="sched_getscheduler" number="157"/>
+ <syscall name="sched_yield" number="158"/>
+ <syscall name="sched_get_priority_max" number="159"/>
+ <syscall name="sched_get_priority_min" number="160"/>
+ <syscall name="sched_rr_get_interval" number="161"/>
+ <syscall name="nanosleep" number="162"/>
+ <syscall name="mremap" number="163"/>
+ <syscall name="setresuid" number="164"/>
+ <syscall name="getresuid" number="165"/>
+ <syscall name="query_module" number="166"/>
+ <syscall name="poll" number="167"/>
+ <syscall name="nfsservctl" number="168"/>
+ <syscall name="setresgid" number="169"/>
+ <syscall name="getresgid" number="170"/>
+ <syscall name="prctl" number="171"/>
+ <syscall name="rt_sigreturn" number="172"/>
+ <syscall name="rt_sigaction" number="173"/>
+ <syscall name="rt_sigprocmask" number="174"/>
+ <syscall name="rt_sigpending" number="175"/>
+ <syscall name="rt_sigtimedwait" number="176"/>
+ <syscall name="rt_sigqueueinfo" number="177"/>
+ <syscall name="rt_sigsuspend" number="178"/>
+ <syscall name="pread64" number="179"/>
+ <syscall name="pwrite64" number="180"/>
+ <syscall name="chown" number="181"/>
+ <syscall name="getcwd" number="182"/>
+ <syscall name="capget" number="183"/>
+ <syscall name="capset" number="184"/>
+ <syscall name="sigaltstack" number="185"/>
+ <syscall name="sendfile" number="186"/>
+ <syscall name="getpmsg" number="187"/>
+ <syscall name="putpmsg" number="188"/>
+ <syscall name="vfork" number="189"/>
+ <syscall name="ugetrlimit" number="190"/>
+ <syscall name="readahead" number="191"/>
+ <syscall name="mmap2" number="192"/>
+ <syscall name="truncate64" number="193"/>
+ <syscall name="ftruncate64" number="194"/>
+ <syscall name="stat64" number="195"/>
+ <syscall name="lstat64" number="196"/>
+ <syscall name="fstat64" number="197"/>
+ <syscall name="pciconfig_read" number="198"/>
+ <syscall name="pciconfig_write" number="199"/>
+ <syscall name="pciconfig_iobase" number="200"/>
+ <syscall name="multiplexer" number="201"/>
+ <syscall name="getdents64" number="202"/>
+ <syscall name="pivot_root" number="203"/>
+ <syscall name="fcntl64" number="204"/>
+ <syscall name="madvise" number="205"/>
+ <syscall name="mincore" number="206"/>
+ <syscall name="gettid" number="207"/>
+ <syscall name="tkill" number="208"/>
+ <syscall name="setxattr" number="209"/>
+ <syscall name="lsetxattr" number="210"/>
+ <syscall name="fsetxattr" number="211"/>
+ <syscall name="getxattr" number="212"/>
+ <syscall name="lgetxattr" number="213"/>
+ <syscall name="fgetxattr" number="214"/>
+ <syscall name="listxattr" number="215"/>
+ <syscall name="llistxattr" number="216"/>
+ <syscall name="flistxattr" number="217"/>
+ <syscall name="removexattr" number="218"/>
+ <syscall name="lremovexattr" number="219"/>
+ <syscall name="fremovexattr" number="220"/>
+ <syscall name="futex" number="221"/>
+ <syscall name="sched_setaffinity" number="222"/>
+ <syscall name="sched_getaffinity" number="223"/>
+ <syscall name="" number="224"/>
+ <syscall name="tuxcall" number="225"/>
+ <syscall name="sendfile64" number="226"/>
+ <syscall name="io_setup" number="227"/>
+ <syscall name="io_destroy" number="228"/>
+ <syscall name="io_getevents" number="229"/>
+ <syscall name="io_submit" number="230"/>
+ <syscall name="io_cancel" number="231"/>
+ <syscall name="set_tid_address" number="232"/>
+ <syscall name="fadvise64" number="233"/>
+ <syscall name="exit_group" number="234"/>
+ <syscall name="lookup_dcookie" number="235"/>
+ <syscall name="epoll_create" number="236"/>
+ <syscall name="epoll_ctl" number="237"/>
+ <syscall name="epoll_wait" number="238"/>
+ <syscall name="remap_file_pages" number="239"/>
+ <syscall name="timer_create" number="240"/>
+ <syscall name="timer_settime" number="241"/>
+ <syscall name="timer_gettime" number="242"/>
+ <syscall name="timer_getoverrun" number="243"/>
+ <syscall name="timer_delete" number="244"/>
+ <syscall name="clock_settime" number="245"/>
+ <syscall name="clock_gettime" number="246"/>
+ <syscall name="clock_getres" number="247"/>
+ <syscall name="clock_nanosleep" number="248"/>
+ <syscall name="swapcontext" number="249"/>
+ <syscall name="tgkill" number="250"/>
+ <syscall name="utimes" number="251"/>
+ <syscall name="statfs64" number="252"/>
+ <syscall name="fstatfs64" number="253"/>
+ <syscall name="fadvise64_64" number="254"/>
+ <syscall name="rtas" number="255"/>
+ <syscall name="sys_debug_setcontext" number="256"/>
+ <syscall name="" number="257"/>
+ <syscall name="" number="258"/>
+ <syscall name="mbind" number="259"/>
+ <syscall name="get_mempolicy" number="260"/>
+ <syscall name="set_mempolicy" number="261"/>
+ <syscall name="mq_open" number="262"/>
+ <syscall name="mq_unlink" number="263"/>
+ <syscall name="mq_timedsend" number="264"/>
+ <syscall name="mq_timedreceive" number="265"/>
+ <syscall name="mq_notify" number="266"/>
+ <syscall name="mq_getsetattr" number="267"/>
+ <syscall name="kexec_load" number="268"/>
+ <syscall name="add_key" number="269"/>
+ <syscall name="request_key" number="270"/>
+ <syscall name="keyctl" number="271"/>
+ <syscall name="waitid" number="272"/>
+ <syscall name="ioprio_set" number="273"/>
+ <syscall name="ioprio_get" number="274"/>
+ <syscall name="inotify_init" number="275"/>
+ <syscall name="inotify_add_watch" number="276"/>
+ <syscall name="inotify_rm_watch" number="277"/>
+ <syscall name="spu_run" number="278"/>
+ <syscall name="spu_create" number="279"/>
+ <syscall name="pselect6" number="280"/>
+ <syscall name="ppoll" number="281"/>
+ <syscall name="unshare" number="282"/>
+ <syscall name="" number="283"/>
+ <syscall name="" number="284"/>
+ <syscall name="" number="285"/>
+ <syscall name="openat" number="286"/>
+ <syscall name="mkdirat" number="287"/>
+ <syscall name="mknodat" number="288"/>
+ <syscall name="fchownat" number="289"/>
+ <syscall name="futimesat" number="290"/>
+ <syscall name="fstatat64" number="291"/>
+ <syscall name="unlinkat" number="292"/>
+ <syscall name="renameat" number="293"/>
+ <syscall name="linkat" number="294"/>
+ <syscall name="symlinkat" number="295"/>
+ <syscall name="readlinkat" number="296"/>
+ <syscall name="fchmodat" number="297"/>
+ <syscall name="faccessat" number="298"/>
+ <syscall name="" number="299"/>
+ <syscall name="" number="300"/>
+</syscalls_info>
diff --git a/gdb/syscalls/ppc64-syscalls.xml b/gdb/syscalls/ppc64-syscalls.xml
new file mode 100644
index 0000000..2795de0
--- /dev/null
+++ b/gdb/syscalls/ppc64-syscalls.xml
@@ -0,0 +1,306 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2007, 2008 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. -->
+
+<!DOCTYPE feature SYSTEM "gdb-syscalls.dtd">
+
+<syscalls_info>
+ <syscall name="restart_syscall" number="0"/>
+ <syscall name="exit" number="1"/>
+ <syscall name="fork" number="2"/>
+ <syscall name="read" number="3"/>
+ <syscall name="write" number="4"/>
+ <syscall name="open" number="5"/>
+ <syscall name="close" number="6"/>
+ <syscall name="waitpid" number="7"/>
+ <syscall name="creat" number="8"/>
+ <syscall name="link" number="9"/>
+ <syscall name="unlink" number="10"/>
+ <syscall name="execve" number="11"/>
+ <syscall name="chdir" number="12"/>
+ <syscall name="time" number="13"/>
+ <syscall name="mknod" number="14"/>
+ <syscall name="chmod" number="15"/>
+ <syscall name="lchown" number="16"/>
+ <syscall name="break" number="17"/>
+ <syscall name="oldstat" number="18"/>
+ <syscall name="lseek" number="19"/>
+ <syscall name="getpid" number="20"/>
+ <syscall name="mount" number="21"/>
+ <syscall name="umount" number="22"/>
+ <syscall name="setuid" number="23"/>
+ <syscall name="getuid" number="24"/>
+ <syscall name="stime" number="25"/>
+ <syscall name="ptrace" number="26"/>
+ <syscall name="alarm" number="27"/>
+ <syscall name="oldfstat" number="28"/>
+ <syscall name="pause" number="29"/>
+ <syscall name="utime" number="30"/>
+ <syscall name="stty" number="31"/>
+ <syscall name="gtty" number="32"/>
+ <syscall name="access" number="33"/>
+ <syscall name="nice" number="34"/>
+ <syscall name="ftime" number="35"/>
+ <syscall name="sync" number="36"/>
+ <syscall name="kill" number="37"/>
+ <syscall name="rename" number="38"/>
+ <syscall name="mkdir" number="39"/>
+ <syscall name="rmdir" number="40"/>
+ <syscall name="dup" number="41"/>
+ <syscall name="pipe" number="42"/>
+ <syscall name="times" number="43"/>
+ <syscall name="prof" number="44"/>
+ <syscall name="brk" number="45"/>
+ <syscall name="setgid" number="46"/>
+ <syscall name="getgid" number="47"/>
+ <syscall name="signal" number="48"/>
+ <syscall name="geteuid" number="49"/>
+ <syscall name="getegid" number="50"/>
+ <syscall name="acct" number="51"/>
+ <syscall name="umount2" number="52"/>
+ <syscall name="lock" number="53"/>
+ <syscall name="ioctl" number="54"/>
+ <syscall name="fcntl" number="55"/>
+ <syscall name="mpx" number="56"/>
+ <syscall name="setpgid" number="57"/>
+ <syscall name="ulimit" number="58"/>
+ <syscall name="oldolduname" number="59"/>
+ <syscall name="umask" number="60"/>
+ <syscall name="chroot" number="61"/>
+ <syscall name="ustat" number="62"/>
+ <syscall name="dup2" number="63"/>
+ <syscall name="getppid" number="64"/>
+ <syscall name="getpgrp" number="65"/>
+ <syscall name="setsid" number="66"/>
+ <syscall name="sigaction" number="67"/>
+ <syscall name="sgetmask" number="68"/>
+ <syscall name="ssetmask" number="69"/>
+ <syscall name="setreuid" number="70"/>
+ <syscall name="setregid" number="71"/>
+ <syscall name="sigsuspend" number="72"/>
+ <syscall name="sigpending" number="73"/>
+ <syscall name="sethostname" number="74"/>
+ <syscall name="setrlimit" number="75"/>
+ <syscall name="getrlimit" number="76"/>
+ <syscall name="getrusage" number="77"/>
+ <syscall name="gettimeofday" number="78"/>
+ <syscall name="settimeofday" number="79"/>
+ <syscall name="getgroups" number="80"/>
+ <syscall name="setgroups" number="81"/>
+ <syscall name="select" number="82"/>
+ <syscall name="symlink" number="83"/>
+ <syscall name="oldlstat" number="84"/>
+ <syscall name="readlink" number="85"/>
+ <syscall name="uselib" number="86"/>
+ <syscall name="swapon" number="87"/>
+ <syscall name="reboot" number="88"/>
+ <syscall name="readdir" number="89"/>
+ <syscall name="mmap" number="90"/>
+ <syscall name="munmap" number="91"/>
+ <syscall name="truncate" number="92"/>
+ <syscall name="ftruncate" number="93"/>
+ <syscall name="fchmod" number="94"/>
+ <syscall name="fchown" number="95"/>
+ <syscall name="getpriority" number="96"/>
+ <syscall name="setpriority" number="97"/>
+ <syscall name="profil" number="98"/>
+ <syscall name="statfs" number="99"/>
+ <syscall name="fstatfs" number="100"/>
+ <syscall name="ioperm" number="101"/>
+ <syscall name="socketcall" number="102"/>
+ <syscall name="syslog" number="103"/>
+ <syscall name="setitimer" number="104"/>
+ <syscall name="getitimer" number="105"/>
+ <syscall name="stat" number="106"/>
+ <syscall name="lstat" number="107"/>
+ <syscall name="fstat" number="108"/>
+ <syscall name="olduname" number="109"/>
+ <syscall name="iopl" number="110"/>
+ <syscall name="vhangup" number="111"/>
+ <syscall name="idle" number="112"/>
+ <syscall name="vm86" number="113"/>
+ <syscall name="wait4" number="114"/>
+ <syscall name="swapoff" number="115"/>
+ <syscall name="sysinfo" number="116"/>
+ <syscall name="ipc" number="117"/>
+ <syscall name="fsync" number="118"/>
+ <syscall name="sigreturn" number="119"/>
+ <syscall name="clone" number="120"/>
+ <syscall name="setdomainname" number="121"/>
+ <syscall name="uname" number="122"/>
+ <syscall name="modify_ldt" number="123"/>
+ <syscall name="adjtimex" number="124"/>
+ <syscall name="mprotect" number="125"/>
+ <syscall name="sigprocmask" number="126"/>
+ <syscall name="create_module" number="127"/>
+ <syscall name="init_module" number="128"/>
+ <syscall name="delete_module" number="129"/>
+ <syscall name="get_kernel_syms" number="130"/>
+ <syscall name="quotactl" number="131"/>
+ <syscall name="getpgid" number="132"/>
+ <syscall name="fchdir" number="133"/>
+ <syscall name="bdflush" number="134"/>
+ <syscall name="sysfs" number="135"/>
+ <syscall name="personality" number="136"/>
+ <syscall name="afs_syscall" number="137"/>
+ <syscall name="setfsuid" number="138"/>
+ <syscall name="setfsgid" number="139"/>
+ <syscall name="_llseek" number="140"/>
+ <syscall name="getdents" number="141"/>
+ <syscall name="_newselect" number="142"/>
+ <syscall name="flock" number="143"/>
+ <syscall name="msync" number="144"/>
+ <syscall name="readv" number="145"/>
+ <syscall name="writev" number="146"/>
+ <syscall name="getsid" number="147"/>
+ <syscall name="fdatasync" number="148"/>
+ <syscall name="_sysctl" number="149"/>
+ <syscall name="mlock" number="150"/>
+ <syscall name="munlock" number="151"/>
+ <syscall name="mlockall" number="152"/>
+ <syscall name="munlockall" number="153"/>
+ <syscall name="sched_setparam" number="154"/>
+ <syscall name="sched_getparam" number="155"/>
+ <syscall name="sched_setscheduler" number="156"/>
+ <syscall name="sched_getscheduler" number="157"/>
+ <syscall name="sched_yield" number="158"/>
+ <syscall name="sched_get_priority_max" number="159"/>
+ <syscall name="sched_get_priority_min" number="160"/>
+ <syscall name="sched_rr_get_interval" number="161"/>
+ <syscall name="nanosleep" number="162"/>
+ <syscall name="mremap" number="163"/>
+ <syscall name="setresuid" number="164"/>
+ <syscall name="getresuid" number="165"/>
+ <syscall name="query_module" number="166"/>
+ <syscall name="poll" number="167"/>
+ <syscall name="nfsservctl" number="168"/>
+ <syscall name="setresgid" number="169"/>
+ <syscall name="getresgid" number="170"/>
+ <syscall name="prctl" number="171"/>
+ <syscall name="rt_sigreturn" number="172"/>
+ <syscall name="rt_sigaction" number="173"/>
+ <syscall name="rt_sigprocmask" number="174"/>
+ <syscall name="rt_sigpending" number="175"/>
+ <syscall name="rt_sigtimedwait" number="176"/>
+ <syscall name="rt_sigqueueinfo" number="177"/>
+ <syscall name="rt_sigsuspend" number="178"/>
+ <syscall name="pread64" number="179"/>
+ <syscall name="pwrite64" number="180"/>
+ <syscall name="chown" number="181"/>
+ <syscall name="getcwd" number="182"/>
+ <syscall name="capget" number="183"/>
+ <syscall name="capset" number="184"/>
+ <syscall name="sigaltstack" number="185"/>
+ <syscall name="sendfile" number="186"/>
+ <syscall name="getpmsg" number="187"/>
+ <syscall name="putpmsg" number="188"/>
+ <syscall name="vfork" number="189"/>
+ <syscall name="ugetrlimit" number="190"/>
+ <syscall name="readahead" number="191"/>
+ <syscall name="" number="192"/>
+ <syscall name="" number="193"/>
+ <syscall name="" number="194"/>
+ <syscall name="" number="195"/>
+ <syscall name="" number="196"/>
+ <syscall name="" number="197"/>
+ <syscall name="pciconfig_read" number="198"/>
+ <syscall name="pciconfig_write" number="199"/>
+ <syscall name="pciconfig_iobase" number="200"/>
+ <syscall name="multiplexer" number="201"/>
+ <syscall name="getdents64" number="202"/>
+ <syscall name="pivot_root" number="203"/>
+ <syscall name="" number="204"/>
+ <syscall name="madvise" number="205"/>
+ <syscall name="mincore" number="206"/>
+ <syscall name="gettid" number="207"/>
+ <syscall name="tkill" number="208"/>
+ <syscall name="setxattr" number="209"/>
+ <syscall name="lsetxattr" number="210"/>
+ <syscall name="fsetxattr" number="211"/>
+ <syscall name="getxattr" number="212"/>
+ <syscall name="lgetxattr" number="213"/>
+ <syscall name="fgetxattr" number="214"/>
+ <syscall name="listxattr" number="215"/>
+ <syscall name="llistxattr" number="216"/>
+ <syscall name="flistxattr" number="217"/>
+ <syscall name="removexattr" number="218"/>
+ <syscall name="lremovexattr" number="219"/>
+ <syscall name="fremovexattr" number="220"/>
+ <syscall name="futex" number="221"/>
+ <syscall name="sched_setaffinity" number="222"/>
+ <syscall name="sched_getaffinity" number="223"/>
+ <syscall name="" number="224"/>
+ <syscall name="tuxcall" number="225"/>
+ <syscall name="" number="226"/>
+ <syscall name="io_setup" number="227"/>
+ <syscall name="io_destroy" number="228"/>
+ <syscall name="io_getevents" number="229"/>
+ <syscall name="io_submit" number="230"/>
+ <syscall name="io_cancel" number="231"/>
+ <syscall name="set_tid_address" number="232"/>
+ <syscall name="fadvise64" number="233"/>
+ <syscall name="exit_group" number="234"/>
+ <syscall name="lookup_dcookie" number="235"/>
+ <syscall name="epoll_create" number="236"/>
+ <syscall name="epoll_ctl" number="237"/>
+ <syscall name="epoll_wait" number="238"/>
+ <syscall name="remap_file_pages" number="239"/>
+ <syscall name="timer_create" number="240"/>
+ <syscall name="timer_settime" number="241"/>
+ <syscall name="timer_gettime" number="242"/>
+ <syscall name="timer_getoverrun" number="243"/>
+ <syscall name="timer_delete" number="244"/>
+ <syscall name="clock_settime" number="245"/>
+ <syscall name="clock_gettime" number="246"/>
+ <syscall name="clock_getres" number="247"/>
+ <syscall name="clock_nanosleep" number="248"/>
+ <syscall name="swapcontext" number="249"/>
+ <syscall name="tgkill" number="250"/>
+ <syscall name="utimes" number="251"/>
+ <syscall name="statfs64" number="252"/>
+ <syscall name="fstatfs64" number="253"/>
+ <syscall name="" number="254"/>
+ <syscall name="rtas" number="255"/>
+ <syscall name="sys_debug_setcontext" number="256"/>
+ <syscall name="" number="257"/>
+ <syscall name="" number="258"/>
+ <syscall name="mbind" number="259"/>
+ <syscall name="get_mempolicy" number="260"/>
+ <syscall name="set_mempolicy" number="261"/>
+ <syscall name="mq_open" number="262"/>
+ <syscall name="mq_unlink" number="263"/>
+ <syscall name="mq_timedsend" number="264"/>
+ <syscall name="mq_timedreceive" number="265"/>
+ <syscall name="mq_notify" number="266"/>
+ <syscall name="mq_getsetattr" number="267"/>
+ <syscall name="kexec_load" number="268"/>
+ <syscall name="add_key" number="269"/>
+ <syscall name="request_key" number="270"/>
+ <syscall name="keyctl" number="271"/>
+ <syscall name="waitid" number="272"/>
+ <syscall name="ioprio_set" number="273"/>
+ <syscall name="ioprio_get" number="274"/>
+ <syscall name="inotify_init" number="275"/>
+ <syscall name="inotify_add_watch" number="276"/>
+ <syscall name="inotify_rm_watch" number="277"/>
+ <syscall name="spu_run" number="278"/>
+ <syscall name="spu_create" number="279"/>
+ <syscall name="pselect6" number="280"/>
+ <syscall name="ppoll" number="281"/>
+ <syscall name="unshare" number="282"/>
+ <syscall name="" number="283"/>
+ <syscall name="" number="284"/>
+ <syscall name="" number="285"/>
+ <syscall name="unlinkat" number="286"/>
+ <syscall name="renameat" number="287"/>
+ <syscall name="linkat" number="288"/>
+ <syscall name="symlinkat" number="289"/>
+ <syscall name="readlinkat" number="290"/>
+ <syscall name="fchmodat" number="291"/>
+ <syscall name="faccessat" number="292"/>
+ <syscall name="" number="293"/>
+ <syscall name="" number="294"/>
+</syscalls_info>
diff --git a/gdb/xml-syscall.c b/gdb/xml-syscall.c
new file mode 100644
index 0000000..8f16752
--- /dev/null
+++ b/gdb/xml-syscall.c
@@ -0,0 +1,438 @@
+/* Functions that provide the mechanism to parse a syscall XML file
+ and get its values.
+
+ Copyright (C) 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
+ 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007, 2008
+ 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 <http://www.gnu.org/licenses/>. */
+
+#include "defs.h"
+#include "gdbtypes.h"
+#include "xml-support.h"
+#include "xml-syscall.h"
+
+#include "filenames.h"
+
+#include "gdb_assert.h"
+
+#ifndef HAVE_LIBEXPAT
+
+/* Dummy functions to indicate that there's no support for fetching
+ syscalls information. */
+
+static void
+syscall_warn_user (void)
+{
+ static int have_warned = 0;
+ if (!have_warned)
+ {
+ have_warned = 1;
+ warning (_("Can not parse XML syscalls information; XML support was "
+ "disabled at compile time"));
+ }
+}
+
+const struct syscalls_info *
+xml_init_syscalls_info (const char *filename)
+{
+ syscall_warn_user ();
+ return NULL;
+}
+
+int
+xml_get_syscall_number (const struct syscalls_info *sysinfo,
+ const char *syscall_name)
+{
+ syscall_warn_user ();
+ return UNKNOWN_SYSCALL;
+}
+
+const char *
+xml_get_syscall_name (const struct syscalls_info *sysinfo,
+ int syscall_number)
+{
+ syscall_warn_user ();
+ return NULL;
+}
+
+int
+xml_number_of_syscalls (const struct syscalls_info *sysinfo)
+{
+ syscall_warn_user ();
+ return 0;
+}
+
+const char **
+xml_list_of_syscalls (const struct syscalls_info *sysinfo)
+{
+ syscall_warn_user ();
+ return NULL;
+}
+
+#else
+
+/* Structure which describes a syscall. */
+
+typedef struct syscall_desc
+{
+ /* The syscall number. */
+
+ int number;
+
+ /* The syscall name. */
+
+ char *name;
+} *syscall_desc_p;
+DEF_VEC_P(syscall_desc_p);
+
+/* Structure that represents syscalls information. */
+
+struct syscalls_info
+{
+ /* The number of syscalls in this system. */
+
+ int number_of_syscalls;
+
+ /* The syscalls. */
+
+ VEC(syscall_desc_p) *syscalls;
+};
+
+/* Callback data for syscall information parsing. */
+
+struct syscall_parsing_data
+{
+ /* The syscalls_info we are building. */
+
+ struct syscalls_info *sysinfo;
+};
+
+
+static struct syscalls_info *
+allocate_syscalls_info (void)
+{
+ return XZALLOC (struct syscalls_info);
+}
+
+static void
+sysinfo_free_syscalls_desc (struct syscall_desc *sd)
+{
+ xfree (sd->name);
+}
+
+static void
+free_syscalls_info (void *arg)
+{
+ struct syscalls_info *sysinfo = arg;
+ struct syscall_desc *sysdesc;
+ int i;
+
+ for (i = 0;
+ VEC_iterate (syscall_desc_p, sysinfo->syscalls, i, sysdesc);
+ i++)
+ sysinfo_free_syscalls_desc (sysdesc);
+ VEC_free (syscall_desc_p, sysinfo->syscalls);
+
+ xfree (sysinfo);
+}
+
+struct cleanup *
+make_cleanup_free_syscalls_info (struct syscalls_info *sysinfo)
+{
+ return make_cleanup (free_syscalls_info, sysinfo);
+}
+
+static void
+do_cleanup_fclose (void *file)
+{
+ fclose (file);
+}
+
+/* Open FILENAME, read all its text into memory, close it, and return
+ the text. If something goes wrong, return NULL and warn. */
+
+static char *
+fetch_xml_from_file (const char *filename, void *baton)
+{
+ const char *dirname = baton;
+ FILE *file;
+ struct cleanup *back_to;
+ char *text;
+ size_t len, offset;
+
+ if (dirname && *dirname)
+ {
+ char *fullname = concat (dirname, "/", filename, (char *) NULL);
+ if (fullname == NULL)
+ nomem (0);
+ file = fopen (fullname, FOPEN_RT);
+ xfree (fullname);
+ }
+ else
+ file = fopen (filename, FOPEN_RT);
+
+ if (file == NULL)
+ return NULL;
+
+ back_to = make_cleanup (do_cleanup_fclose, file);
+
+ /* Read in the whole file, one chunk at a time. */
+ len = 4096;
+ offset = 0;
+ text = xmalloc (len);
+ make_cleanup (free_current_contents, &text);
+ while (1)
+ {
+ size_t bytes_read;
+
+ /* Continue reading where the last read left off. Leave at least
+ one byte so that we can NUL-terminate the result. */
+ bytes_read = fread (text + offset, 1, len - offset - 1, file);
+ if (ferror (file))
+ {
+ warning (_("Read error from \"%s\""), filename);
+ do_cleanups (back_to);
+ return NULL;
+ }
+
+ offset += bytes_read;
+
+ if (feof (file))
+ break;
+
+ len = len * 2;
+ text = xrealloc (text, len);
+ }
+
+ fclose (file);
+ discard_cleanups (back_to);
+
+ text[offset] = '\0';
+ return text;
+}
+
+static void
+syscall_create_syscall_desc (struct syscalls_info *sysinfo,
+ const char *name, int number)
+{
+ struct syscall_desc *sysdesc = XZALLOC (struct syscall_desc);
+
+ sysdesc->name = xstrdup (name);
+ sysdesc->number = number;
+
+ VEC_safe_push (syscall_desc_p, sysinfo->syscalls, sysdesc);
+}
+
+/* Handle the start of a <syscalls_info> element. */
+
+static void
+syscall_start_syscalls_info (struct gdb_xml_parser *parser,
+ const struct gdb_xml_element *element,
+ void *user_data,
+ VEC(gdb_xml_value_s) *attributes)
+{
+ struct syscall_parsing_data *data = user_data;
+ struct syscalls_info *sysinfo = data->sysinfo;
+
+ /* Initializing fields. */
+ sysinfo->number_of_syscalls = 0;
+}
+
+/* Handle the start of a <syscall> element. */
+
+static void
+syscall_start_syscall (struct gdb_xml_parser *parser,
+ const struct gdb_xml_element *element,
+ void *user_data, VEC(gdb_xml_value_s) *attributes)
+{
+ struct syscall_parsing_data *data = user_data;
+ struct gdb_xml_value *attrs = VEC_address (gdb_xml_value_s, attributes);
+ int len, i;
+ /* syscall info. */
+ char *name = NULL;
+ int number = 0;
+
+ len = VEC_length (gdb_xml_value_s, attributes);
+
+ for (i = 0; i < len; i++)
+ {
+ if (strcmp (attrs[i].name, "name") == 0)
+ name = attrs[i].value;
+ else if (strcmp (attrs[i].name, "number") == 0)
+ number = * (ULONGEST *) attrs[i].value;
+ else
+ internal_error (__FILE__, __LINE__,
+ _("Unknown attribute name '%s'."), attrs[i].name);
+ }
+
+ syscall_create_syscall_desc (data->sysinfo, name, number);
+
+ data->sysinfo->number_of_syscalls++;
+}
+
+
+/* The elements and attributes of an XML syscall document. */
+
+static const struct gdb_xml_attribute syscall_attr[] = {
+ { "number", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
+ { "name", GDB_XML_AF_NONE, NULL, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL }
+};
+
+static const struct gdb_xml_element syscalls_info_children[] = {
+ { "syscall", syscall_attr, NULL,
+ GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
+ syscall_start_syscall, NULL },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
+};
+
+static const struct gdb_xml_element syselements[] = {
+ { "syscalls_info", NULL, syscalls_info_children,
+ GDB_XML_EF_NONE, syscall_start_syscalls_info, NULL },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
+};
+
+static struct syscalls_info *
+syscall_parse_xml (const char *document, xml_fetch_another fetcher,
+ void *fetcher_baton)
+{
+ struct cleanup *back_to, *result_cleanup;
+ struct gdb_xml_parser *parser;
+ struct syscall_parsing_data data;
+ char *expanded_text;
+ int i;
+
+ back_to = make_cleanup (null_cleanup, NULL);
+ parser = gdb_xml_create_parser_and_cleanup (_("syscalls info"),
+ syselements, &data);
+
+ memset (&data, 0, sizeof (struct syscall_parsing_data));
+ data.sysinfo = allocate_syscalls_info ();
+ result_cleanup = make_cleanup_free_syscalls_info (data.sysinfo);
+
+ if (gdb_xml_parse (parser, document) == 0)
+ {
+ /* Parsed successfully. */
+ discard_cleanups (result_cleanup);
+ do_cleanups (back_to);
+ return data.sysinfo;
+ }
+ else
+ {
+ warning (_("Could not load XML syscalls info; ignoring"));
+ do_cleanups (back_to);
+ return NULL;
+ }
+}
+
+const struct syscalls_info *
+xml_init_syscalls_info (const char *filename)
+{
+ char *full_file;
+ char *dirname;
+ struct syscalls_info *sysinfo;
+ struct cleanup *back_to;
+
+ full_file = fetch_xml_from_file (filename, gdb_datadir);
+ if (full_file == NULL)
+ {
+ warning (_("Could not open \"%s\""), filename);
+ return NULL;
+ }
+
+ back_to = make_cleanup (xfree, full_file);
+
+ dirname = ldirname (filename);
+ if (dirname != NULL)
+ make_cleanup (xfree, dirname);
+
+ sysinfo = syscall_parse_xml (full_file, fetch_xml_from_file, dirname);
+ do_cleanups (back_to);
+
+ return sysinfo;
+}
+
+int
+xml_get_syscall_number (const struct syscalls_info *sysinfo,
+ const char *syscall_name)
+{
+ struct syscall_desc *sysdesc;
+ int i;
+
+ if (sysinfo == NULL
+ || syscall_name == NULL)
+ return UNKNOWN_SYSCALL;
+
+ for (i = 0;
+ VEC_iterate(syscall_desc_p, sysinfo->syscalls, i, sysdesc);
+ i++)
+ if (strcmp (sysdesc->name, syscall_name) == 0)
+ return sysdesc->number;
+
+ return UNKNOWN_SYSCALL;
+}
+
+const char *
+xml_get_syscall_name (const struct syscalls_info *sysinfo,
+ int syscall_number)
+{
+ struct syscall_desc *sysdesc;
+ int i;
+
+ if (sysinfo == NULL
+ || syscall_number < 0
+ || syscall_number >= sysinfo->number_of_syscalls)
+ return NULL;
+
+ for (i = 0;
+ VEC_iterate(syscall_desc_p, sysinfo->syscalls, i, sysdesc);
+ i++)
+ if (sysdesc->number == syscall_number)
+ return sysdesc->name;
+
+ return NULL;
+}
+
+int
+xml_number_of_syscalls (const struct syscalls_info *sysinfo)
+{
+ return (sysinfo == NULL ? 0 : sysinfo->number_of_syscalls);
+}
+
+const char **
+xml_list_of_syscalls (const struct syscalls_info *sysinfo)
+{
+ struct syscall_desc *sysdesc;
+ const char **names = NULL;
+ int i;
+
+ if (sysinfo == NULL)
+ return NULL;
+
+ names = xmalloc ((sysinfo->number_of_syscalls + 1) * sizeof (char *));
+
+ for (i = 0;
+ VEC_iterate(syscall_desc_p, sysinfo->syscalls, i, sysdesc);
+ i++)
+ names[i] = xstrdup (sysdesc->name);
+
+ names[i] = NULL;
+
+ return names;
+}
+
+#endif /* HAVE_LIBEXPAT */
diff --git a/gdb/xml-syscall.h b/gdb/xml-syscall.h
new file mode 100644
index 0000000..ff11f20
--- /dev/null
+++ b/gdb/xml-syscall.h
@@ -0,0 +1,64 @@
+/* Functions that provide the mechanism to parse a syscall XML file
+ and get its values.
+
+ Copyright (C) 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
+ 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007, 2008
+ 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 <http://www.gnu.org/licenses/>. */
+
+#ifndef XML_SYSCALL_H
+#define XML_SYSCALL_H 1
+
+/* Structure that stores information about the system's
+ syscalls. */
+
+struct syscalls_info;
+
+
+/* Function responsible for initializing the information
+ about the syscalls. It reads the XML file and fills the
+ struct syscalls_info with the values.
+
+ Returns the struct syscalls_info if the file is valid, NULL otherwise. */
+
+const struct syscalls_info *xml_init_syscalls_info (const char *);
+
+/* Function that retrieves the syscall number corresponding to the given
+ name.
+
+ Returns the syscall number if found, or otherwise. */
+
+int xml_get_syscall_number (const struct syscalls_info *, const char *);
+
+/* Function that retrieves the syscall name corresponding to the given
+ number.
+
+ Returns the syscall name if found, NULL otherwise. */
+const char *xml_get_syscall_name (const struct syscalls_info *, int);
+
+/* Function that returns the number of syscalls defined in the system.
+
+ Returns the number of syscalls, or zero otherwise. */
+int xml_number_of_syscalls (const struct syscalls_info *);
+
+/* Function used to retrieve the list of syscalls in the system. This list
+ is returned as an array of strings.
+
+ Returns the list of syscalls in the system, or NULL otherwise. */
+const char **xml_list_of_syscalls (const struct syscalls_info *sysinfo);
+
+#endif /* XML_SYSCALL_H */
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH 3/4] 'catch syscall' feature -- XML support part
2008-11-04 4:32 [PATCH 3/4] 'catch syscall' feature -- XML support part Sérgio Durigan Júnior
@ 2008-11-04 13:36 ` Mark Kettenis
2008-11-04 13:47 ` Daniel Jacobowitz
2008-11-04 15:06 ` Sérgio Durigan Júnior
2008-11-04 18:41 ` Tom Tromey
2008-11-04 21:20 ` Eli Zaretskii
2 siblings, 2 replies; 18+ messages in thread
From: Mark Kettenis @ 2008-11-04 13:36 UTC (permalink / raw)
To: sergiodj; +Cc: gdb-patches
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1103 bytes --]
> From: =?ISO-8859-1?Q?S=E9rgio?= Durigan =?ISO-8859-1?Q?J=FAnior?= <sergiodj@linux.vnet.ibm.com>
> Date: Tue, 04 Nov 2008 02:31:26 -0200
>
> This is the part which adds XML support for the "catch syscall" feature.
> I decided to put the architecture's XML files here too, so that the
> architecture-independent part does not grow too much.
>
> Regards,
>
> --
> Sérgio Durigan Júnior
> Linux on Power Toolchain - Software Engineer
> Linux Technology Center - LTC
> IBM Brazil
>
> gdb/ChangeLog:
>
> 2008-11-04 Sergio Durigan Junior <sergiodj@linux.vnet.ibm.com>
>
> * gdb-syscalls.dtd: New definition file for syscall's XML
> support.
> * i386-syscalls.xml: New file for i386 syscalls.
> * ppc-syscalls.xml: New file for PPC syscalls.
> * ppc64-syscalls.xml: New file for PPC64 syscalls.
> * xml-syscall.c: New file containing functions for manipulating
> syscall's XML files.
> * xml-syscall.h: New file, exporting the functions above mentioned.
Hmm, I haven't looked at the code yes, but this is all Linux-specific
stuff, so this should be reflected in the names of those files.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/4] 'catch syscall' feature -- XML support part
2008-11-04 13:36 ` Mark Kettenis
@ 2008-11-04 13:47 ` Daniel Jacobowitz
2008-11-04 15:05 ` Sérgio Durigan Júnior
2008-11-04 15:06 ` Sérgio Durigan Júnior
1 sibling, 1 reply; 18+ messages in thread
From: Daniel Jacobowitz @ 2008-11-04 13:47 UTC (permalink / raw)
To: Mark Kettenis; +Cc: sergiodj, gdb-patches
On Tue, Nov 04, 2008 at 02:35:55PM +0100, Mark Kettenis wrote:
> Hmm, I haven't looked at the code yes, but this is all Linux-specific
> stuff, so this should be reflected in the names of those files.
Yes please. We should be able to do non-Linux syscalls too, but
they'll require different data files.
Sergio, while you're moving them, could they go in a subdirectory
please? Maybe gdb/syscalls/ ? It doesn't need to have a separate
ChangeLog or Makefile or anything like that.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/4] 'catch syscall' feature -- XML support part
2008-11-04 13:47 ` Daniel Jacobowitz
@ 2008-11-04 15:05 ` Sérgio Durigan Júnior
2008-11-04 15:13 ` Daniel Jacobowitz
0 siblings, 1 reply; 18+ messages in thread
From: Sérgio Durigan Júnior @ 2008-11-04 15:05 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: Mark Kettenis, gdb-patches
Hi Daniel,
On Tue, 2008-11-04 at 08:47 -0500, Daniel Jacobowitz wrote:
> On Tue, Nov 04, 2008 at 02:35:55PM +0100, Mark Kettenis wrote:
> > Hmm, I haven't looked at the code yes, but this is all Linux-specific
> > stuff, so this should be reflected in the names of those files.
>
> Yes please. We should be able to do non-Linux syscalls too, but
> they'll require different data files.
>
> Sergio, while you're moving them, could they go in a subdirectory
> please? Maybe gdb/syscalls/ ? It doesn't need to have a separate
> ChangeLog or Makefile or anything like that.
IIUC, you're asking me to put the XML files in gdb/syscalls/ right?
Well, they are already there :-). I think the correct approach to solve
this problem is renaming the XML files to something like
"i386-linux-syscalls.xml", isn't it?
Regards,
--
Sérgio Durigan Júnior
Linux on Power Toolchain - Software Engineer
Linux Technology Center - LTC
IBM Brazil
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/4] 'catch syscall' feature -- XML support part
2008-11-04 15:05 ` Sérgio Durigan Júnior
@ 2008-11-04 15:13 ` Daniel Jacobowitz
2008-11-04 15:18 ` Sérgio Durigan Júnior
0 siblings, 1 reply; 18+ messages in thread
From: Daniel Jacobowitz @ 2008-11-04 15:13 UTC (permalink / raw)
To: Sérgio Durigan Júnior; +Cc: Mark Kettenis, gdb-patches
On Tue, Nov 04, 2008 at 01:04:16PM -0200, Sérgio Durigan Júnior wrote:
> Hi Daniel,
>
> On Tue, 2008-11-04 at 08:47 -0500, Daniel Jacobowitz wrote:
> > On Tue, Nov 04, 2008 at 02:35:55PM +0100, Mark Kettenis wrote:
> > > Hmm, I haven't looked at the code yes, but this is all Linux-specific
> > > stuff, so this should be reflected in the names of those files.
> >
> > Yes please. We should be able to do non-Linux syscalls too, but
> > they'll require different data files.
> >
> > Sergio, while you're moving them, could they go in a subdirectory
> > please? Maybe gdb/syscalls/ ? It doesn't need to have a separate
> > ChangeLog or Makefile or anything like that.
>
> IIUC, you're asking me to put the XML files in gdb/syscalls/ right?
> Well, they are already there :-). I think the correct approach to solve
> this problem is renaming the XML files to something like
> "i386-linux-syscalls.xml", isn't it?
Oh whoops - then since the ChangeLog is in gdb/ChangeLog, the entry
should refer to "syscalls/i386-syscalls.xml" instead of just
"i386-syscalls.xml". How about renaming to "syscalls/i386-linux.xml"?
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/4] 'catch syscall' feature -- XML support part
2008-11-04 15:13 ` Daniel Jacobowitz
@ 2008-11-04 15:18 ` Sérgio Durigan Júnior
0 siblings, 0 replies; 18+ messages in thread
From: Sérgio Durigan Júnior @ 2008-11-04 15:18 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: Mark Kettenis, gdb-patches
Hi Daniel,
On Tue, 2008-11-04 at 10:12 -0500, Daniel Jacobowitz wrote:
> Oh whoops - then since the ChangeLog is in gdb/ChangeLog, the entry
> should refer to "syscalls/i386-syscalls.xml" instead of just
> "i386-syscalls.xml". How about renaming to "syscalls/i386-linux.xml"?
Yeah, you're right about the ChangeLog, my fault. About the file name, I
think it's OK. I only proposed the "i386-linux-syscall.xml" because I
forgot they were already at the "syscalls" directory :-).
Thanks,
--
Sérgio Durigan Júnior
Linux on Power Toolchain - Software Engineer
Linux Technology Center - LTC
IBM Brazil
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/4] 'catch syscall' feature -- XML support part
2008-11-04 13:36 ` Mark Kettenis
2008-11-04 13:47 ` Daniel Jacobowitz
@ 2008-11-04 15:06 ` Sérgio Durigan Júnior
2008-11-08 19:06 ` Mark Kettenis
1 sibling, 1 reply; 18+ messages in thread
From: Sérgio Durigan Júnior @ 2008-11-04 15:06 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches
Hi Mark,
On Tue, 2008-11-04 at 14:35 +0100, Mark Kettenis wrote:
> Hmm, I haven't looked at the code yes, but this is all Linux-specific
> stuff, so this should be reflected in the names of those files.
I think Daniel asked me to do the same thing, so I'll consider this
problem solved, ok? If there's another thing you think I should fix,
please let me know :-).
Regards,
--
Sérgio Durigan Júnior
Linux on Power Toolchain - Software Engineer
Linux Technology Center - LTC
IBM Brazil
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/4] 'catch syscall' feature -- XML support part
2008-11-04 15:06 ` Sérgio Durigan Júnior
@ 2008-11-08 19:06 ` Mark Kettenis
0 siblings, 0 replies; 18+ messages in thread
From: Mark Kettenis @ 2008-11-08 19:06 UTC (permalink / raw)
To: sergiodj; +Cc: gdb-patches
> From: =?ISO-8859-1?Q?S=E9rgio?= Durigan =?ISO-8859-1?Q?J=FAnior?= <sergiodj@linux.vnet.ibm.com>
> Date: Tue, 04 Nov 2008 13:05:31 -0200
>
> Hi Mark,
>
> On Tue, 2008-11-04 at 14:35 +0100, Mark Kettenis wrote:
>
> > Hmm, I haven't looked at the code yes, but this is all Linux-specific
> > stuff, so this should be reflected in the names of those files.
>
> I think Daniel asked me to do the same thing, so I'll consider this
> problem solved, ok?
Yup.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/4] 'catch syscall' feature -- XML support part
2008-11-04 4:32 [PATCH 3/4] 'catch syscall' feature -- XML support part Sérgio Durigan Júnior
2008-11-04 13:36 ` Mark Kettenis
@ 2008-11-04 18:41 ` Tom Tromey
2008-11-07 3:46 ` Sérgio Durigan Júnior
2008-11-04 21:20 ` Eli Zaretskii
2 siblings, 1 reply; 18+ messages in thread
From: Tom Tromey @ 2008-11-04 18:41 UTC (permalink / raw)
To: Sérgio Durigan Júnior; +Cc: gdb-patches
>>>>> "Sérgio" == Sérgio Durigan Júnior <sergiodj@linux.vnet.ibm.com> writes:
Sérgio> This is the part which adds XML support for the "catch
Sérgio> syscall" feature. I decided to put the architecture's XML
Sérgio> files here too, so that the architecture-independent part does
Sérgio> not grow too much.
Just a few nits from me...
Sérgio> +struct syscalls_info
Sérgio> +{
Sérgio> + /* The number of syscalls in this system. */
Sérgio> +
Sérgio> + int number_of_syscalls;
Sérgio> +
Sérgio> + /* The syscalls. */
Sérgio> +
Sérgio> + VEC(syscall_desc_p) *syscalls;
Sérgio> +};
I think number_of_syscalls is redundant here. The VEC knows how many
elements it contains, so why not just use that?
Sérgio> +static void
Sérgio> +do_cleanup_fclose (void *file)
Sérgio> +{
Sérgio> + fclose (file);
Sérgio> +}
There's a make_cleanup_fclose now.
Sérgio> + <syscall name="" number="223"/>
[...]
Sérgio> + for (i = 0; i < len; i++)
Sérgio> + {
Sérgio> + if (strcmp (attrs[i].name, "name") == 0)
Sérgio> + name = attrs[i].value;
Sérgio> + else if (strcmp (attrs[i].name, "number") == 0)
Sérgio> + number = * (ULONGEST *) attrs[i].value;
Sérgio> + else
Sérgio> + internal_error (__FILE__, __LINE__,
Sérgio> + _("Unknown attribute name '%s'."), attrs[i].name);
Sérgio> + }
Sérgio> +
Sérgio> + syscall_create_syscall_desc (data->sysinfo, name, number);
This will make an entry with an empty name given the above XML
snippet. But that doesn't seem helpful... if this triggers, won't it
print as an unnamed syscall? It seems to me that it would be
preferable to skip nameless ones and just report them numerically, if
they occur.
Sérgio> +static const struct gdb_xml_attribute syscall_attr[] = {
Sérgio> + { "number", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
The indentation is wrong here and in other definitions like this.
It should be just 2 spaces.
Sérgio> +static struct syscalls_info *
Sérgio> +syscall_parse_xml (const char *document, xml_fetch_another fetcher,
Sérgio> + void *fetcher_baton)
Sérgio> +{
[...]
Sérgio> + back_to = make_cleanup (null_cleanup, NULL);
I don't think you need to make a null cleanup here...
Sérgio> + if (gdb_xml_parse (parser, document) == 0)
Sérgio> + {
Sérgio> + /* Parsed successfully. */
Sérgio> + discard_cleanups (result_cleanup);
Sérgio> + do_cleanups (back_to);
Sérgio> + return data.sysinfo;
Sérgio> + }
Sérgio> + else
Sérgio> + {
Sérgio> + warning (_("Could not load XML syscalls info; ignoring"));
Sérgio> + do_cleanups (back_to);
Sérgio> + return NULL;
... you can either just do_ or discard_ result_cleanup instead.
Tom
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH 3/4] 'catch syscall' feature -- XML support part
2008-11-04 18:41 ` Tom Tromey
@ 2008-11-07 3:46 ` Sérgio Durigan Júnior
2008-11-07 18:24 ` Tom Tromey
0 siblings, 1 reply; 18+ messages in thread
From: Sérgio Durigan Júnior @ 2008-11-07 3:46 UTC (permalink / raw)
To: tromey; +Cc: gdb-patches
Hey again :-)
On Tue, 2008-11-04 at 11:40 -0700, Tom Tromey wrote:
> >>>>> "Sérgio" == Sérgio Durigan Júnior <sergiodj@linux.vnet.ibm.com> writes:
> Sérgio> +struct syscalls_info
> Sérgio> +{
> Sérgio> + /* The number of syscalls in this system. */
> Sérgio> +
> Sérgio> + int number_of_syscalls;
> Sérgio> +
> Sérgio> + /* The syscalls. */
> Sérgio> +
> Sérgio> + VEC(syscall_desc_p) *syscalls;
> Sérgio> +};
>
> I think number_of_syscalls is redundant here. The VEC knows how many
> elements it contains, so why not just use that?
Hmm, OK. I'm getting used with this VEC data structure, so I still don't
know what it does/doesn't provide. Thanks for the hint.
>
> Sérgio> +static void
> Sérgio> +do_cleanup_fclose (void *file)
> Sérgio> +{
> Sérgio> + fclose (file);
> Sérgio> +}
>
> There's a make_cleanup_fclose now.
Didn't know too. Thanks.
> Sérgio> + <syscall name="" number="223"/>
> [...]
> Sérgio> + for (i = 0; i < len; i++)
> Sérgio> + {
> Sérgio> + if (strcmp (attrs[i].name, "name") == 0)
> Sérgio> + name = attrs[i].value;
> Sérgio> + else if (strcmp (attrs[i].name, "number") == 0)
> Sérgio> + number = * (ULONGEST *) attrs[i].value;
> Sérgio> + else
> Sérgio> + internal_error (__FILE__, __LINE__,
> Sérgio> + _("Unknown attribute name '%s'."), attrs[i].name);
> Sérgio> + }
> Sérgio> +
> Sérgio> + syscall_create_syscall_desc (data->sysinfo, name, number);
>
> This will make an entry with an empty name given the above XML
> snippet. But that doesn't seem helpful... if this triggers, won't it
> print as an unnamed syscall? It seems to me that it would be
> preferable to skip nameless ones and just report them numerically, if
> they occur.
I'm sorry, but I think I didn't understand completely what you
suggested. You mean that I should set the syscall name to NULL when
there's no name for it in the XML file?
> Sérgio> +static const struct gdb_xml_attribute syscall_attr[] = {
> Sérgio> + { "number", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
>
> The indentation is wrong here and in other definitions like this.
> It should be just 2 spaces.
Ha, I was sure that I'd receive some complains about the
indentation :-P.
> Sérgio> +static struct syscalls_info *
> Sérgio> +syscall_parse_xml (const char *document, xml_fetch_another fetcher,
> Sérgio> + void *fetcher_baton)
> Sérgio> +{
> [...]
> Sérgio> + back_to = make_cleanup (null_cleanup, NULL);
>
> I don't think you need to make a null cleanup here...
Right.
> Sérgio> + if (gdb_xml_parse (parser, document) == 0)
> Sérgio> + {
> Sérgio> + /* Parsed successfully. */
> Sérgio> + discard_cleanups (result_cleanup);
> Sérgio> + do_cleanups (back_to);
> Sérgio> + return data.sysinfo;
> Sérgio> + }
> Sérgio> + else
> Sérgio> + {
> Sérgio> + warning (_("Could not load XML syscalls info; ignoring"));
> Sérgio> + do_cleanups (back_to);
> Sérgio> + return NULL;
>
> ... you can either just do_ or discard_ result_cleanup instead.
I'm sorry, instead of what? do_cleanups? :-)
Thanks again!
Regards,
--
Sérgio Durigan Júnior
Linux on Power Toolchain - Software Engineer
Linux Technology Center - LTC
IBM Brazil
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH 3/4] 'catch syscall' feature -- XML support part
2008-11-07 3:46 ` Sérgio Durigan Júnior
@ 2008-11-07 18:24 ` Tom Tromey
0 siblings, 0 replies; 18+ messages in thread
From: Tom Tromey @ 2008-11-07 18:24 UTC (permalink / raw)
To: Sérgio Durigan Júnior; +Cc: gdb-patches
>>>>> "Sérgio" == Sérgio Durigan Júnior <sergiodj@linux.vnet.ibm.com> writes:
Tom> This will make an entry with an empty name given the above XML
Tom> snippet. But that doesn't seem helpful... if this triggers, won't it
Tom> print as an unnamed syscall? It seems to me that it would be
Tom> preferable to skip nameless ones and just report them numerically, if
Tom> they occur.
Sérgio> I'm sorry, but I think I didn't understand completely what you
Sérgio> suggested. You mean that I should set the syscall name to NULL when
Sérgio> there's no name for it in the XML file?
I think nameless syscalls should simply not be in the table at all.
Sérgio> + if (gdb_xml_parse (parser, document) == 0)
Sérgio> + {
Sérgio> + /* Parsed successfully. */
Sérgio> + discard_cleanups (result_cleanup);
Sérgio> + do_cleanups (back_to);
Sérgio> + return data.sysinfo;
Sérgio> + }
Sérgio> + else
Sérgio> + {
Sérgio> + warning (_("Could not load XML syscalls info; ignoring"));
Sérgio> + do_cleanups (back_to);
Sérgio> + return NULL;
Tom>
Tom> ... you can either just do_ or discard_ result_cleanup instead.
Sérgio> I'm sorry, instead of what? do_cleanups? :-)
I think instead of the above you can simply:
if (...)
...
discard_cleanups (result_cleanup);
else
...
do_cleanups (result_cleanup);
Tom
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/4] 'catch syscall' feature -- XML support part
2008-11-04 4:32 [PATCH 3/4] 'catch syscall' feature -- XML support part Sérgio Durigan Júnior
2008-11-04 13:36 ` Mark Kettenis
2008-11-04 18:41 ` Tom Tromey
@ 2008-11-04 21:20 ` Eli Zaretskii
2008-11-04 22:23 ` Daniel Jacobowitz
2 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2008-11-04 21:20 UTC (permalink / raw)
To: Sérgio Durigan Júnior; +Cc: gdb-patches
> From: =?ISO-8859-1?Q?S=E9rgio?= Durigan =?ISO-8859-1?Q?J=FAnior?= <sergiodj@linux.vnet.ibm.com>
> Date: Tue, 04 Nov 2008 02:31:26 -0200
>
> This is the part which adds XML support for the "catch syscall" feature.
> I decided to put the architecture's XML files here too, so that the
> architecture-independent part does not grow too much.
Is the list of syscalls and their numbers kernel version dependent?
If it is, how will we go about maintaining these files?
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/4] 'catch syscall' feature -- XML support part
2008-11-04 21:20 ` Eli Zaretskii
@ 2008-11-04 22:23 ` Daniel Jacobowitz
2008-11-04 22:27 ` Eli Zaretskii
0 siblings, 1 reply; 18+ messages in thread
From: Daniel Jacobowitz @ 2008-11-04 22:23 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Sérgio Durigan Júnior, gdb-patches
On Tue, Nov 04, 2008 at 11:19:36PM +0200, Eli Zaretskii wrote:
> > From: =?ISO-8859-1?Q?S=E9rgio?= Durigan =?ISO-8859-1?Q?J=FAnior?= <sergiodj@linux.vnet.ibm.com>
> > Date: Tue, 04 Nov 2008 02:31:26 -0200
> >
> > This is the part which adds XML support for the "catch syscall" feature.
> > I decided to put the architecture's XML files here too, so that the
> > architecture-independent part does not grow too much.
>
> Is the list of syscalls and their numbers kernel version dependent?
> If it is, how will we go about maintaining these files?
Fortunately, it is not. There are some exceptions in vendor-provided
kernels, but there is a very strong incentive to not reuse or adjust
syscall numbers.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/4] 'catch syscall' feature -- XML support part
2008-11-04 22:23 ` Daniel Jacobowitz
@ 2008-11-04 22:27 ` Eli Zaretskii
2008-11-04 22:36 ` Daniel Jacobowitz
0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2008-11-04 22:27 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: sergiodj, gdb-patches
> Date: Tue, 4 Nov 2008 17:22:25 -0500
> From: Daniel Jacobowitz <drow@false.org>
> Cc: =?iso-8859-1?Q?S=E9rgio_Durigan_J=FAnior?= <sergiodj@linux.vnet.ibm.com>,
> gdb-patches@sourceware.org
>
> > Is the list of syscalls and their numbers kernel version dependent?
> > If it is, how will we go about maintaining these files?
>
> Fortunately, it is not. There are some exceptions in vendor-provided
> kernels, but there is a very strong incentive to not reuse or adjust
> syscall numbers.
Does this mean we can be sure no new syscalls will be added to the
list, ever?
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/4] 'catch syscall' feature -- XML support part
2008-11-04 22:27 ` Eli Zaretskii
@ 2008-11-04 22:36 ` Daniel Jacobowitz
2008-11-05 1:02 ` Sérgio Durigan Júnior
2008-11-05 4:22 ` Eli Zaretskii
0 siblings, 2 replies; 18+ messages in thread
From: Daniel Jacobowitz @ 2008-11-04 22:36 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: sergiodj, gdb-patches
On Wed, Nov 05, 2008 at 12:25:33AM +0200, Eli Zaretskii wrote:
> Does this mean we can be sure no new syscalls will be added to the
> list, ever?
Syscalls are continually added to the list. But you don't need to
know which ones are present on the current system - just to keep the
files up to date in current versions of GDB. Unknown syscalls should
be displayed by number but otherwise handled just like known ones,
I think.
(General goal, not a statement on the patch; I haven't looked.)
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/4] 'catch syscall' feature -- XML support part
2008-11-04 22:36 ` Daniel Jacobowitz
@ 2008-11-05 1:02 ` Sérgio Durigan Júnior
2008-11-05 4:22 ` Eli Zaretskii
1 sibling, 0 replies; 18+ messages in thread
From: Sérgio Durigan Júnior @ 2008-11-05 1:02 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: Eli Zaretskii, gdb-patches
On Tue, 2008-11-04 at 17:35 -0500, Daniel Jacobowitz wrote:
> On Wed, Nov 05, 2008 at 12:25:33AM +0200, Eli Zaretskii wrote:
> > Does this mean we can be sure no new syscalls will be added to the
> > list, ever?
>
> Syscalls are continually added to the list. But you don't need to
> know which ones are present on the current system - just to keep the
> files up to date in current versions of GDB. Unknown syscalls should
> be displayed by number but otherwise handled just like known ones,
> I think.
>
> (General goal, not a statement on the patch; I haven't looked.)
That's what the patch does, as far as I have tested. I may have missed
something, of course.
--
Sérgio Durigan Júnior
Linux on Power Toolchain - Software Engineer
Linux Technology Center - LTC
IBM Brazil
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/4] 'catch syscall' feature -- XML support part
2008-11-04 22:36 ` Daniel Jacobowitz
2008-11-05 1:02 ` Sérgio Durigan Júnior
@ 2008-11-05 4:22 ` Eli Zaretskii
2008-11-05 14:57 ` Daniel Jacobowitz
1 sibling, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2008-11-05 4:22 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: sergiodj, gdb-patches
> Date: Tue, 4 Nov 2008 17:35:44 -0500
> From: Daniel Jacobowitz <drow@false.org>
> Cc: sergiodj@linux.vnet.ibm.com, gdb-patches@sourceware.org
>
> On Wed, Nov 05, 2008 at 12:25:33AM +0200, Eli Zaretskii wrote:
> > Does this mean we can be sure no new syscalls will be added to the
> > list, ever?
>
> Syscalls are continually added to the list. But you don't need to
> know which ones are present on the current system - just to keep the
> files up to date in current versions of GDB. Unknown syscalls should
> be displayed by number but otherwise handled just like known ones,
> I think.
What happens if I have a list of syscalls that includes some which are
unsupported by my kernel? What would happen if I ask GDB to trace
those unsupported calls?
In the opposite case (a kernel that supports more syscalls than in the
list), I understand I get an error message if I request the syscall by
name, abut I should be able to request it by the number, right? (This
should be described in the manual, and perhaps also said in the error
message.)
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/4] 'catch syscall' feature -- XML support part
2008-11-05 4:22 ` Eli Zaretskii
@ 2008-11-05 14:57 ` Daniel Jacobowitz
0 siblings, 0 replies; 18+ messages in thread
From: Daniel Jacobowitz @ 2008-11-05 14:57 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: sergiodj, gdb-patches
On Wed, Nov 05, 2008 at 06:21:36AM +0200, Eli Zaretskii wrote:
> What happens if I have a list of syscalls that includes some which are
> unsupported by my kernel? What would happen if I ask GDB to trace
> those unsupported calls?
It will work fine. We trace all system calls (on the only supported
implementation, and on the other implementations I'm familiar with).
If your application never makes the unsupported system calls, they'll
never come up; if it does, they'll be caught (and on exit, return an
error, most likely but not always ENOSYS).
> In the opposite case (a kernel that supports more syscalls than in the
> list), I understand I get an error message if I request the syscall by
> name, abut I should be able to request it by the number, right? (This
> should be described in the manual, and perhaps also said in the error
> message.)
That's right.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2008-11-08 19:06 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-04 4:32 [PATCH 3/4] 'catch syscall' feature -- XML support part Sérgio Durigan Júnior
2008-11-04 13:36 ` Mark Kettenis
2008-11-04 13:47 ` Daniel Jacobowitz
2008-11-04 15:05 ` Sérgio Durigan Júnior
2008-11-04 15:13 ` Daniel Jacobowitz
2008-11-04 15:18 ` Sérgio Durigan Júnior
2008-11-04 15:06 ` Sérgio Durigan Júnior
2008-11-08 19:06 ` Mark Kettenis
2008-11-04 18:41 ` Tom Tromey
2008-11-07 3:46 ` Sérgio Durigan Júnior
2008-11-07 18:24 ` Tom Tromey
2008-11-04 21:20 ` Eli Zaretskii
2008-11-04 22:23 ` Daniel Jacobowitz
2008-11-04 22:27 ` Eli Zaretskii
2008-11-04 22:36 ` Daniel Jacobowitz
2008-11-05 1:02 ` Sérgio Durigan Júnior
2008-11-05 4:22 ` Eli Zaretskii
2008-11-05 14:57 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox