home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Headers / mach-o / dyld_debug.h < prev    next >
Text File  |  1995-05-25  |  4KB  |  155 lines

  1. #ifndef _DYLD_DEBUG_
  2. #define _DYLD_DEBUG_
  3.  
  4. #import <mach/mach.h>
  5. /*
  6.  * The dyld debugging API.
  7.  */
  8. enum dyld_debug_return {
  9.     DYLD_SUCCESS,
  10.     DYLD_INCONSISTENT_DATA,
  11.     DYLD_INVALID_ARGUMENTS,
  12.     DYLD_FAILURE
  13. };
  14.  
  15. struct dyld_debug_module {
  16.     struct mach_header *header;
  17.     unsigned long vmaddr_slide;
  18.     unsigned long module_index;
  19. };
  20.  
  21. enum dyld_event_type {
  22.     DYLD_IMAGE_ADDED,
  23.     DYLD_MODULE_BOUND,
  24.     DYLD_MODULE_REMOVED,
  25.     DYLD_MODULE_REPLACED,
  26.     DYLD_PAST_EVENTS_END
  27. };
  28.  
  29. struct dyld_event {
  30.     enum dyld_event_type type;
  31.     struct dyld_debug_module arg[2];
  32. };
  33.  
  34. extern enum dyld_debug_return _dyld_debug_defining_module(
  35.     task_t target_task,
  36.     unsigned long send_timeout,
  37.     unsigned long rcv_timeout,
  38.     boolean_t inconsistent_data_ok,
  39.     char *name,
  40.     struct dyld_debug_module *module);
  41.  
  42. extern enum dyld_debug_return _dyld_debug_is_module_bound(
  43.     task_t target_task,
  44.     unsigned long send_timeout,
  45.     unsigned long rcv_timeout,
  46.     boolean_t inconsistent_data_ok,
  47.     struct dyld_debug_module module,
  48.     boolean_t *bound);
  49.  
  50. extern enum dyld_debug_return _dyld_debug_bind_module(
  51.     task_t target_task,
  52.     unsigned long send_timeout,
  53.     unsigned long rcv_timeout,
  54.     boolean_t inconsistent_data_ok,
  55.     struct dyld_debug_module module);
  56.  
  57. extern enum dyld_debug_return _dyld_debug_module_name(
  58.     task_t target_task,
  59.     unsigned long send_timeout,
  60.     unsigned long rcv_timeout,
  61.     boolean_t inconsistent_data_ok,
  62.     struct dyld_debug_module module,
  63.     char **image_name,
  64.     unsigned long *image_nameCnt,
  65.     char **module_name,
  66.     unsigned long *module_nameCnt);
  67.  
  68. extern enum dyld_debug_return _dyld_debug_subscribe_to_events(
  69.     task_t target_task,
  70.     unsigned long send_timeout,
  71.     unsigned long rcv_timeout,
  72.     boolean_t inconsistent_data_ok,
  73.     void (*dyld_event_routine)(struct dyld_event event));
  74.  
  75. /*
  76.  * _dyld_debug_add_event_subscriber() uses the mig interface functions below
  77.  * to dispatch the dyld event messages from the subscriber port specified.
  78.  */
  79. extern enum dyld_debug_return _dyld_debug_add_event_subscriber(
  80.     task_t target_task,
  81.     unsigned long send_timeout,
  82.     unsigned long rcv_timeout,
  83.     boolean_t inconsistent_data_ok,
  84.     port_t subscriber);
  85. /*
  86.  * These structures should be produced by mig(1) from the mig generated files
  87.  * but they are not.  These are really only needed so the correct size of the
  88.  * request and reply messages can be allocated.
  89.  */
  90. struct _dyld_event_message_request {
  91.     msg_header_t head;
  92.     msg_type_t eventType;
  93.     struct dyld_event event;
  94. };
  95. struct _dyld_event_message_reply {
  96.     msg_header_t head;
  97.     msg_type_t RetCodeType;
  98.     kern_return_t RetCode;
  99. };
  100. #ifndef    mig_internal
  101. /*
  102.  * _dyld_event_server() is the mig generated routine to dispatch dyld event
  103.  * messages.
  104.  */
  105. extern boolean_t _dyld_event_server(
  106.     struct _dyld_event_message_request *request,
  107.     struct _dyld_event_message_reply *reply);
  108. #endif
  109. #ifndef SHLIB
  110. /*
  111.  * _dyld_event_server_callback() is the routine called by _dyld_event_server()
  112.  * that must be written by users of _dyld_event_server().
  113.  */
  114. extern void _dyld_event_server_callback(
  115.     port_t subscriber,
  116.     struct dyld_event event);
  117. #endif
  118.  
  119. /*
  120.  * This is the state of the target task while we are sending a message to it.
  121.  */
  122. struct _dyld_debug_task_state {
  123.     port_t       debug_port;
  124.     thread_t       debug_thread;
  125.     unsigned int   debug_thread_resume_count;
  126.     unsigned int   task_resume_count;
  127.     thread_array_t threads;
  128.     unsigned int   thread_count;
  129. };
  130.  
  131. /*
  132.  * _dyld_debug_make_runnable() is called before sending messages to the
  133.  * dynamic link editor.  Basically it assures that the debugging
  134.  * thread is the only runnable thread in the task to receive the
  135.  * message.  It also assures that the debugging thread is indeed
  136.  * runnable if it was suspended.  The function will make sure each 
  137.  * thread in the remote task is suspended and resumed the same number
  138.  * of times, so in the end the suspend count of each individual thread
  139.  * is the same.
  140.  */
  141. extern enum dyld_debug_return _dyld_debug_make_runnable(
  142.     task_t target_task,
  143.     struct _dyld_debug_task_state *state);
  144.  
  145. /*
  146.  * _dyld_debug_restore_runnable() is called after sending messages to the
  147.  * dynamic link editor.  It undoes what _dyld_debug_make_runnable() did to the
  148.  * task and put it back the way it was.
  149.  */
  150. extern enum dyld_debug_return _dyld_debug_restore_runnable(
  151.     task_t target_task,
  152.     struct _dyld_debug_task_state *state);
  153.  
  154. #endif /* _DYLD_DEBUG_ */
  155.