aboutsummaryrefslogtreecommitdiff
path: root/gdb/i386-linux-tdep.c
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2009-09-08 22:50:59 +0000
committerMichael Snyder <msnyder@vmware.com>2009-09-08 22:50:59 +0000
commit13b6d1d459210ab9ad250fc24df977bb1b178a3a (patch)
treef7b5981493bf455e986bcd1739d8896ae2084a35 /gdb/i386-linux-tdep.c
parent6a89f575aaaf6f183620a91507e965205429a54a (diff)
downloadgdb-13b6d1d459210ab9ad250fc24df977bb1b178a3a.zip
gdb-13b6d1d459210ab9ad250fc24df977bb1b178a3a.tar.gz
gdb-13b6d1d459210ab9ad250fc24df977bb1b178a3a.tar.bz2
2009-09-08 Michael Snyder <msnyder@vmware.com>
* amd64-linux-tdep.h (enum amd64_syscall): New enum consts, to replace literal consts used in amd64-linux-tdep.c * linux-record.h (enum gdb_syscall): New enum consts, to replace literal consts used in amd64-linux-tdep.c and linux-record.c. * amd64-linux-tdep.c (amd64_canonicalize_syscall): New function, translate from native amd64 Linux syscall id to internal gdb id. (amd64_linux_syscall_record): Switch statement abstracted out and replaced with a call to amd64_canonicalize_syscall. * linux-record.c (record_linux_system_call): Replace literal consts with enum consts. * i386-linux-tdep.c (i386_canonicalize_syscall): New function, trivially translate from native i386 Linux syscalls to gdb syscalls. (i386_linux_intx80_sysenter_record):
Diffstat (limited to 'gdb/i386-linux-tdep.c')
-rw-r--r--gdb/i386-linux-tdep.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index ecc634f..748fda0 100644
--- a/gdb/i386-linux-tdep.c
+++ b/gdb/i386-linux-tdep.c
@@ -354,6 +354,24 @@ i386_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
regcache_cooked_write_unsigned (regcache, I386_LINUX_ORIG_EAX_REGNUM, -1);
}
+static struct linux_record_tdep i386_linux_record_tdep;
+
+/* i386_canonicalize_syscall maps from the native i386 Linux set
+ of syscall ids into a canonical set of syscall ids used by
+ process record (a mostly trivial mapping, since the canonical
+ set was originally taken from the i386 set). */
+
+static enum gdb_syscall
+i386_canonicalize_syscall (int syscall)
+{
+ enum { i386_syscall_max = 499 };
+
+ if (syscall <= i386_syscall_max)
+ return syscall;
+ else
+ return -1;
+}
+
/* Parse the arguments of current system call instruction and record
the values of the registers and memory that will be changed into
"record_arch_list". This instruction is "int 0x80" (Linux
@@ -361,24 +379,26 @@ i386_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
Return -1 if something wrong. */
-static struct linux_record_tdep i386_linux_record_tdep;
-
static int
i386_linux_intx80_sysenter_record (struct regcache *regcache)
{
int ret;
- uint32_t tmpu32;
+ LONGEST syscall_native;
+ enum gdb_syscall syscall_gdb;
+
+ regcache_raw_read_signed (regcache, I386_EAX_REGNUM, &syscall_native);
- regcache_raw_read (regcache, I386_EAX_REGNUM, (gdb_byte *) &tmpu32);
+ syscall_gdb = i386_canonicalize_syscall (syscall_native);
- if (tmpu32 > 499)
+ if (syscall_gdb < 0)
{
printf_unfiltered (_("Process record and replay target doesn't "
- "support syscall number %u\n"), tmpu32);
+ "support syscall number %s\n"),
+ plongest (syscall_native));
return -1;
}
- ret = record_linux_system_call (tmpu32, regcache,
+ ret = record_linux_system_call (syscall_gdb, regcache,
&i386_linux_record_tdep);
if (ret)
return ret;