diff options
Diffstat (limited to 'gdb/target.c')
-rw-r--r-- | gdb/target.c | 61 |
1 files changed, 43 insertions, 18 deletions
diff --git a/gdb/target.c b/gdb/target.c index 1b5aa11..962996f 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -56,7 +56,7 @@ #include "cli/cli-decode.h" #include "cli/cli-style.h" -static void generic_tls_error (void) ATTRIBUTE_NORETURN; +[[noreturn]] static void generic_tls_error (void); static void default_rcmd (struct target_ops *, const char *, struct ui_file *); @@ -64,7 +64,7 @@ static int default_verify_memory (struct target_ops *self, const gdb_byte *data, CORE_ADDR memaddr, ULONGEST size); -static void tcomplain (void) ATTRIBUTE_NORETURN; +[[noreturn]] static void tcomplain (void); /* Mapping between target_info objects (which have address identity) and corresponding open/factory function/callback. Each add_target @@ -2428,7 +2428,7 @@ info_target_command (const char *args, int from_tty) resets (things which might change between targets). */ void -target_pre_inferior (int from_tty) +target_pre_inferior () { /* Clear out solib state. Otherwise the solib state of the previous inferior might have survived and is entirely wrong for the new @@ -2452,7 +2452,7 @@ target_pre_inferior (int from_tty) memory regions and features. */ if (!gdbarch_has_global_solist (current_inferior ()->arch ())) { - no_shared_libraries (NULL, from_tty); + no_shared_libraries (current_program_space); invalidate_target_mem_regions (); @@ -2504,7 +2504,7 @@ target_preopen (int from_tty) live process to a core of the same program. */ current_inferior ()->pop_all_targets_above (file_stratum); - target_pre_inferior (from_tty); + target_pre_inferior (); } /* See target.h. */ @@ -2575,18 +2575,12 @@ target_wait (ptid_t ptid, struct target_waitstatus *status, if (!target_can_async_p (target)) gdb_assert ((options & TARGET_WNOHANG) == 0); - try - { - gdb::observers::target_pre_wait.notify (ptid); - ptid_t event_ptid = target->wait (ptid, status, options); - gdb::observers::target_post_wait.notify (event_ptid); - return event_ptid; - } - catch (...) - { - gdb::observers::target_post_wait.notify (null_ptid); - throw; - } + ptid_t event_ptid = null_ptid; + SCOPE_EXIT { gdb::observers::target_post_wait.notify (event_ptid); }; + gdb::observers::target_pre_wait.notify (ptid); + event_ptid = target->wait (ptid, status, options); + + return event_ptid; } /* See target.h. */ @@ -3199,6 +3193,14 @@ target_ops::fileio_fstat (int fd, struct stat *sb, fileio_error *target_errno) } int +target_ops::fileio_stat (struct inferior *inf, const char *filename, + struct stat *sb, fileio_error *target_errno) +{ + *target_errno = FILEIO_ENOSYS; + return -1; +} + +int target_ops::fileio_close (int fd, fileio_error *target_errno) { *target_errno = FILEIO_ENOSYS; @@ -3318,6 +3320,29 @@ target_fileio_fstat (int fd, struct stat *sb, fileio_error *target_errno) /* See target.h. */ int +target_fileio_stat (struct inferior *inf, const char *filename, + struct stat *sb, fileio_error *target_errno) +{ + for (target_ops *t = default_fileio_target (); t != NULL; t = t->beneath ()) + { + int ret = t->fileio_stat (inf, filename, sb, target_errno); + + if (ret == -1 && *target_errno == FILEIO_ENOSYS) + continue; + + target_debug_printf_nofunc ("target_fileio_stat (%s) = %d (%d)", + filename, ret, + ret != -1 ? 0 : *target_errno); + return ret; + } + + *target_errno = FILEIO_ENOSYS; + return -1; +} + +/* See target.h. */ + +int target_fileio_close (int fd, fileio_error *target_errno) { fileio_fh_t *fh = fileio_fd_to_fh (fd); @@ -3667,7 +3692,7 @@ dummy_make_corefile_notes (struct target_ops *self, return NULL; } -#include "target-delegates.c" +#include "target-delegates-gen.c" /* The initial current target, so that there is always a semi-valid current target. */ |