| 1 | /* Process record and replay target code for GNU/Linux. |
| 2 | |
| 3 | Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. |
| 4 | |
| 5 | This file is part of GDB. |
| 6 | |
| 7 | This program is free software; you can redistribute it and/or modify |
| 8 | it under the terms of the GNU General Public License as published by |
| 9 | the Free Software Foundation; either version 3 of the License, or |
| 10 | (at your option) any later version. |
| 11 | |
| 12 | This program is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | GNU General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License |
| 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
| 19 | |
| 20 | #include "defs.h" |
| 21 | #include "target.h" |
| 22 | #include "gdbtypes.h" |
| 23 | #include "regcache.h" |
| 24 | #include "record.h" |
| 25 | #include "linux-record.h" |
| 26 | |
| 27 | /* These macros are the values of the first argument of system call |
| 28 | "sys_ptrace". The values of these macros were obtained from Linux |
| 29 | Kernel source. */ |
| 30 | |
| 31 | #define RECORD_PTRACE_PEEKTEXT 1 |
| 32 | #define RECORD_PTRACE_PEEKDATA 2 |
| 33 | #define RECORD_PTRACE_PEEKUSR 3 |
| 34 | |
| 35 | /* These macros are the values of the first argument of system call |
| 36 | "sys_socketcall". The values of these macros were obtained from |
| 37 | Linux Kernel source. */ |
| 38 | |
| 39 | #define RECORD_SYS_SOCKET 1 |
| 40 | #define RECORD_SYS_BIND 2 |
| 41 | #define RECORD_SYS_CONNECT 3 |
| 42 | #define RECORD_SYS_LISTEN 4 |
| 43 | #define RECORD_SYS_ACCEPT 5 |
| 44 | #define RECORD_SYS_GETSOCKNAME 6 |
| 45 | #define RECORD_SYS_GETPEERNAME 7 |
| 46 | #define RECORD_SYS_SOCKETPAIR 8 |
| 47 | #define RECORD_SYS_SEND 9 |
| 48 | #define RECORD_SYS_RECV 10 |
| 49 | #define RECORD_SYS_SENDTO 11 |
| 50 | #define RECORD_SYS_RECVFROM 12 |
| 51 | #define RECORD_SYS_SHUTDOWN 13 |
| 52 | #define RECORD_SYS_SETSOCKOPT 14 |
| 53 | #define RECORD_SYS_GETSOCKOPT 15 |
| 54 | #define RECORD_SYS_SENDMSG 16 |
| 55 | #define RECORD_SYS_RECVMSG 17 |
| 56 | |
| 57 | /* These macros are the values of the first argument of system call |
| 58 | "sys_ipc". The values of these macros were obtained from Linux |
| 59 | Kernel source. */ |
| 60 | |
| 61 | #define RECORD_SEMOP 1 |
| 62 | #define RECORD_SEMGET 2 |
| 63 | #define RECORD_SEMCTL 3 |
| 64 | #define RECORD_SEMTIMEDOP 4 |
| 65 | #define RECORD_MSGSND 11 |
| 66 | #define RECORD_MSGRCV 12 |
| 67 | #define RECORD_MSGGET 13 |
| 68 | #define RECORD_MSGCTL 14 |
| 69 | #define RECORD_SHMAT 21 |
| 70 | #define RECORD_SHMDT 22 |
| 71 | #define RECORD_SHMGET 23 |
| 72 | #define RECORD_SHMCTL 24 |
| 73 | |
| 74 | /* These macros are the values of the first argument of system call |
| 75 | "sys_quotactl". The values of these macros were obtained from Linux |
| 76 | Kernel source. */ |
| 77 | |
| 78 | #define RECORD_Q_GETFMT 0x800004 |
| 79 | #define RECORD_Q_GETINFO 0x800005 |
| 80 | #define RECORD_Q_GETQUOTA 0x800007 |
| 81 | #define RECORD_Q_XGETQSTAT (('5' << 8) + 5) |
| 82 | #define RECORD_Q_XGETQUOTA (('3' << 8) + 3) |
| 83 | |
| 84 | #define OUTPUT_REG(val, num) phex_nz ((val), \ |
| 85 | TYPE_LENGTH (gdbarch_register_type (get_regcache_arch (regcache), (num)))) |
| 86 | |
| 87 | static int |
| 88 | record_linux_sockaddr (struct regcache *regcache, |
| 89 | struct linux_record_tdep *tdep, ULONGEST addr, |
| 90 | ULONGEST len) |
| 91 | { |
| 92 | gdb_byte *a; |
| 93 | int addrlen; |
| 94 | struct gdbarch *gdbarch = get_regcache_arch (regcache); |
| 95 | enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); |
| 96 | |
| 97 | if (!addr) |
| 98 | return 0; |
| 99 | |
| 100 | a = alloca (tdep->size_int); |
| 101 | |
| 102 | if (record_arch_list_add_mem ((CORE_ADDR) len, tdep->size_int)) |
| 103 | return -1; |
| 104 | |
| 105 | /* Get the addrlen. */ |
| 106 | if (target_read_memory ((CORE_ADDR) len, a, tdep->size_int)) |
| 107 | { |
| 108 | if (record_debug) |
| 109 | fprintf_unfiltered (gdb_stdlog, |
| 110 | "Process record: error reading " |
| 111 | "memory at addr = 0x%s len = %d.\n", |
| 112 | phex_nz (len, tdep->size_pointer), |
| 113 | tdep->size_int); |
| 114 | return -1; |
| 115 | } |
| 116 | addrlen = (int) extract_unsigned_integer (a, tdep->size_int, byte_order); |
| 117 | if (addrlen <= 0 || addrlen > tdep->size_sockaddr) |
| 118 | addrlen = tdep->size_sockaddr; |
| 119 | |
| 120 | if (record_arch_list_add_mem ((CORE_ADDR) addr, addrlen)) |
| 121 | return -1; |
| 122 | |
| 123 | return 0; |
| 124 | } |
| 125 | |
| 126 | static int |
| 127 | record_linux_msghdr (struct regcache *regcache, |
| 128 | struct linux_record_tdep *tdep, ULONGEST addr) |
| 129 | { |
| 130 | gdb_byte *a; |
| 131 | struct gdbarch *gdbarch = get_regcache_arch (regcache); |
| 132 | enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); |
| 133 | CORE_ADDR tmpaddr; |
| 134 | int tmpint; |
| 135 | |
| 136 | if (!addr) |
| 137 | return 0; |
| 138 | |
| 139 | if (record_arch_list_add_mem ((CORE_ADDR) addr, tdep->size_msghdr)) |
| 140 | return -1; |
| 141 | |
| 142 | a = alloca (tdep->size_msghdr); |
| 143 | if (target_read_memory ((CORE_ADDR) addr, a, tdep->size_msghdr)) |
| 144 | { |
| 145 | if (record_debug) |
| 146 | fprintf_unfiltered (gdb_stdlog, |
| 147 | "Process record: error reading " |
| 148 | "memory at addr = 0x%s " |
| 149 | "len = %d.\n", |
| 150 | phex_nz (addr, tdep->size_pointer), |
| 151 | tdep->size_msghdr); |
| 152 | return -1; |
| 153 | } |
| 154 | |
| 155 | /* msg_name msg_namelen */ |
| 156 | addr = extract_unsigned_integer (a, tdep->size_pointer, byte_order); |
| 157 | a += tdep->size_pointer; |
| 158 | if (record_arch_list_add_mem ((CORE_ADDR) addr, |
| 159 | (int) extract_unsigned_integer (a, |
| 160 | tdep->size_int, |
| 161 | byte_order))) |
| 162 | return -1; |
| 163 | a += tdep->size_int; |
| 164 | |
| 165 | /* msg_iov msg_iovlen */ |
| 166 | addr = extract_unsigned_integer (a, tdep->size_pointer, byte_order); |
| 167 | a += tdep->size_pointer; |
| 168 | if (addr) |
| 169 | { |
| 170 | ULONGEST i; |
| 171 | ULONGEST len = extract_unsigned_integer (a, tdep->size_size_t, |
| 172 | byte_order); |
| 173 | gdb_byte *iov = alloca (tdep->size_iovec); |
| 174 | |
| 175 | for (i = 0; i < len; i++) |
| 176 | { |
| 177 | if (target_read_memory ((CORE_ADDR) addr, iov, tdep->size_iovec)) |
| 178 | { |
| 179 | if (record_debug) |
| 180 | fprintf_unfiltered (gdb_stdlog, |
| 181 | "Process record: error " |
| 182 | "reading memory at " |
| 183 | "addr = 0x%s " |
| 184 | "len = %d.\n", |
| 185 | phex_nz (addr,tdep->size_pointer), |
| 186 | tdep->size_iovec); |
| 187 | return -1; |
| 188 | } |
| 189 | tmpaddr = (CORE_ADDR) extract_unsigned_integer (iov, |
| 190 | tdep->size_pointer, |
| 191 | byte_order); |
| 192 | tmpint = (int) extract_unsigned_integer (iov + tdep->size_pointer, |
| 193 | tdep->size_size_t, |
| 194 | byte_order); |
| 195 | if (record_arch_list_add_mem (tmpaddr, tmpint)) |
| 196 | return -1; |
| 197 | addr += tdep->size_iovec; |
| 198 | } |
| 199 | } |
| 200 | a += tdep->size_size_t; |
| 201 | |
| 202 | /* msg_control msg_controllen */ |
| 203 | addr = extract_unsigned_integer (a, tdep->size_pointer, byte_order); |
| 204 | a += tdep->size_pointer; |
| 205 | tmpint = (int) extract_unsigned_integer (a, tdep->size_size_t, byte_order); |
| 206 | if (record_arch_list_add_mem ((CORE_ADDR) addr, tmpint)) |
| 207 | return -1; |
| 208 | |
| 209 | return 0; |
| 210 | } |
| 211 | |
| 212 | /* When the architecture process record get a Linux syscall |
| 213 | instruction, it will get a Linux syscall number of this |
| 214 | architecture and convert it to the Linux syscall number "num" which |
| 215 | is internal to GDB. Most Linux syscalls across architectures in |
| 216 | Linux would be similar and mostly differ by sizes of types and |
| 217 | structures. This sizes are put to "tdep". |
| 218 | |
| 219 | Record the values of the registers and memory that will be changed |
| 220 | in current system call. |
| 221 | |
| 222 | Return -1 if something wrong. */ |
| 223 | |
| 224 | int |
| 225 | record_linux_system_call (enum gdb_syscall syscall, |
| 226 | struct regcache *regcache, |
| 227 | struct linux_record_tdep *tdep) |
| 228 | { |
| 229 | struct gdbarch *gdbarch = get_regcache_arch (regcache); |
| 230 | enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); |
| 231 | ULONGEST tmpulongest; |
| 232 | CORE_ADDR tmpaddr; |
| 233 | int tmpint; |
| 234 | |
| 235 | switch (syscall) |
| 236 | { |
| 237 | case gdb_sys_restart_syscall: |
| 238 | break; |
| 239 | |
| 240 | case gdb_sys_exit: |
| 241 | { |
| 242 | int q; |
| 243 | |
| 244 | target_terminal_ours (); |
| 245 | q = yquery (_("The next instruction is syscall exit. " |
| 246 | "It will make the program exit. " |
| 247 | "Do you want to stop the program?")); |
| 248 | target_terminal_inferior (); |
| 249 | if (q) |
| 250 | return 1; |
| 251 | } |
| 252 | break; |
| 253 | |
| 254 | case gdb_sys_fork: |
| 255 | break; |
| 256 | |
| 257 | case gdb_sys_read: |
| 258 | { |
| 259 | ULONGEST addr, count; |
| 260 | |
| 261 | regcache_raw_read_unsigned (regcache, tdep->arg2, &addr); |
| 262 | regcache_raw_read_unsigned (regcache, tdep->arg3, &count); |
| 263 | if (record_arch_list_add_mem ((CORE_ADDR) addr, (int) count)) |
| 264 | return -1; |
| 265 | } |
| 266 | break; |
| 267 | |
| 268 | case gdb_sys_write: |
| 269 | case gdb_sys_open: |
| 270 | case gdb_sys_close: |
| 271 | case gdb_sys_waitpid: |
| 272 | case gdb_sys_creat: |
| 273 | case gdb_sys_link: |
| 274 | case gdb_sys_unlink: |
| 275 | case gdb_sys_execve: |
| 276 | case gdb_sys_chdir: |
| 277 | case gdb_sys_time: |
| 278 | case gdb_sys_mknod: |
| 279 | case gdb_sys_chmod: |
| 280 | case gdb_sys_lchown16: |
| 281 | case gdb_sys_ni_syscall17: |
| 282 | break; |
| 283 | |
| 284 | case gdb_sys_stat: |
| 285 | case gdb_sys_fstat: |
| 286 | case gdb_sys_lstat: |
| 287 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 288 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 289 | tdep->size__old_kernel_stat)) |
| 290 | return -1; |
| 291 | break; |
| 292 | |
| 293 | case gdb_sys_lseek: |
| 294 | case gdb_sys_getpid: |
| 295 | case gdb_sys_mount: |
| 296 | case gdb_sys_oldumount: |
| 297 | case gdb_sys_setuid16: |
| 298 | case gdb_sys_getuid16: |
| 299 | case gdb_sys_stime: |
| 300 | break; |
| 301 | |
| 302 | case gdb_sys_ptrace: |
| 303 | regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); |
| 304 | if (tmpulongest == RECORD_PTRACE_PEEKTEXT |
| 305 | || tmpulongest == RECORD_PTRACE_PEEKDATA |
| 306 | || tmpulongest == RECORD_PTRACE_PEEKUSR) |
| 307 | { |
| 308 | regcache_raw_read_unsigned (regcache, tdep->arg4, |
| 309 | &tmpulongest); |
| 310 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, 4)) |
| 311 | return -1; |
| 312 | } |
| 313 | break; |
| 314 | |
| 315 | case gdb_sys_alarm: |
| 316 | case gdb_sys_pause: |
| 317 | case gdb_sys_utime: |
| 318 | case gdb_sys_ni_syscall31: |
| 319 | case gdb_sys_ni_syscall32: |
| 320 | case gdb_sys_access: |
| 321 | case gdb_sys_nice: |
| 322 | case gdb_sys_ni_syscall35: |
| 323 | case gdb_sys_sync: |
| 324 | case gdb_sys_kill: |
| 325 | case gdb_sys_rename: |
| 326 | case gdb_sys_mkdir: |
| 327 | case gdb_sys_rmdir: |
| 328 | case gdb_sys_dup: |
| 329 | case gdb_sys_pipe: |
| 330 | break; |
| 331 | |
| 332 | case gdb_sys_times: |
| 333 | regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); |
| 334 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_tms)) |
| 335 | return -1; |
| 336 | break; |
| 337 | |
| 338 | case gdb_sys_ni_syscall44: |
| 339 | case gdb_sys_brk: |
| 340 | case gdb_sys_setgid16: |
| 341 | case gdb_sys_getgid16: |
| 342 | case gdb_sys_signal: |
| 343 | case gdb_sys_geteuid16: |
| 344 | case gdb_sys_getegid16: |
| 345 | case gdb_sys_acct: |
| 346 | case gdb_sys_umount: |
| 347 | case gdb_sys_ni_syscall53: |
| 348 | break; |
| 349 | |
| 350 | case gdb_sys_ioctl: |
| 351 | /* XXX Need to add a lot of support of other ioctl requests. */ |
| 352 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 353 | if (tmpulongest == tdep->ioctl_FIOCLEX |
| 354 | || tmpulongest == tdep->ioctl_FIONCLEX |
| 355 | || tmpulongest == tdep->ioctl_FIONBIO |
| 356 | || tmpulongest == tdep->ioctl_FIOASYNC |
| 357 | || tmpulongest == tdep->ioctl_TCSETS |
| 358 | || tmpulongest == tdep->ioctl_TCSETSW |
| 359 | || tmpulongest == tdep->ioctl_TCSETSF |
| 360 | || tmpulongest == tdep->ioctl_TCSETA |
| 361 | || tmpulongest == tdep->ioctl_TCSETAW |
| 362 | || tmpulongest == tdep->ioctl_TCSETAF |
| 363 | || tmpulongest == tdep->ioctl_TCSBRK |
| 364 | || tmpulongest == tdep->ioctl_TCXONC |
| 365 | || tmpulongest == tdep->ioctl_TCFLSH |
| 366 | || tmpulongest == tdep->ioctl_TIOCEXCL |
| 367 | || tmpulongest == tdep->ioctl_TIOCNXCL |
| 368 | || tmpulongest == tdep->ioctl_TIOCSCTTY |
| 369 | || tmpulongest == tdep->ioctl_TIOCSPGRP |
| 370 | || tmpulongest == tdep->ioctl_TIOCSTI |
| 371 | || tmpulongest == tdep->ioctl_TIOCSWINSZ |
| 372 | || tmpulongest == tdep->ioctl_TIOCMBIS |
| 373 | || tmpulongest == tdep->ioctl_TIOCMBIC |
| 374 | || tmpulongest == tdep->ioctl_TIOCMSET |
| 375 | || tmpulongest == tdep->ioctl_TIOCSSOFTCAR |
| 376 | || tmpulongest == tdep->ioctl_TIOCCONS |
| 377 | || tmpulongest == tdep->ioctl_TIOCSSERIAL |
| 378 | || tmpulongest == tdep->ioctl_TIOCPKT |
| 379 | || tmpulongest == tdep->ioctl_TIOCNOTTY |
| 380 | || tmpulongest == tdep->ioctl_TIOCSETD |
| 381 | || tmpulongest == tdep->ioctl_TCSBRKP |
| 382 | || tmpulongest == tdep->ioctl_TIOCTTYGSTRUCT |
| 383 | || tmpulongest == tdep->ioctl_TIOCSBRK |
| 384 | || tmpulongest == tdep->ioctl_TIOCCBRK |
| 385 | || tmpulongest == tdep->ioctl_TCSETS2 |
| 386 | || tmpulongest == tdep->ioctl_TCSETSW2 |
| 387 | || tmpulongest == tdep->ioctl_TCSETSF2 |
| 388 | || tmpulongest == tdep->ioctl_TIOCSPTLCK |
| 389 | || tmpulongest == tdep->ioctl_TIOCSERCONFIG |
| 390 | || tmpulongest == tdep->ioctl_TIOCSERGWILD |
| 391 | || tmpulongest == tdep->ioctl_TIOCSERSWILD |
| 392 | || tmpulongest == tdep->ioctl_TIOCSLCKTRMIOS |
| 393 | || tmpulongest == tdep->ioctl_TIOCSERGETMULTI |
| 394 | || tmpulongest == tdep->ioctl_TIOCSERSETMULTI |
| 395 | || tmpulongest == tdep->ioctl_TIOCMIWAIT |
| 396 | || tmpulongest == tdep->ioctl_TIOCSHAYESESP) |
| 397 | { |
| 398 | /* Nothing to do. */ |
| 399 | } |
| 400 | else if (tmpulongest == tdep->ioctl_TCGETS |
| 401 | || tmpulongest == tdep->ioctl_TCGETA |
| 402 | || tmpulongest == tdep->ioctl_TIOCGLCKTRMIOS) |
| 403 | { |
| 404 | regcache_raw_read_unsigned (regcache, tdep->arg3, |
| 405 | &tmpulongest); |
| 406 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 407 | tdep->size_termios)) |
| 408 | return -1; |
| 409 | } |
| 410 | else if (tmpulongest == tdep->ioctl_TIOCGPGRP |
| 411 | || tmpulongest == tdep->ioctl_TIOCGSID) |
| 412 | { |
| 413 | regcache_raw_read_unsigned (regcache, tdep->arg3, |
| 414 | &tmpulongest); |
| 415 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 416 | tdep->size_pid_t)) |
| 417 | return -1; |
| 418 | } |
| 419 | else if (tmpulongest == tdep->ioctl_TIOCOUTQ |
| 420 | || tmpulongest == tdep->ioctl_TIOCMGET |
| 421 | || tmpulongest == tdep->ioctl_TIOCGSOFTCAR |
| 422 | || tmpulongest == tdep->ioctl_FIONREAD |
| 423 | || tmpulongest == tdep->ioctl_TIOCINQ |
| 424 | || tmpulongest == tdep->ioctl_TIOCGETD |
| 425 | || tmpulongest == tdep->ioctl_TIOCGPTN |
| 426 | || tmpulongest == tdep->ioctl_TIOCSERGETLSR) |
| 427 | { |
| 428 | regcache_raw_read_unsigned (regcache, tdep->arg3, |
| 429 | &tmpulongest); |
| 430 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 431 | tdep->size_int)) |
| 432 | return -1; |
| 433 | } |
| 434 | else if (tmpulongest == tdep->ioctl_TIOCGWINSZ) |
| 435 | { |
| 436 | regcache_raw_read_unsigned (regcache, tdep->arg3, |
| 437 | &tmpulongest); |
| 438 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 439 | tdep->size_winsize)) |
| 440 | return -1; |
| 441 | } |
| 442 | else if (tmpulongest == tdep->ioctl_TIOCLINUX) |
| 443 | { |
| 444 | regcache_raw_read_unsigned (regcache, tdep->arg3, |
| 445 | &tmpulongest); |
| 446 | /* This syscall affects a char-size memory. */ |
| 447 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, 1)) |
| 448 | return -1; |
| 449 | } |
| 450 | else if (tmpulongest == tdep->ioctl_TIOCGSERIAL) |
| 451 | { |
| 452 | regcache_raw_read_unsigned (regcache, tdep->arg3, |
| 453 | &tmpulongest); |
| 454 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 455 | tdep->size_serial_struct)) |
| 456 | return -1; |
| 457 | } |
| 458 | else if (tmpulongest == tdep->ioctl_TCGETS2) |
| 459 | { |
| 460 | regcache_raw_read_unsigned (regcache, tdep->arg3, |
| 461 | &tmpulongest); |
| 462 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 463 | tdep->size_termios2)) |
| 464 | return -1; |
| 465 | } |
| 466 | else if (tmpulongest == tdep->ioctl_FIOQSIZE) |
| 467 | { |
| 468 | regcache_raw_read_unsigned (regcache, tdep->arg3, |
| 469 | &tmpulongest); |
| 470 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 471 | tdep->size_loff_t)) |
| 472 | return -1; |
| 473 | } |
| 474 | else if (tmpulongest == tdep->ioctl_TIOCGICOUNT) |
| 475 | { |
| 476 | regcache_raw_read_unsigned (regcache, tdep->arg3, |
| 477 | &tmpulongest); |
| 478 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 479 | tdep->size_serial_icounter_struct)) |
| 480 | return -1; |
| 481 | } |
| 482 | else if (tmpulongest == tdep->ioctl_TIOCGHAYESESP) |
| 483 | { |
| 484 | regcache_raw_read_unsigned (regcache, tdep->arg3, |
| 485 | &tmpulongest); |
| 486 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 487 | tdep->size_hayes_esp_config)) |
| 488 | return -1; |
| 489 | } |
| 490 | else if (tmpulongest == tdep->ioctl_TIOCSERGSTRUCT) |
| 491 | { |
| 492 | printf_unfiltered (_("Process record and replay target doesn't " |
| 493 | "support ioctl request TIOCSERGSTRUCT\n")); |
| 494 | return 1; |
| 495 | } |
| 496 | else |
| 497 | { |
| 498 | printf_unfiltered (_("Process record and replay target doesn't " |
| 499 | "support ioctl request 0x%s.\n"), |
| 500 | OUTPUT_REG (tmpulongest, tdep->arg2)); |
| 501 | return 1; |
| 502 | } |
| 503 | break; |
| 504 | |
| 505 | case gdb_sys_fcntl: |
| 506 | /* XXX */ |
| 507 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 508 | sys_fcntl: |
| 509 | if (tmpulongest == tdep->fcntl_F_GETLK) |
| 510 | { |
| 511 | regcache_raw_read_unsigned (regcache, tdep->arg3, |
| 512 | &tmpulongest); |
| 513 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 514 | tdep->size_flock)) |
| 515 | return -1; |
| 516 | } |
| 517 | break; |
| 518 | |
| 519 | case gdb_sys_ni_syscall56: |
| 520 | case gdb_sys_setpgid: |
| 521 | case gdb_sys_ni_syscall58: |
| 522 | break; |
| 523 | |
| 524 | case gdb_sys_olduname: |
| 525 | regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); |
| 526 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 527 | tdep->size_oldold_utsname)) |
| 528 | return -1; |
| 529 | break; |
| 530 | |
| 531 | case gdb_sys_umask: |
| 532 | case gdb_sys_chroot: |
| 533 | break; |
| 534 | |
| 535 | case gdb_sys_ustat: |
| 536 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 537 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 538 | tdep->size_ustat)) |
| 539 | return -1; |
| 540 | break; |
| 541 | |
| 542 | case gdb_sys_dup2: |
| 543 | case gdb_sys_getppid: |
| 544 | case gdb_sys_getpgrp: |
| 545 | case gdb_sys_setsid: |
| 546 | break; |
| 547 | |
| 548 | case gdb_sys_sigaction: |
| 549 | regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); |
| 550 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 551 | tdep->size_old_sigaction)) |
| 552 | return -1; |
| 553 | break; |
| 554 | |
| 555 | case gdb_sys_sgetmask: |
| 556 | case gdb_sys_ssetmask: |
| 557 | case gdb_sys_setreuid16: |
| 558 | case gdb_sys_setregid16: |
| 559 | case gdb_sys_sigsuspend: |
| 560 | break; |
| 561 | |
| 562 | case gdb_sys_sigpending: |
| 563 | regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); |
| 564 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 565 | tdep->size_old_sigset_t)) |
| 566 | return -1; |
| 567 | break; |
| 568 | |
| 569 | case gdb_sys_sethostname: |
| 570 | case gdb_sys_setrlimit: |
| 571 | break; |
| 572 | |
| 573 | case gdb_sys_old_getrlimit: |
| 574 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 575 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 576 | tdep->size_rlimit)) |
| 577 | return -1; |
| 578 | break; |
| 579 | |
| 580 | case gdb_sys_getrusage: |
| 581 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 582 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 583 | tdep->size_rusage)) |
| 584 | return -1; |
| 585 | break; |
| 586 | |
| 587 | case gdb_sys_gettimeofday: |
| 588 | regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); |
| 589 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 590 | tdep->size_timeval)) |
| 591 | return -1; |
| 592 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 593 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 594 | tdep->size_timezone)) |
| 595 | return -1; |
| 596 | break; |
| 597 | |
| 598 | case gdb_sys_settimeofday: |
| 599 | break; |
| 600 | |
| 601 | case gdb_sys_getgroups16: |
| 602 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 603 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 604 | tdep->size_old_gid_t)) |
| 605 | return -1; |
| 606 | break; |
| 607 | |
| 608 | case gdb_sys_setgroups16: |
| 609 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 610 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 611 | tdep->size_old_gid_t)) |
| 612 | return -1; |
| 613 | break; |
| 614 | |
| 615 | case gdb_old_select: |
| 616 | { |
| 617 | struct sel_arg_struct |
| 618 | { |
| 619 | CORE_ADDR n; |
| 620 | CORE_ADDR inp; |
| 621 | CORE_ADDR outp; |
| 622 | CORE_ADDR exp; |
| 623 | CORE_ADDR tvp; |
| 624 | } sel; |
| 625 | |
| 626 | regcache_raw_read_unsigned (regcache, tdep->arg1, |
| 627 | &tmpulongest); |
| 628 | if (tmpulongest) |
| 629 | { |
| 630 | if (target_read_memory (tmpulongest, (gdb_byte *) &sel, |
| 631 | sizeof(sel))) |
| 632 | { |
| 633 | if (record_debug) |
| 634 | fprintf_unfiltered (gdb_stdlog, |
| 635 | "Process record: error reading memory " |
| 636 | "at addr = 0x%s len = %lu.\n", |
| 637 | OUTPUT_REG (tmpulongest, tdep->arg1), |
| 638 | (unsigned long) sizeof (sel)); |
| 639 | return -1; |
| 640 | } |
| 641 | if (record_arch_list_add_mem (sel.inp, tdep->size_fd_set)) |
| 642 | return -1; |
| 643 | if (record_arch_list_add_mem (sel.outp, tdep->size_fd_set)) |
| 644 | return -1; |
| 645 | if (record_arch_list_add_mem (sel.exp, tdep->size_fd_set)) |
| 646 | return -1; |
| 647 | if (record_arch_list_add_mem (sel.tvp, tdep->size_timeval)) |
| 648 | return -1; |
| 649 | } |
| 650 | } |
| 651 | break; |
| 652 | |
| 653 | case gdb_sys_symlink: |
| 654 | break; |
| 655 | |
| 656 | case gdb_sys_readlink: |
| 657 | { |
| 658 | ULONGEST len; |
| 659 | |
| 660 | regcache_raw_read_unsigned (regcache, tdep->arg2, |
| 661 | &tmpulongest); |
| 662 | regcache_raw_read_unsigned (regcache, tdep->arg3, &len); |
| 663 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) len)) |
| 664 | return -1; |
| 665 | } |
| 666 | break; |
| 667 | |
| 668 | case gdb_sys_uselib: |
| 669 | case gdb_sys_swapon: |
| 670 | break; |
| 671 | |
| 672 | case gdb_sys_reboot: |
| 673 | { |
| 674 | int q; |
| 675 | |
| 676 | target_terminal_ours (); |
| 677 | q = yquery (_("The next instruction is syscall reboot. " |
| 678 | "It will restart the computer. " |
| 679 | "Do you want to stop the program?")); |
| 680 | target_terminal_inferior (); |
| 681 | if (q) |
| 682 | return 1; |
| 683 | } |
| 684 | break; |
| 685 | |
| 686 | case gdb_old_readdir: |
| 687 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 688 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 689 | tdep->size_dirent)) |
| 690 | return -1; |
| 691 | break; |
| 692 | |
| 693 | case gdb_old_mmap: |
| 694 | break; |
| 695 | |
| 696 | case gdb_sys_munmap: |
| 697 | { |
| 698 | ULONGEST len; |
| 699 | |
| 700 | regcache_raw_read_unsigned (regcache, tdep->arg1, |
| 701 | &tmpulongest); |
| 702 | regcache_raw_read_unsigned (regcache, tdep->arg2, &len); |
| 703 | if (record_memory_query) |
| 704 | { |
| 705 | int q; |
| 706 | |
| 707 | target_terminal_ours (); |
| 708 | q = yquery (_("\ |
| 709 | The next instruction is syscall munmap.\n\ |
| 710 | It will free the memory addr = 0x%s len = %u.\n\ |
| 711 | It will make record target cannot record some memory change.\n\ |
| 712 | Do you want to stop the program?"), |
| 713 | OUTPUT_REG (tmpulongest, tdep->arg1), (int) len); |
| 714 | target_terminal_inferior (); |
| 715 | if (q) |
| 716 | return 1; |
| 717 | } |
| 718 | } |
| 719 | break; |
| 720 | |
| 721 | case gdb_sys_truncate: |
| 722 | case gdb_sys_ftruncate: |
| 723 | case gdb_sys_fchmod: |
| 724 | case gdb_sys_fchown16: |
| 725 | case gdb_sys_getpriority: |
| 726 | case gdb_sys_setpriority: |
| 727 | case gdb_sys_ni_syscall98: |
| 728 | break; |
| 729 | |
| 730 | case gdb_sys_statfs: |
| 731 | case gdb_sys_fstatfs: |
| 732 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 733 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 734 | tdep->size_statfs)) |
| 735 | return -1; |
| 736 | break; |
| 737 | |
| 738 | case gdb_sys_ioperm: |
| 739 | break; |
| 740 | |
| 741 | case gdb_sys_socket: |
| 742 | case gdb_sys_sendto: |
| 743 | case gdb_sys_sendmsg: |
| 744 | case gdb_sys_shutdown: |
| 745 | case gdb_sys_bind: |
| 746 | case gdb_sys_connect: |
| 747 | case gdb_sys_listen: |
| 748 | case gdb_sys_setsockopt: |
| 749 | break; |
| 750 | |
| 751 | case gdb_sys_accept: |
| 752 | case gdb_sys_getsockname: |
| 753 | case gdb_sys_getpeername: |
| 754 | { |
| 755 | ULONGEST len; |
| 756 | |
| 757 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 758 | regcache_raw_read_unsigned (regcache, tdep->arg3, &len); |
| 759 | if (record_linux_sockaddr (regcache, tdep, tmpulongest, len)) |
| 760 | return -1; |
| 761 | } |
| 762 | break; |
| 763 | |
| 764 | case gdb_sys_recvfrom: |
| 765 | { |
| 766 | ULONGEST len; |
| 767 | |
| 768 | regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest); |
| 769 | regcache_raw_read_unsigned (regcache, tdep->arg5, &len); |
| 770 | if (record_linux_sockaddr (regcache, tdep, tmpulongest, len)) |
| 771 | return -1; |
| 772 | } |
| 773 | case gdb_sys_recv: |
| 774 | { |
| 775 | ULONGEST size; |
| 776 | |
| 777 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 778 | regcache_raw_read_unsigned (regcache, tdep->arg3, &size); |
| 779 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) size)) |
| 780 | return -1; |
| 781 | } |
| 782 | break; |
| 783 | |
| 784 | case gdb_sys_recvmsg: |
| 785 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 786 | if (record_linux_msghdr (regcache, tdep, tmpulongest)) |
| 787 | return -1; |
| 788 | break; |
| 789 | |
| 790 | case gdb_sys_socketpair: |
| 791 | regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest); |
| 792 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int)) |
| 793 | return -1; |
| 794 | break; |
| 795 | |
| 796 | case gdb_sys_getsockopt: |
| 797 | regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest); |
| 798 | if (tmpulongest) |
| 799 | { |
| 800 | ULONGEST optvalp; |
| 801 | gdb_byte *optlenp = alloca (tdep->size_int); |
| 802 | |
| 803 | if (target_read_memory ((CORE_ADDR) tmpulongest, optlenp, |
| 804 | tdep->size_int)) |
| 805 | { |
| 806 | if (record_debug) |
| 807 | fprintf_unfiltered (gdb_stdlog, |
| 808 | "Process record: error reading " |
| 809 | "memory at addr = 0x%s " |
| 810 | "len = %d.\n", |
| 811 | OUTPUT_REG (tmpulongest, tdep->arg5), |
| 812 | tdep->size_int); |
| 813 | return -1; |
| 814 | } |
| 815 | regcache_raw_read_unsigned (regcache, tdep->arg4, &optvalp); |
| 816 | tmpint = (int) extract_signed_integer (optlenp, tdep->size_int, |
| 817 | byte_order); |
| 818 | if (record_arch_list_add_mem ((CORE_ADDR) optvalp, tmpint)) |
| 819 | return -1; |
| 820 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 821 | tdep->size_int)) |
| 822 | return -1; |
| 823 | } |
| 824 | break; |
| 825 | |
| 826 | case gdb_sys_socketcall: |
| 827 | regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); |
| 828 | switch (tmpulongest) |
| 829 | { |
| 830 | case RECORD_SYS_SOCKET: |
| 831 | case RECORD_SYS_BIND: |
| 832 | case RECORD_SYS_CONNECT: |
| 833 | case RECORD_SYS_LISTEN: |
| 834 | break; |
| 835 | case RECORD_SYS_ACCEPT: |
| 836 | case RECORD_SYS_GETSOCKNAME: |
| 837 | case RECORD_SYS_GETPEERNAME: |
| 838 | { |
| 839 | regcache_raw_read_unsigned (regcache, tdep->arg2, |
| 840 | &tmpulongest); |
| 841 | if (tmpulongest) |
| 842 | { |
| 843 | gdb_byte *a = alloca (tdep->size_ulong * 2); |
| 844 | ULONGEST len; |
| 845 | |
| 846 | tmpulongest += tdep->size_ulong; |
| 847 | if (target_read_memory ((CORE_ADDR) tmpulongest, a, |
| 848 | tdep->size_ulong * 2)) |
| 849 | { |
| 850 | if (record_debug) |
| 851 | fprintf_unfiltered (gdb_stdlog, |
| 852 | "Process record: error reading " |
| 853 | "memory at addr = 0x%s len = %d.\n", |
| 854 | OUTPUT_REG (tmpulongest, tdep->arg2), |
| 855 | tdep->size_ulong * 2); |
| 856 | return -1; |
| 857 | } |
| 858 | tmpulongest = extract_unsigned_integer (a, |
| 859 | tdep->size_ulong, |
| 860 | byte_order); |
| 861 | len = extract_unsigned_integer (a + tdep->size_ulong, |
| 862 | tdep->size_ulong, byte_order); |
| 863 | if (record_linux_sockaddr (regcache, tdep, tmpulongest, len)) |
| 864 | return -1; |
| 865 | } |
| 866 | } |
| 867 | break; |
| 868 | |
| 869 | case RECORD_SYS_SOCKETPAIR: |
| 870 | { |
| 871 | gdb_byte *a = alloca (tdep->size_ulong); |
| 872 | |
| 873 | regcache_raw_read_unsigned (regcache, tdep->arg2, |
| 874 | &tmpulongest); |
| 875 | if (tmpulongest) |
| 876 | { |
| 877 | tmpulongest += tdep->size_ulong * 3; |
| 878 | if (target_read_memory ((CORE_ADDR) tmpulongest, a, |
| 879 | tdep->size_ulong)) |
| 880 | { |
| 881 | if (record_debug) |
| 882 | fprintf_unfiltered (gdb_stdlog, |
| 883 | "Process record: error reading " |
| 884 | "memory at addr = 0x%s len = %d.\n", |
| 885 | OUTPUT_REG (tmpulongest, tdep->arg2), |
| 886 | tdep->size_ulong); |
| 887 | return -1; |
| 888 | } |
| 889 | tmpaddr |
| 890 | = (CORE_ADDR) extract_unsigned_integer (a, tdep->size_ulong, |
| 891 | byte_order); |
| 892 | if (record_arch_list_add_mem (tmpaddr, tdep->size_int)) |
| 893 | return -1; |
| 894 | } |
| 895 | } |
| 896 | break; |
| 897 | case RECORD_SYS_SEND: |
| 898 | case RECORD_SYS_SENDTO: |
| 899 | break; |
| 900 | case RECORD_SYS_RECVFROM: |
| 901 | regcache_raw_read_unsigned (regcache, tdep->arg2, |
| 902 | &tmpulongest); |
| 903 | if (tmpulongest) |
| 904 | { |
| 905 | gdb_byte *a = alloca (tdep->size_ulong * 2); |
| 906 | ULONGEST len; |
| 907 | |
| 908 | tmpulongest += tdep->size_ulong * 4; |
| 909 | if (target_read_memory ((CORE_ADDR) tmpulongest, a, |
| 910 | tdep->size_ulong * 2)) |
| 911 | { |
| 912 | if (record_debug) |
| 913 | fprintf_unfiltered (gdb_stdlog, |
| 914 | "Process record: error reading " |
| 915 | "memory at addr = 0x%s len = %d.\n", |
| 916 | OUTPUT_REG (tmpulongest, tdep->arg2), |
| 917 | tdep->size_ulong * 2); |
| 918 | return -1; |
| 919 | } |
| 920 | tmpulongest = extract_unsigned_integer (a, tdep->size_ulong, |
| 921 | byte_order); |
| 922 | len = extract_unsigned_integer (a + tdep->size_ulong, |
| 923 | tdep->size_ulong, byte_order); |
| 924 | if (record_linux_sockaddr (regcache, tdep, tmpulongest, len)) |
| 925 | return -1; |
| 926 | } |
| 927 | case RECORD_SYS_RECV: |
| 928 | regcache_raw_read_unsigned (regcache, tdep->arg2, |
| 929 | &tmpulongest); |
| 930 | if (tmpulongest) |
| 931 | { |
| 932 | gdb_byte *a = alloca (tdep->size_ulong * 2); |
| 933 | |
| 934 | tmpulongest += tdep->size_ulong; |
| 935 | if (target_read_memory ((CORE_ADDR) tmpulongest, a, |
| 936 | tdep->size_ulong)) |
| 937 | { |
| 938 | if (record_debug) |
| 939 | fprintf_unfiltered (gdb_stdlog, |
| 940 | "Process record: error reading " |
| 941 | "memory at addr = 0x%s len = %d.\n", |
| 942 | OUTPUT_REG (tmpulongest, tdep->arg2), |
| 943 | tdep->size_ulong); |
| 944 | return -1; |
| 945 | } |
| 946 | tmpulongest = extract_unsigned_integer (a, tdep->size_ulong, |
| 947 | byte_order); |
| 948 | if (tmpulongest) |
| 949 | { |
| 950 | a += tdep->size_ulong; |
| 951 | tmpint = (int) extract_unsigned_integer (a, tdep->size_ulong, |
| 952 | byte_order); |
| 953 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 954 | tmpint)) |
| 955 | return -1; |
| 956 | } |
| 957 | } |
| 958 | break; |
| 959 | case RECORD_SYS_SHUTDOWN: |
| 960 | case RECORD_SYS_SETSOCKOPT: |
| 961 | break; |
| 962 | case RECORD_SYS_GETSOCKOPT: |
| 963 | { |
| 964 | gdb_byte *a = alloca (tdep->size_ulong * 2); |
| 965 | gdb_byte *av = alloca (tdep->size_int); |
| 966 | |
| 967 | regcache_raw_read_unsigned (regcache, tdep->arg2, |
| 968 | &tmpulongest); |
| 969 | if (tmpulongest) |
| 970 | { |
| 971 | tmpulongest += tdep->size_ulong * 3; |
| 972 | if (target_read_memory ((CORE_ADDR) tmpulongest, a, |
| 973 | tdep->size_ulong * 2)) |
| 974 | { |
| 975 | if (record_debug) |
| 976 | fprintf_unfiltered (gdb_stdlog, |
| 977 | "Process record: error reading " |
| 978 | "memory at addr = 0x%s len = %d.\n", |
| 979 | OUTPUT_REG (tmpulongest, tdep->arg2), |
| 980 | tdep->size_ulong * 2); |
| 981 | return -1; |
| 982 | } |
| 983 | tmpulongest = extract_unsigned_integer (a + tdep->size_ulong, |
| 984 | tdep->size_ulong, |
| 985 | byte_order); |
| 986 | if (tmpulongest) |
| 987 | { |
| 988 | if (target_read_memory ((CORE_ADDR) tmpulongest, av, |
| 989 | tdep->size_int)) |
| 990 | { |
| 991 | if (record_debug) |
| 992 | fprintf_unfiltered (gdb_stdlog, |
| 993 | "Process record: error reading " |
| 994 | "memory at addr = 0x%s " |
| 995 | "len = %d.\n", |
| 996 | phex_nz (tmpulongest, |
| 997 | tdep->size_ulong), |
| 998 | tdep->size_int); |
| 999 | return -1; |
| 1000 | } |
| 1001 | tmpaddr |
| 1002 | = (CORE_ADDR) extract_unsigned_integer (a, |
| 1003 | tdep->size_ulong, |
| 1004 | byte_order); |
| 1005 | tmpint = (int) extract_unsigned_integer (av, |
| 1006 | tdep->size_int, |
| 1007 | byte_order); |
| 1008 | if (record_arch_list_add_mem (tmpaddr, tmpint)) |
| 1009 | return -1; |
| 1010 | a += tdep->size_ulong; |
| 1011 | tmpaddr |
| 1012 | = (CORE_ADDR) extract_unsigned_integer (a, |
| 1013 | tdep->size_ulong, |
| 1014 | byte_order); |
| 1015 | if (record_arch_list_add_mem (tmpaddr, tdep->size_int)) |
| 1016 | return -1; |
| 1017 | } |
| 1018 | } |
| 1019 | } |
| 1020 | break; |
| 1021 | case RECORD_SYS_SENDMSG: |
| 1022 | break; |
| 1023 | case RECORD_SYS_RECVMSG: |
| 1024 | { |
| 1025 | gdb_byte *a = alloca (tdep->size_ulong); |
| 1026 | |
| 1027 | regcache_raw_read_unsigned (regcache, tdep->arg2, |
| 1028 | &tmpulongest); |
| 1029 | if (tmpulongest) |
| 1030 | { |
| 1031 | tmpulongest += tdep->size_ulong; |
| 1032 | if (target_read_memory ((CORE_ADDR) tmpulongest, a, |
| 1033 | tdep->size_ulong)) |
| 1034 | { |
| 1035 | if (record_debug) |
| 1036 | fprintf_unfiltered (gdb_stdlog, |
| 1037 | "Process record: error reading " |
| 1038 | "memory at addr = 0x%s len = %d.\n", |
| 1039 | OUTPUT_REG (tmpulongest, tdep->arg2), |
| 1040 | tdep->size_ulong); |
| 1041 | return -1; |
| 1042 | } |
| 1043 | tmpulongest = extract_unsigned_integer (a, tdep->size_ulong, |
| 1044 | byte_order); |
| 1045 | if (record_linux_msghdr (regcache, tdep, tmpulongest)) |
| 1046 | return -1; |
| 1047 | } |
| 1048 | } |
| 1049 | break; |
| 1050 | default: |
| 1051 | printf_unfiltered (_("Process record and replay target " |
| 1052 | "doesn't support socketcall call 0x%s\n"), |
| 1053 | OUTPUT_REG (tmpulongest, tdep->arg1)); |
| 1054 | return -1; |
| 1055 | break; |
| 1056 | } |
| 1057 | break; |
| 1058 | |
| 1059 | case gdb_sys_syslog: |
| 1060 | break; |
| 1061 | |
| 1062 | case gdb_sys_setitimer: |
| 1063 | regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); |
| 1064 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1065 | tdep->size_itimerval)) |
| 1066 | return -1; |
| 1067 | break; |
| 1068 | |
| 1069 | case gdb_sys_getitimer: |
| 1070 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 1071 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1072 | tdep->size_itimerval)) |
| 1073 | return -1; |
| 1074 | break; |
| 1075 | |
| 1076 | case gdb_sys_newstat: |
| 1077 | case gdb_sys_newlstat: |
| 1078 | case gdb_sys_newfstat: |
| 1079 | case gdb_sys_newfstatat: |
| 1080 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 1081 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_stat)) |
| 1082 | return -1; |
| 1083 | break; |
| 1084 | |
| 1085 | case gdb_sys_uname: |
| 1086 | regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); |
| 1087 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1088 | tdep->size_old_utsname)) |
| 1089 | return -1; |
| 1090 | break; |
| 1091 | |
| 1092 | case gdb_sys_iopl: |
| 1093 | case gdb_sys_vhangup: |
| 1094 | case gdb_sys_ni_syscall112: |
| 1095 | case gdb_sys_vm86old: |
| 1096 | break; |
| 1097 | |
| 1098 | case gdb_sys_wait4: |
| 1099 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 1100 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1101 | tdep->size_int)) |
| 1102 | return -1; |
| 1103 | regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest); |
| 1104 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1105 | tdep->size_rusage)) |
| 1106 | return -1; |
| 1107 | break; |
| 1108 | |
| 1109 | case gdb_sys_swapoff: |
| 1110 | break; |
| 1111 | |
| 1112 | case gdb_sys_sysinfo: |
| 1113 | regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); |
| 1114 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1115 | tdep->size_sysinfo)) |
| 1116 | return -1; |
| 1117 | break; |
| 1118 | |
| 1119 | case gdb_sys_shmget: |
| 1120 | case gdb_sys_semget: |
| 1121 | case gdb_sys_semop: |
| 1122 | case gdb_sys_msgget: |
| 1123 | /* XXX maybe need do some record works with sys_shmdt. */ |
| 1124 | case gdb_sys_shmdt: |
| 1125 | case gdb_sys_msgsnd: |
| 1126 | case gdb_sys_semtimedop: |
| 1127 | break; |
| 1128 | |
| 1129 | case gdb_sys_shmat: |
| 1130 | regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); |
| 1131 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1132 | tdep->size_ulong)) |
| 1133 | return -1; |
| 1134 | break; |
| 1135 | |
| 1136 | case gdb_sys_shmctl: |
| 1137 | regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); |
| 1138 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1139 | tdep->size_shmid_ds)) |
| 1140 | return -1; |
| 1141 | break; |
| 1142 | |
| 1143 | /* XXX sys_semctl 525 still not supported. */ |
| 1144 | /* sys_semctl */ |
| 1145 | |
| 1146 | case gdb_sys_msgrcv: |
| 1147 | { |
| 1148 | ULONGEST msgp; |
| 1149 | |
| 1150 | regcache_raw_read_signed (regcache, tdep->arg3, &tmpulongest); |
| 1151 | regcache_raw_read_unsigned (regcache, tdep->arg2, &msgp); |
| 1152 | tmpint = (int) tmpulongest + tdep->size_long; |
| 1153 | if (record_arch_list_add_mem ((CORE_ADDR) msgp, tmpint)) |
| 1154 | return -1; |
| 1155 | } |
| 1156 | break; |
| 1157 | |
| 1158 | case gdb_sys_msgctl: |
| 1159 | regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); |
| 1160 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1161 | tdep->size_msqid_ds)) |
| 1162 | return -1; |
| 1163 | break; |
| 1164 | |
| 1165 | case gdb_sys_ipc: |
| 1166 | regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); |
| 1167 | tmpulongest &= 0xffff; |
| 1168 | switch (tmpulongest) |
| 1169 | { |
| 1170 | case RECORD_SEMOP: |
| 1171 | case RECORD_SEMGET: |
| 1172 | case RECORD_SEMTIMEDOP: |
| 1173 | case RECORD_MSGSND: |
| 1174 | case RECORD_MSGGET: |
| 1175 | /* XXX maybe need do some record works with RECORD_SHMDT. */ |
| 1176 | case RECORD_SHMDT: |
| 1177 | case RECORD_SHMGET: |
| 1178 | break; |
| 1179 | case RECORD_MSGRCV: |
| 1180 | { |
| 1181 | ULONGEST second; |
| 1182 | ULONGEST ptr; |
| 1183 | |
| 1184 | regcache_raw_read_signed (regcache, tdep->arg3, &second); |
| 1185 | regcache_raw_read_unsigned (regcache, tdep->arg5, &ptr); |
| 1186 | tmpint = (int) second + tdep->size_long; |
| 1187 | if (record_arch_list_add_mem ((CORE_ADDR) ptr, tmpint)) |
| 1188 | return -1; |
| 1189 | } |
| 1190 | break; |
| 1191 | case RECORD_MSGCTL: |
| 1192 | regcache_raw_read_unsigned (regcache, tdep->arg5, |
| 1193 | &tmpulongest); |
| 1194 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1195 | tdep->size_msqid_ds)) |
| 1196 | return -1; |
| 1197 | break; |
| 1198 | case RECORD_SHMAT: |
| 1199 | regcache_raw_read_unsigned (regcache, tdep->arg4, |
| 1200 | &tmpulongest); |
| 1201 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1202 | tdep->size_ulong)) |
| 1203 | return -1; |
| 1204 | break; |
| 1205 | case RECORD_SHMCTL: |
| 1206 | regcache_raw_read_unsigned (regcache, tdep->arg5, |
| 1207 | &tmpulongest); |
| 1208 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1209 | tdep->size_shmid_ds)) |
| 1210 | return -1; |
| 1211 | break; |
| 1212 | default: |
| 1213 | /* XXX RECORD_SEMCTL still not supported. */ |
| 1214 | printf_unfiltered (_("Process record and replay target doesn't " |
| 1215 | "support ipc number %s\n"), |
| 1216 | pulongest (tmpulongest)); |
| 1217 | break; |
| 1218 | } |
| 1219 | break; |
| 1220 | |
| 1221 | case gdb_sys_fsync: |
| 1222 | case gdb_sys_sigreturn: |
| 1223 | case gdb_sys_clone: |
| 1224 | case gdb_sys_setdomainname: |
| 1225 | break; |
| 1226 | |
| 1227 | case gdb_sys_newuname: |
| 1228 | regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); |
| 1229 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1230 | tdep->size_new_utsname)) |
| 1231 | return -1; |
| 1232 | break; |
| 1233 | |
| 1234 | case gdb_sys_modify_ldt: |
| 1235 | regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); |
| 1236 | if (tmpulongest == 0 || tmpulongest == 2) |
| 1237 | { |
| 1238 | ULONGEST ptr, bytecount; |
| 1239 | |
| 1240 | regcache_raw_read_unsigned (regcache, tdep->arg2, &ptr); |
| 1241 | regcache_raw_read_unsigned (regcache, tdep->arg3, &bytecount); |
| 1242 | if (record_arch_list_add_mem ((CORE_ADDR) ptr, (int) bytecount)) |
| 1243 | return -1; |
| 1244 | } |
| 1245 | break; |
| 1246 | |
| 1247 | case gdb_sys_adjtimex: |
| 1248 | regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); |
| 1249 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_timex)) |
| 1250 | return -1; |
| 1251 | break; |
| 1252 | |
| 1253 | case gdb_sys_mprotect: |
| 1254 | break; |
| 1255 | |
| 1256 | case gdb_sys_sigprocmask: |
| 1257 | regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); |
| 1258 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1259 | tdep->size_old_sigset_t)) |
| 1260 | return -1; |
| 1261 | break; |
| 1262 | |
| 1263 | case gdb_sys_ni_syscall127: |
| 1264 | case gdb_sys_init_module: |
| 1265 | case gdb_sys_delete_module: |
| 1266 | case gdb_sys_ni_syscall130: |
| 1267 | break; |
| 1268 | |
| 1269 | case gdb_sys_quotactl: |
| 1270 | regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); |
| 1271 | switch (tmpulongest) |
| 1272 | { |
| 1273 | case RECORD_Q_GETFMT: |
| 1274 | regcache_raw_read_unsigned (regcache, tdep->arg4, |
| 1275 | &tmpulongest); |
| 1276 | /* __u32 */ |
| 1277 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, 4)) |
| 1278 | return -1; |
| 1279 | break; |
| 1280 | case RECORD_Q_GETINFO: |
| 1281 | regcache_raw_read_unsigned (regcache, tdep->arg4, |
| 1282 | &tmpulongest); |
| 1283 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1284 | tdep->size_mem_dqinfo)) |
| 1285 | return -1; |
| 1286 | break; |
| 1287 | case RECORD_Q_GETQUOTA: |
| 1288 | regcache_raw_read_unsigned (regcache, tdep->arg4, |
| 1289 | &tmpulongest); |
| 1290 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1291 | tdep->size_if_dqblk)) |
| 1292 | return -1; |
| 1293 | break; |
| 1294 | case RECORD_Q_XGETQSTAT: |
| 1295 | case RECORD_Q_XGETQUOTA: |
| 1296 | regcache_raw_read_unsigned (regcache, tdep->arg4, |
| 1297 | &tmpulongest); |
| 1298 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1299 | tdep->size_fs_quota_stat)) |
| 1300 | return -1; |
| 1301 | break; |
| 1302 | } |
| 1303 | break; |
| 1304 | |
| 1305 | case gdb_sys_getpgid: |
| 1306 | case gdb_sys_fchdir: |
| 1307 | case gdb_sys_bdflush: |
| 1308 | break; |
| 1309 | |
| 1310 | case gdb_sys_sysfs: |
| 1311 | regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); |
| 1312 | if (tmpulongest == 2) |
| 1313 | { |
| 1314 | regcache_raw_read_unsigned (regcache, tdep->arg3, |
| 1315 | &tmpulongest); |
| 1316 | /*XXX the size of memory is not very clear. */ |
| 1317 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, 10)) |
| 1318 | return -1; |
| 1319 | } |
| 1320 | break; |
| 1321 | |
| 1322 | case gdb_sys_personality: |
| 1323 | case gdb_sys_ni_syscall137: |
| 1324 | case gdb_sys_setfsuid16: |
| 1325 | case gdb_sys_setfsgid16: |
| 1326 | break; |
| 1327 | |
| 1328 | case gdb_sys_llseek: |
| 1329 | regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest); |
| 1330 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1331 | tdep->size_loff_t)) |
| 1332 | return -1; |
| 1333 | break; |
| 1334 | |
| 1335 | case gdb_sys_getdents: |
| 1336 | { |
| 1337 | ULONGEST count; |
| 1338 | |
| 1339 | regcache_raw_read_unsigned (regcache, tdep->arg2, |
| 1340 | &tmpulongest); |
| 1341 | regcache_raw_read_unsigned (regcache, tdep->arg3, &count); |
| 1342 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1343 | tdep->size_dirent * count)) |
| 1344 | return -1; |
| 1345 | } |
| 1346 | break; |
| 1347 | |
| 1348 | case gdb_sys_select: |
| 1349 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 1350 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1351 | tdep->size_fd_set)) |
| 1352 | return -1; |
| 1353 | regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); |
| 1354 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1355 | tdep->size_fd_set)) |
| 1356 | return -1; |
| 1357 | regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest); |
| 1358 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1359 | tdep->size_fd_set)) |
| 1360 | return -1; |
| 1361 | regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest); |
| 1362 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1363 | tdep->size_timeval)) |
| 1364 | return -1; |
| 1365 | break; |
| 1366 | |
| 1367 | case gdb_sys_flock: |
| 1368 | case gdb_sys_msync: |
| 1369 | break; |
| 1370 | |
| 1371 | case gdb_sys_readv: |
| 1372 | { |
| 1373 | ULONGEST vec, vlen; |
| 1374 | |
| 1375 | regcache_raw_read_unsigned (regcache, tdep->arg2, &vec); |
| 1376 | if (vec) |
| 1377 | { |
| 1378 | gdb_byte *iov = alloca (tdep->size_iovec); |
| 1379 | |
| 1380 | regcache_raw_read_unsigned (regcache, tdep->arg3, &vlen); |
| 1381 | for (tmpulongest = 0; tmpulongest < vlen; tmpulongest++) |
| 1382 | { |
| 1383 | if (target_read_memory ((CORE_ADDR) vec, iov, |
| 1384 | tdep->size_iovec)) |
| 1385 | { |
| 1386 | if (record_debug) |
| 1387 | fprintf_unfiltered (gdb_stdlog, |
| 1388 | "Process record: error reading " |
| 1389 | "memory at addr = 0x%s len = %d.\n", |
| 1390 | OUTPUT_REG (vec, tdep->arg2), |
| 1391 | tdep->size_iovec); |
| 1392 | return -1; |
| 1393 | } |
| 1394 | tmpaddr |
| 1395 | = (CORE_ADDR) extract_unsigned_integer (iov, |
| 1396 | tdep->size_pointer, |
| 1397 | byte_order); |
| 1398 | tmpint |
| 1399 | = (int) extract_unsigned_integer (iov + tdep->size_pointer, |
| 1400 | tdep->size_size_t, |
| 1401 | byte_order); |
| 1402 | if (record_arch_list_add_mem (tmpaddr, tmpint)) |
| 1403 | return -1; |
| 1404 | vec += tdep->size_iovec; |
| 1405 | } |
| 1406 | } |
| 1407 | } |
| 1408 | break; |
| 1409 | |
| 1410 | case gdb_sys_writev: |
| 1411 | case gdb_sys_getsid: |
| 1412 | case gdb_sys_fdatasync: |
| 1413 | case gdb_sys_sysctl: |
| 1414 | case gdb_sys_mlock: |
| 1415 | case gdb_sys_munlock: |
| 1416 | case gdb_sys_mlockall: |
| 1417 | case gdb_sys_munlockall: |
| 1418 | case gdb_sys_sched_setparam: |
| 1419 | break; |
| 1420 | |
| 1421 | case gdb_sys_sched_getparam: |
| 1422 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 1423 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int)) |
| 1424 | return -1; |
| 1425 | break; |
| 1426 | |
| 1427 | case gdb_sys_sched_setscheduler: |
| 1428 | case gdb_sys_sched_getscheduler: |
| 1429 | case gdb_sys_sched_yield: |
| 1430 | case gdb_sys_sched_get_priority_max: |
| 1431 | case gdb_sys_sched_get_priority_min: |
| 1432 | break; |
| 1433 | |
| 1434 | case gdb_sys_sched_rr_get_interval: |
| 1435 | case gdb_sys_nanosleep: |
| 1436 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 1437 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1438 | tdep->size_timespec)) |
| 1439 | return -1; |
| 1440 | break; |
| 1441 | |
| 1442 | case gdb_sys_mremap: |
| 1443 | case gdb_sys_setresuid16: |
| 1444 | break; |
| 1445 | |
| 1446 | case gdb_sys_getresuid16: |
| 1447 | regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); |
| 1448 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1449 | tdep->size_old_uid_t)) |
| 1450 | return -1; |
| 1451 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 1452 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1453 | tdep->size_old_uid_t)) |
| 1454 | return -1; |
| 1455 | regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); |
| 1456 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1457 | tdep->size_old_uid_t)) |
| 1458 | return -1; |
| 1459 | break; |
| 1460 | |
| 1461 | case gdb_sys_vm86: |
| 1462 | case gdb_sys_ni_syscall167: |
| 1463 | break; |
| 1464 | |
| 1465 | case gdb_sys_poll: |
| 1466 | regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); |
| 1467 | if (tmpulongest) |
| 1468 | { |
| 1469 | ULONGEST nfds; |
| 1470 | |
| 1471 | regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds); |
| 1472 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1473 | tdep->size_pollfd * nfds)) |
| 1474 | return -1; |
| 1475 | } |
| 1476 | break; |
| 1477 | |
| 1478 | case gdb_sys_nfsservctl: |
| 1479 | regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); |
| 1480 | if (tmpulongest == 7 || tmpulongest == 8) |
| 1481 | { |
| 1482 | int rsize; |
| 1483 | |
| 1484 | if (tmpulongest == 7) |
| 1485 | rsize = tdep->size_NFS_FHSIZE; |
| 1486 | else |
| 1487 | rsize = tdep->size_knfsd_fh; |
| 1488 | regcache_raw_read_unsigned (regcache, tdep->arg3, |
| 1489 | &tmpulongest); |
| 1490 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, rsize)) |
| 1491 | return -1; |
| 1492 | } |
| 1493 | break; |
| 1494 | |
| 1495 | case gdb_sys_setresgid16: |
| 1496 | break; |
| 1497 | |
| 1498 | case gdb_sys_getresgid16: |
| 1499 | regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); |
| 1500 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1501 | tdep->size_old_gid_t)) |
| 1502 | return -1; |
| 1503 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 1504 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1505 | tdep->size_old_gid_t)) |
| 1506 | return -1; |
| 1507 | regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); |
| 1508 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1509 | tdep->size_old_gid_t)) |
| 1510 | return -1; |
| 1511 | break; |
| 1512 | |
| 1513 | case gdb_sys_prctl: |
| 1514 | regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); |
| 1515 | switch (tmpulongest) |
| 1516 | { |
| 1517 | case 2: |
| 1518 | regcache_raw_read_unsigned (regcache, tdep->arg2, |
| 1519 | &tmpulongest); |
| 1520 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1521 | tdep->size_int)) |
| 1522 | return -1; |
| 1523 | break; |
| 1524 | case 16: |
| 1525 | regcache_raw_read_unsigned (regcache, tdep->arg2, |
| 1526 | &tmpulongest); |
| 1527 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1528 | tdep->size_TASK_COMM_LEN)) |
| 1529 | return -1; |
| 1530 | break; |
| 1531 | } |
| 1532 | break; |
| 1533 | |
| 1534 | case gdb_sys_rt_sigreturn: |
| 1535 | break; |
| 1536 | |
| 1537 | case gdb_sys_rt_sigaction: |
| 1538 | regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); |
| 1539 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1540 | tdep->size_sigaction)) |
| 1541 | return -1; |
| 1542 | break; |
| 1543 | |
| 1544 | case gdb_sys_rt_sigprocmask: |
| 1545 | regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); |
| 1546 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1547 | tdep->size_sigset_t)) |
| 1548 | return -1; |
| 1549 | break; |
| 1550 | |
| 1551 | case gdb_sys_rt_sigpending: |
| 1552 | regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); |
| 1553 | if (tmpulongest) |
| 1554 | { |
| 1555 | ULONGEST sigsetsize; |
| 1556 | |
| 1557 | regcache_raw_read_unsigned (regcache, tdep->arg2,&sigsetsize); |
| 1558 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1559 | (int) sigsetsize)) |
| 1560 | return -1; |
| 1561 | } |
| 1562 | break; |
| 1563 | |
| 1564 | case gdb_sys_rt_sigtimedwait: |
| 1565 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 1566 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1567 | tdep->size_siginfo_t)) |
| 1568 | return -1; |
| 1569 | break; |
| 1570 | |
| 1571 | case gdb_sys_rt_sigqueueinfo: |
| 1572 | case gdb_sys_rt_sigsuspend: |
| 1573 | break; |
| 1574 | |
| 1575 | case gdb_sys_pread64: |
| 1576 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 1577 | if (tmpulongest) |
| 1578 | { |
| 1579 | ULONGEST count; |
| 1580 | |
| 1581 | regcache_raw_read_unsigned (regcache, tdep->arg3,&count); |
| 1582 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) count)) |
| 1583 | return -1; |
| 1584 | } |
| 1585 | break; |
| 1586 | |
| 1587 | case gdb_sys_pwrite64: |
| 1588 | case gdb_sys_chown16: |
| 1589 | break; |
| 1590 | |
| 1591 | case gdb_sys_getcwd: |
| 1592 | regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); |
| 1593 | if (tmpulongest) |
| 1594 | { |
| 1595 | ULONGEST size; |
| 1596 | |
| 1597 | regcache_raw_read_unsigned (regcache, tdep->arg2, &size); |
| 1598 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) size)) |
| 1599 | return -1; |
| 1600 | } |
| 1601 | break; |
| 1602 | |
| 1603 | case gdb_sys_capget: |
| 1604 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 1605 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1606 | tdep->size_cap_user_data_t)) |
| 1607 | return -1; |
| 1608 | break; |
| 1609 | |
| 1610 | case gdb_sys_capset: |
| 1611 | break; |
| 1612 | |
| 1613 | case gdb_sys_sigaltstack: |
| 1614 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 1615 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1616 | tdep->size_stack_t)) |
| 1617 | return -1; |
| 1618 | break; |
| 1619 | |
| 1620 | case gdb_sys_sendfile: |
| 1621 | regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); |
| 1622 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1623 | tdep->size_off_t)) |
| 1624 | return -1; |
| 1625 | break; |
| 1626 | |
| 1627 | case gdb_sys_ni_syscall188: |
| 1628 | case gdb_sys_ni_syscall189: |
| 1629 | case gdb_sys_vfork: |
| 1630 | break; |
| 1631 | |
| 1632 | case gdb_sys_getrlimit: |
| 1633 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 1634 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1635 | tdep->size_rlimit)) |
| 1636 | return -1; |
| 1637 | break; |
| 1638 | |
| 1639 | case gdb_sys_mmap2: |
| 1640 | break; |
| 1641 | |
| 1642 | case gdb_sys_truncate64: |
| 1643 | case gdb_sys_ftruncate64: |
| 1644 | break; |
| 1645 | |
| 1646 | case gdb_sys_stat64: |
| 1647 | case gdb_sys_lstat64: |
| 1648 | case gdb_sys_fstat64: |
| 1649 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 1650 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1651 | tdep->size_stat64)) |
| 1652 | return -1; |
| 1653 | break; |
| 1654 | |
| 1655 | case gdb_sys_lchown: |
| 1656 | case gdb_sys_getuid: |
| 1657 | case gdb_sys_getgid: |
| 1658 | case gdb_sys_geteuid: |
| 1659 | case gdb_sys_getegid: |
| 1660 | case gdb_sys_setreuid: |
| 1661 | case gdb_sys_setregid: |
| 1662 | break; |
| 1663 | |
| 1664 | case gdb_sys_getgroups: |
| 1665 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 1666 | if (tmpulongest) |
| 1667 | { |
| 1668 | ULONGEST gidsetsize; |
| 1669 | |
| 1670 | regcache_raw_read_unsigned (regcache, tdep->arg1, |
| 1671 | &gidsetsize); |
| 1672 | tmpint = tdep->size_gid_t * (int) gidsetsize; |
| 1673 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint)) |
| 1674 | return -1; |
| 1675 | } |
| 1676 | break; |
| 1677 | |
| 1678 | case gdb_sys_setgroups: |
| 1679 | case gdb_sys_fchown: |
| 1680 | case gdb_sys_setresuid: |
| 1681 | break; |
| 1682 | |
| 1683 | case gdb_sys_getresuid: |
| 1684 | regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); |
| 1685 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_uid_t)) |
| 1686 | return -1; |
| 1687 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 1688 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_uid_t)) |
| 1689 | return -1; |
| 1690 | regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); |
| 1691 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_uid_t)) |
| 1692 | return -1; |
| 1693 | break; |
| 1694 | |
| 1695 | case gdb_sys_setresgid: |
| 1696 | break; |
| 1697 | |
| 1698 | case gdb_sys_getresgid: |
| 1699 | regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); |
| 1700 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_gid_t)) |
| 1701 | return -1; |
| 1702 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 1703 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_gid_t)) |
| 1704 | return -1; |
| 1705 | regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); |
| 1706 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_gid_t)) |
| 1707 | return -1; |
| 1708 | break; |
| 1709 | |
| 1710 | case gdb_sys_chown: |
| 1711 | case gdb_sys_setuid: |
| 1712 | case gdb_sys_setgid: |
| 1713 | case gdb_sys_setfsuid: |
| 1714 | case gdb_sys_setfsgid: |
| 1715 | case gdb_sys_pivot_root: |
| 1716 | break; |
| 1717 | |
| 1718 | case gdb_sys_mincore: |
| 1719 | regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); |
| 1720 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1721 | tdep->size_PAGE_SIZE)) |
| 1722 | return -1; |
| 1723 | break; |
| 1724 | |
| 1725 | case gdb_sys_madvise: |
| 1726 | break; |
| 1727 | |
| 1728 | case gdb_sys_getdents64: |
| 1729 | { |
| 1730 | ULONGEST count; |
| 1731 | |
| 1732 | regcache_raw_read_unsigned (regcache, tdep->arg2, |
| 1733 | &tmpulongest); |
| 1734 | regcache_raw_read_unsigned (regcache, tdep->arg3, &count); |
| 1735 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1736 | tdep->size_dirent64 * count)) |
| 1737 | return -1; |
| 1738 | } |
| 1739 | break; |
| 1740 | |
| 1741 | case gdb_sys_fcntl64: |
| 1742 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 1743 | if (tmpulongest == tdep->fcntl_F_GETLK64) |
| 1744 | { |
| 1745 | regcache_raw_read_unsigned (regcache, tdep->arg3, |
| 1746 | &tmpulongest); |
| 1747 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1748 | tdep->size_flock64)) |
| 1749 | return -1; |
| 1750 | } |
| 1751 | else if (tmpulongest != tdep->fcntl_F_SETLK64 |
| 1752 | && tmpulongest != tdep->fcntl_F_SETLKW64) |
| 1753 | { |
| 1754 | goto sys_fcntl; |
| 1755 | } |
| 1756 | break; |
| 1757 | |
| 1758 | case gdb_sys_ni_syscall222: |
| 1759 | case gdb_sys_ni_syscall223: |
| 1760 | case gdb_sys_gettid: |
| 1761 | case gdb_sys_readahead: |
| 1762 | case gdb_sys_setxattr: |
| 1763 | case gdb_sys_lsetxattr: |
| 1764 | case gdb_sys_fsetxattr: |
| 1765 | break; |
| 1766 | |
| 1767 | case gdb_sys_getxattr: |
| 1768 | case gdb_sys_lgetxattr: |
| 1769 | case gdb_sys_fgetxattr: |
| 1770 | regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); |
| 1771 | if (tmpulongest) |
| 1772 | { |
| 1773 | ULONGEST size; |
| 1774 | |
| 1775 | regcache_raw_read_unsigned (regcache, tdep->arg4, &size); |
| 1776 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) size)) |
| 1777 | return -1; |
| 1778 | } |
| 1779 | break; |
| 1780 | |
| 1781 | case gdb_sys_listxattr: |
| 1782 | case gdb_sys_llistxattr: |
| 1783 | case gdb_sys_flistxattr: |
| 1784 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 1785 | if (tmpulongest) |
| 1786 | { |
| 1787 | ULONGEST size; |
| 1788 | |
| 1789 | regcache_raw_read_unsigned (regcache, tdep->arg3, &size); |
| 1790 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) size)) |
| 1791 | return -1; |
| 1792 | } |
| 1793 | break; |
| 1794 | |
| 1795 | case gdb_sys_removexattr: |
| 1796 | case gdb_sys_lremovexattr: |
| 1797 | case gdb_sys_fremovexattr: |
| 1798 | case gdb_sys_tkill: |
| 1799 | break; |
| 1800 | |
| 1801 | case gdb_sys_sendfile64: |
| 1802 | regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); |
| 1803 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1804 | tdep->size_loff_t)) |
| 1805 | return -1; |
| 1806 | break; |
| 1807 | |
| 1808 | case gdb_sys_futex: |
| 1809 | case gdb_sys_sched_setaffinity: |
| 1810 | break; |
| 1811 | |
| 1812 | case gdb_sys_sched_getaffinity: |
| 1813 | regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); |
| 1814 | if (tmpulongest) |
| 1815 | { |
| 1816 | ULONGEST len; |
| 1817 | |
| 1818 | regcache_raw_read_unsigned (regcache, tdep->arg2, &len); |
| 1819 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) len)) |
| 1820 | return -1; |
| 1821 | } |
| 1822 | break; |
| 1823 | |
| 1824 | case gdb_sys_set_thread_area: |
| 1825 | regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); |
| 1826 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int)) |
| 1827 | return -1; |
| 1828 | break; |
| 1829 | |
| 1830 | case gdb_sys_get_thread_area: |
| 1831 | regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); |
| 1832 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1833 | tdep->size_user_desc)) |
| 1834 | return -1; |
| 1835 | break; |
| 1836 | |
| 1837 | case gdb_sys_io_setup: |
| 1838 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 1839 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_long)) |
| 1840 | return -1; |
| 1841 | break; |
| 1842 | |
| 1843 | case gdb_sys_io_destroy: |
| 1844 | break; |
| 1845 | |
| 1846 | case gdb_sys_io_getevents: |
| 1847 | regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest); |
| 1848 | if (tmpulongest) |
| 1849 | { |
| 1850 | ULONGEST nr; |
| 1851 | |
| 1852 | regcache_raw_read_unsigned (regcache, tdep->arg3, &nr); |
| 1853 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1854 | nr * tdep->size_io_event)) |
| 1855 | return -1; |
| 1856 | } |
| 1857 | break; |
| 1858 | |
| 1859 | case gdb_sys_io_submit: |
| 1860 | regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); |
| 1861 | if (tmpulongest) |
| 1862 | { |
| 1863 | ULONGEST nr, i; |
| 1864 | gdb_byte *iocbp; |
| 1865 | |
| 1866 | regcache_raw_read_unsigned (regcache, tdep->arg2, &nr); |
| 1867 | iocbp = alloca (nr * tdep->size_pointer); |
| 1868 | if (target_read_memory ((CORE_ADDR) tmpulongest, iocbp, |
| 1869 | nr * tdep->size_pointer)) |
| 1870 | { |
| 1871 | if (record_debug) |
| 1872 | fprintf_unfiltered (gdb_stdlog, |
| 1873 | "Process record: error reading memory " |
| 1874 | "at addr = 0x%s len = %u.\n", |
| 1875 | OUTPUT_REG (tmpulongest, tdep->arg2), |
| 1876 | (int) (nr * tdep->size_pointer)); |
| 1877 | return -1; |
| 1878 | } |
| 1879 | for (i = 0; i < nr; i++) |
| 1880 | { |
| 1881 | tmpaddr |
| 1882 | = (CORE_ADDR) extract_unsigned_integer (iocbp, |
| 1883 | tdep->size_pointer, |
| 1884 | byte_order); |
| 1885 | if (record_arch_list_add_mem (tmpaddr, tdep->size_iocb)) |
| 1886 | return -1; |
| 1887 | iocbp += tdep->size_pointer; |
| 1888 | } |
| 1889 | } |
| 1890 | break; |
| 1891 | |
| 1892 | case gdb_sys_io_cancel: |
| 1893 | regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); |
| 1894 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1895 | tdep->size_io_event)) |
| 1896 | return -1; |
| 1897 | break; |
| 1898 | |
| 1899 | case gdb_sys_fadvise64: |
| 1900 | case gdb_sys_ni_syscall251: |
| 1901 | break; |
| 1902 | |
| 1903 | case gdb_sys_exit_group: |
| 1904 | { |
| 1905 | int q; |
| 1906 | |
| 1907 | target_terminal_ours (); |
| 1908 | q = yquery (_("The next instruction is syscall exit_group. " |
| 1909 | "It will make the program exit. " |
| 1910 | "Do you want to stop the program?")); |
| 1911 | target_terminal_inferior (); |
| 1912 | if (q) |
| 1913 | return 1; |
| 1914 | } |
| 1915 | break; |
| 1916 | |
| 1917 | case gdb_sys_lookup_dcookie: |
| 1918 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 1919 | if (tmpulongest) |
| 1920 | { |
| 1921 | ULONGEST len; |
| 1922 | |
| 1923 | regcache_raw_read_unsigned (regcache, tdep->arg3, &len); |
| 1924 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) len)) |
| 1925 | return -1; |
| 1926 | } |
| 1927 | break; |
| 1928 | |
| 1929 | case gdb_sys_epoll_create: |
| 1930 | case gdb_sys_epoll_ctl: |
| 1931 | break; |
| 1932 | |
| 1933 | case gdb_sys_epoll_wait: |
| 1934 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 1935 | if (tmpulongest) |
| 1936 | { |
| 1937 | ULONGEST maxevents; |
| 1938 | |
| 1939 | regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents); |
| 1940 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1941 | maxevents * tdep->size_epoll_event)) |
| 1942 | return -1; |
| 1943 | } |
| 1944 | break; |
| 1945 | |
| 1946 | case gdb_sys_remap_file_pages: |
| 1947 | case gdb_sys_set_tid_address: |
| 1948 | break; |
| 1949 | |
| 1950 | case gdb_sys_timer_create: |
| 1951 | regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); |
| 1952 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int)) |
| 1953 | return -1; |
| 1954 | break; |
| 1955 | |
| 1956 | case gdb_sys_timer_settime: |
| 1957 | regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest); |
| 1958 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1959 | tdep->size_itimerspec)) |
| 1960 | return -1; |
| 1961 | break; |
| 1962 | |
| 1963 | case gdb_sys_timer_gettime: |
| 1964 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 1965 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1966 | tdep->size_itimerspec)) |
| 1967 | return -1; |
| 1968 | break; |
| 1969 | |
| 1970 | case gdb_sys_timer_getoverrun: |
| 1971 | case gdb_sys_timer_delete: |
| 1972 | case gdb_sys_clock_settime: |
| 1973 | break; |
| 1974 | |
| 1975 | case gdb_sys_clock_gettime: |
| 1976 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 1977 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1978 | tdep->size_timespec)) |
| 1979 | return -1; |
| 1980 | break; |
| 1981 | |
| 1982 | case gdb_sys_clock_getres: |
| 1983 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 1984 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1985 | tdep->size_timespec)) |
| 1986 | return -1; |
| 1987 | break; |
| 1988 | |
| 1989 | case gdb_sys_clock_nanosleep: |
| 1990 | regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest); |
| 1991 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 1992 | tdep->size_timespec)) |
| 1993 | return -1; |
| 1994 | break; |
| 1995 | |
| 1996 | case gdb_sys_statfs64: |
| 1997 | case gdb_sys_fstatfs64: |
| 1998 | regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); |
| 1999 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 2000 | tdep->size_statfs64)) |
| 2001 | return -1; |
| 2002 | break; |
| 2003 | |
| 2004 | case gdb_sys_tgkill: |
| 2005 | case gdb_sys_utimes: |
| 2006 | case gdb_sys_fadvise64_64: |
| 2007 | case gdb_sys_ni_syscall273: |
| 2008 | case gdb_sys_mbind: |
| 2009 | break; |
| 2010 | |
| 2011 | case gdb_sys_get_mempolicy: |
| 2012 | regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); |
| 2013 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int)) |
| 2014 | return -1; |
| 2015 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 2016 | if (tmpulongest) |
| 2017 | { |
| 2018 | ULONGEST maxnode; |
| 2019 | |
| 2020 | regcache_raw_read_unsigned (regcache, tdep->arg3, &maxnode); |
| 2021 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 2022 | maxnode * tdep->size_long)) |
| 2023 | return -1; |
| 2024 | } |
| 2025 | break; |
| 2026 | |
| 2027 | case gdb_sys_set_mempolicy: |
| 2028 | case gdb_sys_mq_open: |
| 2029 | case gdb_sys_mq_unlink: |
| 2030 | case gdb_sys_mq_timedsend: |
| 2031 | break; |
| 2032 | |
| 2033 | case gdb_sys_mq_timedreceive: |
| 2034 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 2035 | if (tmpulongest) |
| 2036 | { |
| 2037 | ULONGEST msg_len; |
| 2038 | |
| 2039 | regcache_raw_read_unsigned (regcache, tdep->arg3, &msg_len); |
| 2040 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 2041 | (int) msg_len)) |
| 2042 | return -1; |
| 2043 | } |
| 2044 | regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest); |
| 2045 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int)) |
| 2046 | return -1; |
| 2047 | break; |
| 2048 | |
| 2049 | case gdb_sys_mq_notify: |
| 2050 | break; |
| 2051 | |
| 2052 | case gdb_sys_mq_getsetattr: |
| 2053 | regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); |
| 2054 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 2055 | tdep->size_mq_attr)) |
| 2056 | return -1; |
| 2057 | break; |
| 2058 | |
| 2059 | case gdb_sys_kexec_load: |
| 2060 | break; |
| 2061 | |
| 2062 | case gdb_sys_waitid: |
| 2063 | regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); |
| 2064 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 2065 | tdep->size_siginfo)) |
| 2066 | return -1; |
| 2067 | regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest); |
| 2068 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 2069 | tdep->size_rusage)) |
| 2070 | return -1; |
| 2071 | break; |
| 2072 | |
| 2073 | case gdb_sys_ni_syscall285: |
| 2074 | case gdb_sys_add_key: |
| 2075 | case gdb_sys_request_key: |
| 2076 | break; |
| 2077 | |
| 2078 | case gdb_sys_keyctl: |
| 2079 | regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); |
| 2080 | if (tmpulongest == 6 || tmpulongest == 11) |
| 2081 | { |
| 2082 | regcache_raw_read_unsigned (regcache, tdep->arg3, |
| 2083 | &tmpulongest); |
| 2084 | if (tmpulongest) |
| 2085 | { |
| 2086 | ULONGEST buflen; |
| 2087 | |
| 2088 | regcache_raw_read_unsigned (regcache, tdep->arg4, &buflen); |
| 2089 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 2090 | (int) buflen)) |
| 2091 | return -1; |
| 2092 | } |
| 2093 | } |
| 2094 | break; |
| 2095 | |
| 2096 | case gdb_sys_ioprio_set: |
| 2097 | case gdb_sys_ioprio_get: |
| 2098 | case gdb_sys_inotify_init: |
| 2099 | case gdb_sys_inotify_add_watch: |
| 2100 | case gdb_sys_inotify_rm_watch: |
| 2101 | case gdb_sys_migrate_pages: |
| 2102 | case gdb_sys_openat: |
| 2103 | case gdb_sys_mkdirat: |
| 2104 | case gdb_sys_mknodat: |
| 2105 | case gdb_sys_fchownat: |
| 2106 | case gdb_sys_futimesat: |
| 2107 | break; |
| 2108 | |
| 2109 | case gdb_sys_fstatat64: |
| 2110 | regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); |
| 2111 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 2112 | tdep->size_stat64)) |
| 2113 | return -1; |
| 2114 | break; |
| 2115 | |
| 2116 | case gdb_sys_unlinkat: |
| 2117 | case gdb_sys_renameat: |
| 2118 | case gdb_sys_linkat: |
| 2119 | case gdb_sys_symlinkat: |
| 2120 | break; |
| 2121 | |
| 2122 | case gdb_sys_readlinkat: |
| 2123 | regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); |
| 2124 | if (tmpulongest) |
| 2125 | { |
| 2126 | ULONGEST bufsiz; |
| 2127 | |
| 2128 | regcache_raw_read_unsigned (regcache, tdep->arg4, &bufsiz); |
| 2129 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) bufsiz)) |
| 2130 | return -1; |
| 2131 | } |
| 2132 | break; |
| 2133 | |
| 2134 | case gdb_sys_fchmodat: |
| 2135 | case gdb_sys_faccessat: |
| 2136 | break; |
| 2137 | |
| 2138 | case gdb_sys_pselect6: |
| 2139 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 2140 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 2141 | tdep->size_fd_set)) |
| 2142 | return -1; |
| 2143 | regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); |
| 2144 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 2145 | tdep->size_fd_set)) |
| 2146 | return -1; |
| 2147 | regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest); |
| 2148 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 2149 | tdep->size_fd_set)) |
| 2150 | return -1; |
| 2151 | regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest); |
| 2152 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 2153 | tdep->size_timespec)) |
| 2154 | return -1; |
| 2155 | break; |
| 2156 | |
| 2157 | case gdb_sys_ppoll: |
| 2158 | regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); |
| 2159 | if (tmpulongest) |
| 2160 | { |
| 2161 | ULONGEST nfds; |
| 2162 | |
| 2163 | regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds); |
| 2164 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 2165 | tdep->size_pollfd * nfds)) |
| 2166 | return -1; |
| 2167 | } |
| 2168 | regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); |
| 2169 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 2170 | tdep->size_timespec)) |
| 2171 | return -1; |
| 2172 | break; |
| 2173 | |
| 2174 | case gdb_sys_unshare: |
| 2175 | case gdb_sys_set_robust_list: |
| 2176 | break; |
| 2177 | |
| 2178 | case gdb_sys_get_robust_list: |
| 2179 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 2180 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int)) |
| 2181 | return -1; |
| 2182 | regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); |
| 2183 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int)) |
| 2184 | return -1; |
| 2185 | break; |
| 2186 | |
| 2187 | case gdb_sys_splice: |
| 2188 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 2189 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 2190 | tdep->size_loff_t)) |
| 2191 | return -1; |
| 2192 | regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest); |
| 2193 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 2194 | tdep->size_loff_t)) |
| 2195 | return -1; |
| 2196 | break; |
| 2197 | |
| 2198 | case gdb_sys_sync_file_range: |
| 2199 | case gdb_sys_tee: |
| 2200 | case gdb_sys_vmsplice: |
| 2201 | break; |
| 2202 | |
| 2203 | case gdb_sys_move_pages: |
| 2204 | regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest); |
| 2205 | if (tmpulongest) |
| 2206 | { |
| 2207 | ULONGEST nr_pages; |
| 2208 | |
| 2209 | regcache_raw_read_unsigned (regcache, tdep->arg2, &nr_pages); |
| 2210 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 2211 | nr_pages * tdep->size_int)) |
| 2212 | return -1; |
| 2213 | } |
| 2214 | break; |
| 2215 | |
| 2216 | case gdb_sys_getcpu: |
| 2217 | regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); |
| 2218 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int)) |
| 2219 | return -1; |
| 2220 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 2221 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int)) |
| 2222 | return -1; |
| 2223 | regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); |
| 2224 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, |
| 2225 | tdep->size_ulong * 2)) |
| 2226 | return -1; |
| 2227 | break; |
| 2228 | |
| 2229 | case gdb_sys_epoll_pwait: |
| 2230 | regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); |
| 2231 | if (tmpulongest) |
| 2232 | { |
| 2233 | ULONGEST maxevents; |
| 2234 | |
| 2235 | regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents); |
| 2236 | tmpint = (int) maxevents * tdep->size_epoll_event; |
| 2237 | if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint)) |
| 2238 | return -1; |
| 2239 | } |
| 2240 | break; |
| 2241 | |
| 2242 | default: |
| 2243 | printf_unfiltered (_("Process record and replay target doesn't " |
| 2244 | "support syscall number %d\n"), syscall); |
| 2245 | return -1; |
| 2246 | break; |
| 2247 | } |
| 2248 | |
| 2249 | return 0; |
| 2250 | } |