diff options
author | Simon Marchi <simon.marchi@ericsson.com> | 2017-10-16 10:14:53 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2017-10-16 11:07:18 -0400 |
commit | a79b1bc6f690f3d146a3caddabd9f13a886c856a (patch) | |
tree | a80d8994788044e3c175bb974b2893352b065db5 /gdb/memrange.h | |
parent | 63f0e930d4667eb7dbc95c78f770cd58acd328ef (diff) | |
download | gdb-a79b1bc6f690f3d146a3caddabd9f13a886c856a.zip gdb-a79b1bc6f690f3d146a3caddabd9f13a886c856a.tar.gz gdb-a79b1bc6f690f3d146a3caddabd9f13a886c856a.tar.bz2 |
Get rid of VEC(mem_range_s)
This patch replaces the last usages of VEC(mem_range_s) with
std::vector<mem_range>. This allows getting rid of a few cleanups and
of the DEF_VEC_O(mem_range_s).
I added a test for normalize_mem_ranges to make sure I didn't break
anything there.
Regtested on the buildbot.
gdb/ChangeLog:
* memrange.h (struct mem_range): Define operator< and operator==.
(mem_range_s): Remove.
(DEF_VEC_O (mem_range_s)): Remove.
(normalize_mem_ranges): Change parameter type to std::vector.
* memrange.c (compare_mem_ranges): Remove.
(normalize_mem_ranges): Change parameter type to std::vector,
adjust to vector change.
* exec.c (section_table_available_memory): Return vector, remove
parameter.
(section_table_read_available_memory): Adjust to std::vector
change.
* remote.c (remote_read_bytes): Adjust to std::vector
change.
* tracepoint.h (traceframe_available_memory): Change parameter
type to std::vector.
* tracepoint.c (traceframe_available_memory): Change parameter
type to std::vector, adjust.
* gdb/mi/mi-main.c (mi_cmd_trace_frame_collected): Adjust to
std::vector change.
* gdb/Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
unittests/memrange-selftests.c.
(SUBDIR_UNITTESTS_OBS): Add memrange-selftests.o.
* gdb/unittests/memrange-selftests.c: New file.
Diffstat (limited to 'gdb/memrange.h')
-rw-r--r-- | gdb/memrange.h | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/gdb/memrange.h b/gdb/memrange.h index 029ec71..fb10cda 100644 --- a/gdb/memrange.h +++ b/gdb/memrange.h @@ -32,6 +32,17 @@ struct mem_range : start (start_), length (length_) {} + bool operator< (const mem_range &other) const + { + return this->start < other.start; + } + + bool operator== (const mem_range &other) const + { + return (this->start == other.start + && this->length == other.length); + } + /* Lowest address in the range. */ CORE_ADDR start; @@ -39,10 +50,6 @@ struct mem_range int length; }; -typedef struct mem_range mem_range_s; - -DEF_VEC_O(mem_range_s); - /* Returns true if the ranges defined by [start1, start1+len1) and [start2, start2+len2) overlap. */ @@ -57,6 +64,6 @@ extern int address_in_mem_range (CORE_ADDR addr, /* Sort ranges by start address, then coalesce contiguous or overlapping ranges. */ -extern void normalize_mem_ranges (VEC(mem_range_s) *memory); +extern void normalize_mem_ranges (std::vector<mem_range> *memory); #endif |