From: Tom Tromey <tom@tromey.com>
To: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] gdb: add gdb_bfd_all_sections for range-based iteration
Date: Mon, 24 Aug 2020 14:31:16 -0600 [thread overview]
Message-ID: <87a6yjbxbf.fsf@tromey.com> (raw)
In-Reply-To: <20200824194333.196744-1-simon.marchi@polymtl.ca> (Simon Marchi via Gdb-patches's message of "Mon, 24 Aug 2020 15:43:33 -0400")
>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
Simon> I wanted to make a nicer / type-safe interface for
Simon> bfd_map_over_sections, avoiding the `void *` data parameter.
Simon> My first shot was to make a wrapper for bfd_map_over_sections,
Simon> gdb_bfd_map_over_sections that took a gdb::function_view.
Simon> However, I think that a range adapter gives nicer and simpler code, as a
Simon> simple for loop is easier to read than a callback / lambda function. So
Simon> here it is, it uses next_iterator and next_adapter, so it's not much
Simon> code.
Simon> As an example, I ported maintenance_info_sections and friends to use it.
Simon> The maint_print_section_data type could probably be removed now, but I
Simon> didn't want to do too much in one patch.
I also did this kind of thing -- I have some patches to remove many uses
of bfd_map_over_sections, though not all of them, since some seem hard
to test.
Simon> * gdb_bfd.h (gdb_bfd_section_iterator, gdb_bfd_section_range,
Simon> gdb_bfd_all_sections): New.
Simon> * maint.c (print_bfd_section_info): Change param type to
Simon> maint_print_section_data.
Simon> (print_objfile_section_info): Likewise.
Simon> (print_bfd_section_info_maybe_relocated): Likewise.
Simon> (maintenance_info_sections): Use gdb_bfd_all_sections.
Looks good. Thanks.
Tom
next prev parent reply other threads:[~2020-08-24 20:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-24 19:43 Simon Marchi
2020-08-24 20:31 ` Tom Tromey [this message]
2020-08-24 20:34 ` Simon Marchi
2020-08-24 20:57 ` Tom Tromey
2020-08-24 21:30 ` Simon Marchi
2020-08-27 12:59 ` Simon Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a6yjbxbf.fsf@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox