public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Pedro Alves <pedro@palves.net>, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/2] Autogenerate gdb/syscalls/linux-defaults.xml.in (groups) from strace sources
Date: Fri, 24 Feb 2023 22:00:45 -0500	[thread overview]
Message-ID: <7eba04ab-b77d-5b2f-755a-78157115d055@simark.ca> (raw)
In-Reply-To: <20230224232650.4031472-2-pedro@palves.net>



On 2/24/23 18:26, Pedro Alves wrote:
> 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.

Thanks, that LGTM.

I think the filename passed around is not actually used, so you can do:

---

diff --git a/gdb/syscalls/update-linux-defaults.sh b/gdb/syscalls/update-linux-defaults.sh
index 2c001aa3b8a9..bf74f1e321a8 100755
--- a/gdb/syscalls/update-linux-defaults.sh
+++ b/gdb/syscalls/update-linux-defaults.sh
@@ -35,8 +35,6 @@ fi
 
 pre ()
 {
-    f="$1"
-
     year=$(date +%Y)
 
     cat <<EOF
@@ -61,9 +59,7 @@ post ()
 
 generate ()
 {
-    f="$1"
-
-    pre "$f"
+    pre
 
     grep -rn -E "T[A-Z][,|]" "$d/src/linux/" \
 	| sed -e 's/\(T[A-Z][,|].*\)/\x03&/' -e 's/.*\x03//' \
@@ -92,4 +88,4 @@ generate ()
 f=linux-defaults.xml.in
 
 echo "Generating $f"
-generate "$t" > "$f"
+generate > "$f"

---

I was tipped off by this shellcheck warning:

In update-linux-defaults.sh line 95:
generate "$t" > "$f"
          ^-- SC2154 (warning): t is referenced but not assigned.

Simon

  reply	other threads:[~2023-02-25  3:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24 23:26 [PATCH 0/2] Autogenerate gdb/syscalls/linux-defaults.xml.in (syscall groups) " Pedro Alves
2023-02-24 23:26 ` [PATCH 1/2] Autogenerate gdb/syscalls/linux-defaults.xml.in (groups) " Pedro Alves
2023-02-25  3:00   ` Simon Marchi [this message]
2023-02-27 15:04     ` Pedro Alves
2023-02-24 23:26 ` [PATCH 2/2] Regenerate Linux syscall group info Pedro Alves
2023-02-25  9:31 ` [PATCH 0/2] Autogenerate gdb/syscalls/linux-defaults.xml.in (syscall groups) from strace sources Tom de Vries
2023-02-27 14:53   ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7eba04ab-b77d-5b2f-755a-78157115d055@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@palves.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).