X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fcorefile.c;h=6de0772584ca623463c7087ba18654b65b9eb6e1;hb=e17a4113357102b55cfa5b80557d590a46a43300;hp=e667183c61c3e45fd239a3277190b87d4fabb63d;hpb=7df3ce47694f5c804a9468d4c098825b5901216e;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/corefile.c b/gdb/corefile.c index e667183c61..6de0772584 100644 --- a/gdb/corefile.c +++ b/gdb/corefile.c @@ -219,11 +219,11 @@ memory_error (int status, CORE_ADDR memaddr) bounds. */ throw_error (MEMORY_ERROR, _("Cannot access memory at address %s"), - paddress (memaddr)); + paddress (target_gdbarch, memaddr)); else throw_error (MEMORY_ERROR, _("Error accessing memory address %s: %s."), - paddress (memaddr), + paddress (target_gdbarch, memaddr), safe_strerror (status)); } @@ -246,6 +246,7 @@ struct captured_read_memory_integer_arguments { CORE_ADDR memaddr; int len; + enum bfd_endian byte_order; LONGEST result; }; @@ -262,8 +263,9 @@ do_captured_read_memory_integer (void *data) struct captured_read_memory_integer_arguments *args = (struct captured_read_memory_integer_arguments*) data; CORE_ADDR memaddr = args->memaddr; int len = args->len; + enum bfd_endian byte_order = args->byte_order; - args->result = read_memory_integer (memaddr, len); + args->result = read_memory_integer (memaddr, len, byte_order); return 1; } @@ -273,12 +275,14 @@ do_captured_read_memory_integer (void *data) if successful. */ int -safe_read_memory_integer (CORE_ADDR memaddr, int len, LONGEST *return_value) +safe_read_memory_integer (CORE_ADDR memaddr, int len, enum bfd_endian byte_order, + LONGEST *return_value) { int status; struct captured_read_memory_integer_arguments args; args.memaddr = memaddr; args.len = len; + args.byte_order = byte_order; status = catch_errors (do_captured_read_memory_integer, &args, "", RETURN_MASK_ALL); @@ -289,21 +293,21 @@ safe_read_memory_integer (CORE_ADDR memaddr, int len, LONGEST *return_value) } LONGEST -read_memory_integer (CORE_ADDR memaddr, int len) +read_memory_integer (CORE_ADDR memaddr, int len, enum bfd_endian byte_order) { gdb_byte buf[sizeof (LONGEST)]; read_memory (memaddr, buf, len); - return extract_signed_integer (buf, len); + return extract_signed_integer (buf, len, byte_order); } ULONGEST -read_memory_unsigned_integer (CORE_ADDR memaddr, int len) +read_memory_unsigned_integer (CORE_ADDR memaddr, int len, enum bfd_endian byte_order) { gdb_byte buf[sizeof (ULONGEST)]; read_memory (memaddr, buf, len); - return extract_unsigned_integer (buf, len); + return extract_unsigned_integer (buf, len, byte_order); } void @@ -353,19 +357,21 @@ write_memory (CORE_ADDR memaddr, const bfd_byte *myaddr, int len) /* Store VALUE at ADDR in the inferior as a LEN-byte unsigned integer. */ void -write_memory_unsigned_integer (CORE_ADDR addr, int len, ULONGEST value) +write_memory_unsigned_integer (CORE_ADDR addr, int len, enum bfd_endian byte_order, + ULONGEST value) { gdb_byte *buf = alloca (len); - store_unsigned_integer (buf, len, value); + store_unsigned_integer (buf, len, byte_order, value); write_memory (addr, buf, len); } /* Store VALUE at ADDR in the inferior as a LEN-byte signed integer. */ void -write_memory_signed_integer (CORE_ADDR addr, int len, LONGEST value) +write_memory_signed_integer (CORE_ADDR addr, int len, enum bfd_endian byte_order, + LONGEST value) { gdb_byte *buf = alloca (len); - store_signed_integer (buf, len, value); + store_signed_integer (buf, len, byte_order, value); write_memory (addr, buf, len); } @@ -399,7 +405,7 @@ set_gnutarget (char *newtarget) { if (gnutarget_string != NULL) xfree (gnutarget_string); - gnutarget_string = savestring (newtarget, strlen (newtarget)); + gnutarget_string = xstrdup (newtarget); set_gnutarget_command (NULL, 0, NULL); }