[1/3] gdb: syscalls: Handle __NR3264_ prefixed syscall number
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-arm |
success
|
Test passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
success
|
Test passed
|
Commit Message
In gdb commit a08dc2aa004b ("gdb: syscalls: Add loongarch-linux.xml.in"),
there exist some __NR3264_ prefixed syscall numbers, replace them with
digital numbers according to /usr/include/asm-generic/unistd.h and sort
them by syscall number manually, it is better to modify update-linux.sh
to do the work automatically.
By the way, a Linux kernel patch did the similar change.
Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d6e1cc6b7220
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
gdb/syscalls/update-linux.sh | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
Comments
On 11/26/24 09:59, Tiezhu Yang wrote:
Hi,
thanks for the patch.
> In gdb commit a08dc2aa004b ("gdb: syscalls: Add loongarch-linux.xml.in"),
> there exist some __NR3264_ prefixed syscall numbers, replace them with
> digital numbers according to /usr/include/asm-generic/unistd.h and sort
> them by syscall number manually, it is better to modify update-linux.sh
> to do the work automatically.
>
This seems to be a literal quote, which is not clearly indicated and
also make the sentence construction problematic.
Consider indicating this in the usual way, for instance using a '...'
marker:
--------------------------------------------------------------------------
In gdb commit a08dc2aa004b ("gdb: syscalls: Add
loongarch-linux.xml.in"), we find:
...
There exist some __NR3264_ prefixed syscall numbers, replace them
with digital numbers according to /usr/include/asm-generic/unistd.h
and sort them by syscall number manually, maybe we can modify the
script to do it automatically in the future.
...
--------------------------------------------------------------------------
Or using whitespace and indentation:
--------------------------------------------------------------------------In
gdb commit a08dc2aa004b ("gdb: syscalls: Add loongarch-linux.xml.in"),
we find:
There exist some __NR3264_ prefixed syscall numbers, replace them
with digital numbers according to /usr/include/asm-generic/unistd.h
and sort them by syscall number manually, maybe we can modify the
script to do it automatically in the future.
--------------------------------------------------------------------------
> By the way, a Linux kernel patch did the similar change.
>
> Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d6e1cc6b7220
We don't use the Link tag, instead we use footnotes.
So, something like:
...
By the way, a Linux kernel patch did the similar change [1].
[1]
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d6e1cc6b7220
...
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
> gdb/syscalls/update-linux.sh | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/gdb/syscalls/update-linux.sh b/gdb/syscalls/update-linux.sh
> index e2af1a75cb5..da8082d6488 100755
> --- a/gdb/syscalls/update-linux.sh
> +++ b/gdb/syscalls/update-linux.sh
> @@ -62,10 +62,15 @@ EOF
>
I'd like a comment here, showing an example of each of the two types of
lines we're trying to parse here.
Thanks,
- Tom
> echo '#include <sys/syscall.h>' \
> | gcc -E - -dD "$@" \
> - | grep -E '#define __NR_' \
> + | grep -E '#define (__NR_|__NR3264_)' \
> | while read -r line; do
> - name=$(echo "$line" | awk '{print $2}' | sed 's/^__NR_//')
> - nr=$(echo "$line" | awk '{print $3}')
> + line=$(echo "$line" | awk '$2 ~ "__NR" && $3 !~ "__NR3264_" {
> + sub("^#define __NR(3264)?_", ""); print | "sort -k2 -n"}')
> + if [ -z "$line" ]; then
> + continue
> + fi
> + name=$(echo "$line" | awk '{print $1}')
> + nr=$(echo "$line" | awk '{print $2}')
> echo " <syscall name=\"$name\" number=\"$nr\"/>"
> done
>
@@ -62,10 +62,15 @@ EOF
echo '#include <sys/syscall.h>' \
| gcc -E - -dD "$@" \
- | grep -E '#define __NR_' \
+ | grep -E '#define (__NR_|__NR3264_)' \
| while read -r line; do
- name=$(echo "$line" | awk '{print $2}' | sed 's/^__NR_//')
- nr=$(echo "$line" | awk '{print $3}')
+ line=$(echo "$line" | awk '$2 ~ "__NR" && $3 !~ "__NR3264_" {
+ sub("^#define __NR(3264)?_", ""); print | "sort -k2 -n"}')
+ if [ -z "$line" ]; then
+ continue
+ fi
+ name=$(echo "$line" | awk '{print $1}')
+ nr=$(echo "$line" | awk '{print $2}')
echo " <syscall name=\"$name\" number=\"$nr\"/>"
done