This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 3/6] Replace -1 with TARGET_XFER_E_IO
- From: Yao Qi <yao at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Fri, 31 Jan 2014 11:35:22 +0800
- Subject: [PATCH 3/6] Replace -1 with TARGET_XFER_E_IO
- Authentication-results: sourceware.org; auth=none
- References: <1391139325-2758-1-git-send-email-yao at codesourcery dot com>
Hi,
This patch replaces -1 with TARGET_XFER_E_IO in the implementations of
to_xfer_partial and their callees. This change is quite mechanical,
and get the next patch shorter.
gdb:
2014-01-30 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.
---
gdb/auxv.c | 14 +++++++-------
gdb/bfd-target.c | 2 +-
gdb/bsd-kvm.c | 2 +-
gdb/corelow.c | 26 +++++++++++++-------------
gdb/ctf.c | 2 +-
gdb/darwin-nat.c | 6 +++---
gdb/exec.c | 2 +-
gdb/gnu-nat.c | 2 +-
gdb/ia64-hpux-nat.c | 2 +-
gdb/inf-ptrace.c | 10 +++++-----
gdb/inf-ttrace.c | 8 ++++----
gdb/linux-nat.c | 10 +++++-----
gdb/procfs.c | 4 ++--
gdb/record-full.c | 6 +++---
gdb/remote-sim.c | 2 +-
gdb/remote.c | 20 ++++++++++----------
gdb/rs6000-nat.c | 4 ++--
gdb/sparc-nat.c | 2 +-
gdb/spu-linux-nat.c | 4 ++--
gdb/target.c | 6 +++---
gdb/tracepoint.c | 4 ++--
gdb/windows-nat.c | 4 ++--
22 files changed, 71 insertions(+), 71 deletions(-)
diff --git a/gdb/auxv.c b/gdb/auxv.c
index dacad10..3b5872e 100644
--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -52,7 +52,7 @@ procfs_xfer_auxv (gdb_byte *readbuf,
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)
@@ -86,10 +86,10 @@ ld_so_xfer_auxv (gdb_byte *readbuf,
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
@@ -118,14 +118,14 @@ ld_so_xfer_auxv (gdb_byte *readbuf,
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;
@@ -134,7 +134,7 @@ ld_so_xfer_auxv (gdb_byte *readbuf,
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
@@ -144,7 +144,7 @@ ld_so_xfer_auxv (gdb_byte *readbuf,
{
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;
diff --git a/gdb/bfd-target.c b/gdb/bfd-target.c
index 657de35..41930ee 100644
--- a/gdb/bfd-target.c
+++ b/gdb/bfd-target.c
@@ -55,7 +55,7 @@ target_bfd_xfer_partial (struct target_ops *ops,
NULL);
}
default:
- return -1;
+ return TARGET_XFER_E_IO;
}
}
diff --git a/gdb/bsd-kvm.c b/gdb/bsd-kvm.c
index 20d6a1c..4c2d194 100644
--- a/gdb/bsd-kvm.c
+++ b/gdb/bsd-kvm.c
@@ -142,7 +142,7 @@ bsd_kvm_xfer_partial (struct target_ops *ops, enum target_object object,
return bsd_kvm_xfer_memory (offset, len, readbuf, writebuf);
default:
- return -1;
+ return TARGET_XFER_E_IO;
}
}
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 2d4a719..5f1e55f 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -698,7 +698,7 @@ core_xfer_partial (struct target_ops *ops, enum target_object object,
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)
@@ -711,12 +711,12 @@ core_xfer_partial (struct target_ops *ops, enum target_object object,
(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)
@@ -730,7 +730,7 @@ core_xfer_partial (struct target_ops *ops, enum target_object object,
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)
@@ -743,19 +743,19 @@ core_xfer_partial (struct target_ops *ops, enum target_object object,
(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);
@@ -767,7 +767,7 @@ core_xfer_partial (struct target_ops *ops, enum target_object object,
&& 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);
@@ -789,7 +789,7 @@ core_xfer_partial (struct target_ops *ops, enum target_object object,
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)
@@ -802,7 +802,7 @@ core_xfer_partial (struct target_ops *ops, enum target_object object,
(file_ptr) offset, size))
{
warning (_("Couldn't read SPU section in core file."));
- return -1;
+ return TARGET_XFER_E_IO;
}
return size;
@@ -820,19 +820,19 @@ core_xfer_partial (struct target_ops *ops, enum target_object object,
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;
}
}
diff --git a/gdb/ctf.c b/gdb/ctf.c
index a22937f..3070273 100644
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
@@ -1479,7 +1479,7 @@ ctf_xfer_partial (struct target_ops *ops, enum target_object object,
}
/* Indicate failure to find the requested memory block. */
- return -1;
+ return TARGET_XFER_E_IO;
}
/* This is the implementation of target_ops method
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index dd4b3ce..0b1d59c 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -1907,7 +1907,7 @@ darwin_read_dyld_info (task_t task, CORE_ADDR addr, gdb_byte *rdaddr,
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;
@@ -1942,12 +1942,12 @@ darwin_xfer_partial (struct target_ops *ops,
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;
}
}
diff --git a/gdb/exec.c b/gdb/exec.c
index b5aa7f2..3ec6c2f 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -650,7 +650,7 @@ exec_xfer_partial (struct target_ops *ops, enum target_object object,
table->sections_end,
NULL);
else
- return -1;
+ return TARGET_XFER_E_IO;
}
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index ca61c11..7374962 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -2520,7 +2520,7 @@ gnu_xfer_partial (struct target_ops *ops, enum target_object object,
return gnu_xfer_memory (readbuf, writebuf, offset, len);
default:
- return -1;
+ return TARGET_XFER_E_IO;
}
}
diff --git a/gdb/ia64-hpux-nat.c b/gdb/ia64-hpux-nat.c
index 2b0e889..b783c99 100644
--- a/gdb/ia64-hpux-nat.c
+++ b/gdb/ia64-hpux-nat.c
@@ -630,7 +630,7 @@ ia64_hpux_xfer_uregs (struct target_ops *ops, const char *annex,
status = ia64_hpux_read_register_from_save_state_t (offset, readbuf, len);
if (status < 0)
- return -1;
+ return TARGET_XFER_E_IO;
return len;
}
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index a64c876..dc3746b 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -573,7 +573,7 @@ inf_ptrace_xfer_partial (struct target_ops *ops, enum target_object object,
}
case TARGET_OBJECT_UNWIND_TABLE:
- return -1;
+ return TARGET_XFER_E_IO;
case TARGET_OBJECT_AUXV:
#if defined (PT_IO) && defined (PIOD_READ_AUXV)
@@ -584,7 +584,7 @@ inf_ptrace_xfer_partial (struct target_ops *ops, enum target_object object,
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;
@@ -596,13 +596,13 @@ inf_ptrace_xfer_partial (struct target_ops *ops, enum target_object object,
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;
}
}
diff --git a/gdb/inf-ttrace.c b/gdb/inf-ttrace.c
index ea76153..3fd98f2 100644
--- a/gdb/inf-ttrace.c
+++ b/gdb/inf-ttrace.c
@@ -1234,16 +1234,16 @@ inf_ttrace_xfer_partial (struct target_ops *ops, enum target_object object,
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;
}
}
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index d144c77..ebf4055 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -3879,12 +3879,12 @@ linux_xfer_siginfo (struct target_ops *ops, enum target_object object,
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
@@ -3909,7 +3909,7 @@ linux_xfer_siginfo (struct target_ops *ops, enum target_object object,
errno = 0;
ptrace (PTRACE_SETSIGINFO, pid, (PTRACE_TYPE_ARG3) 0, &siginfo);
if (errno != 0)
- return -1;
+ return TARGET_XFER_E_IO;
}
return len;
@@ -4219,7 +4219,7 @@ linux_proc_xfer_spu (struct target_ops *ops, enum target_object object,
if (!annex)
{
if (!readbuf)
- return -1;
+ return TARGET_XFER_E_IO;
else
return spu_enumerate_spu_ids (pid, readbuf, offset, len);
}
@@ -4227,7 +4227,7 @@ linux_proc_xfer_spu (struct target_ops *ops, enum target_object object,
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)
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 2383366..d1a24ab 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -3987,7 +3987,7 @@ procfs_xfer_partial (struct target_ops *ops, enum target_object object,
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:
@@ -3999,7 +3999,7 @@ procfs_xfer_partial (struct target_ops *ops, enum target_object object,
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;
}
}
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 9a2b5e6..2859112 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -1685,7 +1685,7 @@ record_full_xfer_partial (struct target_ops *ops, enum target_object object,
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 ())
{
@@ -1694,7 +1694,7 @@ record_full_xfer_partial (struct target_ops *ops, enum target_object object,
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;
@@ -2270,7 +2270,7 @@ record_full_core_xfer_partial (struct target_ops *ops,
}
}
- return -1;
+ return TARGET_XFER_E_IO;
}
else
error (_("You can't do that without a process to debug."));
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 9309087..0322c1d 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -1124,7 +1124,7 @@ gdbsim_xfer_partial (struct target_ops *ops, enum target_object object,
return gdbsim_xfer_memory (ops, readbuf, writebuf, offset, len);
default:
- return -1;
+ return TARGET_XFER_E_IO;
}
}
diff --git a/gdb/remote.c b/gdb/remote.c
index 7297df0..0118bd9 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -8753,7 +8753,7 @@ remote_write_qxfer (struct target_ops *ops, const char *object_name,
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,
@@ -8769,7 +8769,7 @@ remote_write_qxfer (struct target_ops *ops, const char *object_name,
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;
@@ -8792,7 +8792,7 @@ remote_read_qxfer (struct target_ops *ops, const char *object_name,
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. */
@@ -8822,12 +8822,12 @@ remote_read_qxfer (struct target_ops *ops, const char *object_name,
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);
@@ -8924,7 +8924,7 @@ remote_xfer_partial (struct target_ops *ops, enum target_object object,
&remote_protocol_packets
[PACKET_qXfer_statictrace_read]);
else
- return -1;
+ return TARGET_XFER_E_IO;
}
/* Only handle flash writes. */
@@ -8938,7 +8938,7 @@ remote_xfer_partial (struct target_ops *ops, enum target_object object,
return remote_flash_write (ops, offset, len, writebuf);
default:
- return -1;
+ return TARGET_XFER_E_IO;
}
}
@@ -9006,7 +9006,7 @@ remote_xfer_partial (struct target_ops *ops, enum target_object object,
&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
@@ -9016,7 +9016,7 @@ remote_xfer_partial (struct target_ops *ops, enum target_object object,
/* 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. */
@@ -9048,7 +9048,7 @@ remote_xfer_partial (struct target_ops *ops, enum target_object object,
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);
diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c
index 676edd9..ec3f812 100644
--- a/gdb/rs6000-nat.c
+++ b/gdb/rs6000-nat.c
@@ -476,7 +476,7 @@ rs6000_xfer_partial (struct target_ops *ops, enum target_object object,
}
default:
- return -1;
+ return TARGET_XFER_E_IO;
}
}
@@ -697,7 +697,7 @@ rs6000_xfer_shared_libraries
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);
diff --git a/gdb/sparc-nat.c b/gdb/sparc-nat.c
index 2953c7c..05be02d 100644
--- a/gdb/sparc-nat.c
+++ b/gdb/sparc-nat.c
@@ -272,7 +272,7 @@ sparc_xfer_wcookie (struct target_ops *ops, enum target_object object,
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
diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c
index 784939b..a095dfb 100644
--- a/gdb/spu-linux-nat.c
+++ b/gdb/spu-linux-nat.c
@@ -244,7 +244,7 @@ spu_proc_xfer_spu (const char *annex, gdb_byte *readbuf,
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)
@@ -601,7 +601,7 @@ spu_xfer_partial (struct target_ops *ops,
offset & lslr, len);
}
- return -1;
+ return TARGET_XFER_E_IO;
}
/* Override the to_can_use_hw_breakpoint routine. */
diff --git a/gdb/target.c b/gdb/target.c
index 3d63ada..3ca3e71 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -1542,12 +1542,12 @@ memory_xfer_partial_1 (struct target_ops *ops, enum target_object object,
{
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:
@@ -1557,7 +1557,7 @@ memory_xfer_partial_1 (struct target_ops *ops, enum target_object object,
break;
case MEM_NONE:
- return -1;
+ return TARGET_XFER_E_IO;
}
if (!ptid_equal (inferior_ptid, null_ptid))
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index f3b9bfc..cd9be80 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -5108,7 +5108,7 @@ tfile_xfer_partial (struct target_ops *ops, enum target_object object,
{
/* 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"));
@@ -5187,7 +5187,7 @@ tfile_xfer_partial (struct target_ops *ops, enum target_object object,
}
/* 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'
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 5bcb7b7..3ce564a 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -2514,7 +2514,7 @@ windows_xfer_shared_libraries (struct target_ops *ops,
struct so_list *so;
if (writebuf)
- return -1;
+ return TARGET_XFER_E_IO;
obstack_init (&obstack);
obstack_grow_str (&obstack, "<library-list>\n");
@@ -2557,7 +2557,7 @@ windows_xfer_partial (struct target_ops *ops, enum target_object object,
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;
}
}
--
1.7.7.6