* symfile.h (struct sym_fns): Delete member "sym_flavour".
[deliverable/binutils-gdb.git] / gdb / target-memory.c
index cb6acc593a8e53a49066f91ce78460e1166fcbc2..1301e7e5cc7e111ae6b6dc3d51b006b8c14c4c65 100644 (file)
@@ -1,13 +1,13 @@
 /* Parts of target interface that deal with accessing memory and memory-like
    objects.
 
 /* Parts of target interface that deal with accessing memory and memory-like
    objects.
 
-   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2006-2013 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
    This file is part of GDB.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -16,9 +16,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "defs.h"
 #include "vec.h"
 
 #include "defs.h"
 #include "vec.h"
@@ -86,10 +84,11 @@ claim_memory (VEC(memory_write_request_s) *blocks,
        {
          struct memory_write_request *n =
            VEC_safe_push (memory_write_request_s, *result, NULL);
        {
          struct memory_write_request *n =
            VEC_safe_push (memory_write_request_s, *result, NULL);
-         memset (n, 0, sizeof (struct memory_write_request));
+
+         *n = *r;
          n->begin = claimed_begin;
          n->end = claimed_end;
          n->begin = claimed_begin;
          n->end = claimed_end;
-         n->data = r->data + (claimed_begin - r->begin);
+         n->data += claimed_begin - r->begin;
        }
     }
 }
        }
     }
 }
@@ -118,8 +117,8 @@ split_regular_and_flash_blocks (VEC(memory_write_request_s) *blocks,
   while (1)
     {
       VEC(memory_write_request_s) **r;
   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);
       r = region->attrib.mode == MEM_FLASH ? flash_blocks : regular_blocks;
       cur_address = region->hi;
       claim_memory (blocks, r, region->lo, region->hi);
@@ -177,6 +176,7 @@ blocks_to_erase (VEC(memory_write_request_s) *written)
        {
          struct memory_write_request *n =
            VEC_safe_push (memory_write_request_s, result, NULL);
        {
          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;
          memset (n, 0, sizeof (struct memory_write_request));
          n->begin = begin;
          n->end = end;
@@ -257,6 +257,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);
            {
              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;
              memset (n, 0, sizeof (struct memory_write_request));
              n->begin = erased.begin;
              n->end = written->begin;
@@ -302,6 +303,7 @@ static void
 cleanup_write_requests_vector (void *p)
 {
   VEC(memory_write_request_s) **v = p;
 cleanup_write_requests_vector (void *p)
 {
   VEC(memory_write_request_s) **v = p;
+
   VEC_free (memory_write_request_s, *v);
 }
 
   VEC_free (memory_write_request_s, *v);
 }
 
@@ -336,7 +338,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,
         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);
   make_cleanup (cleanup_write_requests_vector, &regular);
   make_cleanup (cleanup_write_requests_vector, &flash);
   split_regular_and_flash_blocks (blocks, &regular, &flash);
@@ -377,7 +379,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),
 
          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);
        }
     }
 
        }
     }
 
@@ -395,7 +398,7 @@ target_write_memory_blocks (VEC(memory_write_request_s) *requests,
     {
       LONGEST len;
 
     {
       LONGEST len;
 
-      len = target_write_with_progress (&current_target,
+      len = target_write_with_progress (current_target.beneath,
                                        TARGET_OBJECT_MEMORY, NULL,
                                        r->data, r->begin, r->end - r->begin,
                                        progress_cb, r->baton);
                                        TARGET_OBJECT_MEMORY, NULL,
                                        r->data, r->begin, r->end - r->begin,
                                        progress_cb, r->baton);
@@ -420,7 +423,8 @@ target_write_memory_blocks (VEC(memory_write_request_s) *requests,
 
          len = target_write_with_progress (&current_target,
                                            TARGET_OBJECT_FLASH, NULL,
 
          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"));
                                            progress_cb, r->baton);
          if (len < (LONGEST) (r->end - r->begin))
            error (_("Error writing data to flash"));
This page took 0.025627 seconds and 4 git commands to generate.