+
+#define get_thread_lwp(thr) ((struct lwp_info *) (inferior_target_data (thr)))
+#define get_lwp_thread(lwp) ((lwp)->thread)
+
+/* This struct is recorded in the target_data field of struct thread_info.
+
+ On linux ``all_threads'' is keyed by the LWP ID, which we use as the
+ GDB protocol representation of the thread ID. Threads also have
+ a "process ID" (poorly named) which is (presently) the same as the
+ LWP ID.
+
+ There is also ``all_processes'' is keyed by the "overall process ID",
+ which GNU/Linux calls tgid, "thread group ID". */
+
+struct lwp_info
+{
+ /* Backlink to the parent object. */
+ struct thread_info *thread;
+
+ /* If this flag is set, the next SIGSTOP will be ignored (the
+ process will be immediately resumed). This means that either we
+ sent the SIGSTOP to it ourselves and got some other pending event
+ (so the SIGSTOP is still pending), or that we stopped the
+ inferior implicitly via PTRACE_ATTACH and have not waited for it
+ yet. */
+ int stop_expected;
+
+ /* When this is true, we shall not try to resume this thread, even
+ if last_resume_kind isn't resume_stop. */
+ int suspended;
+
+ /* If this flag is set, the lwp is known to be stopped right now (stop
+ event already received in a wait()). */
+ int stopped;
+
+ /* If this flag is set, the lwp is known to be dead already (exit
+ event already received in a wait(), and is cached in
+ status_pending). */
+ int dead;
+
+ /* When stopped is set, the last wait status recorded for this lwp. */
+ int last_status;
+
+ /* This is used to store extended ptrace event information until
+ it is reported to GDB. */
+ struct target_waitstatus waitstatus;
+
+ /* When stopped is set, this is where the lwp last stopped, with
+ decr_pc_after_break already accounted for. If the LWP is
+ running, this is the address at which the lwp was resumed. */
+ CORE_ADDR stop_pc;
+
+ /* If this flag is set, STATUS_PENDING is a waitstatus that has not yet
+ been reported. */
+ int status_pending_p;
+ int status_pending;
+
+ /* The reason the LWP last stopped, if we need to track it
+ (breakpoint, watchpoint, etc.) */
+ enum target_stop_reason stop_reason;
+
+ /* On architectures where it is possible to know the data address of
+ a triggered watchpoint, STOPPED_DATA_ADDRESS is non-zero, and
+ contains such data address. Only valid if STOPPED_BY_WATCHPOINT
+ is true. */
+ CORE_ADDR stopped_data_address;
+
+ /* If this is non-zero, it is a breakpoint to be reinserted at our next
+ stop (SIGTRAP stops only). */
+ CORE_ADDR bp_reinsert;
+
+ /* If this flag is set, the last continue operation at the ptrace
+ level on this process was a single-step. */
+ int stepping;
+
+ /* Range to single step within. This is a copy of the step range
+ passed along the last resume request. See 'struct
+ thread_resume'. */
+ CORE_ADDR step_range_start; /* Inclusive */
+ CORE_ADDR step_range_end; /* Exclusive */
+
+ /* If this flag is set, we need to set the event request flags the
+ next time we see this LWP stop. */
+ int must_set_ptrace_flags;
+
+ /* If this is non-zero, it points to a chain of signals which need to
+ be delivered to this process. */
+ struct pending_signals *pending_signals;
+
+ /* A link used when resuming. It is initialized from the resume request,
+ and then processed and cleared in linux_resume_one_lwp. */
+ struct thread_resume *resume;
+
+ /* True if it is known that this lwp is presently collecting a fast
+ tracepoint (it is in the jump pad or in some code that will
+ return to the jump pad. Normally, we won't care about this, but
+ we will if a signal arrives to this lwp while it is
+ collecting. */
+ int collecting_fast_tracepoint;
+
+ /* If this is non-zero, it points to a chain of signals which need
+ to be reported to GDB. These were deferred because the thread
+ was doing a fast tracepoint collect when they arrived. */
+ struct pending_signals *pending_signals_to_report;
+
+ /* When collecting_fast_tracepoint is first found to be 1, we insert
+ a exit-jump-pad-quickly breakpoint. This is it. */
+ struct breakpoint *exit_jump_pad_bkpt;
+
+ /* True if the LWP was seen stop at an internal breakpoint and needs
+ stepping over later when it is resumed. */
+ int need_step_over;
+
+#ifdef USE_THREAD_DB
+ int thread_known;
+ /* The thread handle, used for e.g. TLS access. Only valid if
+ THREAD_KNOWN is set. */
+ td_thrhandle_t th;
+#endif
+
+ /* Arch-specific additions. */
+ struct arch_lwp_info *arch_private;
+};
+
+int linux_pid_exe_is_elf_64_file (int pid, unsigned int *machine);
+
+/* Attach to PTID. Returns 0 on success, non-zero otherwise (an
+ errno). */
+int linux_attach_lwp (ptid_t ptid);
+
+struct lwp_info *find_lwp_pid (ptid_t ptid);
+/* For linux_stop_lwp see nat/linux-nat.h. */
+
+#ifdef HAVE_LINUX_REGSETS
+void initialize_regsets_info (struct regsets_info *regsets_info);
+#endif
+
+void initialize_low_arch (void);
+
+/* From thread-db.c */
+int thread_db_init (int use_events);
+void thread_db_detach (struct process_info *);
+void thread_db_mourn (struct process_info *);
+int thread_db_handle_monitor_command (char *);
+int thread_db_get_tls_address (struct thread_info *thread, CORE_ADDR offset,
+ CORE_ADDR load_module, CORE_ADDR *address);
+int thread_db_look_up_one_symbol (const char *name, CORE_ADDR *addrp);