]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/ChangeLog
gdb: make bp_locations an std::vector
authorSimon Marchi <simon.marchi@polymtl.ca>
Thu, 27 May 2021 18:58:37 +0000 (14:58 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Thu, 27 May 2021 18:58:37 +0000 (14:58 -0400)
commit5d51cd5d14d12056585cf7525cd82af521e45894
tree39c7d4713f3f3ab8a9d4f9aea6950ac1ba368e8e
parent40cb8ca5396e563968fa8465a10173e7c2fd9d84
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
gdb/ChangeLog
gdb/breakpoint.c