Add sys_fcntl argument interfaces to linux_record_tdep.
* linux-record.h (linux_record_tdep): Add fcntl_F_GETLK, fcntl_F_GETLK64, fcntl_F_SETLK64 and fcntl_F_SETLKW64 to be interfaces. * i386-linux-tdep.c (I386_LINUX_RECORD_FCNTL_F_GETLK, I386_LINUX_RECORD_FCNTL_F_GETLK64, I386_LINUX_RECORD_FCNTL_F_SETLK64, I386_LINUX_RECORD_FCNTL_F_SETLKW64): New macros. The values of I386 Linux sys_fcntl arguments. (i386_linux_init_abi): Set macros values to linux_record_tdep. * linux-record.c (record_linux_system_call): Change to use the interface in linux_record_tdep in sys_fcntl and sys_fcntl64. * linux-record.c (record_linux_system_call): Fix the process record build error about type in CYGWIN.
This commit is contained in:
parent
48229727d8
commit
50ef67b36b
3 changed files with 65 additions and 46 deletions
|
@ -586,6 +586,14 @@ static int i386_linux_sc_reg_offset[] =
|
||||||
#define I386_LINUX_RECORD_IOCTL_TIOCSHAYESESP 0x545F
|
#define I386_LINUX_RECORD_IOCTL_TIOCSHAYESESP 0x545F
|
||||||
#define I386_LINUX_RECORD_IOCTL_FIOQSIZE 0x5460
|
#define I386_LINUX_RECORD_IOCTL_FIOQSIZE 0x5460
|
||||||
|
|
||||||
|
/* The values of the second argument of system call "sys_fcntl"
|
||||||
|
and "sys_fcntl64". The values of these macros were obtained from
|
||||||
|
Linux Kernel source. */
|
||||||
|
#define I386_LINUX_RECORD_FCNTL_F_GETLK 5
|
||||||
|
#define I386_LINUX_RECORD_FCNTL_F_GETLK64 12
|
||||||
|
#define I386_LINUX_RECORD_FCNTL_F_SETLK64 13
|
||||||
|
#define I386_LINUX_RECORD_FCNTL_F_SETLKW64 14
|
||||||
|
|
||||||
static void
|
static void
|
||||||
i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||||
{
|
{
|
||||||
|
@ -783,6 +791,12 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||||
I386_LINUX_RECORD_IOCTL_TIOCSHAYESESP;
|
I386_LINUX_RECORD_IOCTL_TIOCSHAYESESP;
|
||||||
i386_linux_record_tdep.ioctl_FIOQSIZE = I386_LINUX_RECORD_IOCTL_FIOQSIZE;
|
i386_linux_record_tdep.ioctl_FIOQSIZE = I386_LINUX_RECORD_IOCTL_FIOQSIZE;
|
||||||
|
|
||||||
|
i386_linux_record_tdep.fcntl_F_GETLK = I386_LINUX_RECORD_FCNTL_F_GETLK;
|
||||||
|
i386_linux_record_tdep.fcntl_F_GETLK64 = I386_LINUX_RECORD_FCNTL_F_GETLK64;
|
||||||
|
i386_linux_record_tdep.fcntl_F_SETLK64 = I386_LINUX_RECORD_FCNTL_F_SETLK64;
|
||||||
|
i386_linux_record_tdep.fcntl_F_SETLKW64 =
|
||||||
|
I386_LINUX_RECORD_FCNTL_F_SETLKW64;
|
||||||
|
|
||||||
i386_linux_record_tdep.arg1 = I386_EBX_REGNUM;
|
i386_linux_record_tdep.arg1 = I386_EBX_REGNUM;
|
||||||
i386_linux_record_tdep.arg2 = I386_ECX_REGNUM;
|
i386_linux_record_tdep.arg2 = I386_ECX_REGNUM;
|
||||||
i386_linux_record_tdep.arg3 = I386_EDX_REGNUM;
|
i386_linux_record_tdep.arg3 = I386_EDX_REGNUM;
|
||||||
|
|
|
@ -393,8 +393,8 @@ record_linux_system_call (int num, struct regcache *regcache,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf_unfiltered (_("Process record and replay target doesn't "
|
printf_unfiltered (_("Process record and replay target doesn't "
|
||||||
"support ioctl request 0x%08x.\n"),
|
"support ioctl request 0x%s.\n"),
|
||||||
tmpu32);
|
phex_nz (tmpu32, 4));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -404,7 +404,7 @@ record_linux_system_call (int num, struct regcache *regcache,
|
||||||
/* XXX */
|
/* XXX */
|
||||||
regcache_raw_read (regcache, tdep->arg2, (gdb_byte *) & tmpu32);
|
regcache_raw_read (regcache, tdep->arg2, (gdb_byte *) & tmpu32);
|
||||||
sys_fcntl:
|
sys_fcntl:
|
||||||
if (tmpu32 == F_GETLK)
|
if (tmpu32 == tdep->fcntl_F_GETLK)
|
||||||
{
|
{
|
||||||
regcache_raw_read (regcache, tdep->arg3,
|
regcache_raw_read (regcache, tdep->arg3,
|
||||||
(gdb_byte *) & tmpu32);
|
(gdb_byte *) & tmpu32);
|
||||||
|
@ -546,9 +546,9 @@ record_linux_system_call (int num, struct regcache *regcache,
|
||||||
if (record_debug)
|
if (record_debug)
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
"Process record: error reading memory "
|
"Process record: error reading memory "
|
||||||
"at addr = 0x%s len = %d.\n",
|
"at addr = 0x%s len = %lu.\n",
|
||||||
paddr_nz (tmpu32),
|
paddr_nz (tmpu32),
|
||||||
(int) sizeof (sel));
|
(unsigned long)sizeof (sel));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (record_arch_list_add_mem (sel.inp, tdep->size_fd_set))
|
if (record_arch_list_add_mem (sel.inp, tdep->size_fd_set))
|
||||||
|
@ -623,10 +623,10 @@ record_linux_system_call (int num, struct regcache *regcache,
|
||||||
target_terminal_ours ();
|
target_terminal_ours ();
|
||||||
q =
|
q =
|
||||||
yquery (_("The next instruction is syscall munmap. "
|
yquery (_("The next instruction is syscall munmap. "
|
||||||
"It will free the memory addr = 0x%s len = %d. "
|
"It will free the memory addr = 0x%s len = %u. "
|
||||||
"It will make record target get error. "
|
"It will make record target get error. "
|
||||||
"Do you want to stop the program?"),
|
"Do you want to stop the program?"),
|
||||||
paddr_nz (tmpu32), len);
|
paddr_nz (tmpu32), (int)len);
|
||||||
target_terminal_inferior ();
|
target_terminal_inferior ();
|
||||||
if (q)
|
if (q)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -686,9 +686,9 @@ record_linux_system_call (int num, struct regcache *regcache,
|
||||||
if (record_debug)
|
if (record_debug)
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
"Process record: error reading "
|
"Process record: error reading "
|
||||||
"memory at addr = 0x%s len = %d.\n",
|
"memory at addr = 0x%s len = %lu.\n",
|
||||||
paddr_nz (tmpu32),
|
paddr_nz (tmpu32),
|
||||||
(int) sizeof (a));
|
(unsigned long)sizeof (a));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (record_arch_list_add_mem (a[1], tdep->size_sockaddr))
|
if (record_arch_list_add_mem (a[1], tdep->size_sockaddr))
|
||||||
|
@ -711,9 +711,9 @@ record_linux_system_call (int num, struct regcache *regcache,
|
||||||
if (record_debug)
|
if (record_debug)
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
"Process record: error reading "
|
"Process record: error reading "
|
||||||
"memory at addr = 0x%s len = %d.\n",
|
"memory at addr = 0x%s len = %lu.\n",
|
||||||
paddr_nz (tmpu32),
|
paddr_nz (tmpu32),
|
||||||
(int) sizeof (a));
|
(unsigned long)sizeof (a));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (record_arch_list_add_mem (a[3], tdep->size_int))
|
if (record_arch_list_add_mem (a[3], tdep->size_int))
|
||||||
|
@ -736,9 +736,9 @@ record_linux_system_call (int num, struct regcache *regcache,
|
||||||
if (record_debug)
|
if (record_debug)
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
"Process record: error reading "
|
"Process record: error reading "
|
||||||
"memory at addr = 0x%s len = %d.\n",
|
"memory at addr = 0x%s len = %lu.\n",
|
||||||
paddr_nz (tmpu32),
|
paddr_nz (tmpu32),
|
||||||
(int) sizeof (a));
|
(unsigned long)sizeof (a));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (a[2])
|
if (a[2])
|
||||||
|
@ -750,9 +750,9 @@ record_linux_system_call (int num, struct regcache *regcache,
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
"Process record: error reading "
|
"Process record: error reading "
|
||||||
"memory at addr = 0x%s "
|
"memory at addr = 0x%s "
|
||||||
"len = %d.\n",
|
"len = %lu.\n",
|
||||||
paddr_nz (a[2]),
|
paddr_nz (a[2]),
|
||||||
(int) sizeof (a[2]));
|
(unsigned long)sizeof (a[2]));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (record_arch_list_add_mem (a[1], a[2]))
|
if (record_arch_list_add_mem (a[1], a[2]))
|
||||||
|
@ -773,9 +773,9 @@ record_linux_system_call (int num, struct regcache *regcache,
|
||||||
if (record_debug)
|
if (record_debug)
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
"Process record: error reading "
|
"Process record: error reading "
|
||||||
"memory at addr = 0x%s len = %d.\n",
|
"memory at addr = 0x%s len = %lu.\n",
|
||||||
paddr_nz (tmpu32),
|
paddr_nz (tmpu32),
|
||||||
(int) sizeof (a));
|
(unsigned long)sizeof (a));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (a[2])
|
if (a[2])
|
||||||
|
@ -787,9 +787,9 @@ record_linux_system_call (int num, struct regcache *regcache,
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
"Process record: error reading "
|
"Process record: error reading "
|
||||||
"memory at addr = 0x%s "
|
"memory at addr = 0x%s "
|
||||||
"len = %d.\n",
|
"len = %lu.\n",
|
||||||
paddr_nz (a[2]),
|
paddr_nz (a[2]),
|
||||||
(int) sizeof (a[2]));
|
(unsigned long)sizeof (a[2]));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (record_arch_list_add_mem (a[1], a[2]))
|
if (record_arch_list_add_mem (a[1], a[2]))
|
||||||
|
@ -819,9 +819,9 @@ record_linux_system_call (int num, struct regcache *regcache,
|
||||||
if (record_debug)
|
if (record_debug)
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
"Process record: error reading "
|
"Process record: error reading "
|
||||||
"memory at addr = 0x%s len = %d.\n",
|
"memory at addr = 0x%s len = %lu.\n",
|
||||||
paddr_nz (tmpu32),
|
paddr_nz (tmpu32),
|
||||||
(int) sizeof (a));
|
(unsigned long)sizeof (a));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (a[4])
|
if (a[4])
|
||||||
|
@ -833,9 +833,9 @@ record_linux_system_call (int num, struct regcache *regcache,
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
"Process record: error reading "
|
"Process record: error reading "
|
||||||
"memory at addr = 0x%s "
|
"memory at addr = 0x%s "
|
||||||
"len = %d.\n",
|
"len = %lu.\n",
|
||||||
paddr_nz (a[4]),
|
paddr_nz (a[4]),
|
||||||
(int) sizeof (av));
|
(unsigned long)sizeof (av));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (record_arch_list_add_mem (a[3], av))
|
if (record_arch_list_add_mem (a[3], av))
|
||||||
|
@ -876,9 +876,9 @@ record_linux_system_call (int num, struct regcache *regcache,
|
||||||
if (record_debug)
|
if (record_debug)
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
"Process record: error reading "
|
"Process record: error reading "
|
||||||
"memory at addr = 0x%s len = %d.\n",
|
"memory at addr = 0x%s len = %lu.\n",
|
||||||
paddr_nz (tmpu32),
|
paddr_nz (tmpu32),
|
||||||
(int) sizeof (a));
|
(unsigned long)sizeof (a));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (record_arch_list_add_mem (a[1], tdep->size_msghdr))
|
if (record_arch_list_add_mem (a[1], tdep->size_msghdr))
|
||||||
|
@ -892,9 +892,9 @@ record_linux_system_call (int num, struct regcache *regcache,
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
"Process record: error reading "
|
"Process record: error reading "
|
||||||
"memory at addr = 0x%s "
|
"memory at addr = 0x%s "
|
||||||
"len = %d.\n",
|
"len = %lu.\n",
|
||||||
paddr_nz (a[1]),
|
paddr_nz (a[1]),
|
||||||
(int) sizeof (rec));
|
(unsigned long)sizeof (rec));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (record_arch_list_add_mem
|
if (record_arch_list_add_mem
|
||||||
|
@ -916,10 +916,10 @@ record_linux_system_call (int num, struct regcache *regcache,
|
||||||
"Process record: error "
|
"Process record: error "
|
||||||
"reading memory at "
|
"reading memory at "
|
||||||
"addr = 0x%s "
|
"addr = 0x%s "
|
||||||
"len = %d.\n",
|
"len = %lu.\n",
|
||||||
paddr_nz (rec.
|
paddr_nz (rec.
|
||||||
msg_iov),
|
msg_iov),
|
||||||
(int) sizeof (iov));
|
(unsigned long)sizeof (iov));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (record_arch_list_add_mem
|
if (record_arch_list_add_mem
|
||||||
|
@ -934,8 +934,8 @@ record_linux_system_call (int num, struct regcache *regcache,
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf_unfiltered (_("Process record and replay target "
|
printf_unfiltered (_("Process record and replay target "
|
||||||
"doesn't support socketcall call 0x%08x\n"),
|
"doesn't support socketcall call 0x%s\n"),
|
||||||
tmpu32);
|
phex_nz (tmpu32, 4));
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1233,9 +1233,9 @@ record_linux_system_call (int num, struct regcache *regcache,
|
||||||
if (record_debug)
|
if (record_debug)
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
"Process record: error reading "
|
"Process record: error reading "
|
||||||
"memory at addr = 0x%s len = %d.\n",
|
"memory at addr = 0x%s len = %lu.\n",
|
||||||
paddr_nz (vec),
|
paddr_nz (vec),
|
||||||
(int) sizeof (struct record_iovec));
|
(unsigned long)sizeof (struct record_iovec));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (record_arch_list_add_mem (iov.iov_base, iov.iov_len))
|
if (record_arch_list_add_mem (iov.iov_base, iov.iov_len))
|
||||||
|
@ -1631,20 +1631,17 @@ record_linux_system_call (int num, struct regcache *regcache,
|
||||||
/* sys_fcntl64 */
|
/* sys_fcntl64 */
|
||||||
case 221:
|
case 221:
|
||||||
regcache_raw_read (regcache, tdep->arg2, (gdb_byte *) & tmpu32);
|
regcache_raw_read (regcache, tdep->arg2, (gdb_byte *) & tmpu32);
|
||||||
switch (tmpu32)
|
if (tmpu32 == tdep->fcntl_F_GETLK64)
|
||||||
{
|
{
|
||||||
case F_GETLK64:
|
|
||||||
regcache_raw_read (regcache, tdep->arg3,
|
regcache_raw_read (regcache, tdep->arg3,
|
||||||
(gdb_byte *) & tmpu32);
|
(gdb_byte *) & tmpu32);
|
||||||
if (record_arch_list_add_mem (tmpu32, tdep->size_flock64))
|
if (record_arch_list_add_mem (tmpu32, tdep->size_flock64))
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
}
|
||||||
case F_SETLK64:
|
else if (tmpu32 != tdep->fcntl_F_SETLK64
|
||||||
case F_SETLKW64:
|
&& tmpu32 != tdep->fcntl_F_SETLKW64)
|
||||||
break;
|
{
|
||||||
default:
|
|
||||||
goto sys_fcntl;
|
goto sys_fcntl;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1785,8 +1782,9 @@ record_linux_system_call (int num, struct regcache *regcache,
|
||||||
if (record_debug)
|
if (record_debug)
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
"Process record: error reading memory "
|
"Process record: error reading memory "
|
||||||
"at addr = 0x%s len = %d.\n",
|
"at addr = 0x%s len = %u.\n",
|
||||||
paddr_nz (tmpu32), nr * tdep->size_int);
|
paddr_nz (tmpu32),
|
||||||
|
(int)(nr * tdep->size_int));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
for (i = 0; i < nr; i++)
|
for (i = 0; i < nr; i++)
|
||||||
|
@ -2195,8 +2193,8 @@ record_linux_system_call (int num, struct regcache *regcache,
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf_unfiltered (_("Process record and replay target doesn't "
|
printf_unfiltered (_("Process record and replay target doesn't "
|
||||||
"support syscall number 0x%08x\n"),
|
"support syscall number %u\n"),
|
||||||
tmpu32);
|
(int)tmpu32);
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,6 +158,13 @@ struct linux_record_tdep
|
||||||
int ioctl_TIOCSHAYESESP;
|
int ioctl_TIOCSHAYESESP;
|
||||||
int ioctl_FIOQSIZE;
|
int ioctl_FIOQSIZE;
|
||||||
|
|
||||||
|
/* The values of the second argument of system call "sys_fcntl"
|
||||||
|
and "sys_fcntl64". */
|
||||||
|
int fcntl_F_GETLK;
|
||||||
|
int fcntl_F_GETLK64;
|
||||||
|
int fcntl_F_SETLK64;
|
||||||
|
int fcntl_F_SETLKW64;
|
||||||
|
|
||||||
/* The number of the registers that are used as the arguments of
|
/* The number of the registers that are used as the arguments of
|
||||||
a system call. */
|
a system call. */
|
||||||
int arg1;
|
int arg1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue