gdb/gdbserver/gdbthread.h - gdb

Data types defined

Macros defined

Source code

  1. /* Multi-thread control defs for remote server for GDB.
  2.    Copyright (C) 1993-2015 Free Software Foundation, Inc.

  3.    This file is part of GDB.

  4.    This program is free software; you can redistribute it and/or modify
  5.    it under the terms of the GNU General Public License as published by
  6.    the Free Software Foundation; either version 3 of the License, or
  7.    (at your option) any later version.

  8.    This program is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11.    GNU General Public License for more details.

  12.    You should have received a copy of the GNU General Public License
  13.    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

  14. #ifndef GDB_THREAD_H
  15. #define GDB_THREAD_H

  16. #include "inferiors.h"

  17. struct btrace_target_info;

  18. struct thread_info
  19. {
  20.   /* This must appear first.  See inferiors.h.
  21.      The list iterator functions assume it.  */
  22.   struct inferior_list_entry entry;

  23.   void *target_data;
  24.   void *regcache_data;

  25.   /* The last resume GDB requested on this thread.  */
  26.   enum resume_kind last_resume_kind;

  27.   /* The last wait status reported for this thread.  */
  28.   struct target_waitstatus last_status;

  29.   /* True if LAST_STATUS hasn't been reported to GDB yet.  */
  30.   int status_pending_p;

  31.   /* Given `while-stepping', a thread may be collecting data for more
  32.      than one tracepoint simultaneously.  E.g.:

  33.     ff0001  INSN1 <-- TP1, while-stepping 10 collect $regs
  34.     ff0002  INSN2
  35.     ff0003  INSN3 <-- TP2, collect $regs
  36.     ff0004  INSN4 <-- TP3, while-stepping 10 collect $regs
  37.     ff0005  INSN5

  38.    Notice that when instruction INSN5 is reached, the while-stepping
  39.    actions of both TP1 and TP3 are still being collected, and that TP2
  40.    had been collected meanwhile.  The whole range of ff0001-ff0005
  41.    should be single-stepped, due to at least TP1's while-stepping
  42.    action covering the whole range.

  43.    On the other hand, the same tracepoint with a while-stepping action
  44.    may be hit by more than one thread simultaneously, hence we can't
  45.    keep the current step count in the tracepoint itself.

  46.    This is the head of the list of the states of `while-stepping'
  47.    tracepoint actions this thread is now collecting; NULL if empty.
  48.    Each item in the list holds the current step of the while-stepping
  49.    action.  */
  50.   struct wstep_state *while_stepping;

  51.   /* Branch trace target information for this thread.  */
  52.   struct btrace_target_info *btrace;
  53. };

  54. extern struct inferior_list all_threads;

  55. void remove_thread (struct thread_info *thread);
  56. struct thread_info *add_thread (ptid_t ptid, void *target_data);

  57. struct thread_info *get_first_thread (void);

  58. struct thread_info *find_thread_ptid (ptid_t ptid);

  59. /* Get current thread ID (Linux task ID).  */
  60. #define current_ptid (current_thread->entry.id)

  61. #endif /* GDB_THREAD_H */