public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH 11/12] gdbsupport: make filtered_iterator::operator* return the same thing as underlying iterator
Date: Thu, 11 May 2023 10:48:31 -0400	[thread overview]
Message-ID: <20230511144832.17974-12-simon.marchi@efficios.com> (raw)
In-Reply-To: <20230511144832.17974-1-simon.marchi@efficios.com>

This is the same idea as the previous patch, but for filtered_iterator.
Without this patch, I would see this when applying the patch that
removes reference_to_pointer_iterator from breakpoint_range:

      CXX    breakpoint.o
    /home/smarchi/src/binutils-gdb/gdb/breakpoint.c: In function ‘void download_tracepoint_locations()’:
    /home/smarchi/src/binutils-gdb/gdb/breakpoint.c:11007:41: error: cannot allocate an object of abstract type ‘breakpoint’
    11007 |   for (breakpoint &b : all_tracepoints ())
          |                                         ^
    In file included from /home/smarchi/src/binutils-gdb/gdb/gdbthread.h:26,
                     from /home/smarchi/src/binutils-gdb/gdb/infrun.h:21,
                     from /home/smarchi/src/binutils-gdb/gdb/gdbarch.h:28,
                     from /home/smarchi/src/binutils-gdb/gdb/arch-utils.h:23,
                     from /home/smarchi/src/binutils-gdb/gdb/breakpoint.c:21:
    /home/smarchi/src/binutils-gdb/gdb/breakpoint.h:619:8: note:   because the following virtual functions are pure within ‘breakpoint’:
      619 | struct breakpoint : public intrusive_list_node<breakpoint>
          |        ^~~~~~~~~~
    /home/smarchi/src/binutils-gdb/gdb/breakpoint.c:250:1: note:     ‘virtual breakpoint::~breakpoint()’
      250 | breakpoint::~breakpoint ()
          | ^~~~~~~~~~

Change-Id: I05285ff27d21cb0ab80cba392ec4e959167e3cd7
---
 gdbsupport/filtered-iterator.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdbsupport/filtered-iterator.h b/gdbsupport/filtered-iterator.h
index d87484cadca4..9e9548ef824e 100644
--- a/gdbsupport/filtered-iterator.h
+++ b/gdbsupport/filtered-iterator.h
@@ -19,6 +19,8 @@
 #ifndef COMMON_FILTERED_ITERATOR_H
 #define COMMON_FILTERED_ITERATOR_H
 
+#include "gdbsupport/invoke-result.h"
+
 /* A filtered iterator.  This wraps BaseIterator and automatically
    skips elements that FilterFunc filters out.  Requires that
    default-constructing a BaseIterator creates a valid one-past-end
@@ -54,7 +56,10 @@ class filtered_iterator
     : filtered_iterator (static_cast<const filtered_iterator &> (other))
   {}
 
-  value_type operator* () const { return *m_it; }
+  typename gdb::invoke_result<decltype(&BaseIterator::operator*),
+			      BaseIterator>::type
+    operator* () const
+  { return *m_it; }
 
   self_type &operator++ ()
   {
-- 
2.40.1


  parent reply	other threads:[~2023-05-11 14:50 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-11 14:48 [PATCH 00/12] Use intrusive_list for breakpoints and breakpoint locations Simon Marchi
2023-05-11 14:48 ` [PATCH 01/12] gdb: get gdbarch from syscall_catchpoint instead of location Simon Marchi
2023-05-15  9:12   ` Alexandra Petlanova Hajkova
2023-05-11 14:48 ` [PATCH 02/12] gdb: make some breakpoint methods use `this` Simon Marchi
2023-05-15 13:12   ` Alexandra Petlanova Hajkova
2023-05-15 18:25     ` Simon Marchi
2023-05-11 14:48 ` [PATCH 03/12] gdb: constify breakpoint::print_it parameter Simon Marchi
2023-05-11 14:48 ` [PATCH 04/12] gdb: add breakpoint "has locations" methods Simon Marchi
2023-05-11 14:48 ` [PATCH 05/12] gdb: add breakpoint::first_loc methods Simon Marchi
2023-05-18 12:50   ` Andrew Burgess
2023-05-18 17:55     ` Simon Marchi
2023-05-24 13:00       ` Andrew Burgess
2023-05-11 14:48 ` [PATCH 06/12] gdbsupport: add missing increment/decrement operators to reference_to_pointer_iterator Simon Marchi
2023-05-11 14:48 ` [PATCH 07/12] gdb: link breakpoint locations with intrusive_list Simon Marchi
2023-05-18 14:44   ` Andrew Burgess
2023-05-18 18:40     ` Simon Marchi
2023-05-24 13:04       ` Andrew Burgess
2023-05-11 14:48 ` [PATCH 08/12] gdb: remove bp_location_pointer_iterator Simon Marchi
2023-05-11 14:48 ` [PATCH 09/12] gdb: link breakpoints with intrusive_list Simon Marchi
2023-05-11 14:48 ` [PATCH 10/12] gdbsupport: make basic_safe_iterator::operator* return the same thing as underlying iterator Simon Marchi
2023-05-11 14:48 ` Simon Marchi [this message]
2023-05-11 14:48 ` [PATCH 12/12] gdb: remove breakpoint_pointer_iterator Simon Marchi
2023-05-18 15:53   ` Andrew Burgess
2023-05-18 18:44     ` Simon Marchi
2023-05-18 20:59       ` Simon Marchi
2023-05-18 15:54 ` [PATCH 00/12] Use intrusive_list for breakpoints and breakpoint locations Andrew Burgess
2023-05-18 21:01   ` Simon Marchi
2023-05-25 14:01     ` 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=20230511144832.17974-12-simon.marchi@efficios.com \
    --to=simon.marchi@efficios.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).