+2014-02-07 Yao Qi <yao@codesourcery.com>
+
+ * auxv.c (procfs_xfer_auxv): Replace -1 with TARGET_XFER_E_IO.
+ (ld_so_xfer_auxv): Likewise.
+ * bfd-target.c (target_bfd_xfer_partial): Likewise.
+ * bsd-kvm.c (bsd_kvm_xfer_partial): Likewise.
+ * corelow.c (core_xfer_partial): Likewise.
+ * ctf.c (ctf_xfer_partial): Likewise.
+ * darwin-nat.c (darwin_read_dyld_info): Likewise.
+ (darwin_xfer_partial): Likewise.
+ * exec.c (exec_xfer_partial): Likewise.
+ * gnu-nat.c (gnu_xfer_partial): Likewise.
+ * ia64-hpux-nat.c (ia64_hpux_xfer_uregs): Likewise.
+ * inf-ptrace.c (inf_ptrace_xfer_partial): Likewise.
+ * inf-ttrace.c (inf_ttrace_xfer_partial): Likewise.
+ * linux-nat.c (linux_xfer_siginfo): Likewise.
+ (linux_proc_xfer_spu): Likewise.
+ * procfs.c (procfs_xfer_partial): Likewise.
+ * record-full.c (record_full_xfer_partial): Likewise.
+ (record_full_core_xfer_partial): Likewise.
+ * remote-sim.c (gdbsim_xfer_partial): Likewise.
+ * remote.c (remote_write_qxfer): Likewise.
+ (remote_write_qxfer, remote_read_qxfer): Likewise.
+ (remote_xfer_partial): Likewise.
+ * rs6000-nat.c (rs6000_xfer_partial): Likewise.
+ (rs6000_xfer_shared_libraries): Likewise.
+ * sparc-nat.c (sparc_xfer_wcookie): Likewise.
+ * spu-linux-nat.c (spu_proc_xfer_spu): Likewise.
+ (spu_xfer_partial): Likewise.
+ * target.c (memory_xfer_partial_1): Likewise.
+ * tracepoint.c (tfile_xfer_partial): Likewise.
+ * windows-nat.c (windows_xfer_shared_libraries): Likewise.
+ (windows_xfer_partial): Likewise.
+
2014-02-07 Yao Qi <yao@codesourcery.com>
* gdbarch.sh (core_xfer_shared_libraries): Returns ULONGEST. Add
fd = gdb_open_cloexec (pathname, writebuf != NULL ? O_WRONLY : O_RDONLY, 0);
xfree (pathname);
if (fd < 0)
- return -1;
+ return TARGET_XFER_E_IO;
if (offset != (ULONGEST) 0
&& lseek (fd, (off_t) offset, SEEK_SET) != (off_t) offset)
msym = lookup_minimal_symbol ("_dl_auxv", NULL, NULL);
if (msym == NULL)
- return -1;
+ return TARGET_XFER_E_IO;
if (MSYMBOL_SIZE (msym) != ptr_size)
- return -1;
+ return TARGET_XFER_E_IO;
/* POINTER_ADDRESS is a location where the `_dl_auxv' variable
resides. DATA_ADDRESS is the inferior value present in
11440. */
if (target_read_memory (pointer_address, ptr_buf, ptr_size) != 0)
- return -1;
+ return TARGET_XFER_E_IO;
data_address = extract_typed_address (ptr_buf, ptr_type);
/* Possibly still not initialized such as during an inferior
startup. */
if (data_address == 0)
- return -1;
+ return TARGET_XFER_E_IO;
data_address += offset;
if (target_write_memory (data_address, writebuf, len) == 0)
return len;
else
- return -1;
+ return TARGET_XFER_E_IO;
}
/* Stop if trying to read past the existing AUXV block. The final
{
if (target_read_memory (data_address - auxv_pair_size, ptr_buf,
ptr_size) != 0)
- return -1;
+ return TARGET_XFER_E_IO;
if (extract_typed_address (ptr_buf, ptr_type) == AT_NULL)
return 0;
NULL);
}
default:
- return -1;
+ return TARGET_XFER_E_IO;
}
}
return bsd_kvm_xfer_memory (offset, len, readbuf, writebuf);
default:
- return -1;
+ return TARGET_XFER_E_IO;
}
}
section = bfd_get_section_by_name (core_bfd, ".auxv");
if (section == NULL)
- return -1;
+ return TARGET_XFER_E_IO;
size = bfd_section_size (core_bfd, section);
if (offset >= size)
(file_ptr) offset, size))
{
warning (_("Couldn't read NT_AUXV note in core file."));
- return -1;
+ return TARGET_XFER_E_IO;
}
return size;
}
- return -1;
+ return TARGET_XFER_E_IO;
case TARGET_OBJECT_WCOOKIE:
if (readbuf)
section = bfd_get_section_by_name (core_bfd, ".wcookie");
if (section == NULL)
- return -1;
+ return TARGET_XFER_E_IO;
size = bfd_section_size (core_bfd, section);
if (offset >= size)
(file_ptr) offset, size))
{
warning (_("Couldn't read StackGhost cookie in core file."));
- return -1;
+ return TARGET_XFER_E_IO;
}
return size;
}
- return -1;
+ return TARGET_XFER_E_IO;
case TARGET_OBJECT_LIBRARIES:
if (core_gdbarch
&& gdbarch_core_xfer_shared_libraries_p (core_gdbarch))
{
if (writebuf)
- return -1;
+ return TARGET_XFER_E_IO;
return
gdbarch_core_xfer_shared_libraries (core_gdbarch,
readbuf, offset, len);
&& gdbarch_core_xfer_shared_libraries_aix_p (core_gdbarch))
{
if (writebuf)
- return -1;
+ return TARGET_XFER_E_IO;
return
gdbarch_core_xfer_shared_libraries_aix (core_gdbarch,
readbuf, offset, len);
section = bfd_get_section_by_name (core_bfd, sectionstr);
if (section == NULL)
- return -1;
+ return TARGET_XFER_E_IO;
size = bfd_section_size (core_bfd, section);
if (offset >= size)
(file_ptr) offset, size))
{
warning (_("Couldn't read SPU section in core file."));
- return -1;
+ return TARGET_XFER_E_IO;
}
return size;
bfd_map_over_sections (core_bfd, add_to_spuid_list, &list);
return list.written;
}
- return -1;
+ return TARGET_XFER_E_IO;
case TARGET_OBJECT_SIGNAL_INFO:
if (readbuf)
return get_core_siginfo (core_bfd, readbuf, offset, len);
- return -1;
+ return TARGET_XFER_E_IO;
default:
if (ops->beneath != NULL)
return ops->beneath->to_xfer_partial (ops->beneath, object,
annex, readbuf,
writebuf, offset, len);
- return -1;
+ return TARGET_XFER_E_IO;
}
}
}
/* Indicate failure to find the requested memory block. */
- return -1;
+ return TARGET_XFER_E_IO;
}
/* This is the implementation of target_ops method
kret = task_info (task, TASK_DYLD_INFO, (task_info_t) &task_dyld_info, &count);
MACH_CHECK_ERROR (kret);
if (kret != KERN_SUCCESS)
- return -1;
+ return TARGET_XFER_E_IO;
/* Truncate. */
if (addr + length > sz)
length = sz - addr;
if (writebuf != NULL || readbuf == NULL)
{
/* Support only read. */
- return -1;
+ return TARGET_XFER_E_IO;
}
return darwin_read_dyld_info (inf->private->task, offset, readbuf, len);
#endif
default:
- return -1;
+ return TARGET_XFER_E_IO;
}
}
table->sections_end,
NULL);
else
- return -1;
+ return TARGET_XFER_E_IO;
}
\f
return gnu_xfer_memory (readbuf, writebuf, offset, len);
default:
- return -1;
+ return TARGET_XFER_E_IO;
}
}
status = ia64_hpux_read_register_from_save_state_t (offset, readbuf, len);
if (status < 0)
- return -1;
+ return TARGET_XFER_E_IO;
return len;
}
}
case TARGET_OBJECT_UNWIND_TABLE:
- return -1;
+ return TARGET_XFER_E_IO;
case TARGET_OBJECT_AUXV:
#if defined (PT_IO) && defined (PIOD_READ_AUXV)
struct ptrace_io_desc piod;
if (writebuf)
- return -1;
+ return TARGET_XFER_E_IO;
piod.piod_op = PIOD_READ_AUXV;
piod.piod_addr = readbuf;
piod.piod_offs = (void *) (long) offset;
return piod.piod_len;
}
#endif
- return -1;
+ return TARGET_XFER_E_IO;
case TARGET_OBJECT_WCOOKIE:
- return -1;
+ return TARGET_XFER_E_IO;
default:
- return -1;
+ return TARGET_XFER_E_IO;
}
}
return inf_ttrace_xfer_memory (offset, len, readbuf, writebuf);
case TARGET_OBJECT_UNWIND_TABLE:
- return -1;
+ return TARGET_XFER_E_IO;
case TARGET_OBJECT_AUXV:
- return -1;
+ return TARGET_XFER_E_IO;
case TARGET_OBJECT_WCOOKIE:
- return -1;
+ return TARGET_XFER_E_IO;
default:
- return -1;
+ return TARGET_XFER_E_IO;
}
}
pid = ptid_get_pid (inferior_ptid);
if (offset > sizeof (siginfo))
- return -1;
+ return TARGET_XFER_E_IO;
errno = 0;
ptrace (PTRACE_GETSIGINFO, pid, (PTRACE_TYPE_ARG3) 0, &siginfo);
if (errno != 0)
- return -1;
+ return TARGET_XFER_E_IO;
/* When GDB is built as a 64-bit application, ptrace writes into
SIGINFO an object with 64-bit layout. Since debugging a 32-bit
errno = 0;
ptrace (PTRACE_SETSIGINFO, pid, (PTRACE_TYPE_ARG3) 0, &siginfo);
if (errno != 0)
- return -1;
+ return TARGET_XFER_E_IO;
}
return len;
if (!annex)
{
if (!readbuf)
- return -1;
+ return TARGET_XFER_E_IO;
else
return spu_enumerate_spu_ids (pid, readbuf, offset, len);
}
xsnprintf (buf, sizeof buf, "/proc/%d/fd/%s", pid, annex);
fd = gdb_open_cloexec (buf, writebuf? O_WRONLY : O_RDONLY, 0);
if (fd <= 0)
- return -1;
+ return TARGET_XFER_E_IO;
if (offset != 0
&& lseek (fd, (off_t) offset, SEEK_SET) != (off_t) offset)
if (writebuf)
return (*ops->deprecated_xfer_memory) (offset, (gdb_byte *) writebuf,
len, 1/*write*/, NULL, ops);
- return -1;
+ return TARGET_XFER_E_IO;
#ifdef NEW_PROC_API
case TARGET_OBJECT_AUXV:
if (ops->beneath != NULL)
return ops->beneath->to_xfer_partial (ops->beneath, object, annex,
readbuf, writebuf, offset, len);
- return -1;
+ return TARGET_XFER_E_IO;
}
}
fprintf_unfiltered (gdb_stdlog,
"Process record: failed to record "
"execution log.");
- return -1;
+ return TARGET_XFER_E_IO;
}
if (record_full_arch_list_add_end ())
{
fprintf_unfiltered (gdb_stdlog,
"Process record: failed to record "
"execution log.");
- return -1;
+ return TARGET_XFER_E_IO;
}
record_full_list->next = record_full_arch_list_head;
record_full_arch_list_head->prev = record_full_list;
}
}
- return -1;
+ return TARGET_XFER_E_IO;
}
else
error (_("You can't do that without a process to debug."));
return gdbsim_xfer_memory (ops, readbuf, writebuf, offset, len);
default:
- return -1;
+ return TARGET_XFER_E_IO;
}
}
int max_size = get_memory_write_packet_size ();
if (packet->support == PACKET_DISABLE)
- return -1;
+ return TARGET_XFER_E_IO;
/* Insert header. */
i = snprintf (rs->buf, max_size,
if (putpkt_binary (rs->buf, i + buf_len) < 0
|| getpkt_sane (&rs->buf, &rs->buf_size, 0) < 0
|| packet_ok (rs->buf, packet) != PACKET_OK)
- return -1;
+ return TARGET_XFER_E_IO;
unpack_varlen_hex (rs->buf, &n);
return n;
LONGEST i, n, packet_len;
if (packet->support == PACKET_DISABLE)
- return -1;
+ return TARGET_XFER_E_IO;
/* Check whether we've cached an end-of-object packet that matches
this request. */
phex_nz (n, sizeof n));
i = putpkt (rs->buf);
if (i < 0)
- return -1;
+ return TARGET_XFER_E_IO;
rs->buf[0] = '\0';
packet_len = getpkt_sane (&rs->buf, &rs->buf_size, 0);
if (packet_len < 0 || packet_ok (rs->buf, packet) != PACKET_OK)
- return -1;
+ return TARGET_XFER_E_IO;
if (rs->buf[0] != 'l' && rs->buf[0] != 'm')
error (_("Unknown remote qXfer reply: %s"), rs->buf);
&remote_protocol_packets
[PACKET_qXfer_statictrace_read]);
else
- return -1;
+ return TARGET_XFER_E_IO;
}
/* Only handle flash writes. */
return remote_flash_write (ops, offset, len, writebuf);
default:
- return -1;
+ return TARGET_XFER_E_IO;
}
}
&remote_protocol_packets[PACKET_qXfer_btrace]);
default:
- return -1;
+ return TARGET_XFER_E_IO;
}
/* Note: a zero OFFSET and LEN can be used to query the minimum
/* Minimum outbuf size is get_remote_packet_size (). If LEN is not
large enough let the caller deal with it. */
if (len < get_remote_packet_size ())
- return -1;
+ return TARGET_XFER_E_IO;
len = get_remote_packet_size ();
/* Except for querying the minimum buffer size, target must be open. */
i = putpkt (rs->buf);
if (i < 0)
- return i;
+ return TARGET_XFER_E_IO;
getpkt (&rs->buf, &rs->buf_size, 0);
strcpy ((char *) readbuf, rs->buf);
}
default:
- return -1;
+ return TARGET_XFER_E_IO;
}
}
gdb_assert (target_has_execution);
if (writebuf)
- return -1;
+ return TARGET_XFER_E_IO;
ldi_buf = rs6000_ptrace_ldinfo (inferior_ptid);
gdb_assert (ldi_buf != NULL);
if (offset == sizeof (unsigned long))
return 0; /* Signal EOF. */
if (offset > sizeof (unsigned long))
- return -1;
+ return TARGET_XFER_E_IO;
#ifdef PT_WCOOKIE
/* If PT_WCOOKIE is defined (by <sys/ptrace.h>), assume we're
xsnprintf (buf, sizeof buf, "/proc/%d/fd/%s", pid, annex);
fd = open (buf, writebuf? O_WRONLY : O_RDONLY);
if (fd <= 0)
- return -1;
+ return TARGET_XFER_E_IO;
if (offset != 0
&& lseek (fd, (off_t) offset, SEEK_SET) != (off_t) offset)
offset & lslr, len);
}
- return -1;
+ return TARGET_XFER_E_IO;
}
/* Override the to_can_use_hw_breakpoint routine. */
{
case MEM_RO:
if (writebuf != NULL)
- return -1;
+ return TARGET_XFER_E_IO;
break;
case MEM_WO:
if (readbuf != NULL)
- return -1;
+ return TARGET_XFER_E_IO;
break;
case MEM_FLASH:
break;
case MEM_NONE:
- return -1;
+ return TARGET_XFER_E_IO;
}
if (!ptid_equal (inferior_ptid, null_ptid))
{
/* We're only doing regular memory for now. */
if (object != TARGET_OBJECT_MEMORY)
- return -1;
+ return TARGET_XFER_E_IO;
if (readbuf == NULL)
error (_("tfile_xfer_partial: trace file is read-only"));
}
/* Indicate failure to find the requested memory block. */
- return -1;
+ return TARGET_XFER_E_IO;
}
/* Iterate through the blocks of a trace frame, looking for a 'V'
struct so_list *so;
if (writebuf)
- return -1;
+ return TARGET_XFER_E_IO;
obstack_init (&obstack);
obstack_grow_str (&obstack, "<library-list>\n");
if (ops->beneath != NULL)
return ops->beneath->to_xfer_partial (ops->beneath, object, annex,
readbuf, writebuf, offset, len);
- return -1;
+ return TARGET_XFER_E_IO;
}
}