From: Lancelot SIX <lsix@lancelotsix.com>
To: Tom Tromey <tromey@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 6/7] Convert solib-rocm to new type-safe gdb_bfd_openr_iovec
Date: Mon, 18 Sep 2023 10:41:09 +0100 [thread overview]
Message-ID: <20230918094109.ke2zzdlvghdmehaj@octopus> (raw)
In-Reply-To: <20230824-gdb-bfd-vec-v1-6-850e4e907ed1@adacore.com>
Hi Tom,
I have tested this patch. As it is, it fails to compile.
Here is a diff fixing the build. Changes are minor:
- Change rocm_code_object_*::read to accept the " bfd *" first param
to properly override gdb_bfd_iovec_base::read.
- The "open" lambda passed to gdb_bfd_openr_iovec does not need to
capture anything.
Best,
Lancelot.
---
gdb/solib-rocm.c | 29 ++++++++++-------------------
1 file changed, 10 insertions(+), 19 deletions(-)
diff --git a/gdb/solib-rocm.c b/gdb/solib-rocm.c
index 009a5c1b774..6b84f09e88b 100644
--- a/gdb/solib-rocm.c
+++ b/gdb/solib-rocm.c
@@ -272,20 +272,9 @@ struct rocm_code_object_stream : public gdb_bfd_iovec_base
{
DISABLE_COPY_AND_ASSIGN (rocm_code_object_stream);
- /* Copy SIZE bytes from the underlying objfile storage starting at OFFSET
- into the user provided buffer BUF.
+ int stat (bfd *abfd, struct stat *sb) final override;
- Return the number of bytes actually copied (might be inferior to SIZE if
- the end of the stream is reached). */
- virtual file_ptr read (void *buf, file_ptr size, file_ptr offset) = 0;
-
- /* Retrieve file information in SB.
-
- Return 0 on success. On failure, set the appropriate bfd error number
- (using bfd_set_error) and return -1. */
- int stat (struct stat *sb);
-
- virtual ~rocm_code_object_stream () = default;
+ ~rocm_code_object_stream () override = default;
protected:
rocm_code_object_stream () = default;
@@ -298,7 +287,7 @@ struct rocm_code_object_stream : public gdb_bfd_iovec_base
};
int
-rocm_code_object_stream::stat (struct stat *sb)
+rocm_code_object_stream::stat (bfd *, struct stat *sb)
{
const LONGEST size = this->size ();
if (size == -1)
@@ -319,7 +308,8 @@ struct rocm_code_object_stream_file final : rocm_code_object_stream
rocm_code_object_stream_file (inferior *inf, int fd, ULONGEST offset,
ULONGEST size);
- file_ptr read (void *buf, file_ptr size, file_ptr offset) override;
+ file_ptr read (bfd *abfd, void *buf, file_ptr size,
+ file_ptr offset) override;
LONGEST size () override;
@@ -348,7 +338,7 @@ rocm_code_object_stream_file::rocm_code_object_stream_file
}
file_ptr
-rocm_code_object_stream_file::read (void *buf, file_ptr size,
+rocm_code_object_stream_file::read (bfd *, void *buf, file_ptr size,
file_ptr offset)
{
fileio_error target_errno;
@@ -423,7 +413,8 @@ struct rocm_code_object_stream_memory final : public rocm_code_object_stream
rocm_code_object_stream_memory (gdb::byte_vector buffer);
- file_ptr read (void *buf, file_ptr size, file_ptr offset) override;
+ file_ptr read (bfd *abfd, void *buf, file_ptr size,
+ file_ptr offset) override;
protected:
@@ -445,7 +436,7 @@ rocm_code_object_stream_memory::rocm_code_object_stream_memory
}
file_ptr
-rocm_code_object_stream_memory::read (void *buf, file_ptr size,
+rocm_code_object_stream_memory::read (bfd *, void *buf, file_ptr size,
file_ptr offset)
{
if (size > m_objfile_image.size () - offset)
@@ -613,7 +604,7 @@ rocm_solib_bfd_open (const char *pathname)
if (strstr (pathname, "://") == nullptr)
return svr4_so_ops.bfd_open (pathname);
- auto open = [&] (bfd *nbfd) -> gdb_bfd_iovec_base *
+ auto open = [] (bfd *nbfd) -> gdb_bfd_iovec_base *
{
return rocm_bfd_iovec_open (nbfd, current_inferior ());
};
next prev parent reply other threads:[~2023-09-18 9:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-24 17:12 [PATCH 0/7] Rewrite gdb_bfd_openr_iovec to be type-safe Tom Tromey
2023-08-24 17:12 ` [PATCH 1/7] Introduce type-safe variant of gdb_bfd_openr_iovec Tom Tromey
2023-09-18 10:29 ` Lancelot SIX
2023-09-18 14:44 ` Tom Tromey
2023-08-24 17:12 ` [PATCH 2/7] Small constructor change to target_buffer Tom Tromey
2023-08-24 17:12 ` [PATCH 3/7] Convert mem_bfd_iovec to new type-safe gdb_bfd_openr_iovec Tom Tromey
2023-08-24 17:12 ` [PATCH 4/7] Convert target fileio " Tom Tromey
2023-08-24 17:12 ` [PATCH 5/7] Convert minidebug " Tom Tromey
2023-08-24 17:12 ` [PATCH 6/7] Convert solib-rocm " Tom Tromey
2023-09-18 9:41 ` Lancelot SIX [this message]
2023-09-18 14:49 ` Tom Tromey
2023-08-24 17:12 ` [PATCH 7/7] Remove old gdb_bfd_openr_iovec Tom Tromey
2023-09-18 12:34 ` [PATCH 0/7] Rewrite gdb_bfd_openr_iovec to be type-safe Lancelot SIX
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=20230918094109.ke2zzdlvghdmehaj@octopus \
--to=lsix@lancelotsix.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@adacore.com \
/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).