mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-24 10:35:12 +08:00
610cfd618e
The == and != operators on filtered_iterator are not doing the right thing, they compare values pointed by the wrapped iterators instead of comparing the iterators themselves. As a result, operator== will return true if the two iterators point to two equal values at different positions. operator!= will fail similarly. Also, this causes it to deference past-the-end iterators when doing. For example, in for (iter = ...; iter != end_iter; ++iter) the != comparison dereferences end_iter. I don't think this should happen. I don't think it's a problem today, given that we only use filtered_iterator to wrap linked lists of threads and inferiors. Dereferencing past-the-end iterators of these types is not fatal, it just returns NULL, which is not a value we otherwise find in the lists. But in other contexts, it could become problematic. I have added a simple self test that fails without the fix applied. gdb/ChangeLog: * filtered-iterator.h (filtered_iterator) <operator==, operator!=>: Compare wrapped iterators, not wrapped pointers. * Makefile.in (SUBDIR_UNITTESTS_SRCS): Add unittests/filtered_iterator-selftests.c. * unittests/filtered_iterator-selftests.c: New file. |
||
---|---|---|
.. | ||
agent.c | ||
agent.h | ||
alt-stack.h | ||
array-view.h | ||
ax.def | ||
block-signals.h | ||
break-common.h | ||
btrace-common.c | ||
btrace-common.h | ||
buffer.c | ||
buffer.h | ||
byte-vector.h | ||
cleanups.c | ||
cleanups.h | ||
common-debug.c | ||
common-debug.h | ||
common-defs.h | ||
common-exceptions.c | ||
common-exceptions.h | ||
common-gdbthread.h | ||
common-inferior.c | ||
common-inferior.h | ||
common-regcache.c | ||
common-regcache.h | ||
common-types.h | ||
common-utils.c | ||
common-utils.h | ||
common.m4 | ||
create-version.sh | ||
def-vector.h | ||
default-init-alloc.h | ||
enum-flags.h | ||
environ.c | ||
environ.h | ||
errors.c | ||
errors.h | ||
fileio.c | ||
fileio.h | ||
filestuff.c | ||
filestuff.h | ||
filtered-iterator.h | ||
format.c | ||
format.h | ||
forward-scope-exit.h | ||
function-view.h | ||
gdb_assert.h | ||
gdb_binary_search.h | ||
gdb_locale.h | ||
gdb_optional.h | ||
gdb_proc_service.h | ||
gdb_ref_ptr.h | ||
gdb_setjmp.h | ||
gdb_signals.h | ||
gdb_splay_tree.h | ||
gdb_string_view.h | ||
gdb_string_view.tcc | ||
gdb_sys_time.h | ||
gdb_tilde_expand.c | ||
gdb_tilde_expand.h | ||
gdb_unique_ptr.h | ||
gdb_unlinker.h | ||
gdb_vecs.c | ||
gdb_vecs.h | ||
gdb_wait.h | ||
gdb-dlfcn.c | ||
gdb-dlfcn.h | ||
gdb-sigmask.h | ||
hash_enum.h | ||
host-defs.h | ||
job-control.c | ||
job-control.h | ||
netstuff.c | ||
netstuff.h | ||
new-op.c | ||
next-iterator.h | ||
observable.h | ||
offset-type.h | ||
parallel-for.h | ||
pathstuff.c | ||
pathstuff.h | ||
poison.h | ||
preprocessor.h | ||
print-utils.c | ||
print-utils.h | ||
ptid.c | ||
ptid.h | ||
refcounted-object.h | ||
rsp-low.c | ||
rsp-low.h | ||
run-time-clock.c | ||
run-time-clock.h | ||
safe-iterator.h | ||
safe-strerror.c | ||
scope-exit.h | ||
scoped_fd.h | ||
scoped_mmap.c | ||
scoped_mmap.h | ||
scoped_restore.h | ||
selftest.c | ||
selftest.h | ||
signals-state-save-restore.c | ||
signals-state-save-restore.h | ||
signals.c | ||
symbol.h | ||
tdesc.c | ||
tdesc.h | ||
thread-pool.c | ||
thread-pool.h | ||
traits.h | ||
underlying.h | ||
valid-expr.h | ||
version.h | ||
x86-xstate.h | ||
xml-utils.c | ||
xml-utils.h |