--- i386-linux-tdep.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) --- a/i386-linux-tdep.c +++ b/i386-linux-tdep.c @@ -389,6 +389,83 @@ i386_linux_intx80_sysenter_record (struc return 0; } + +static int +i386_linux_process_record_temp_register (struct regcache *regcache) +{ + if (record_arch_list_add_reg (regcache, I386_EAX_REGNUM)) + return -1; + if (record_arch_list_add_reg (regcache, I386_ECX_REGNUM)) + return -1; + if (record_arch_list_add_reg (regcache, I386_EDX_REGNUM)) + return -1; + if (record_arch_list_add_reg (regcache, I386_ESP_REGNUM)) + return -1; + if (record_arch_list_add_reg (regcache, I386_EIP_REGNUM)) + return -1; + if (record_arch_list_add_reg (regcache, I386_EFLAGS_REGNUM)) + return -1; + + return 0; +} + +static int +i386_linux_process_record_simple_function (struct regcache *regcache) +{ + if (i386_linux_process_record_temp_register (regcache)) + return -1; + + if (record_arch_list_add_end ()) + return -1; + + return 0; +} + +static int +i386_linux_process_record_memset (struct regcache *regcache) +{ + ULONGEST tmpulongest; + struct gdbarch *gdbarch = get_regcache_arch (regcache); + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + gdb_byte buf[12]; + int tmpint; + + if (i386_linux_process_record_temp_register (regcache)) + return -1; + + regcache_raw_read_unsigned (regcache, I386_ESP_REGNUM, &tmpulongest); + tmpulongest += 4; + if (target_read_memory ((CORE_ADDR) tmpulongest, buf, 12)) + { + if (record_debug) + fprintf_unfiltered (gdb_stdlog, + "Process record: error reading " + "memory at addr = 0x%s " + "len = %d.\n", + phex_nz (tmpulongest, 4), 12); + return -1; + } + tmpulongest = extract_unsigned_integer (buf, 4, byte_order); + tmpint = (int) extract_unsigned_integer (buf + 8, 4, byte_order); + if (record_arch_list_add_mem ((CORE_ADDR)tmpulongest, tmpint)) + return -1; + + if (record_arch_list_add_end ()) + return -1; + + return 0; +} + +static void +i386_linux_process_record_open (struct gdbarch *gdbarch) +{ + record_skip_entry_create (gdbarch, "printf", + i386_linux_process_record_simple_function); + record_skip_entry_create (gdbarch, "memset", + i386_linux_process_record_memset); + record_skip_entry_create (gdbarch, "memcpy", + i386_linux_process_record_memset); +} /* The register sets used in GNU/Linux ELF core-dumps are identical to @@ -484,6 +561,7 @@ i386_linux_init_abi (struct gdbarch_info tdep->sc_num_regs = ARRAY_SIZE (i386_linux_sc_reg_offset); set_gdbarch_process_record (gdbarch, i386_process_record); + set_gdbarch_process_record_open (gdbarch, i386_linux_process_record_open); /* Initialize the i386_linux_record_tdep. */ /* These values are the size of the type that will be used in a system