/* 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-2015 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)
{
struct memory_write_request *n =
VEC_safe_push (memory_write_request_s, *result, NULL);
+
*n = *r;
n->begin = claimed_begin;
n->end = claimed_end;
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);
{
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;
{
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;
cleanup_write_requests_vector (void *p)
{
VEC(memory_write_request_s) **v = p;
+
VEC_free (memory_write_request_s, *v);
}
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, ®ular);
make_cleanup (cleanup_write_requests_vector, &flash);
split_regular_and_flash_blocks (blocks, ®ular, &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);
}
}
len = target_write_with_progress (¤t_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"));