mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-08-06 06:45:56 +08:00
Return gdb::optional<std::string> from target_fileio_readlink
This changes to_fileio_readlink and target_fileio_readlink to return a gdb::optional<std::sring>, and then fixes up the callers and implementations. This allows the removal of some cleanups. Regression tested by the buildbot. gdb/ChangeLog 2018-03-07 Tom Tromey <tom@tromey.com> * linux-tdep.c (linux_info_proc): Update. * target.h (struct target_ops) <to_fileio_readlink>: Return optional<string>. (target_fileio_readlink): Return optional<string>. * remote.c (remote_hostio_readlink): Return optional<string>. * inf-child.c (inf_child_fileio_readlink): Return optional<string>. * target.c (target_fileio_readlink): Return optional<string>.
This commit is contained in:
17
gdb/target.h
17
gdb/target.h
@ -933,12 +933,12 @@ struct target_ops
|
||||
/* Read value of symbolic link FILENAME on the target, in the
|
||||
filesystem as seen by INF. If INF is NULL, use the filesystem
|
||||
seen by the debugger (GDB or, for remote targets, the remote
|
||||
stub). Return a null-terminated string allocated via xmalloc,
|
||||
or NULL if an error occurs (and set *TARGET_ERRNO). */
|
||||
char *(*to_fileio_readlink) (struct target_ops *,
|
||||
struct inferior *inf,
|
||||
const char *filename,
|
||||
int *target_errno);
|
||||
stub). Return a string, or an empty optional if an error
|
||||
occurs (and set *TARGET_ERRNO). */
|
||||
gdb::optional<std::string> (*to_fileio_readlink) (struct target_ops *,
|
||||
struct inferior *inf,
|
||||
const char *filename,
|
||||
int *target_errno);
|
||||
|
||||
|
||||
/* Implement the "info proc" command. */
|
||||
@ -2095,9 +2095,8 @@ extern int target_fileio_unlink (struct inferior *inf,
|
||||
by the debugger (GDB or, for remote targets, the remote stub).
|
||||
Return a null-terminated string allocated via xmalloc, or NULL if
|
||||
an error occurs (and set *TARGET_ERRNO). */
|
||||
extern char *target_fileio_readlink (struct inferior *inf,
|
||||
const char *filename,
|
||||
int *target_errno);
|
||||
extern gdb::optional<std::string> target_fileio_readlink
|
||||
(struct inferior *inf, const char *filename, int *target_errno);
|
||||
|
||||
/* Read target file FILENAME, in the filesystem as seen by INF. If
|
||||
INF is NULL, use the filesystem seen by the debugger (GDB or, for
|
||||
|
Reference in New Issue
Block a user