aboutsummaryrefslogtreecommitdiff
path: root/gdb/target.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-02-24 09:55:30 -0700
committerTom Tromey <tom@tromey.com>2018-02-27 12:00:34 -0700
commit55089490f79ce1ddb9610fd6abeeaf896825fb71 (patch)
tree9e745a2bfcfc782e678ab8df7876c9f401038116 /gdb/target.h
parent5b616beff49ce5fe10c5efc2784b6b234bb8cb4f (diff)
downloadgdb-55089490f79ce1ddb9610fd6abeeaf896825fb71.zip
gdb-55089490f79ce1ddb9610fd6abeeaf896825fb71.tar.gz
gdb-55089490f79ce1ddb9610fd6abeeaf896825fb71.tar.bz2
Change target_write_memory_blocks to use std::vector
This changes target_write_memory_blocks to use std::vector, rather than VEC. This allows the removal of some cleanups. This version incorporates the additions that Simon made. Regression tested by the buildbot. ChangeLog 2018-02-27 Simon Marchi <simon.marchi@polymtl.ca> Tom Tromey <tom@tromey.com> * target.h (memory_write_request_s): Remove typedef. Don't define VEC. (target_write_memory_blocks): Change argument to std::vector. (struct memory_write_request): Add constructor. * target-memory.c (compare_block_starting_address): Return bool. Change argument types. (claim_memory): Change arguments to use std::vector. (split_regular_and_flash_blocks, blocks_to_erase) (compute_garbled_blocks): Likewise. (cleanup_request_data, cleanup_write_requests_vector): Remove. (target_write_memory_blocks): Change argument to std::vector. * symfile.c (struct load_section_data): Add constructor and destructor. Use std::vector for "requests". (struct load_progress_data): Add initializers. (load_section_callback): Update. Use "new". (clear_memory_write_data): Remove. (generic_load): Update.
Diffstat (limited to 'gdb/target.h')
-rw-r--r--gdb/target.h34
1 files changed, 19 insertions, 15 deletions
diff --git a/gdb/target.h b/gdb/target.h
index 83cf485..e8972ca 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -1463,18 +1463,21 @@ void target_flash_done (void);
/* Describes a request for a memory write operation. */
struct memory_write_request
- {
- /* Begining address that must be written. */
- ULONGEST begin;
- /* Past-the-end address. */
- ULONGEST end;
- /* The data to write. */
- gdb_byte *data;
- /* A callback baton for progress reporting for this request. */
- void *baton;
- };
-typedef struct memory_write_request memory_write_request_s;
-DEF_VEC_O(memory_write_request_s);
+{
+ memory_write_request (ULONGEST begin_, ULONGEST end_,
+ gdb_byte *data_ = nullptr, void *baton_ = nullptr)
+ : begin (begin_), end (end_), data (data_), baton (baton_)
+ {}
+
+ /* Begining address that must be written. */
+ ULONGEST begin;
+ /* Past-the-end address. */
+ ULONGEST end;
+ /* The data to write. */
+ gdb_byte *data;
+ /* A callback baton for progress reporting for this request. */
+ void *baton;
+};
/* Enumeration specifying different flash preservation behaviour. */
enum flash_preserve_mode
@@ -1500,9 +1503,10 @@ enum flash_preserve_mode
with a NULL baton, when preserved flash sectors are being rewritten.
The function returns 0 on success, and error otherwise. */
-int target_write_memory_blocks (VEC(memory_write_request_s) *requests,
- enum flash_preserve_mode preserve_flash_p,
- void (*progress_cb) (ULONGEST, void *));
+int target_write_memory_blocks
+ (const std::vector<memory_write_request> &requests,
+ enum flash_preserve_mode preserve_flash_p,
+ void (*progress_cb) (ULONGEST, void *));
/* Print a line about the current target. */