diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-05-27 14:58:37 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-05-27 14:58:37 -0400 |
commit | 5d51cd5d14d12056585cf7525cd82af521e45894 (patch) | |
tree | 39c7d4713f3f3ab8a9d4f9aea6950ac1ba368e8e /compile | |
parent | 40cb8ca5396e563968fa8465a10173e7c2fd9d84 (diff) | |
download | gdb-5d51cd5d14d12056585cf7525cd82af521e45894.zip gdb-5d51cd5d14d12056585cf7525cd82af521e45894.tar.gz gdb-5d51cd5d14d12056585cf7525cd82af521e45894.tar.bz2 |
gdb: make bp_locations an std::vector
Change the type of the global location list, bp_locations, to be an
std::vector.
Adjust the users to deal with that, mostly in an obvious way by using
.data() and .size(). The user where it's slightly less obvious is
update_global_location_list. There, we std::move the old location list
out of the global vector into a local variable. The code to fill the
new location list gets simpler, as it's now simply using .push_back(),
no need to count the locations beforehand.
In the rest of update_global_location_list, the code is adjusted to work
with indices instead of `bp_location **`, to iterate on the location
list. I believe it's a bit easier to understand this way. But more
importantly, when we build with _GLIBCXX_DEBUG, the operator[] of the
vector does bound checking, so we will know if we ever access past a
vector size (which we won't if we access by raw pointer). I think that
work can further be done to make that function easier to understand,
notably find better names than "loc" and "loc2" for variables, but
that's work for later.
gdb/ChangeLog:
* breakpoint.c (bp_locations): Change to std::vector, update all
users.
(bp_locations_count): Remove.
(update_global_location_list): Change to work with indices
rather than bp_location**.
Change-Id: I193ce40f84d5dc930fbab8867cf946e78ff0df0b
Diffstat (limited to 'compile')
0 files changed, 0 insertions, 0 deletions