ps_err_e ps_lgetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, prgregset_t gregset) { #ifdef HAVE_REGSETS struct process_info *process; struct thread_info *reg_inferior, *save_inferior; process = (struct process_info *) find_inferior_id (&all_processes, lwpid); if (process == NULL) return PS_ERR; reg_inferior = get_process_thread (process); save_inferior = current_inferior; current_inferior = reg_inferior; the_target->fetch_registers (0); gregset_info()->fill_function (gregset); current_inferior = save_inferior; return PS_OK; #else return PS_ERR; #endif }
ps_err_e ps_lgetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, prgregset_t gregset) { #ifdef HAVE_REGSETS struct lwp_info *lwp; struct thread_info *reg_inferior, *save_inferior; struct regcache *regcache; lwp = find_lwp_pid (pid_to_ptid (lwpid)); if (lwp == NULL) return PS_ERR; reg_inferior = get_lwp_thread (lwp); save_inferior = current_inferior; current_inferior = reg_inferior; regcache = get_thread_regcache (current_inferior, 1); gregset_info ()->fill_function (regcache, gregset); current_inferior = save_inferior; return PS_OK; #else return PS_ERR; #endif }