gdb/target/waitstatus.h - gdb

Data types defined

Macros defined

Source code

  1. /* Target waitstatus definitions and prototypes.

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

  16. #include "gdb_signals.h"

  17. /* Stuff for target_wait.  */

  18. /* Generally, what has the program done?  */
  19. enum target_waitkind
  20. {
  21.   /* The program has exited.  The exit status is in value.integer.  */
  22.   TARGET_WAITKIND_EXITED,

  23.   /* The program has stopped with a signal.  Which signal is in
  24.      value.sig.  */
  25.   TARGET_WAITKIND_STOPPED,

  26.   /* The program has terminated with a signal.  Which signal is in
  27.      value.sig.  */
  28.   TARGET_WAITKIND_SIGNALLED,

  29.   /* The program is letting us know that it dynamically loaded
  30.      something (e.g. it called load(2) on AIX).  */
  31.   TARGET_WAITKIND_LOADED,

  32.   /* The program has forked.  A "related" process' PTID is in
  33.      value.related_pid.  I.e., if the child forks, value.related_pid
  34.      is the parent's ID.  */
  35.   TARGET_WAITKIND_FORKED,

  36.   /* The program has vforked.  A "related" process's PTID is in
  37.      value.related_pid.  */
  38.   TARGET_WAITKIND_VFORKED,

  39.   /* The program has exec'ed a new executable file.  The new file's
  40.      pathname is pointed to by value.execd_pathname.  */
  41.   TARGET_WAITKIND_EXECD,

  42.   /* The program had previously vforked, and now the child is done
  43.      with the shared memory region, because it exec'ed or exited.
  44.      Note that the event is reported to the vfork parent.  This is
  45.      only used if GDB did not stay attached to the vfork child,
  46.      otherwise, a TARGET_WAITKIND_EXECD or
  47.      TARGET_WAITKIND_EXIT|SIGNALLED event associated with the child
  48.      has the same effect.  */
  49.   TARGET_WAITKIND_VFORK_DONE,

  50.   /* The program has entered or returned from a system call.  On
  51.      HP-UX, this is used in the hardware watchpoint implementation.
  52.      The syscall's unique integer ID number is in
  53.      value.syscall_id.  */
  54.   TARGET_WAITKIND_SYSCALL_ENTRY,
  55.   TARGET_WAITKIND_SYSCALL_RETURN,

  56.   /* Nothing happened, but we stopped anyway.  This perhaps should
  57.      be handled within target_wait, but I'm not sure target_wait
  58.      should be resuming the inferior.  */
  59.   TARGET_WAITKIND_SPURIOUS,

  60.   /* An event has occured, but we should wait again.
  61.      Remote_async_wait() returns this when there is an event
  62.      on the inferior, but the rest of the world is not interested in
  63.      it.  The inferior has not stopped, but has just sent some output
  64.      to the console, for instance.  In this case, we want to go back
  65.      to the event loop and wait there for another event from the
  66.      inferior, rather than being stuck in the remote_async_wait()
  67.      function.  This way the event loop is responsive to other events,
  68.      like for instance the user typing.  */
  69.   TARGET_WAITKIND_IGNORE,

  70.   /* The target has run out of history information,
  71.      and cannot run backward any further.  */
  72.   TARGET_WAITKIND_NO_HISTORY,

  73.   /* There are no resumed children left in the program.  */
  74.   TARGET_WAITKIND_NO_RESUMED
  75. };

  76. struct target_waitstatus
  77. {
  78.   enum target_waitkind kind;

  79.   /* Additional information about the event.  */
  80.   union
  81.     {
  82.       /* Exit status */
  83.       int integer;
  84.       /* Signal number */
  85.       enum gdb_signal sig;
  86.       /* Forked child pid */
  87.       ptid_t related_pid;
  88.       /* execd pathname */
  89.       char *execd_pathname;
  90.       /* Syscall number */
  91.       int syscall_number;
  92.     } value;
  93. };

  94. /* Prototypes */

  95. /* Return a pretty printed form of target_waitstatus.
  96.    Space for the result is malloc'd, caller must free.  */
  97. extern char *target_waitstatus_to_string (const struct target_waitstatus *);

  98. #endif /* WAITSTATUS_H */