diff options
Diffstat (limited to 'gdb/target.c')
-rw-r--r-- | gdb/target.c | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/gdb/target.c b/gdb/target.c index b6d1abe..f7c43f6 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -1,6 +1,6 @@ /* Select target systems and architectures at runtime for GDB. - Copyright (C) 1990-2024 Free Software Foundation, Inc. + Copyright (C) 1990-2025 Free Software Foundation, Inc. Contributed by Cygnus Support. @@ -50,7 +50,7 @@ #include "gdbsupport/byte-vector.h" #include "gdbsupport/search.h" #include "terminal.h" -#include <unordered_map> +#include "gdbsupport/unordered_map.h" #include "target-connection.h" #include "valprint.h" #include "cli/cli-decode.h" @@ -72,7 +72,7 @@ static int default_verify_memory (struct target_ops *self, TARGET_NAME" command that when invoked calls the factory registered here. The target_info object is associated with the command via the command's context. */ -static std::unordered_map<const target_info *, target_open_ftype *> +static gdb::unordered_map<const target_info *, target_open_ftype *> target_factories; /* The singleton debug target. */ @@ -1250,11 +1250,21 @@ generic_tls_error (void) _("Cannot find thread-local variables on this target")); } -/* Using the objfile specified in OBJFILE, find the address for the - current thread's thread-local storage with offset OFFSET. */ +/* See target.h. */ + CORE_ADDR -target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset) +target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset, + const char *name) { + if (!target_has_registers ()) + { + if (name == nullptr) + error (_("Cannot translate TLS address without registers")); + else + error (_("Cannot find address of TLS symbol `%s' without registers"), + name); + } + volatile CORE_ADDR addr = 0; struct target_ops *target = current_inferior ()->top_target (); gdbarch *gdbarch = current_inferior ()->arch (); @@ -2454,6 +2464,7 @@ target_pre_inferior () if (!gdbarch_has_global_solist (current_inferior ()->arch ())) { no_shared_libraries (current_program_space); + current_program_space->unset_solib_ops (); invalidate_target_mem_regions (); @@ -3194,8 +3205,8 @@ 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_ops::fileio_lstat (struct inferior *inf, const char *filename, + struct stat *sb, fileio_error *target_errno) { *target_errno = FILEIO_ENOSYS; return -1; @@ -3321,17 +3332,17 @@ 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) +target_fileio_lstat (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); + int ret = t->fileio_lstat (inf, filename, sb, target_errno); if (ret == -1 && *target_errno == FILEIO_ENOSYS) continue; - target_debug_printf_nofunc ("target_fileio_stat (%s) = %d (%d)", + target_debug_printf_nofunc ("target_fileio_lstat (%s) = %d (%d)", filename, ret, ret != -1 ? 0 : *target_errno); return ret; @@ -4492,10 +4503,7 @@ set_write_memory_registers_permission (const char *args, int from_tty, update_observer_mode (); } -void _initialize_target (); - -void -_initialize_target () +INIT_GDB_FILE (target) { the_debug_target = new debug_target (); |