public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][gdb/record] Handle statx system call
@ 2022-05-09 10:41 Tom de Vries
  2022-05-11  6:36 ` [committed][gdb/record] " Tom de Vries
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2022-05-09 10:41 UTC (permalink / raw)
  To: gdb-patches

Hi,

When running test-case gdb.reverse/fstatat-reverse.exp with target board
unix/-m32 on openSUSE Tumbleweed, I run into:
...
(gdb) PASS: gdb.reverse/fstatat-reverse.exp: set breakpoint at marker2
continue^M
Continuing.^M
Process record and replay target doesn't support syscall number 383^M
Process record: failed to record execution log.^M
^M
Program stopped.^M
0xf7fc5555 in __kernel_vsyscall ()^M
(gdb) FAIL: gdb.reverse/fstatat-reverse.exp: continue to breakpoint: marker2
...

The problems is that while with native we're trying to record these syscalls
(showing strace output):
...
openat(AT_FDCWD, "/", O_RDONLY|O_PATH)  = 3
newfstatat(3, ".", {st_mode=S_IFDIR|0755, st_size=146, ...}, 0) = 0
...
with unix/-m32 we have instead:
...
openat(AT_FDCWD, "/", O_RDONLY|O_PATH)  = 3
statx(3, ".", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_BASIC_STATS, \
  {stx_mask=STATX_ALL|STATX_MNT_ID, stx_attributes=STATX_ATTR_MOUNT_ROOT, \
  stx_mode=S_IFDIR|0755, stx_size=146, ...}) = 0
...
and statx is not supported.

Fix this by adding support for recording syscall statx.

Tested on x86_64-linux.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28461

Any comments?

Thanks,
- Tom

[gdb/record] Handle statx system call

---
 gdb/linux-record.c | 6 ++++++
 gdb/linux-record.h | 1 +
 2 files changed, 7 insertions(+)

diff --git a/gdb/linux-record.c b/gdb/linux-record.c
index ea858df59a6..1e8e3c95567 100644
--- a/gdb/linux-record.c
+++ b/gdb/linux-record.c
@@ -1046,6 +1046,12 @@ Do you want to stop the program?"),
 	return -1;
       break;
 
+    case gdb_sys_statx:
+      regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
+      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, 256))
+	return -1;
+      break;
+
     case gdb_sys_uname:
       if (record_mem_at_reg (regcache, tdep->arg1,
 			     tdep->size_old_utsname))
diff --git a/gdb/linux-record.h b/gdb/linux-record.h
index 07f0c5a2604..ab4c93cb870 100644
--- a/gdb/linux-record.h
+++ b/gdb/linux-record.h
@@ -509,6 +509,7 @@ enum gdb_syscall {
   gdb_sys_epoll_create1 = 329,
   gdb_sys_dup3 = 330,
   gdb_sys_pipe2 = 331,
+  gdb_sys_statx = 383,
   gdb_sys_inotify_init1 = 332,
   gdb_sys_socket = 500,
   gdb_sys_connect = 501,

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [committed][gdb/record] Handle statx system call
  2022-05-09 10:41 [PATCH][gdb/record] Handle statx system call Tom de Vries
@ 2022-05-11  6:36 ` Tom de Vries
  0 siblings, 0 replies; 2+ messages in thread
From: Tom de Vries @ 2022-05-11  6:36 UTC (permalink / raw)
  To: gdb-patches

On 5/9/22 12:41, Tom de Vries via Gdb-patches wrote:
> Hi,
> 
> When running test-case gdb.reverse/fstatat-reverse.exp with target board
> unix/-m32 on openSUSE Tumbleweed, I run into:
> ...
> (gdb) PASS: gdb.reverse/fstatat-reverse.exp: set breakpoint at marker2
> continue^M
> Continuing.^M
> Process record and replay target doesn't support syscall number 383^M
> Process record: failed to record execution log.^M
> ^M
> Program stopped.^M
> 0xf7fc5555 in __kernel_vsyscall ()^M
> (gdb) FAIL: gdb.reverse/fstatat-reverse.exp: continue to breakpoint: marker2
> ...
> 
> The problems is that while with native we're trying to record these syscalls
> (showing strace output):
> ...
> openat(AT_FDCWD, "/", O_RDONLY|O_PATH)  = 3
> newfstatat(3, ".", {st_mode=S_IFDIR|0755, st_size=146, ...}, 0) = 0
> ...
> with unix/-m32 we have instead:
> ...
> openat(AT_FDCWD, "/", O_RDONLY|O_PATH)  = 3
> statx(3, ".", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_BASIC_STATS, \
>    {stx_mask=STATX_ALL|STATX_MNT_ID, stx_attributes=STATX_ATTR_MOUNT_ROOT, \
>    stx_mode=S_IFDIR|0755, stx_size=146, ...}) = 0
> ...
> and statx is not supported.
> 
> Fix this by adding support for recording syscall statx.
> 
> Tested on x86_64-linux.
> 
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28461
> 
> Any comments?
> 
> Thanks,
> - Tom
> 
> [gdb/record] Handle statx system call
> 
> ---
>   gdb/linux-record.c | 6 ++++++
>   gdb/linux-record.h | 1 +
>   2 files changed, 7 insertions(+)
> 
> diff --git a/gdb/linux-record.c b/gdb/linux-record.c
> index ea858df59a6..1e8e3c95567 100644
> --- a/gdb/linux-record.c
> +++ b/gdb/linux-record.c
> @@ -1046,6 +1046,12 @@ Do you want to stop the program?"),
>   	return -1;
>         break;
>   
> +    case gdb_sys_statx:
> +      regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
> +      if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, 256))
> +	return -1;
> +      break;
> +
>       case gdb_sys_uname:
>         if (record_mem_at_reg (regcache, tdep->arg1,
>   			     tdep->size_old_utsname))
> diff --git a/gdb/linux-record.h b/gdb/linux-record.h
> index 07f0c5a2604..ab4c93cb870 100644
> --- a/gdb/linux-record.h
> +++ b/gdb/linux-record.h
> @@ -509,6 +509,7 @@ enum gdb_syscall {
>     gdb_sys_epoll_create1 = 329,
>     gdb_sys_dup3 = 330,
>     gdb_sys_pipe2 = 331,
> +  gdb_sys_statx = 383,
>     gdb_sys_inotify_init1 = 332,
>     gdb_sys_socket = 500,
>     gdb_sys_connect = 501,


Committed, with this fixed:
...
-  gdb_sys_statx = 383,
    gdb_sys_inotify_init1 = 332,
+  gdb_sys_statx = 383,
...

Thanks,
- Tom

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-11  6:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-09 10:41 [PATCH][gdb/record] Handle statx system call Tom de Vries
2022-05-11  6:36 ` [committed][gdb/record] " Tom de Vries

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).