GDBserver
/home/stan/gdb/src/gdb/gdbserver/gdbthread.h
Go to the documentation of this file.
00001 /* Multi-thread control defs for remote server for GDB.
00002    Copyright (C) 1993-2013 Free Software Foundation, Inc.
00003 
00004    This file is part of GDB.
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 3 of the License, or
00009    (at your option) any later version.
00010 
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00018 
00019 #ifndef GDB_THREAD_H
00020 #define GDB_THREAD_H
00021 
00022 #include "server.h"
00023 #include "inferiors.h"
00024 
00025 struct btrace_target_info;
00026 
00027 struct thread_info
00028 {
00029   struct inferior_list_entry entry;
00030   void *target_data;
00031   void *regcache_data;
00032 
00033   /* The last resume GDB requested on this thread.  */
00034   enum resume_kind last_resume_kind;
00035 
00036   /* The last wait status reported for this thread.  */
00037   struct target_waitstatus last_status;
00038 
00039   /* Given `while-stepping', a thread may be collecting data for more
00040      than one tracepoint simultaneously.  E.g.:
00041 
00042     ff0001  INSN1 <-- TP1, while-stepping 10 collect $regs
00043     ff0002  INSN2
00044     ff0003  INSN3 <-- TP2, collect $regs
00045     ff0004  INSN4 <-- TP3, while-stepping 10 collect $regs
00046     ff0005  INSN5
00047 
00048    Notice that when instruction INSN5 is reached, the while-stepping
00049    actions of both TP1 and TP3 are still being collected, and that TP2
00050    had been collected meanwhile.  The whole range of ff0001-ff0005
00051    should be single-stepped, due to at least TP1's while-stepping
00052    action covering the whole range.
00053 
00054    On the other hand, the same tracepoint with a while-stepping action
00055    may be hit by more than one thread simultaneously, hence we can't
00056    keep the current step count in the tracepoint itself.
00057 
00058    This is the head of the list of the states of `while-stepping'
00059    tracepoint actions this thread is now collecting; NULL if empty.
00060    Each item in the list holds the current step of the while-stepping
00061    action.  */
00062   struct wstep_state *while_stepping;
00063 
00064   /* Branch trace target information for this thread.  */
00065   struct btrace_target_info *btrace;
00066 };
00067 
00068 extern struct inferior_list all_threads;
00069 
00070 void remove_thread (struct thread_info *thread);
00071 void add_thread (ptid_t ptid, void *target_data);
00072 
00073 struct thread_info *find_thread_ptid (ptid_t ptid);
00074 struct thread_info *gdb_id_to_thread (unsigned int);
00075 
00076 /* Get current thread ID (Linux task ID).  */
00077 #define current_ptid ((struct inferior_list_entry *) current_inferior)->id
00078 #endif /* GDB_THREAD_H */
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines