aboutsummaryrefslogtreecommitdiff
path: root/include/opcode/spu.h
diff options
context:
space:
mode:
authorAaron Merey <amerey@redhat.com>2024-03-19 16:12:36 -0400
committerAaron Merey <amerey@redhat.com>2024-03-19 17:09:06 -0400
commit0f5116cb492cca755c55ad30ea06be4e7c72a27f (patch)
treec1227ba7e096c669a28d90a525de58258bbf7664 /include/opcode/spu.h
parent1ab9eefe3cea741aba17e11ff28ed48ac3a8293a (diff)
downloadfsf-binutils-gdb-0f5116cb492cca755c55ad30ea06be4e7c72a27f.zip
fsf-binutils-gdb-0f5116cb492cca755c55ad30ea06be4e7c72a27f.tar.gz
fsf-binutils-gdb-0f5116cb492cca755c55ad30ea06be4e7c72a27f.tar.bz2
gdb/progspace: Add reverse safe iterator
This patch changes progspace objfile_list insertion so that separate debug objfiles are placed into the list after the parent objfile, instead of before. Additionally qf_require_partial_symbols now returns a safe_range. These changes are intended to prepare gdb for on-demand debuginfo downloading and the downloading of .gdb_index sections. With on-demand downloading enabled, gdb might need to delete a .gdb_index quick_symbol_functions from a parent objfile while looping the objfile's list of quick_symbol_functions because the separate debug objfile has just been downloaded. The use of a safe_range prevents this removal from causing iterator invalidation. gdb might also download a debuginfo file during symtab expansion. In this case an objfile will be added to the current progspace's objfiles_list during iteration over the list (for example, in iterate_over_symtabs). We want these loops to also iterate over newly downloaded objfiles. So objfiles need to be inserted into objfiles_list after their parent since it is during the search of the parent objfile for some symbol or filename that the separate debug objfile might be downloaded. To facilitate the safe deletion of objfiles, this patch also adds basic_safe_reverse_range and basic_safe_reverse_iterator. This allows objfiles to be removed from the objfiles_list in a loop without iterator invalidation. If a forward safe iterator were to be used, the deletion of an objfile could invalidate the safe iterator's reference to the next objfile in the objfiles_list. This can happen when the deletion of an objfile causes the deletion of a separate debug objfile that happens to the be next element in the objfiles_list. The standard reverse iterator is not suitable for safe objfile deletion. In order to safely delete the first objfile in the objfiles_list, the standard reverse iterator's underlying begin iterator would have to be decremented, resulting in undefined behavior. A small change was also made to a testcase in py-objfile.exp to account for the new placement of separate debug objfiles in objfiles_list.
Diffstat (limited to 'include/opcode/spu.h')
0 files changed, 0 insertions, 0 deletions