mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-19 05:42:42 +08:00
Eliminate target_fileio_open_warn_if_slow
This basically makes target_fileio_open_1 extern, renamed to target_fileio_open, and eliminates the current target_fileio_open_warn_if_slow and target_fileio_open. A following parameter will want to change gdb_bfd_iovec_fileio_open, the only caller of target_fileio_open_warn_if_slow, to pass down "warn_if_slow" true/false from the caller, instead of hardcoding "warn_if_slow" true. gdb/ChangeLog: 2020-05-19 Pedro Alves <palves@redhat.com> * gdb_bfd.c (gdb_bfd_iovec_fileio_open): Adjust. * target.c (target_fileio_open_1): Rename to target_fileio_open and make extern. Use bool. (target_fileio_open, target_fileio_open_warn_if_slow): Delete. (target_fileio_read_alloc_1): Adjust. * target.h (target_fileio_open): Add 'warn_if_slow' parameter. (target_fileio_open_warn_if_slow): Delete declaration.
This commit is contained in:
@ -1,3 +1,13 @@
|
|||||||
|
2020-05-19 Pedro Alves <palves@redhat.com>
|
||||||
|
|
||||||
|
* gdb_bfd.c (gdb_bfd_iovec_fileio_open): Adjust.
|
||||||
|
* target.c (target_fileio_open_1): Rename to target_fileio_open
|
||||||
|
and make extern. Use bool.
|
||||||
|
(target_fileio_open, target_fileio_open_warn_if_slow): Delete.
|
||||||
|
(target_fileio_read_alloc_1): Adjust.
|
||||||
|
* target.h (target_fileio_open): Add 'warn_if_slow' parameter.
|
||||||
|
(target_fileio_open_warn_if_slow): Delete declaration.
|
||||||
|
|
||||||
2020-05-19 Pedro Alves <palves@redhat.com>
|
2020-05-19 Pedro Alves <palves@redhat.com>
|
||||||
|
|
||||||
* gdb_bfd.h: (gdb_bfd_open): Default to 'fd' parameter to -1.
|
* gdb_bfd.h: (gdb_bfd_open): Default to 'fd' parameter to -1.
|
||||||
|
@ -284,11 +284,10 @@ gdb_bfd_iovec_fileio_open (struct bfd *abfd, void *inferior)
|
|||||||
|
|
||||||
gdb_assert (is_target_filename (filename));
|
gdb_assert (is_target_filename (filename));
|
||||||
|
|
||||||
fd = target_fileio_open_warn_if_slow ((struct inferior *) inferior,
|
fd = target_fileio_open ((struct inferior *) inferior,
|
||||||
filename
|
filename + strlen (TARGET_SYSROOT_PREFIX),
|
||||||
+ strlen (TARGET_SYSROOT_PREFIX),
|
FILEIO_O_RDONLY, 0, true,
|
||||||
FILEIO_O_RDONLY, 0,
|
&target_errno);
|
||||||
&target_errno);
|
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
{
|
{
|
||||||
errno = fileio_errno_to_host (target_errno);
|
errno = fileio_errno_to_host (target_errno);
|
||||||
|
33
gdb/target.c
33
gdb/target.c
@ -2775,13 +2775,11 @@ target_ops::fileio_readlink (struct inferior *inf, const char *filename,
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Helper for target_fileio_open and
|
/* See target.h. */
|
||||||
target_fileio_open_warn_if_slow. */
|
|
||||||
|
|
||||||
static int
|
int
|
||||||
target_fileio_open_1 (struct inferior *inf, const char *filename,
|
target_fileio_open (struct inferior *inf, const char *filename,
|
||||||
int flags, int mode, int warn_if_slow,
|
int flags, int mode, bool warn_if_slow, int *target_errno)
|
||||||
int *target_errno)
|
|
||||||
{
|
{
|
||||||
for (target_ops *t = default_fileio_target (); t != NULL; t = t->beneath ())
|
for (target_ops *t = default_fileio_target (); t != NULL; t = t->beneath ())
|
||||||
{
|
{
|
||||||
@ -2813,27 +2811,6 @@ target_fileio_open_1 (struct inferior *inf, const char *filename,
|
|||||||
|
|
||||||
/* See target.h. */
|
/* See target.h. */
|
||||||
|
|
||||||
int
|
|
||||||
target_fileio_open (struct inferior *inf, const char *filename,
|
|
||||||
int flags, int mode, int *target_errno)
|
|
||||||
{
|
|
||||||
return target_fileio_open_1 (inf, filename, flags, mode, 0,
|
|
||||||
target_errno);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* See target.h. */
|
|
||||||
|
|
||||||
int
|
|
||||||
target_fileio_open_warn_if_slow (struct inferior *inf,
|
|
||||||
const char *filename,
|
|
||||||
int flags, int mode, int *target_errno)
|
|
||||||
{
|
|
||||||
return target_fileio_open_1 (inf, filename, flags, mode, 1,
|
|
||||||
target_errno);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* See target.h. */
|
|
||||||
|
|
||||||
int
|
int
|
||||||
target_fileio_pwrite (int fd, const gdb_byte *write_buf, int len,
|
target_fileio_pwrite (int fd, const gdb_byte *write_buf, int len,
|
||||||
ULONGEST offset, int *target_errno)
|
ULONGEST offset, int *target_errno)
|
||||||
@ -3036,7 +3013,7 @@ target_fileio_read_alloc_1 (struct inferior *inf, const char *filename,
|
|||||||
int target_errno;
|
int target_errno;
|
||||||
|
|
||||||
scoped_target_fd fd (target_fileio_open (inf, filename, FILEIO_O_RDONLY,
|
scoped_target_fd fd (target_fileio_open (inf, filename, FILEIO_O_RDONLY,
|
||||||
0700, &target_errno));
|
0700, false, &target_errno));
|
||||||
if (fd.get () == -1)
|
if (fd.get () == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
20
gdb/target.h
20
gdb/target.h
@ -2135,21 +2135,15 @@ extern int target_search_memory (CORE_ADDR start_addr,
|
|||||||
current_top_target ()->filesystem_is_local ()
|
current_top_target ()->filesystem_is_local ()
|
||||||
|
|
||||||
/* Open FILENAME on the target, in the filesystem as seen by INF,
|
/* Open FILENAME on the target, in the filesystem as seen by INF,
|
||||||
using FLAGS and MODE. If INF is NULL, use the filesystem seen
|
using FLAGS and MODE. If INF is NULL, use the filesystem seen by
|
||||||
by the debugger (GDB or, for remote targets, the remote stub).
|
the debugger (GDB or, for remote targets, the remote stub). Return
|
||||||
Return a target file descriptor, or -1 if an error occurs (and
|
a target file descriptor, or -1 if an error occurs (and set
|
||||||
set *TARGET_ERRNO). */
|
*TARGET_ERRNO). If WARN_IF_SLOW is true, print a warning message
|
||||||
|
if the file is being accessed over a link that may be slow. */
|
||||||
extern int target_fileio_open (struct inferior *inf,
|
extern int target_fileio_open (struct inferior *inf,
|
||||||
const char *filename, int flags,
|
const char *filename, int flags,
|
||||||
int mode, int *target_errno);
|
int mode, bool warn_if_slow,
|
||||||
|
int *target_errno);
|
||||||
/* Like target_fileio_open, but print a warning message if the
|
|
||||||
file is being accessed over a link that may be slow. */
|
|
||||||
extern int target_fileio_open_warn_if_slow (struct inferior *inf,
|
|
||||||
const char *filename,
|
|
||||||
int flags,
|
|
||||||
int mode,
|
|
||||||
int *target_errno);
|
|
||||||
|
|
||||||
/* Write up to LEN bytes from WRITE_BUF to FD on the target.
|
/* Write up to LEN bytes from WRITE_BUF to FD on the target.
|
||||||
Return the number of bytes written, or -1 if an error occurs
|
Return the number of bytes written, or -1 if an error occurs
|
||||||
|
Reference in New Issue
Block a user