gdb/common/ptid.h - gdb

Data types defined

Macros defined

Source code

  1. /* The ptid_t type and common functions operating on it.

  2.    Copyright (C) 1986-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 PTID_H
  15. #define PTID_H

  16. /* The ptid struct is a collection of the various "ids" necessary for
  17.    identifying the inferior process/thread being debugged.  This
  18.    consists of the process id (pid), lightweight process id (lwp) and
  19.    thread id (tid).  When manipulating ptids, the constructors,
  20.    accessors, and predicates declared in this file should be used.  Do
  21.    NOT access the struct ptid members directly.

  22.    process_stratum targets that handle threading themselves should
  23.    prefer using the ptid.lwp field, leaving the ptid.tid field for any
  24.    thread_stratum target that might want to sit on top.
  25. */

  26. struct ptid
  27. {
  28.   /* Process id.  */
  29.   int pid;

  30.   /* Lightweight process id.  */
  31.   long lwp;

  32.   /* Thread id.  */
  33.   long tid;
  34. };

  35. typedef struct ptid ptid_t;

  36. /* The null or zero ptid, often used to indicate no process. */
  37. extern ptid_t null_ptid;

  38. /* The (-1,0,0) ptid, often used to indicate either an error condition
  39.    or a "don't care" condition, i.e, "run all threads."  */
  40. extern ptid_t minus_one_ptid;

  41. /* Make a ptid given the necessary PID, LWP, and TID components.  */
  42. ptid_t ptid_build (int pid, long lwp, long tid);

  43. /* Make a new ptid from just a pid.  This ptid is usually used to
  44.    represent a whole process, including all its lwps/threads.  */
  45. ptid_t pid_to_ptid (int pid);

  46. /* Fetch the pid (process id) component from a ptid.  */
  47. int ptid_get_pid (ptid_t ptid);

  48. /* Fetch the lwp (lightweight process) component from a ptid.  */
  49. long ptid_get_lwp (ptid_t ptid);

  50. /* Fetch the tid (thread id) component from a ptid.  */
  51. long ptid_get_tid (ptid_t ptid);

  52. /* Compare two ptids to see if they are equal.  */
  53. int ptid_equal (ptid_t ptid1, ptid_t ptid2);

  54. /* Returns true if PTID represents a whole process, including all its
  55.    lwps/threads.  Such ptids have the form of (pid,0,0), with pid !=
  56.    -1.  */
  57. int ptid_is_pid (ptid_t ptid);

  58. /* Return true if PTID's lwp member is non-zero.  */
  59. int ptid_lwp_p (ptid_t ptid);

  60. /* Return true if PTID's tid member is non-zero.  */
  61. int ptid_tid_p (ptid_t ptid);

  62. /* Returns true if PTID matches filter FILTER.  FILTER can be the wild
  63.    card MINUS_ONE_PTID (all ptid match it); can be a ptid representing
  64.    a process (ptid_is_pid returns true), in which case, all lwps and
  65.    threads of that given process match, lwps and threads of other
  66.    processes do not; or, it can represent a specific thread, in which
  67.    case, only that thread will match true.  PTID must represent a
  68.    specific LWP or THREAD, it can never be a wild card.  */

  69. extern int ptid_match (ptid_t ptid, ptid_t filter);

  70. #endif