Re: [RFA/RFC Prec] Add Linux AMD64 process record support second version, (64 bits system call support) 2/3

Michael Snyder
2009-07-25T22:20:56Z

Hui, I have just a few more small issues with this patch:

> linux-record.c | 2570 ++++++++++++++++++++++++++++++------------------------
[...]
> + case RECORD_SYS_ACCEPT:
> + case RECORD_SYS_GETSOCKNAME:
> + case RECORD_SYS_GETPEERNAME:
> + {
> + regcache_raw_read_unsigned (regcache, tdep->arg2,
> + &tmpulongest);
> + if (tmpulongest)
> + {
> + gdb_byte *a = alloca (tdep->size_ulong * 2);
> + int addrlen;
> + gdb_byte *addrlenp;

> + tmpulongest += tdep->size_ulong;
> + if (target_read_memory ((CORE_ADDR) tmpulongest, a,
> + tdep->size_ulong * 2))
> + {
> + if (record_debug)
> + fprintf_unfiltered (gdb_stdlog,
> + "Process record: error reading "
> + "memory at addr = 0x%s len = %d.\n",
> + OUTPUT_REG (tmpulongest, tdep->arg2),
> + tdep->size_ulong * 2);
> + return -1;
> + }
> + if (record_linux_sockaddr (regcache, tdep,
> + extract_unsigned_integer
> + (a, tdep->size_ulong, byte_order),
> + extract_unsigned_integer
> + (a + tdep->size_ulong,
> + tdep->size_ulong, byte_order)))

Could you use a couple of temporary variables for
extract_unsigned_integer here?

> + case RECORD_SYS_RECVFROM:
> + regcache_raw_read_unsigned (regcache, tdep->arg2,
> + &tmpulongest);
> + if (tmpulongest)
> + {
> + gdb_byte *a = alloca (tdep->size_ulong * 2);
> + int addrlen;
> + gdb_byte *addrlenp;
>

> + tmpulongest += tdep->size_ulong * 4;
> + if (target_read_memory ((CORE_ADDR) tmpulongest, a,
> + tdep->size_ulong * 2))
> + {
> + if (record_debug)
> + fprintf_unfiltered (gdb_stdlog,
> + "Process record: error reading "
> + "memory at addr = 0x%s len = %d.\n",
> + OUTPUT_REG (tmpulongest, tdep->arg2),
> + tdep->size_ulong * 2);
> + return -1;
> + }
> + if (record_linux_sockaddr (regcache, tdep,
> + extract_unsigned_integer
> + (a, tdep->size_ulong, byte_order),
> + extract_unsigned_integer
> + (a + tdep->size_ulong,
> + tdep->size_ulong, byte_order)))

And here?

> + case RECORD_SYS_RECVMSG:
> + {
> + gdb_byte *a = alloca (tdep->size_ulong);
> +
> + regcache_raw_read_unsigned (regcache, tdep->arg2,
> + &tmpulongest);
> + if (tmpulongest)
> + {
> + tmpulongest += tdep->size_ulong;
> + if (target_read_memory ((CORE_ADDR) tmpulongest, a,
> + tdep->size_ulong))
> + {
> + if (record_debug)
> + fprintf_unfiltered (gdb_stdlog,
> + "Process record: error reading "
> + "memory at addr = 0x%s len = %d.\n",
> + OUTPUT_REG (tmpulongest, tdep->arg2),
> + tdep->size_ulong);
> + return -1;
> + }
> + tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
> + byte_order);
> + if (record_linux_msghdr (regcache, tdep,
> + extract_unsigned_integer
> + (a, tdep->size_ulong, byte_order)))

And here?

> + case 528:
> + /* sys_shmdt */
> + /* XXX maybe need do some record works wiht sys_shmdt. */

"with".

> + case RECORD_SEMOP:
> + case RECORD_SEMGET:
> + case RECORD_SEMTIMEDOP:
> + case RECORD_MSGSND:
> + case RECORD_MSGGET:
> + /* XXX maybe need do some record works wiht RECORD_SHMDT. */

"with".

That's all I've got! After those, I'm good.

Mark? How about you?

Michael