arm-tdep.c: Remove unused arm_displaced_step_copy_insn
[deliverable/binutils-gdb.git] / gdb / target-memory.c
index 4dfe7b3b01a461034c858e46a5ddfc5861d1eefb..39d022b90dd1aa6600791dd0af32937c1478380a 100644 (file)
@@ -1,7 +1,7 @@
 /* Parts of target interface that deal with accessing memory and memory-like
    objects.
 
-   Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2006-2016 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 #include "target.h"
 #include "memory-map.h"
 
-#include "gdb_assert.h"
-
-#include <stdio.h>
-#include <sys/time.h>
+#include "gdb_sys_time.h"
 
 static int
 compare_block_starting_address (const void *a, const void *b)
 {
-  const struct memory_write_request *a_req = a;
-  const struct memory_write_request *b_req = b;
+  const struct memory_write_request *a_req
+    = (const struct memory_write_request *) a;
+  const struct memory_write_request *b_req
+    = (const struct memory_write_request *) b;
 
   if (a_req->begin < b_req->begin)
     return -1;
@@ -84,6 +83,7 @@ claim_memory (VEC(memory_write_request_s) *blocks,
        {
          struct memory_write_request *n =
            VEC_safe_push (memory_write_request_s, *result, NULL);
+
          *n = *r;
          n->begin = claimed_begin;
          n->end = claimed_end;
@@ -116,8 +116,8 @@ split_regular_and_flash_blocks (VEC(memory_write_request_s) *blocks,
   while (1)
     {
       VEC(memory_write_request_s) **r;
-      region = lookup_mem_region (cur_address);
 
+      region = lookup_mem_region (cur_address);
       r = region->attrib.mode == MEM_FLASH ? flash_blocks : regular_blocks;
       cur_address = region->hi;
       claim_memory (blocks, r, region->lo, region->hi);
@@ -175,6 +175,7 @@ blocks_to_erase (VEC(memory_write_request_s) *written)
        {
          struct memory_write_request *n =
            VEC_safe_push (memory_write_request_s, result, NULL);
+
          memset (n, 0, sizeof (struct memory_write_request));
          n->begin = begin;
          n->end = end;
@@ -255,6 +256,7 @@ compute_garbled_blocks (VEC(memory_write_request_s) *erased_blocks,
            {
              struct memory_write_request *n =
                VEC_safe_push (memory_write_request_s, result, NULL);
+
              memset (n, 0, sizeof (struct memory_write_request));
              n->begin = erased.begin;
              n->end = written->begin;
@@ -288,7 +290,7 @@ compute_garbled_blocks (VEC(memory_write_request_s) *erased_blocks,
 static void
 cleanup_request_data (void *p)
 {
-  VEC(memory_write_request_s) **v = p;
+  VEC(memory_write_request_s) **v = (VEC(memory_write_request_s) **) p;
   struct memory_write_request *r;
   int i;
 
@@ -299,7 +301,8 @@ cleanup_request_data (void *p)
 static void
 cleanup_write_requests_vector (void *p)
 {
-  VEC(memory_write_request_s) **v = p;
+  VEC(memory_write_request_s) **v = (VEC(memory_write_request_s) **) p;
+
   VEC_free (memory_write_request_s, *v);
 }
 
@@ -334,7 +337,7 @@ target_write_memory_blocks (VEC(memory_write_request_s) *requests,
         sizeof (struct memory_write_request), compare_block_starting_address);
 
   /* Split blocks into list of regular memory blocks,
-     and list of flash memory blocks. */
+     and list of flash memory blocks.  */
   make_cleanup (cleanup_write_requests_vector, &regular);
   make_cleanup (cleanup_write_requests_vector, &flash);
   split_regular_and_flash_blocks (blocks, &regular, &flash);
@@ -365,7 +368,7 @@ target_write_memory_blocks (VEC(memory_write_request_s) *requests,
          for (i = 0; VEC_iterate (memory_write_request_s, garbled, i, r); ++i)
            {
              gdb_assert (r->data == NULL);
-             r->data = xmalloc (r->end - r->begin);
+             r->data = (gdb_byte *) xmalloc (r->end - r->begin);
              err = target_read_memory (r->begin, r->data, r->end - r->begin);
              if (err != 0)
                goto out;
@@ -375,7 +378,8 @@ target_write_memory_blocks (VEC(memory_write_request_s) *requests,
 
          qsort (VEC_address (memory_write_request_s, flash),
                 VEC_length (memory_write_request_s, flash),
-                sizeof (struct memory_write_request), compare_block_starting_address);
+                sizeof (struct memory_write_request),
+                compare_block_starting_address);
        }
     }
 
@@ -418,7 +422,8 @@ target_write_memory_blocks (VEC(memory_write_request_s) *requests,
 
          len = target_write_with_progress (&current_target,
                                            TARGET_OBJECT_FLASH, NULL,
-                                           r->data, r->begin, r->end - r->begin,
+                                           r->data, r->begin,
+                                           r->end - r->begin,
                                            progress_cb, r->baton);
          if (len < (LONGEST) (r->end - r->begin))
            error (_("Error writing data to flash"));
This page took 0.026164 seconds and 4 git commands to generate.