Autogenerate gdb/syscalls/linux-defaults.xml.in (groups) from strace sources
authorPedro Alves <pedro@palves.net>
Fri, 24 Feb 2023 18:58:31 +0000 (18:58 +0000)
committerPedro Alves <pedro@palves.net>
Mon, 27 Feb 2023 15:01:07 +0000 (15:01 +0000)
commit08c815c2bffb3b76a84c0a14acdd71cc302ed609
treececf9ec2e778c876f41c16d84e372259591c86be
parent1b30ccce02065e40a6a82664e50e7f86225c7a67
Autogenerate gdb/syscalls/linux-defaults.xml.in (groups) from strace sources

I noticed that "catch syscall group:process" doesn't catch clone3,
while it does catch clone.

The catch syscall group information is recorded in the
gdb/syscalls/linux-defaults.xml.in file, which says:

  <!-- The group field information was based on strace.  -->

So I looked at the strace sources, to confirm that clone3 is in fact
recorded in the "process" group there too, and to check what other
syscalls might be missing groups.

After some digging, I found that strace records the group info in C
arrays, with entries like:
...
[ 61] = { 4, TP, SEN(wait4), "wait4" },
[ 62] = { 2, TS|TP, SEN(kill), "kill" },
[ 63] = { 1, 0, SEN(uname), "uname" },
...

You can see the current master's table for Linux x86-64 here:

  https://github.com/strace/strace/blob/e88e5e9ae6da68f22d15f9be3193b1412ac9aa02/src/linux/x86_64/syscallent.h

The column with TS|TP above is what defines each syscall's groups.  So
I wrote a script that extracts this information and generates
linux-defaults.xml.in.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I679d59d42fb2a914bf7a99e4c558e9696e5adff1
gdb/syscalls/update-linux-defaults.sh [new file with mode: 0755]