home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / dev / gcc / ixemulsrc.lha / ixemul / include / sys / tracecntl.h < prev    next >
C/C++ Source or Header  |  1996-12-11  |  3KB  |  79 lines

  1. /*
  2.  *  This file is part of ixemul.library for the Amiga.
  3.  *  Copyright (C) 1991, 1992  Markus M. Wild
  4.  *
  5.  *  This library is free software; you can redistribute it and/or
  6.  *  modify it under the terms of the GNU Library General Public
  7.  *  License as published by the Free Software Foundation; either
  8.  *  version 2 of the License, or (at your option) any later version.
  9.  *
  10.  *  This library is distributed in the hope that it will be useful,
  11.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.  *  Library General Public License for more details.
  14.  *
  15.  *  You should have received a copy of the GNU Library General Public
  16.  *  License along with this library; if not, write to the Free
  17.  *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  */
  19.  
  20. #ifndef _SYS_TRACECNTL_H
  21. #define _SYS_TRACECNTL_H
  22.  
  23. #include <sys/types.h>
  24. #include <sys/syscall.h>
  25. #include <exec/ports.h>
  26.  
  27. struct trace_packet {
  28.   struct Message tp_message;
  29.   struct MsgPort *tp_tracer_port;    /* set this up before INSTALL !! */
  30.   int         tp_flags;        /* currently ignored, *must* be 0 !! */
  31.   pid_t         tp_pid;        /* pid, or 0 to trace all but self */
  32.   enum _syscall_ tp_syscall;        /* sc, or 0 to trace all */
  33.   /* these are the arguments filled in on a trace message */
  34.   int         tp_is_entry;        /* true when entry, false when exit */
  35.   int         *tp_argv;        /* arguments of the function.
  36.                          argv[0] is always the syscall,
  37.                          argv[1] is the result if !tp_is_entry,
  38.                          now follows the return address in
  39.                          the program that did this call, then
  40.                        the following elements are the 
  41.                        arguments to the function */
  42.   int         *tp_errno;        /* the address of the process errno */
  43.   /* here you can specify actions to be performed when you reply to this msg */
  44.   int         tp_action;        /* available values see below */
  45. };
  46.  
  47. #define TRACE_ACTION_JSR    1    /* jsr into the syscall, and trace
  48.                        result (with tp_is_entry == 0) */
  49. #define TRACE_ACTION_JMP    0    /* jmp into the syscall, no result trace */
  50. #define TRACE_ACTION_RTS    -1    /* causes the syscall to return with
  51.                        the value in argv[0] without actually
  52.                        performing the call */
  53. #define TRACE_ACTION_ABORT    2    /* causes the process to call abort() */
  54.  
  55.  
  56. /* these are the commands available in tracecntl (): */
  57. enum trace_cmd {
  58.     /* install a trace handling packet. for INSTALL_TRACE_HANDLER you
  59.        have to initialize :
  60.          tp_tracer_port    here's where the packet is sent
  61.          tp_pid        get notice for this pid (0 for all)
  62.          tp_syscall        get notice for this syscall (0 for all)
  63.      */
  64.   TRACE_INSTALL_HANDLER,
  65.   
  66.     /* remove the installed packet. Don't (!) do this if the handler
  67.        is expecting a reply from you. */
  68.   TRACE_REMOVE_HANDLER,
  69.  
  70.     /* to be extended ;-)) */
  71. };
  72.  
  73. /* results:
  74.    0:  handler installed
  75.    -1: handler not installed, library configured without tracecntl support */
  76. int tracecntl (enum trace_cmd, struct trace_packet *);
  77.  
  78. #endif /* _SYS_TRACECNTL */
  79.