diff options
author | Pedro Alves <palves@redhat.com> | 2015-10-27 17:25:09 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2015-10-27 17:25:09 +0000 |
commit | d09f2c3fc15dd4491e9cfa455191045c0729a3c3 (patch) | |
tree | d5fcb14b4ba086bfc062bf13b2d6926c4e6d7ed8 /gdb/disasm.c | |
parent | c5192092506e52a5f075b137a36933e42db64563 (diff) | |
download | gdb-d09f2c3fc15dd4491e9cfa455191045c0729a3c3.zip gdb-d09f2c3fc15dd4491e9cfa455191045c0729a3c3.tar.gz gdb-d09f2c3fc15dd4491e9cfa455191045c0729a3c3.tar.bz2 |
target_read_memory&co: no longer return target_xfer_status
Years ago, these functions used to return errno/EIO. Later, through a
series of changes that intended to remove native/remote differences,
they ended up returning a target_xfer_status in disguise.
Unlike target_xfer_partial&co, the point of target_read_memory&co is
to either fully succeed or fail. On error, they always return
TARGET_XFER_E_IO. So there's no real point in casting the return of
target_read_memory to a target_xfer_status to pass it to memory_error.
Instead, it results in clearer code to simply decouple
target_read_memory&co's return from target_xfer_status.
This fixes build errors like this in C++ mode:
../../src/gdb/corefile.c: In function ‘void read_stack(CORE_ADDR, gdb_byte*, ssize_t)’:
../../src/gdb/corefile.c:276:34: error: invalid conversion from ‘int’ to ‘target_xfer_status’ [-fpermissive]
memory_error (status, memaddr);
^
../../src/gdb/corefile.c:216:1: error: initializing argument 1 of ‘void memory_error(target_xfer_status, CORE_ADDR)’ [-fpermissive]
gdb/ChangeLog:
2015-10-27 Pedro Alves <palves@redhat.com>
* alpha-tdep.c (alpha_read_insn): Always pass TARGET_XFER_E_IO to
memory_error. Rename local 'status' to 'res'.
* c-lang.c (c_get_string): Always pass TARGET_XFER_E_IO to
memory_error.
* corefile.c (read_stack, read_code, write_memory): Always pass
TARGET_XFER_E_IO to memory_error.
* disasm.c (dis_asm_memory_error): Always pass TARGET_XFER_E_IO to
memory_error. Rename parameter 'status' to 'err'.
(dump_insns): Rename local 'status' to 'err'.
* mips-tdep.c (mips_fetch_instruction): Rename parameter 'statusp'
to 'errp'. Rename local 'status' to 'err'. Always pass
TARGET_XFER_E_IO to memory_error.
(mips_breakpoint_from_pc): Rename local 'status' to 'err'.
* target.c (target_read_memory, target_read_raw_memory)
(target_read_stack, target_read_code, target_write_memory)
(target_write_raw_memory): Return -1 on error instead of
TARGET_XFER_E_IO.
* valprint.c (val_print_string): Rename local 'errcode' to 'err'.
Always pass TARGET_XFER_E_IO to memory_error. Update comment.
Diffstat (limited to 'gdb/disasm.c')
-rw-r--r-- | gdb/disasm.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gdb/disasm.c b/gdb/disasm.c index 6e3d6c1..c17574e 100644 --- a/gdb/disasm.c +++ b/gdb/disasm.c @@ -129,10 +129,10 @@ dis_asm_read_memory (bfd_vma memaddr, gdb_byte *myaddr, unsigned int len, /* Like memory_error with slightly different parameters. */ static void -dis_asm_memory_error (int status, bfd_vma memaddr, +dis_asm_memory_error (int err, bfd_vma memaddr, struct disassemble_info *info) { - memory_error (status, memaddr); + memory_error (TARGET_XFER_E_IO, memaddr); } /* Like print_address with slightly different parameters. */ @@ -230,7 +230,7 @@ dump_insns (struct gdbarch *gdbarch, struct ui_out *uiout, { CORE_ADDR old_pc = pc; bfd_byte data; - int status; + int err; const char *spacer = ""; /* Build the opcodes using a temporary stream so we can @@ -242,9 +242,9 @@ dump_insns (struct gdbarch *gdbarch, struct ui_out *uiout, pc += gdbarch_print_insn (gdbarch, pc, di); for (;old_pc < pc; old_pc++) { - status = (*di->read_memory_func) (old_pc, &data, 1, di); - if (status != 0) - (*di->memory_error_func) (status, old_pc, di); + err = (*di->read_memory_func) (old_pc, &data, 1, di); + if (err != 0) + (*di->memory_error_func) (err, old_pc, di); fprintf_filtered (opcode_stream, "%s%02x", spacer, (unsigned) data); spacer = " "; |