diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2019-09-16 09:12:27 -0400 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2019-10-02 14:05:49 +0100 |
commit | 46f29a9a260da1a03176682aff63bad03d8f2e8b (patch) | |
tree | 4fd2bb40deed8e0e8b6745bd2c6f70bab02347d0 /gdb/gdbsupport/btrace-common.h | |
parent | de4859eacb74a440d9fd61e4a0f051e3737a05dd (diff) | |
download | gdb-46f29a9a260da1a03176682aff63bad03d8f2e8b.zip gdb-46f29a9a260da1a03176682aff63bad03d8f2e8b.tar.gz gdb-46f29a9a260da1a03176682aff63bad03d8f2e8b.tar.bz2 |
gdb: Remove a VEC from gdbsupport/btrace-common.h
Converts a VEC into a std::vector in gdbsupport/btrace-common.h. This
commit just performs a mechanical conversion and doesn't do any
refactoring. One consequence of this is that the std::vector must
actually be a pointer to std::vector as it is placed within a union.
It might be possible in future to refactor to a class hierarchy and
remove the need for a union, but I'd rather have that be a separate
change to make it easier to see the evolution of the code.
gdb/ChangeLog:
* btrace.c (btrace_compute_ftrace_bts): Update for std::vector,
make accesses into the vector constant references.
(btrace_add_pc): Update for std::vector.
(btrace_stitch_bts): Likewise.
(parse_xml_btrace_block): Likewise.
(btrace_maint_update_packets): Likewise.
(btrace_maint_print_packets): Likewise.
(maint_info_btrace_cmd): Likewise.
* gdbsupport/btrace-common.c (btrace_data::fini): Update for
std::vector.
(btrace_data::empty): Likewise.
(btrace_data_append): Likewise.
* gdbsupport/btrace-common.h: Remove use of DEF_VEC_O.
(typedef btrace_block_s): Delete.
(struct btrace_block): Add constructor.
(struct btrace_data_bts) <blocks>: Change to std::vector.
* nat/linux-btrace.c (perf_event_read_bts): Update for
std::vector.
(linux_read_bts): Likewise.
gdb/gdbserver/ChangeLog:
* linux-low.c (linux_low_read_btrace): Update for change to
std::vector.
Diffstat (limited to 'gdb/gdbsupport/btrace-common.h')
-rw-r--r-- | gdb/gdbsupport/btrace-common.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/gdb/gdbsupport/btrace-common.h b/gdb/gdbsupport/btrace-common.h index 0b18924..9c57645 100644 --- a/gdb/gdbsupport/btrace-common.h +++ b/gdb/gdbsupport/btrace-common.h @@ -43,11 +43,15 @@ struct btrace_block /* The address of the first byte of the last instruction in the block. */ CORE_ADDR end; -}; -/* Define functions operating on a vector of branch trace blocks. */ -typedef struct btrace_block btrace_block_s; -DEF_VEC_O (btrace_block_s); + /* Simple constructor. */ + btrace_block (CORE_ADDR begin, CORE_ADDR end) + : begin (begin), + end (end) + { + /* Nothing. */ + } +}; /* Enumeration of btrace formats. */ @@ -137,8 +141,9 @@ struct btrace_config struct btrace_data_bts { /* Branch trace is represented as a vector of branch trace blocks starting - with the most recent block. */ - VEC (btrace_block_s) *blocks; + with the most recent block. This needs to be a pointer as we place + btrace_data_bts into a union. */ + std::vector <btrace_block> *blocks; }; /* Configuration information to go with the trace data. */ |