binutils-gdb/gdb/xml-syscall.h

70 lines
2.7 KiB
C
Raw Normal View History

/* Functions that provide the mechanism to parse a syscall XML file
and get its values.
Copyright (C) 2009-2019 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
/* Function used to set the name of the file which contains
information about the system calls present in the current
architecture.
This function *should* be called before anything else, otherwise
GDB won't be able to find the correct XML file to open and get
the syscalls definitions. */
Partial fix for PR breakpoints/10737: Make syscall info be per-arch instead of global This patch intends to partially fix PR breakpoints/10737, which is about making the syscall information (for the "catch syscall" command) be per-arch, instead of global. This is not a full fix because of the other issues pointed by Pedro here: <https://sourceware.org/bugzilla/show_bug.cgi?id=10737#c5> However, I consider it a good step towards the real fix. It will also help me fix <https://sourceware.org/bugzilla/show_bug.cgi?id=17402>. What this patch does, basically, is move the "syscalls_info" struct to gdbarch. Currently, the syscall information is stored in a global variable inside gdb/xml-syscall.c, which means that there is no easy way to correlate this info with the current target or architecture being used, for example. This causes strange behaviors, because the syscall info is not re-read when the arch changes. For example, if you put a syscall catchpoint in syscall 5 on i386 (syscall open), and then load a x86_64 program on GDB and put the same syscall 5 there (fstat on x86_64), you will still see that GDB tells you that it is catching "open", even though it is not. With this patch, GDB correctly says that it will be catching fstat syscalls. (gdb) set architecture i386 The target architecture is assumed to be i386 (gdb) catch syscall 5 Catchpoint 1 (syscall 'open' [5]) (gdb) set architecture i386:x86-64 The target architecture is assumed to be i386:x86-64 (gdb) catch syscall 5 Catchpoint 2 (syscall 'open' [5]) But with the patch: (gdb) set architecture i386 The target architecture is assumed to be i386 (gdb) catch syscall 5 Catchpoint 1 (syscall 'open' [5]) (gdb) set architecture i386:x86-64 The target architecture is assumed to be i386:x86-64 (gdb) catch syscall 5 Catchpoint 2 (syscall 'fstat' [5]) As I said, there are still some problems on the "catch syscall" mechanism, because (for example) the user should be able to "catch syscall open" on i386, and then expect "open" to be caught also on x86_64. Currently, it doesn't work. I intend to work on this later. gdb/ 2014-11-20 Sergio Durigan Junior <sergiodj@redhat.com> PR breakpoints/10737 * amd64-linux-tdep.c (amd64_linux_init_abi_common): Adjust call to set_xml_syscall_file_name to provide gdbarch. * arm-linux-tdep.c (arm_linux_init_abi): Likewise. * bfin-linux-tdep.c (bfin_linux_init_abi): Likewise. * breakpoint.c (print_it_catch_syscall): Adjust call to get_syscall_by_number to provide gdbarch. (print_one_catch_syscall): Likewise. (print_mention_catch_syscall): Likewise. (print_recreate_catch_syscall): Likewise. (catch_syscall_split_args): Adjust calls to get_syscall_by_number and get_syscall_by_name to provide gdbarch. (catch_syscall_completer): Adjust call to get_syscall_names to provide gdbarch. * gdbarch.c: Regenerate. * gdbarch.h: Likewise. * gdbarch.sh: Forward declare "struct syscalls_info". (xml_syscall_file): New variable. (syscalls_info): Likewise. * i386-linux-tdep.c (i386_linux_init_abi): Adjust call to set_xml_syscall_file_name to provide gdbarch. * mips-linux-tdep.c (mips_linux_init_abi): Likewise. * ppc-linux-tdep.c (ppc_linux_init_abi): Likewise. * s390-linux-tdep.c (s390_gdbarch_init): Likewise. * sparc-linux-tdep.c (sparc32_linux_init_abi): Likewise. * sparc64-linux-tdep.c (sparc64_linux_init_abi): Likewise. * xml-syscall.c: Include gdbarch.h. (set_xml_syscall_file_name): Accept gdbarch parameter. (get_syscall_by_number): Likewise. (get_syscall_by_name): Likewise. (get_syscall_names): Likewise. (my_gdb_datadir): Delete global variable. (struct syscalls_info) <my_gdb_datadir>: New variable. (struct syscalls_info) <sysinfo>: Rename variable to "syscalls_info". (sysinfo): Delete global variable. (have_initialized_sysinfo): Likewise. (xml_syscall_file): Likewise. (sysinfo_free_syscalls_desc): Rename to... (syscalls_info_free_syscalls_desc): ... this. (free_syscalls_info): Rename "sysinfo" to "syscalls_info". Adjust code to the new layout of "struct syscalls_info". (make_cleanup_free_syscalls_info): Rename parameter "sysinfo" to "syscalls_info". (syscall_create_syscall_desc): Likewise. (syscall_start_syscall): Likewise. (syscall_parse_xml): Likewise. (xml_init_syscalls_info): Likewise. Drop "const" from return value. (init_sysinfo): Rename to... (init_syscalls_info): ...this. Add gdbarch as a parameter. Adjust function to deal with gdbarch. (xml_get_syscall_number): Delete parameter sysinfo. Accept gdbarch as a parameter. Adjust code. (xml_get_syscall_name): Likewise. (xml_list_of_syscalls): Likewise. (set_xml_syscall_file_name): Accept gdbarch as parameter. (get_syscall_by_number): Likewise. (get_syscall_by_name): Likewise. (get_syscall_names): Likewise. * xml-syscall.h (set_xml_syscall_file_name): Likewise. (get_syscall_by_number): Likewise. (get_syscall_by_name): Likewise. (get_syscall_names): Likewise. gdb/testsuite/ 2014-11-20 Sergio Durigan Junior <sergiodj@redhat.com> PR breakpoints/10737 * gdb.base/catch-syscall.exp (do_syscall_tests): Call test_catch_syscall_multi_arch. (test_catch_syscall_multi_arch): New function.
2014-11-20 18:28:18 +01:00
void set_xml_syscall_file_name (struct gdbarch *gdbarch,
const char *name);
/* Function that retrieves the syscall name corresponding to the given
number. It puts the requested information inside 'struct syscall'. */
Partial fix for PR breakpoints/10737: Make syscall info be per-arch instead of global This patch intends to partially fix PR breakpoints/10737, which is about making the syscall information (for the "catch syscall" command) be per-arch, instead of global. This is not a full fix because of the other issues pointed by Pedro here: <https://sourceware.org/bugzilla/show_bug.cgi?id=10737#c5> However, I consider it a good step towards the real fix. It will also help me fix <https://sourceware.org/bugzilla/show_bug.cgi?id=17402>. What this patch does, basically, is move the "syscalls_info" struct to gdbarch. Currently, the syscall information is stored in a global variable inside gdb/xml-syscall.c, which means that there is no easy way to correlate this info with the current target or architecture being used, for example. This causes strange behaviors, because the syscall info is not re-read when the arch changes. For example, if you put a syscall catchpoint in syscall 5 on i386 (syscall open), and then load a x86_64 program on GDB and put the same syscall 5 there (fstat on x86_64), you will still see that GDB tells you that it is catching "open", even though it is not. With this patch, GDB correctly says that it will be catching fstat syscalls. (gdb) set architecture i386 The target architecture is assumed to be i386 (gdb) catch syscall 5 Catchpoint 1 (syscall 'open' [5]) (gdb) set architecture i386:x86-64 The target architecture is assumed to be i386:x86-64 (gdb) catch syscall 5 Catchpoint 2 (syscall 'open' [5]) But with the patch: (gdb) set architecture i386 The target architecture is assumed to be i386 (gdb) catch syscall 5 Catchpoint 1 (syscall 'open' [5]) (gdb) set architecture i386:x86-64 The target architecture is assumed to be i386:x86-64 (gdb) catch syscall 5 Catchpoint 2 (syscall 'fstat' [5]) As I said, there are still some problems on the "catch syscall" mechanism, because (for example) the user should be able to "catch syscall open" on i386, and then expect "open" to be caught also on x86_64. Currently, it doesn't work. I intend to work on this later. gdb/ 2014-11-20 Sergio Durigan Junior <sergiodj@redhat.com> PR breakpoints/10737 * amd64-linux-tdep.c (amd64_linux_init_abi_common): Adjust call to set_xml_syscall_file_name to provide gdbarch. * arm-linux-tdep.c (arm_linux_init_abi): Likewise. * bfin-linux-tdep.c (bfin_linux_init_abi): Likewise. * breakpoint.c (print_it_catch_syscall): Adjust call to get_syscall_by_number to provide gdbarch. (print_one_catch_syscall): Likewise. (print_mention_catch_syscall): Likewise. (print_recreate_catch_syscall): Likewise. (catch_syscall_split_args): Adjust calls to get_syscall_by_number and get_syscall_by_name to provide gdbarch. (catch_syscall_completer): Adjust call to get_syscall_names to provide gdbarch. * gdbarch.c: Regenerate. * gdbarch.h: Likewise. * gdbarch.sh: Forward declare "struct syscalls_info". (xml_syscall_file): New variable. (syscalls_info): Likewise. * i386-linux-tdep.c (i386_linux_init_abi): Adjust call to set_xml_syscall_file_name to provide gdbarch. * mips-linux-tdep.c (mips_linux_init_abi): Likewise. * ppc-linux-tdep.c (ppc_linux_init_abi): Likewise. * s390-linux-tdep.c (s390_gdbarch_init): Likewise. * sparc-linux-tdep.c (sparc32_linux_init_abi): Likewise. * sparc64-linux-tdep.c (sparc64_linux_init_abi): Likewise. * xml-syscall.c: Include gdbarch.h. (set_xml_syscall_file_name): Accept gdbarch parameter. (get_syscall_by_number): Likewise. (get_syscall_by_name): Likewise. (get_syscall_names): Likewise. (my_gdb_datadir): Delete global variable. (struct syscalls_info) <my_gdb_datadir>: New variable. (struct syscalls_info) <sysinfo>: Rename variable to "syscalls_info". (sysinfo): Delete global variable. (have_initialized_sysinfo): Likewise. (xml_syscall_file): Likewise. (sysinfo_free_syscalls_desc): Rename to... (syscalls_info_free_syscalls_desc): ... this. (free_syscalls_info): Rename "sysinfo" to "syscalls_info". Adjust code to the new layout of "struct syscalls_info". (make_cleanup_free_syscalls_info): Rename parameter "sysinfo" to "syscalls_info". (syscall_create_syscall_desc): Likewise. (syscall_start_syscall): Likewise. (syscall_parse_xml): Likewise. (xml_init_syscalls_info): Likewise. Drop "const" from return value. (init_sysinfo): Rename to... (init_syscalls_info): ...this. Add gdbarch as a parameter. Adjust function to deal with gdbarch. (xml_get_syscall_number): Delete parameter sysinfo. Accept gdbarch as a parameter. Adjust code. (xml_get_syscall_name): Likewise. (xml_list_of_syscalls): Likewise. (set_xml_syscall_file_name): Accept gdbarch as parameter. (get_syscall_by_number): Likewise. (get_syscall_by_name): Likewise. (get_syscall_names): Likewise. * xml-syscall.h (set_xml_syscall_file_name): Likewise. (get_syscall_by_number): Likewise. (get_syscall_by_name): Likewise. (get_syscall_names): Likewise. gdb/testsuite/ 2014-11-20 Sergio Durigan Junior <sergiodj@redhat.com> PR breakpoints/10737 * gdb.base/catch-syscall.exp (do_syscall_tests): Call test_catch_syscall_multi_arch. (test_catch_syscall_multi_arch): New function.
2014-11-20 18:28:18 +01:00
void get_syscall_by_number (struct gdbarch *gdbarch,
int syscall_number, struct syscall *s);
Add an optional "alias" attribute to syscall entries. When setting a syscall catchpoint by name, catch syscalls whose name or alias matches the requested string. When the ABI of a system call is changed in the FreeBSD kernel, this is implemented by leaving a compatibility system call using the old ABI at the existing "slot" and allocating a new system call for the version using the new ABI. For example, new fields were added to the 'struct kevent' used by the kevent() system call in FreeBSD 12. The previous kevent() system call in FreeBSD 12 kernels is now called freebsd11_kevent() and is still used by older binaries compiled against the older ABI. The freebsd11_kevent() system call can be tagged with an "alias" attribute of "kevent" permitting 'catch syscall kevent' to catch both system calls and providing the expected user behavior for both old and new binaries. It also provides the expected behavior if GDB is compiled on an older host (such as a FreeBSD 11 host). gdb/ChangeLog: * NEWS: Add entry documenting system call aliases. * break-catch-syscall.c (catch_syscall_split_args): Pass 'result' to get_syscalls_by_name. * gdbarch.sh (UNKNOWN_SYSCALL): Remove. * gdbarch.h: Regenerate. * syscalls/gdb-syscalls.dtd (syscall): Add alias attribute. * xml-syscall.c [!HAVE_LIBEXPAT] (get_syscalls_by_name): Rename from get_syscall_by_name. Now accepts a pointer to a vector of integers and returns a bool. [HAVE_LIBEXPAT] (struct syscall_desc): Add alias member. (syscall_create_syscall_desc): Add alias parameter and pass it to syscall_desc constructor. (syscall_start_syscall): Handle alias attribute. (syscall_attr): Add alias attribute. (xml_get_syscalls_by_name): Rename from xml_get_syscall_number. Now accepts a pointer to a vector of integers and returns a bool. Add syscalls whose alias or name matches the requested name. (get_syscalls_by_name): Rename from get_syscall_by_name. Now accepts a pointer to a vector of integers and returns a bool. * xml-syscall.h (get_syscalls_by_name): Likewise. gdb/doc/ChangeLog: * gdb.texinfo (Set Catchpoints): Add an anchor for 'catch syscall'. (Native): Add a FreeBSD subsection. (FreeBSD): Document use of system call aliases for compatibility system calls.
2018-12-13 20:36:42 +01:00
/* Function that retrieves the syscall numbers corresponding to the
given name. The numbers of all syscalls with either a name or
alias equal to SYSCALL_NAME are appended to SYSCALL_NUMBERS. If no
matching syscalls are found, return false. */
Add an optional "alias" attribute to syscall entries. When setting a syscall catchpoint by name, catch syscalls whose name or alias matches the requested string. When the ABI of a system call is changed in the FreeBSD kernel, this is implemented by leaving a compatibility system call using the old ABI at the existing "slot" and allocating a new system call for the version using the new ABI. For example, new fields were added to the 'struct kevent' used by the kevent() system call in FreeBSD 12. The previous kevent() system call in FreeBSD 12 kernels is now called freebsd11_kevent() and is still used by older binaries compiled against the older ABI. The freebsd11_kevent() system call can be tagged with an "alias" attribute of "kevent" permitting 'catch syscall kevent' to catch both system calls and providing the expected user behavior for both old and new binaries. It also provides the expected behavior if GDB is compiled on an older host (such as a FreeBSD 11 host). gdb/ChangeLog: * NEWS: Add entry documenting system call aliases. * break-catch-syscall.c (catch_syscall_split_args): Pass 'result' to get_syscalls_by_name. * gdbarch.sh (UNKNOWN_SYSCALL): Remove. * gdbarch.h: Regenerate. * syscalls/gdb-syscalls.dtd (syscall): Add alias attribute. * xml-syscall.c [!HAVE_LIBEXPAT] (get_syscalls_by_name): Rename from get_syscall_by_name. Now accepts a pointer to a vector of integers and returns a bool. [HAVE_LIBEXPAT] (struct syscall_desc): Add alias member. (syscall_create_syscall_desc): Add alias parameter and pass it to syscall_desc constructor. (syscall_start_syscall): Handle alias attribute. (syscall_attr): Add alias attribute. (xml_get_syscalls_by_name): Rename from xml_get_syscall_number. Now accepts a pointer to a vector of integers and returns a bool. Add syscalls whose alias or name matches the requested name. (get_syscalls_by_name): Rename from get_syscall_by_name. Now accepts a pointer to a vector of integers and returns a bool. * xml-syscall.h (get_syscalls_by_name): Likewise. gdb/doc/ChangeLog: * gdb.texinfo (Set Catchpoints): Add an anchor for 'catch syscall'. (Native): Add a FreeBSD subsection. (FreeBSD): Document use of system call aliases for compatibility system calls.
2018-12-13 20:36:42 +01:00
bool get_syscalls_by_name (struct gdbarch *gdbarch, const char *syscall_name,
std::vector<int> *syscall_numbers);
/* 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. */
Partial fix for PR breakpoints/10737: Make syscall info be per-arch instead of global This patch intends to partially fix PR breakpoints/10737, which is about making the syscall information (for the "catch syscall" command) be per-arch, instead of global. This is not a full fix because of the other issues pointed by Pedro here: <https://sourceware.org/bugzilla/show_bug.cgi?id=10737#c5> However, I consider it a good step towards the real fix. It will also help me fix <https://sourceware.org/bugzilla/show_bug.cgi?id=17402>. What this patch does, basically, is move the "syscalls_info" struct to gdbarch. Currently, the syscall information is stored in a global variable inside gdb/xml-syscall.c, which means that there is no easy way to correlate this info with the current target or architecture being used, for example. This causes strange behaviors, because the syscall info is not re-read when the arch changes. For example, if you put a syscall catchpoint in syscall 5 on i386 (syscall open), and then load a x86_64 program on GDB and put the same syscall 5 there (fstat on x86_64), you will still see that GDB tells you that it is catching "open", even though it is not. With this patch, GDB correctly says that it will be catching fstat syscalls. (gdb) set architecture i386 The target architecture is assumed to be i386 (gdb) catch syscall 5 Catchpoint 1 (syscall 'open' [5]) (gdb) set architecture i386:x86-64 The target architecture is assumed to be i386:x86-64 (gdb) catch syscall 5 Catchpoint 2 (syscall 'open' [5]) But with the patch: (gdb) set architecture i386 The target architecture is assumed to be i386 (gdb) catch syscall 5 Catchpoint 1 (syscall 'open' [5]) (gdb) set architecture i386:x86-64 The target architecture is assumed to be i386:x86-64 (gdb) catch syscall 5 Catchpoint 2 (syscall 'fstat' [5]) As I said, there are still some problems on the "catch syscall" mechanism, because (for example) the user should be able to "catch syscall open" on i386, and then expect "open" to be caught also on x86_64. Currently, it doesn't work. I intend to work on this later. gdb/ 2014-11-20 Sergio Durigan Junior <sergiodj@redhat.com> PR breakpoints/10737 * amd64-linux-tdep.c (amd64_linux_init_abi_common): Adjust call to set_xml_syscall_file_name to provide gdbarch. * arm-linux-tdep.c (arm_linux_init_abi): Likewise. * bfin-linux-tdep.c (bfin_linux_init_abi): Likewise. * breakpoint.c (print_it_catch_syscall): Adjust call to get_syscall_by_number to provide gdbarch. (print_one_catch_syscall): Likewise. (print_mention_catch_syscall): Likewise. (print_recreate_catch_syscall): Likewise. (catch_syscall_split_args): Adjust calls to get_syscall_by_number and get_syscall_by_name to provide gdbarch. (catch_syscall_completer): Adjust call to get_syscall_names to provide gdbarch. * gdbarch.c: Regenerate. * gdbarch.h: Likewise. * gdbarch.sh: Forward declare "struct syscalls_info". (xml_syscall_file): New variable. (syscalls_info): Likewise. * i386-linux-tdep.c (i386_linux_init_abi): Adjust call to set_xml_syscall_file_name to provide gdbarch. * mips-linux-tdep.c (mips_linux_init_abi): Likewise. * ppc-linux-tdep.c (ppc_linux_init_abi): Likewise. * s390-linux-tdep.c (s390_gdbarch_init): Likewise. * sparc-linux-tdep.c (sparc32_linux_init_abi): Likewise. * sparc64-linux-tdep.c (sparc64_linux_init_abi): Likewise. * xml-syscall.c: Include gdbarch.h. (set_xml_syscall_file_name): Accept gdbarch parameter. (get_syscall_by_number): Likewise. (get_syscall_by_name): Likewise. (get_syscall_names): Likewise. (my_gdb_datadir): Delete global variable. (struct syscalls_info) <my_gdb_datadir>: New variable. (struct syscalls_info) <sysinfo>: Rename variable to "syscalls_info". (sysinfo): Delete global variable. (have_initialized_sysinfo): Likewise. (xml_syscall_file): Likewise. (sysinfo_free_syscalls_desc): Rename to... (syscalls_info_free_syscalls_desc): ... this. (free_syscalls_info): Rename "sysinfo" to "syscalls_info". Adjust code to the new layout of "struct syscalls_info". (make_cleanup_free_syscalls_info): Rename parameter "sysinfo" to "syscalls_info". (syscall_create_syscall_desc): Likewise. (syscall_start_syscall): Likewise. (syscall_parse_xml): Likewise. (xml_init_syscalls_info): Likewise. Drop "const" from return value. (init_sysinfo): Rename to... (init_syscalls_info): ...this. Add gdbarch as a parameter. Adjust function to deal with gdbarch. (xml_get_syscall_number): Delete parameter sysinfo. Accept gdbarch as a parameter. Adjust code. (xml_get_syscall_name): Likewise. (xml_list_of_syscalls): Likewise. (set_xml_syscall_file_name): Accept gdbarch as parameter. (get_syscall_by_number): Likewise. (get_syscall_by_name): Likewise. (get_syscall_names): Likewise. * xml-syscall.h (set_xml_syscall_file_name): Likewise. (get_syscall_by_number): Likewise. (get_syscall_by_name): Likewise. (get_syscall_names): Likewise. gdb/testsuite/ 2014-11-20 Sergio Durigan Junior <sergiodj@redhat.com> PR breakpoints/10737 * gdb.base/catch-syscall.exp (do_syscall_tests): Call test_catch_syscall_multi_arch. (test_catch_syscall_multi_arch): New function.
2014-11-20 18:28:18 +01:00
const char **get_syscall_names (struct gdbarch *gdbarch);
Implement catch syscall group Implement support to add catchpoints for a group of related syscalls using the syntax: (gdb) catch syscall group:<group> or (gdb) catch syscall g:<group> Several groups are predefined in the xml files for all architectures supported by GDB over Linux. They are based on the groups defined by strace. gdb/ * xml-syscall.c (get_syscalls_by_group): New. (get_syscall_group_names): New. (struct syscall_group_desc): New structure to store group data. (struct syscalls_info): Include field to store the group list. (sysinfo_free_syscall_group_desc): New. (free_syscalls_info): Free group list. (syscall_group_create_syscall_group_desc): New. (syscall_group_add_syscall): New. (syscall_create_syscall_desc): Add syscall to its groups. (syscall_start_syscall): Load group attribute. (syscall_group_get_group_by_name): New. (xml_list_syscalls_by_group): New. (xml_list_of_groups): New. * xml-syscall.h (get_syscalls_by_group): Export function to retrieve a list of syscalls filtered by the group name. (get_syscall_group_names): Export function to retrieve the list of syscall groups. * break-catch-syscall.c (catch_syscall_split_args): Verify if argument is a syscall group and expand it to a list of syscalls when creating catchpoints. (catch_syscall_completer): Add word completion for system call groups. * configure.ac: Include dependency for xsltproc when building in maintainer-mode. * break-catch-syscall.c (_initialize_breakpoint): Update catch syscall command documentation. * NEWS: Include section about catching groups of syscalls. * configure: Regenerate. * data-directory/Makefile.in: Generate syscall xml when building in maintainer mode. * syscalls/gdb-syscalls.dtd: Include group attribute to the syscall element. * syscalls/apply-defaults.xsl: New. * syscalls/linux-defaults.xml.in: New. * 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. * syscalls/aarch64-linux.xml: Regenerate. * syscalls/amd64-linux.xml: Regenerate. * syscalls/arm-linux.xml: Regenerate. * syscalls/i386-linux.xml: Regenerate. * syscalls/mips-n32-linux.xml: Regenerate. * syscalls/mips-n64-linux.xml: Regenerate. * syscalls/mips-o32-linux.xml: Regenerate. * syscalls/ppc-linux.xml: Regenerate. * syscalls/ppc64-linux.xml: Regenerate. * syscalls/s390-linux.xml: Regenerate. * syscalls/s390x-linux.xml: Regenerate. * syscalls/sparc-linux.xml: Regenerate. * syscalls/sparc64-linux.xml: Regenerate. gdb/testsuite/ * gdb.base/catch-syscall.exp (do_syscall_tests): Add call to test_catch_syscall_group. (test_catch_syscall_group): New. gdb/doc/ * gdb.texinfo (Set Catchpoints): Add 'group' argument to catch syscall.
2016-07-23 23:38:24 +02:00
/* Function used to retrieve the list of syscalls of a given group in
the system. The syscall numbers are appended to SYSCALL_NUMBERS.
If the group doesn't exist, return false. */
Implement catch syscall group Implement support to add catchpoints for a group of related syscalls using the syntax: (gdb) catch syscall group:<group> or (gdb) catch syscall g:<group> Several groups are predefined in the xml files for all architectures supported by GDB over Linux. They are based on the groups defined by strace. gdb/ * xml-syscall.c (get_syscalls_by_group): New. (get_syscall_group_names): New. (struct syscall_group_desc): New structure to store group data. (struct syscalls_info): Include field to store the group list. (sysinfo_free_syscall_group_desc): New. (free_syscalls_info): Free group list. (syscall_group_create_syscall_group_desc): New. (syscall_group_add_syscall): New. (syscall_create_syscall_desc): Add syscall to its groups. (syscall_start_syscall): Load group attribute. (syscall_group_get_group_by_name): New. (xml_list_syscalls_by_group): New. (xml_list_of_groups): New. * xml-syscall.h (get_syscalls_by_group): Export function to retrieve a list of syscalls filtered by the group name. (get_syscall_group_names): Export function to retrieve the list of syscall groups. * break-catch-syscall.c (catch_syscall_split_args): Verify if argument is a syscall group and expand it to a list of syscalls when creating catchpoints. (catch_syscall_completer): Add word completion for system call groups. * configure.ac: Include dependency for xsltproc when building in maintainer-mode. * break-catch-syscall.c (_initialize_breakpoint): Update catch syscall command documentation. * NEWS: Include section about catching groups of syscalls. * configure: Regenerate. * data-directory/Makefile.in: Generate syscall xml when building in maintainer mode. * syscalls/gdb-syscalls.dtd: Include group attribute to the syscall element. * syscalls/apply-defaults.xsl: New. * syscalls/linux-defaults.xml.in: New. * 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. * syscalls/aarch64-linux.xml: Regenerate. * syscalls/amd64-linux.xml: Regenerate. * syscalls/arm-linux.xml: Regenerate. * syscalls/i386-linux.xml: Regenerate. * syscalls/mips-n32-linux.xml: Regenerate. * syscalls/mips-n64-linux.xml: Regenerate. * syscalls/mips-o32-linux.xml: Regenerate. * syscalls/ppc-linux.xml: Regenerate. * syscalls/ppc64-linux.xml: Regenerate. * syscalls/s390-linux.xml: Regenerate. * syscalls/s390x-linux.xml: Regenerate. * syscalls/sparc-linux.xml: Regenerate. * syscalls/sparc64-linux.xml: Regenerate. gdb/testsuite/ * gdb.base/catch-syscall.exp (do_syscall_tests): Add call to test_catch_syscall_group. (test_catch_syscall_group): New. gdb/doc/ * gdb.texinfo (Set Catchpoints): Add 'group' argument to catch syscall.
2016-07-23 23:38:24 +02:00
bool get_syscalls_by_group (struct gdbarch *gdbarch, const char *group,
std::vector<int> *syscall_numbers);
Implement catch syscall group Implement support to add catchpoints for a group of related syscalls using the syntax: (gdb) catch syscall group:<group> or (gdb) catch syscall g:<group> Several groups are predefined in the xml files for all architectures supported by GDB over Linux. They are based on the groups defined by strace. gdb/ * xml-syscall.c (get_syscalls_by_group): New. (get_syscall_group_names): New. (struct syscall_group_desc): New structure to store group data. (struct syscalls_info): Include field to store the group list. (sysinfo_free_syscall_group_desc): New. (free_syscalls_info): Free group list. (syscall_group_create_syscall_group_desc): New. (syscall_group_add_syscall): New. (syscall_create_syscall_desc): Add syscall to its groups. (syscall_start_syscall): Load group attribute. (syscall_group_get_group_by_name): New. (xml_list_syscalls_by_group): New. (xml_list_of_groups): New. * xml-syscall.h (get_syscalls_by_group): Export function to retrieve a list of syscalls filtered by the group name. (get_syscall_group_names): Export function to retrieve the list of syscall groups. * break-catch-syscall.c (catch_syscall_split_args): Verify if argument is a syscall group and expand it to a list of syscalls when creating catchpoints. (catch_syscall_completer): Add word completion for system call groups. * configure.ac: Include dependency for xsltproc when building in maintainer-mode. * break-catch-syscall.c (_initialize_breakpoint): Update catch syscall command documentation. * NEWS: Include section about catching groups of syscalls. * configure: Regenerate. * data-directory/Makefile.in: Generate syscall xml when building in maintainer mode. * syscalls/gdb-syscalls.dtd: Include group attribute to the syscall element. * syscalls/apply-defaults.xsl: New. * syscalls/linux-defaults.xml.in: New. * 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. * syscalls/aarch64-linux.xml: Regenerate. * syscalls/amd64-linux.xml: Regenerate. * syscalls/arm-linux.xml: Regenerate. * syscalls/i386-linux.xml: Regenerate. * syscalls/mips-n32-linux.xml: Regenerate. * syscalls/mips-n64-linux.xml: Regenerate. * syscalls/mips-o32-linux.xml: Regenerate. * syscalls/ppc-linux.xml: Regenerate. * syscalls/ppc64-linux.xml: Regenerate. * syscalls/s390-linux.xml: Regenerate. * syscalls/s390x-linux.xml: Regenerate. * syscalls/sparc-linux.xml: Regenerate. * syscalls/sparc64-linux.xml: Regenerate. gdb/testsuite/ * gdb.base/catch-syscall.exp (do_syscall_tests): Add call to test_catch_syscall_group. (test_catch_syscall_group): New. gdb/doc/ * gdb.texinfo (Set Catchpoints): Add 'group' argument to catch syscall.
2016-07-23 23:38:24 +02:00
/* Function used to retrieve the list of syscall groups in the system.
Return an array of strings terminated by a NULL element. The list
must be freed by the caller. Return NULL if there is no syscall
information available. */
const char **get_syscall_group_names (struct gdbarch *gdbarch);
#endif /* XML_SYSCALL_H */