forked from Imagelibrary/binutils-gdb
Change get_syscalls_by_group to append to an existing vector of integers.
This removes the need for the caller to explicitly manage the memory for the returned system call list. The sole caller only needed the system call numbers rather than the full syscall structures. get_syscalls_by_group now uses a boolean return value to indicate if the requested group exists. gdb/ChangeLog: * break-catch-syscall.c (catch_syscall_split_args): Pass 'result' to get_syscalls_by_group. * xml-syscall.c [!HAVE_LIBEXPAT] (get_syscalls_by_group): Return false. [HAVE_LIBEXPAT] (xml_list_syscalls_by_group): Append syscall numbers to an existing vector of integers and return a bool. (get_syscalls_by_group): Accept pointer to vector of integers and change return type to bool. * xml-syscall.h (get_syscalls_by_group): Likewise.
This commit is contained in:
@@ -409,25 +409,13 @@ catch_syscall_split_args (const char *arg)
|
||||
{
|
||||
/* We have a syscall group. Let's expand it into a syscall
|
||||
list before inserting. */
|
||||
struct syscall *syscall_list;
|
||||
const char *group_name;
|
||||
|
||||
/* Skip over "g:" and "group:" prefix strings. */
|
||||
group_name = strchr (cur_name, ':') + 1;
|
||||
|
||||
syscall_list = get_syscalls_by_group (gdbarch, group_name);
|
||||
|
||||
if (syscall_list == NULL)
|
||||
if (!get_syscalls_by_group (gdbarch, group_name, &result))
|
||||
error (_("Unknown syscall group '%s'."), group_name);
|
||||
|
||||
for (i = 0; syscall_list[i].name != NULL; i++)
|
||||
{
|
||||
/* Insert each syscall that are part of the group. No
|
||||
need to check if it is valid. */
|
||||
result.push_back (syscall_list[i].number);
|
||||
}
|
||||
|
||||
xfree (syscall_list);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user