From e56cb451c9ca63bdafc11cc3d3ee14b74e409fa9 Mon Sep 17 00:00:00 2001 From: Kevin Buettner Date: Wed, 4 Mar 2020 17:42:41 -0700 Subject: section_table_xfer_memory: Replace section name with callback predicate This patch is motivated by the need to be able to select sections that section_table_xfer_memory_partial should consider for memory transfers. I'll use this facility in the next patch in this series. section_table_xfer_memory_partial() can currently be passed a section name which may be used to make name-based selections. This is similar to what I want to do, except that I want to be able to consider section flags instead of the name. I'm replacing the section name parameter with a predicate that, when passed a pointer to a target_section struct, will return true if that section should be further considered, or false which indicates that it shouldn't. I've converted the one existing use where a non-NULL section name is passed to section_table_xfer_memory_partial(). Instead of passing the section name, it now looks like this: auto match_cb = [=] (const struct target_section *s) { return (strcmp (section_name, s->the_bfd_section->name) == 0); }; return section_table_xfer_memory_partial (readbuf, writebuf, memaddr, len, xfered_len, table->sections, table->sections_end, match_cb); The other callers all passed NULL; they've been simplified somewhat in that they no longer need to pass NULL. gdb/ChangeLog: * exec.h (section_table_xfer_memory): Revise declaration, replacing section name parameter with an optional callback predicate. * exec.c (section_table_xfer_memory): Likewise. * bfd-target.c, exec.c, target.c, corelow.c: Adjust all callers of section_table_xfer_memory. --- gdb/bfd-target.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'gdb/bfd-target.c') diff --git a/gdb/bfd-target.c b/gdb/bfd-target.c index b75abd7..3d26695 100644 --- a/gdb/bfd-target.c +++ b/gdb/bfd-target.c @@ -77,8 +77,7 @@ target_bfd::xfer_partial (target_object object, return section_table_xfer_memory_partial (readbuf, writebuf, offset, len, xfered_len, m_table.sections, - m_table.sections_end, - NULL); + m_table.sections_end); } default: return TARGET_XFER_E_IO; -- cgit v1.1