public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom de Vries <vries@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] [gdb/tdep] Improve gdb/syscalls/update-linux.sh
Date: Thu, 12 May 2022 08:58:55 +0000 (GMT)	[thread overview]
Message-ID: <20220512085855.5DB07384F01F@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=59eb8e236c0a80258951d5fac57903db7a1cc7e0

commit 59eb8e236c0a80258951d5fac57903db7a1cc7e0
Author: Tom de Vries <tdevries@suse.de>
Date:   Thu May 12 10:58:50 2022 +0200

    [gdb/tdep] Improve gdb/syscalls/update-linux.sh
    
    Fix two things in update-linux.sh:
    - remove use of unnecessary tmp file
    - inline gen-header.py into update-linux.sh
    
    Tested on x86_64-linux.

Diff:
---
 gdb/syscalls/gen-header.py   | 32 --------------------------------
 gdb/syscalls/update-linux.sh | 33 +++++++++++++++++++++++----------
 2 files changed, 23 insertions(+), 42 deletions(-)

diff --git a/gdb/syscalls/gen-header.py b/gdb/syscalls/gen-header.py
deleted file mode 100644
index 78ccdddbff6..00000000000
--- a/gdb/syscalls/gen-header.py
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright (C) 2013-2022 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.  This file is offered as-is,
-# without any warranty.
-
-import sys
-import time
-
-infname = sys.argv[1]
-
-print(
-    """\
-<?xml version="1.0"?>
-<!-- Copyright (C) 2009-%s 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">
-
-<!-- This file was generated using the following file:
-
-     %s
-
-     The file mentioned above belongs to the Linux Kernel.  -->
-
-"""
-    % (time.strftime("%Y"), infname)
-)
diff --git a/gdb/syscalls/update-linux.sh b/gdb/syscalls/update-linux.sh
index a6719077dc5..e26ec4e92cb 100755
--- a/gdb/syscalls/update-linux.sh
+++ b/gdb/syscalls/update-linux.sh
@@ -36,25 +36,38 @@ if [ ! -f "$f" ]; then
     exit 1
 fi
 
+year=$(date +%Y)
+
 (
-    python gen-header.py "<sys/syscall.h>"
+    cat <<EOF
+<?xml version="1.0"?>
+<!-- Copyright (C) 2009-$year Free Software Foundation, Inc.
 
-    tmp=$(mktemp)
+     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.  -->
 
-    echo '#include <sys/syscall.h>' \
-	| gcc -E - -dD "$@" \
-	| grep -E '#define __NR_' \
-		> "$tmp"
+<!DOCTYPE feature SYSTEM "gdb-syscalls.dtd">
+
+<!-- This file was generated using the following file:
+
+     <sys/syscall.h>
+
+     The file mentioned above belongs to the Linux Kernel.  -->
+
+
+EOF
 
     echo '<syscalls_info>'
 
-    while read -r line; do
+    echo '#include <sys/syscall.h>' \
+	| gcc -E - -dD "$@" \
+	| grep -E '#define __NR_' \
+	| while read -r line; do
 	name=$(echo "$line" | awk '{print $2}' | sed 's/^__NR_//')
 	nr=$(echo "$line" | awk '{print $3}')
 	echo "  <syscall name=\"$name\" number=\"$nr\"/>"
-    done < "$tmp"
+    done
 
     echo '</syscalls_info>'
-
-    rm -f "$tmp"
 ) > "$f"


                 reply	other threads:[~2022-05-12  8:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220512085855.5DB07384F01F@sourceware.org \
    --to=vries@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /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).