Annotation of coherent/a/usr/man/COHERENT/ptrace, revision 1.1

1.1     ! root        1: 
        !             2: 
        !             3: ptrace()               COHERENT System Call              ptrace()
        !             4: 
        !             5: 
        !             6: 
        !             7: 
        !             8: Trace process execution
        !             9: 
        !            10: #include <signal.h>
        !            11: iinntt ppttrraaccee(_c_o_m_m_a_n_d, _p_i_d, _l_o_c_a_t_i_o_n, _v_a_l_u_e)
        !            12: iinntt _c_o_m_m_a_n_d, _p_i_d, *_l_o_c_a_t_i_o_n, _v_a_l_u_e;
        !            13: 
        !            14: ptrace provides  a parent process with  primitives to monitor and
        !            15: alter the  execution of a child  process.  These primitives typi-
        !            16: cally are used  by a debugger such as db,  which needs to examine
        !            17: and change  memory, plant breakpoints, and  single-step the child
        !            18: process being debugged.
        !            19: 
        !            20: Once a child process indicates it wishes to be traced, its parent
        !            21: issues various commands to control the child.  pid identifies the
        !            22: affected process.   The parent may issue a  command only when the
        !            23: child process is in a  stopped state, which occurs when the child
        !            24: encounters a  signal.  A special  return value of  0177 from wait
        !            25: informs the parent that  the child has entered the stopped state.
        !            26: The parent  may then examine  or change the  child process memory
        !            27: space or restart the process at any point.
        !            28: 
        !            29: When the child process issues  an exec, the child stops with sig-
        !            30: nal SIGTRAP  to enable the parent to  plant breakpoints.  The set
        !            31: user  id and  set group  id modes are  ineffective when  a traced
        !            32: process performs an exec.
        !            33: 
        !            34: The following  list describes each available  command.  A command
        !            35: ignores any arguments not mentioned.
        !            36: 
        !            37: 00    This  is the only  command the child process  may issue.  It
        !            38:      tells the system that the child wishes to be traced.  Parent
        !            39:      and child  must agree that  tracing should occur  to achieve
        !            40:      the  desired  effect.  Only  the  command  argument is  sig-
        !            41:      nificant.
        !            42: 
        !            43: 11,22  The  int at  location is the  return value.  Command  1 sig-
        !            44:      nifies that  location is  in the instruction  space, whereas
        !            45:      command 2 signifies  data space.  Often these two spaces are
        !            46:      equivalent.
        !            47: 
        !            48: 33    The  return value is the int of  the process description, as
        !            49:      defined  in sys/uproc.h.   This call may  be used  to obtain
        !            50:      values  such  as  hardware  register  contents  and  segment
        !            51:      allocation information.
        !            52: 
        !            53: 44,55  Modify  the child  process's memory  by changing the  int at
        !            54:      location to  value.  Command  4 means instruction  space and
        !            55:      command 5 means  data space.  Shared segments may be written
        !            56:      only if no other executing process is using them.
        !            57: 
        !            58: 66    Modify the int  at location in the process description area,
        !            59:      as with command  3.  The permissible values for location are
        !            60:      restricted to such  things as hardware registers and bits of
        !            61:      machine status registers that the user may safely change.
        !            62: 
        !            63: 
        !            64: COHERENT Lexicon                                           Page 1
        !            65: 
        !            66: 
        !            67: 
        !            68: 
        !            69: ptrace()               COHERENT System Call              ptrace()
        !            70: 
        !            71: 
        !            72: 
        !            73: 
        !            74: 77    This command restarts the stopped child process after it en-
        !            75:      counters a  signal.  The process resumes  execution at loca-
        !            76:      tion, or  from where the process was  stopped if location is
        !            77:      (int  *)1.  value  gives a  signal  number that  the process
        !            78:      receives as it restarts.  This is normally the number of the
        !            79:      signal  that caused  the process to  stop, fetched  from the
        !            80:      process description area by  a 33 command.  If value is zero,
        !            81:      the effect of the signal is ignored.
        !            82: 
        !            83: 88    Force the child process to exit.
        !            84: 
        !            85: 99    Like command 77, except  that the child stops again with sig-
        !            86:      nal SIGTRAP as soon as practicable after the execution of at
        !            87:      least one  instruction.  The actual hardware  method used to
        !            88:      implement this  command varies from machine  to machine, ex-
        !            89:      plaining the imprecise  nature of its definition.  This call
        !            90:      may provide part of the basis for breakpoints.
        !            91: 
        !            92: ***** Files *****
        !            93: 
        !            94: <signal.h>
        !            95: <sys/uproc.h>
        !            96: 
        !            97: ***** See Also *****
        !            98: 
        !            99: db, COHERENT system calls, exec, signal(), wait()
        !           100: 
        !           101: ***** Diagnostics *****
        !           102: 
        !           103: ptrace returns  -1 if pid  is not the  process id of  an eligible
        !           104: child  process or  if some  other argument is  invalid or  out of
        !           105: bounds.   Some commands  may return an  arbitrary data  value, in
        !           106: which case errno should  be checked to distinguish a return value
        !           107: of -1 from an error return.
        !           108: 
        !           109: ***** Notes *****
        !           110: 
        !           111: There  is no  way to  specify which signals  should not  stop the
        !           112: process.
        !           113: 
        !           114: 
        !           115: 
        !           116: 
        !           117: 
        !           118: 
        !           119: 
        !           120: 
        !           121: 
        !           122: 
        !           123: 
        !           124: 
        !           125: 
        !           126: 
        !           127: 
        !           128: 
        !           129: 
        !           130: COHERENT Lexicon                                           Page 2
        !           131: 
        !           132: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.