home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 5 / FreshFish_July-August1994.bin / bbs / gnu / ixemul-39.47-env-bin.lha / include / sys / tracecntl.h < prev    next >
C/C++ Source or Header  |  1994-07-08  |  3KB  |  80 lines

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