diff options
Diffstat (limited to 'gdb/target.c')
-rw-r--r-- | gdb/target.c | 46 |
1 files changed, 31 insertions, 15 deletions
diff --git a/gdb/target.c b/gdb/target.c index 4a1964e..d8633ca 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -1186,6 +1186,14 @@ target_stack::push (target_ops *t) if (m_stack[stratum].get () != nullptr) unpush (m_stack[stratum].get ()); + /* If this target can't be shared, then check that the target doesn't + already appear on some other target stack. */ + if (!t->is_shareable ()) + for (inferior *inf : all_inferiors ()) + if (inf->target_is_pushed (t)) + internal_error (_("Attempt to push unshareable target: %s."), + t->shortname ()); + /* Now add the new one. */ m_stack[stratum] = std::move (ref); @@ -1250,11 +1258,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 +2472,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 +3213,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 +3340,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; @@ -3793,11 +3812,11 @@ target_pass_ctrlc (void) if (proc_target == NULL) continue; - for (thread_info *thr : inf->non_exited_threads ()) + for (thread_info &thr : inf->non_exited_threads ()) { /* A thread can be THREAD_STOPPED and executing, while running an infcall. */ - if (thr->state == THREAD_RUNNING || thr->executing ()) + if (thr.state == THREAD_RUNNING || thr.executing ()) { /* We can get here quite deep in target layers. Avoid switching thread context or anything that would @@ -4492,10 +4511,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 (); |