diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2020-08-27 08:58:43 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2020-08-27 08:58:43 -0400 |
commit | b886559f31fabb8bf234c1818dd01f8987e3c190 (patch) | |
tree | 3bb438a20bff2ea6e7d2835642fb5b9613dabbab /binutils/readelf.c | |
parent | ec10b3bb916cde1203912847e3f5844ab5ab24bd (diff) | |
download | gdb-b886559f31fabb8bf234c1818dd01f8987e3c190.zip gdb-b886559f31fabb8bf234c1818dd01f8987e3c190.tar.gz gdb-b886559f31fabb8bf234c1818dd01f8987e3c190.tar.bz2 |
gdb: add gdb_bfd_sections for range-based iteration
I wanted to make a nicer / type-safe interface for
bfd_map_over_sections, avoiding the `void *` data parameter.
My first shot was to make a wrapper for bfd_map_over_sections,
gdb_bfd_map_over_sections that took a gdb::function_view.
However, I think that a range adapter gives nicer and simpler code, as a
simple for loop is easier to read than a callback / lambda function. So
here it is, it uses next_iterator and next_adapter, so it's not much
code.
As an example, I ported maintenance_info_sections and friends to use it.
The maint_print_section_data type could probably be removed now, but I
didn't want to do too much in one patch.
gdb/ChangeLog:
* gdb_bfd.h (gdb_bfd_section_iterator, gdb_bfd_section_range,
gdb_bfd_sections): New.
* maint.c (print_bfd_section_info): Change param type to
maint_print_section_data.
(print_objfile_section_info): Likewise.
(print_bfd_section_info_maybe_relocated): Likewise.
(maintenance_info_sections): Use gdb_bfd_sections.
Change-Id: Ib496f6b0a0eb7aadb10da1dd381304014d934ea0
Diffstat (limited to 'binutils/readelf.c')
0 files changed, 0 insertions, 0 deletions