diff options
author | Yao Qi <yao@codesourcery.com> | 2014-01-27 17:32:33 +0800 |
---|---|---|
committer | Yao Qi <yao@codesourcery.com> | 2014-02-07 11:19:58 +0800 |
commit | 2ed4b5488f68c63da0713dc008ba8b688a742386 (patch) | |
tree | 9bc671808d970999362caf23c2c1eb9ed9595f9a | |
parent | c09f20e469dbed255f419433b06a2808ae0a40a8 (diff) | |
download | binutils-gdb-2ed4b5488f68c63da0713dc008ba8b688a742386.tar.gz |
Replace -1 with TARGET_XFER_E_IO
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 makes the next patch shorter.
gdb:
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.
-rw-r--r-- | gdb/ChangeLog | 34 | ||||
-rw-r--r-- | gdb/auxv.c | 14 | ||||
-rw-r--r-- | gdb/bfd-target.c | 2 | ||||
-rw-r--r-- | gdb/bsd-kvm.c | 2 | ||||
-rw-r--r-- | gdb/corelow.c | 26 | ||||
-rw-r--r-- | gdb/ctf.c | 2 | ||||
-rw-r--r-- | gdb/darwin-nat.c | 6 | ||||
-rw-r--r-- | gdb/exec.c | 2 | ||||
-rw-r--r-- | gdb/gnu-nat.c | 2 | ||||
-rw-r--r-- | gdb/ia64-hpux-nat.c | 2 | ||||
-rw-r--r-- | gdb/inf-ptrace.c | 10 | ||||
-rw-r--r-- | gdb/inf-ttrace.c | 8 | ||||
-rw-r--r-- | gdb/linux-nat.c | 10 | ||||
-rw-r--r-- | gdb/procfs.c | 4 | ||||
-rw-r--r-- | gdb/record-full.c | 6 | ||||
-rw-r--r-- | gdb/remote-sim.c | 2 | ||||
-rw-r--r-- | gdb/remote.c | 20 | ||||
-rw-r--r-- | gdb/rs6000-nat.c | 4 | ||||
-rw-r--r-- | gdb/sparc-nat.c | 2 | ||||
-rw-r--r-- | gdb/spu-linux-nat.c | 4 | ||||
-rw-r--r-- | gdb/target.c | 6 | ||||
-rw-r--r-- | gdb/tracepoint.c | 4 | ||||
-rw-r--r-- | gdb/windows-nat.c | 4 |
23 files changed, 105 insertions, 71 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 146ac98faeb..6601b480ace 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,39 @@ 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 comments. (core_xfer_shared_libraries_aix): Likewise. diff --git a/gdb/auxv.c b/gdb/auxv.c index dd13237dd0c..f93c7ec85e9 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 657de357d5f..41930ee5544 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 cfa8867151c..36b33e93b6e 100644 --- a/gdb/bsd-kvm.c +++ b/gdb/bsd-kvm.c @@ -143,7 +143,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 2d4a7198774..5f1e55faedd 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 6035c2bc122..54cf56be9c1 100644 --- a/gdb/ctf.c +++ b/gdb/ctf.c @@ -1493,7 +1493,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 dd4b3ce1775..0b1d59c13ac 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 b5aa7f288c9..3ec6c2f124e 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 ca61c11306a..737496234c5 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 2b0e88990fc..b783c99d2e9 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 a64c8764ed1..dc3746b0ad8 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 ea76153c6ec..3fd98f2eaa4 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 d144c7772e9..ebf40559f03 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 2383366ab35..d1a24ab1ef7 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 9a2b5e6630e..2859112f97d 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 93090875880..0322c1da2e2 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 e1d0a64d211..da0f64a7501 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -8749,7 +8749,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, @@ -8765,7 +8765,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; @@ -8788,7 +8788,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. */ @@ -8818,12 +8818,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); @@ -8920,7 +8920,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. */ @@ -8934,7 +8934,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; } } @@ -9002,7 +9002,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 @@ -9012,7 +9012,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. */ @@ -9044,7 +9044,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 676edd9be5e..ec3f8123c00 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 2953c7c0c5b..05be02d1d96 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 784939be419..a095dfb8b3b 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 3d63ada5ad5..3ca3e71fb63 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 0a50606b102..52538bc169f 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -5120,7 +5120,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")); @@ -5199,7 +5199,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 5bcb7b70cd5..3ce564a0474 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; } } |